Klaus Demo nginx / 700a779
fix posix_fadvise() error handling Igor Sysoev 12 years ago
2 changed file(s) with 21 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
401401 }
402402
403403
404 #if (NGX_HAVE_POSIX_FADVISE)
405
406 ngx_int_t
407 ngx_read_ahead(ngx_fd_t fd, size_t n)
408 {
409 int err;
410
411 err = posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL);
412
413 if (err == 0) {
414 return 0;
415 }
416
417 ngx_set_errno(err);
418 return NGX_FILE_ERROR;
419 }
420
421 #endif
422
423
404424 #if (NGX_HAVE_O_DIRECT)
405425
406426 ngx_int_t
263263
264264 #define NGX_HAVE_READ_AHEAD 1
265265
266 #define ngx_read_ahead(fd, n) posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL)
266 ngx_int_t ngx_read_ahead(ngx_fd_t fd, size_t n);
267267 #define ngx_read_ahead_n "posix_fadvise(POSIX_FADV_SEQUENTIAL)"
268268
269269 #else