aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_files.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2008-09-12 13:50:12 +0000
committerIgor Sysoev <igor@sysoev.ru>2008-09-12 13:50:12 +0000
commitfae2c00d02d3631347a17deab2709968be1a05c7 (patch)
treea62d5986fc44f517e87de51567145b12bbaab078 /src/os/unix/ngx_files.c
parent0f8ea4de461b5fc54b69e09364c94b066363c0c9 (diff)
downloadnginx-fae2c00d02d3631347a17deab2709968be1a05c7.tar.gz
nginx-fae2c00d02d3631347a17deab2709968be1a05c7.zip
disable directio for unaligned reads in Linux
Diffstat (limited to 'src/os/unix/ngx_files.c')
-rw-r--r--src/os/unix/ngx_files.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c
index ab861467e..661ecaa4e 100644
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -389,7 +389,7 @@ ngx_unlock_fd(ngx_fd_t fd)
#if (NGX_HAVE_O_DIRECT)
ngx_int_t
-ngx_directio(ngx_fd_t fd)
+ngx_directio_on(ngx_fd_t fd)
{
int flags;
@@ -402,4 +402,19 @@ ngx_directio(ngx_fd_t fd)
return fcntl(fd, F_SETFL, flags | O_DIRECT);
}
+
+ngx_int_t
+ngx_directio_off(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