Mercurial > hg > nginx
diff src/os/unix/ngx_files.c @ 2248:1adec90a0e46
disable directio for unaligned reads in Linux
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 12 Sep 2008 13:50:12 +0000 |
parents | c7c319896bb4 |
children | 5e87ddb4764f |
line wrap: on
line diff
--- 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