used posix_fadvise in lib/http-fil.c
This commit is contained in:
		
							
								
								
									
										2
									
								
								mio/configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								mio/configure
									
									
									
									
										vendored
									
									
								
							@ -17828,7 +17828,7 @@ _ACEOF
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for ac_func in lstat fchmod fsync ftruncate
 | 
					for ac_func in lstat fchmod fsync ftruncate posix_fadvise
 | 
				
			||||||
do :
 | 
					do :
 | 
				
			||||||
  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 | 
					  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 | 
				
			||||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
 | 
					ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
 | 
				
			||||||
 | 
				
			|||||||
@ -152,7 +152,7 @@ AC_CHECK_FUNCS([mbsnrtowcs mbsrtowcs wcsnrtombs wcsrtombs])
 | 
				
			|||||||
AC_CHECK_FUNCS([wctype iswctype wctrans towctrans])
 | 
					AC_CHECK_FUNCS([wctype iswctype wctrans towctrans])
 | 
				
			||||||
AC_CHECK_FUNCS([isblank iswblank])
 | 
					AC_CHECK_FUNCS([isblank iswblank])
 | 
				
			||||||
AC_CHECK_FUNCS([lseek64 stat64 fstat64 lstat64 ftruncate64 readdir64 dirfd])
 | 
					AC_CHECK_FUNCS([lseek64 stat64 fstat64 lstat64 ftruncate64 readdir64 dirfd])
 | 
				
			||||||
AC_CHECK_FUNCS([lstat fchmod fsync ftruncate])
 | 
					AC_CHECK_FUNCS([lstat fchmod fsync ftruncate posix_fadvise])
 | 
				
			||||||
AC_CHECK_FUNCS([timegm timelocal localtime_r gettimeofday settimeofday clock_gettime clock_settime])
 | 
					AC_CHECK_FUNCS([timegm timelocal localtime_r gettimeofday settimeofday clock_gettime clock_settime])
 | 
				
			||||||
AC_CHECK_FUNCS([utime utimes futimes lutimes futimens])
 | 
					AC_CHECK_FUNCS([utime utimes futimes lutimes futimens])
 | 
				
			||||||
AC_CHECK_FUNCS([sysconf prctl fdopendir setrlimit getrlimit getpgid getpgrp])
 | 
					AC_CHECK_FUNCS([sysconf prctl fdopendir setrlimit getrlimit getpgid getpgrp])
 | 
				
			||||||
 | 
				
			|||||||
@ -408,7 +408,6 @@ pdfdir = @pdfdir@
 | 
				
			|||||||
prefix = @prefix@
 | 
					prefix = @prefix@
 | 
				
			||||||
program_transform_name = @program_transform_name@
 | 
					program_transform_name = @program_transform_name@
 | 
				
			||||||
psdir = @psdir@
 | 
					psdir = @psdir@
 | 
				
			||||||
runstatedir = @runstatedir@
 | 
					 | 
				
			||||||
sbindir = @sbindir@
 | 
					sbindir = @sbindir@
 | 
				
			||||||
sharedstatedir = @sharedstatedir@
 | 
					sharedstatedir = @sharedstatedir@
 | 
				
			||||||
srcdir = @srcdir@
 | 
					srcdir = @srcdir@
 | 
				
			||||||
 | 
				
			|||||||
@ -610,6 +610,7 @@ static int open_peer (file_state_t* file_state, const mio_bch_t* actual_file)
 | 
				
			|||||||
				file_state_send_final_status_to_client (file_state, ERRNO_TO_STATUS_CODE(errno), 1);
 | 
									file_state_send_final_status_to_client (file_state, ERRNO_TO_STATUS_CODE(errno), 1);
 | 
				
			||||||
				return -1;
 | 
									return -1;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		case MIO_HTTP_PUT:
 | 
							case MIO_HTTP_PUT:
 | 
				
			||||||
@ -643,6 +644,14 @@ static int open_peer (file_state_t* file_state, const mio_bch_t* actual_file)
 | 
				
			|||||||
	return -1;
 | 
						return -1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static MIO_INLINE void fadvise_on_peer (file_state_t* file_state)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					#if defined(HAVE_POSIX_FADVISE)
 | 
				
			||||||
 | 
						if (file_state->req_method == MIO_HTTP_GET)
 | 
				
			||||||
 | 
							posix_fadvise (file_state->peer, file_state->start_offset, file_state->end_offset - file_state->start_offset + 1, POSIX_FADV_SEQUENTIAL);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int mio_svc_htts_dofile (mio_svc_htts_t* htts, mio_dev_sck_t* csck, mio_htre_t* req, const mio_bch_t* docroot, const mio_bch_t* file)
 | 
					int mio_svc_htts_dofile (mio_svc_htts_t* htts, mio_dev_sck_t* csck, mio_htre_t* req, const mio_bch_t* docroot, const mio_bch_t* file)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	mio_t* mio = htts->mio;
 | 
						mio_t* mio = htts->mio;
 | 
				
			||||||
@ -682,6 +691,8 @@ int mio_svc_htts_dofile (mio_svc_htts_t* htts, mio_dev_sck_t* csck, mio_htre_t*
 | 
				
			|||||||
	if (open_peer(file_state, actual_file) <= -1 || 
 | 
						if (open_peer(file_state, actual_file) <= -1 || 
 | 
				
			||||||
	    process_range_header(file_state, req) <= -1) goto oops;
 | 
						    process_range_header(file_state, req) <= -1) goto oops;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fadvise_on_peer (file_state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(FILE_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH)
 | 
					#if !defined(FILE_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH)
 | 
				
			||||||
	if (file_state->req_content_length_unlimited)
 | 
						if (file_state->req_content_length_unlimited)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
				
			|||||||
@ -376,6 +376,9 @@
 | 
				
			|||||||
/* Define to 1 if you have the <openssl/ssl.h> header file. */
 | 
					/* Define to 1 if you have the <openssl/ssl.h> header file. */
 | 
				
			||||||
#undef HAVE_OPENSSL_SSL_H
 | 
					#undef HAVE_OPENSSL_SSL_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Define to 1 if you have the `posix_fadvise' function. */
 | 
				
			||||||
 | 
					#undef HAVE_POSIX_FADVISE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Define to 1 if you have the `posix_spawn' function. */
 | 
					/* Define to 1 if you have the `posix_spawn' function. */
 | 
				
			||||||
#undef HAVE_POSIX_SPAWN
 | 
					#undef HAVE_POSIX_SPAWN
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user