mirror of
https://github.com/nginx/nginx.git
synced 2024-12-23 15:40:03 -06:00
fix posix_fadvise() error handling
This commit is contained in:
parent
b13029c57c
commit
700a779824
@ -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)
|
#if (NGX_HAVE_O_DIRECT)
|
||||||
|
|
||||||
ngx_int_t
|
ngx_int_t
|
||||||
|
@ -264,7 +264,7 @@ ngx_err_t ngx_unlock_fd(ngx_fd_t fd);
|
|||||||
|
|
||||||
#define NGX_HAVE_READ_AHEAD 1
|
#define NGX_HAVE_READ_AHEAD 1
|
||||||
|
|
||||||
#define ngx_read_ahead(fd, n) posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL)
|
ngx_int_t ngx_read_ahead(ngx_fd_t fd, size_t n);
|
||||||
#define ngx_read_ahead_n "posix_fadvise(POSIX_FADV_SEQUENTIAL)"
|
#define ngx_read_ahead_n "posix_fadvise(POSIX_FADV_SEQUENTIAL)"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user