comparison src/core/ngx_output_chain.c @ 3052:6060225e9261

FreeBSD and Linux AIO support
author Igor Sysoev <igor@sysoev.ru>
date Fri, 28 Aug 2009 08:12:35 +0000
parents dc01b26f8de8
children 0d253659da12
comparison
equal deleted inserted replaced
3051:26dfc0fa22c8 3052:6060225e9261
517 } 517 }
518 } 518 }
519 519
520 #endif 520 #endif
521 521
522 #if (NGX_HAVE_FILE_AIO)
523
524 if (ctx->aio) {
525 n = ngx_file_aio_read(src->file, dst->pos, (size_t) size,
526 src->file_pos, ctx->pool);
527 if (n == NGX_AGAIN) {
528 ctx->aio(ctx, src->file);
529 return NGX_AGAIN;
530 }
531
532 } else {
533 n = ngx_read_file(src->file, dst->pos, (size_t) size,
534 src->file_pos);
535 }
536 #else
537
522 n = ngx_read_file(src->file, dst->pos, (size_t) size, src->file_pos); 538 n = ngx_read_file(src->file, dst->pos, (size_t) size, src->file_pos);
539
540 #endif
523 541
524 #if (NGX_HAVE_ALIGNED_DIRECTIO) 542 #if (NGX_HAVE_ALIGNED_DIRECTIO)
525 543
526 if (ctx->unaligned) { 544 if (ctx->unaligned) {
527 ngx_err_t err; 545 ngx_err_t err;
542 #endif 560 #endif
543 561
544 if (n == NGX_ERROR) { 562 if (n == NGX_ERROR) {
545 return (ngx_int_t) n; 563 return (ngx_int_t) n;
546 } 564 }
547
548 #if (NGX_FILE_AIO_READ)
549 if (n == NGX_AGAIN) {
550 return (ngx_int_t) n;
551 }
552 #endif
553 565
554 if (n != size) { 566 if (n != size) {
555 ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0, 567 ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
556 ngx_read_file_n " read only %z of %O from \"%s\"", 568 ngx_read_file_n " read only %z of %O from \"%s\"",
557 n, size, src->file->name.data); 569 n, size, src->file->name.data);