From 1f01183b9e6658749934313fd72f7f16c1918b54 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Mon, 27 Dec 2021 19:49:26 +0300 Subject: 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. --- src/event/ngx_event_openssl.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/event') diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c index 57e2d44ca..33977af61 100644 --- a/src/event/ngx_event_openssl.c +++ b/src/event/ngx_event_openssl.c @@ -2955,7 +2955,13 @@ ngx_ssl_sendfile(ngx_connection_t *c, ngx_buf_t *file, size_t size) ngx_set_errno(0); #if (NGX_HAVE_SENDFILE_NODISKIO) + flags = (c->busy_count <= 2) ? SF_NODISKIO : 0; + + if (file->file->directio) { + flags |= SF_NOCACHE; + } + #else flags = 0; #endif -- cgit