comparison src/core/ngx_output_chain.c @ 7987:b002ad258f1d

Support for sendfile(SF_NOCACHE). The SF_NOCACHE flag, introduced in FreeBSD 11 along with the new non-blocking sendfile() implementation by glebius@, makes it possible to use sendfile() along with the "directio" directive.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 27 Dec 2021 19:49:26 +0300
parents ec2e6893caaa
children
comparison
equal deleted inserted replaced
7986:f1fcb0fe6975 7987:b002ad258f1d
254 buf->file->thread_handler = ctx->thread_handler; 254 buf->file->thread_handler = ctx->thread_handler;
255 buf->file->thread_ctx = ctx->filter_ctx; 255 buf->file->thread_ctx = ctx->filter_ctx;
256 } 256 }
257 #endif 257 #endif
258 258
259 sendfile = ctx->sendfile;
260
261 #if (NGX_SENDFILE_LIMIT)
262
263 if (buf->in_file && buf->file_pos >= NGX_SENDFILE_LIMIT) {
264 sendfile = 0;
265 }
266
267 #endif
268
269 #if !(NGX_HAVE_SENDFILE_NODISKIO)
270
271 /*
272 * With DIRECTIO, disable sendfile() unless sendfile(SF_NOCACHE)
273 * is available.
274 */
275
259 if (buf->in_file && buf->file->directio) { 276 if (buf->in_file && buf->file->directio) {
260 return 0;
261 }
262
263 sendfile = ctx->sendfile;
264
265 #if (NGX_SENDFILE_LIMIT)
266
267 if (buf->in_file && buf->file_pos >= NGX_SENDFILE_LIMIT) {
268 sendfile = 0; 277 sendfile = 0;
269 } 278 }
270 279
271 #endif 280 #endif
272 281