]> git.kaiwu.me - nginx.git/commitdiff
uniform ngx_directio_on/off() interface with other file functions
authorIgor Sysoev <igor@sysoev.ru>
Fri, 25 Sep 2009 14:17:28 +0000 (14:17 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 25 Sep 2009 14:17:28 +0000 (14:17 +0000)
src/core/ngx_open_file_cache.c
src/core/ngx_output_chain.c
src/os/unix/ngx_files.c
src/os/win32/ngx_files.c

index aa87fd22c40afe7726a13d1232f4fc92f395660e..5f6e0b263e058f8122ce27afaf4d8349f89203ab 100644 (file)
@@ -525,7 +525,7 @@ ngx_open_and_stat_file(u_char *name, ngx_open_file_info_t *of, ngx_log_t *log)
         of->fd = fd;
 
         if (of->directio <= ngx_file_size(&fi)) {
-            if (ngx_directio_on(fd) == -1) {
+            if (ngx_directio_on(fd) == NGX_FILE_ERROR) {
                 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
                               ngx_directio_on_n " \"%s\" failed", name);
 
index 590da4f450c716a79339195b5a166ad3fc53f31d..3ff25ff76ce86b7b8d9e80c3e40dbee7a9a24fc6 100644 (file)
@@ -514,7 +514,7 @@ ngx_output_chain_copy_buf(ngx_output_chain_ctx_t *ctx)
 #if (NGX_HAVE_ALIGNED_DIRECTIO)
 
         if (ctx->unaligned) {
-            if (ngx_directio_off(src->file->fd) == -1) {
+            if (ngx_directio_off(src->file->fd) == NGX_FILE_ERROR) {
                 ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, ngx_errno,
                               ngx_directio_off_n " \"%s\" failed",
                               src->file->name.data);
@@ -550,7 +550,7 @@ ngx_output_chain_copy_buf(ngx_output_chain_ctx_t *ctx)
 
             err = ngx_errno;
 
-            if (ngx_directio_on(src->file->fd) == -1) {
+            if (ngx_directio_on(src->file->fd) == NGX_FILE_ERROR) {
                 ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, ngx_errno,
                               ngx_directio_on_n " \"%s\" failed",
                               src->file->name.data);
index d4bf0436f160ceaec7ba7dec1e8b8db2307f7d99..2154bed49ee49c5c308ab6360107b7583a8deb8b 100644 (file)
@@ -406,7 +406,7 @@ ngx_directio_on(ngx_fd_t fd)
     flags = fcntl(fd, F_GETFL);
 
     if (flags == -1) {
-        return -1;
+        return NGX_FILE_ERROR;
     }
 
     return fcntl(fd, F_SETFL, flags | O_DIRECT);
@@ -421,7 +421,7 @@ ngx_directio_off(ngx_fd_t fd)
     flags = fcntl(fd, F_GETFL);
 
     if (flags == -1) {
-        return -1;
+        return NGX_FILE_ERROR;
     }
 
     return fcntl(fd, F_SETFL, flags & ~O_DIRECT);
index bfbb98fb0c81a352c9658c1dde813203b1033174..70cab2f1ce3e0326d97079d382afb1422823b811 100644 (file)
@@ -479,14 +479,14 @@ ngx_de_link_info(u_char *name, ngx_dir_t *dir)
 ngx_int_t
 ngx_directio_on(ngx_fd_t fd)
 {
-    return 0;
+    return ~NGX_FILE_ERROR;
 }
 
 
 ngx_int_t
 ngx_directio_off(ngx_fd_t fd)
 {
-    return 0;
+    return ~NGX_FILE_ERROR;
 }