From 385af286421e983f744f7f5d339b8060ccd36302 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Wed, 30 Jul 2008 12:34:04 +0000 Subject: directio --- src/os/unix/ngx_files.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/os/unix/ngx_files.c') 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 -- cgit v1.2.3