diff src/os/unix/ngx_files.c @ 3322:e19df6e65352

fix posix_fadvise() error handling
author Igor Sysoev <igor@sysoev.ru>
date Sun, 15 Nov 2009 09:16:58 +0000
parents 04cfc09b8b8d
children 515d50917016
line wrap: on
line diff
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -402,6 +402,26 @@ ngx_unlock_fd(ngx_fd_t fd)
 }
 
 
+#if (NGX_HAVE_POSIX_FADVISE)
+
+ngx_int_t
+ngx_read_ahead(ngx_fd_t fd, size_t n)
+{
+    int  err;
+
+    err = posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL);
+
+    if (err == 0) {
+        return 0;
+    }
+
+    ngx_set_errno(err);
+    return NGX_FILE_ERROR;
+}
+
+#endif
+
+
 #if (NGX_HAVE_O_DIRECT)
 
 ngx_int_t