diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2021-12-27 19:49:26 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2021-12-27 19:49:26 +0300 |
commit | 1f01183b9e6658749934313fd72f7f16c1918b54 (patch) | |
tree | 70456837095468405c238636c3e1aa1e63373110 /src/os/unix | |
parent | 2a00e6141f154d77a835e53b6527a1b3225f6f74 (diff) | |
download | nginx-1f01183b9e6658749934313fd72f7f16c1918b54.tar.gz nginx-1f01183b9e6658749934313fd72f7f16c1918b54.zip |
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.
Diffstat (limited to 'src/os/unix')
-rw-r--r-- | src/os/unix/ngx_freebsd_sendfile_chain.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/os/unix/ngx_freebsd_sendfile_chain.c b/src/os/unix/ngx_freebsd_sendfile_chain.c index c939f6ad6..5c6a830d8 100644 --- a/src/os/unix/ngx_freebsd_sendfile_chain.c +++ b/src/os/unix/ngx_freebsd_sendfile_chain.c @@ -174,7 +174,13 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) sent = 0; #if (NGX_HAVE_SENDFILE_NODISKIO) + flags = (c->busy_count <= 2) ? SF_NODISKIO : 0; + + if (file->file->directio) { + flags |= SF_NOCACHE; + } + #endif rc = sendfile(file->file->fd, c->fd, file->file_pos, |