diff options
Diffstat (limited to 'src/os/unix/ngx_files.c')
| -rw-r--r-- | src/os/unix/ngx_files.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c index 7ee8cbd84..e2148d843 100644 --- a/src/os/unix/ngx_files.c +++ b/src/os/unix/ngx_files.c @@ -351,3 +351,22 @@ ngx_unlock_fd(ngx_fd_t fd) return 0; } + + +#if (NGX_HAVE_O_DIRECT) + +ngx_int_t +ngx_directio(ngx_fd_t fd) +{ + int flags; + + flags = fcntl(fd, F_GETFL); + + if (flags == -1) { + return -1; + } + + return fcntl(fd, F_SETFL, flags | O_DIRECT); +} + +#endif |
