diff src/os/unix/ngx_files.c @ 410:a8e3f1441eec NGINX_0_7_17

nginx 0.7.17 *) Feature: now the "directio" directive works on Linux. *) Feature: the $pid variable. *) Bugfix: the "directio" optimization that had appeared in 0.7.15 did not work with open_file_cache. *) Bugfix: the "access_log" with variables did not work on Linux; the bug had appeared in 0.7.7. *) Bugfix: the ngx_http_charset_module did not understand quoted charset name received from backend.
author Igor Sysoev <http://sysoev.ru>
date Mon, 15 Sep 2008 00:00:00 +0400
parents 79c5df00501e
children ca8f7f6cab16
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