diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-11-15 09:16:58 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2009-11-15 09:16:58 +0000 |
commit | 700a779824c2d83ba1f8c7278f20863dce5ea3e1 (patch) | |
tree | b8b2cfece1215cf1c598fdbb51dd4b123e3f3c0b /src/os/unix/ngx_files.c | |
parent | b13029c57c3011c6df10566278eb4d5255e592d2 (diff) | |
download | nginx-700a779824c2d83ba1f8c7278f20863dce5ea3e1.tar.gz nginx-700a779824c2d83ba1f8c7278f20863dce5ea3e1.zip |
fix posix_fadvise() error handling
Diffstat (limited to 'src/os/unix/ngx_files.c')
-rw-r--r-- | src/os/unix/ngx_files.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c index 2264cc13e..0ef083824 100644 --- 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 |