Mercurial > hg > nginx
diff 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 |
line wrap: on
line diff
--- a/src/core/ngx_output_chain.c +++ b/src/core/ngx_output_chain.c @@ -519,8 +519,26 @@ ngx_output_chain_copy_buf(ngx_output_cha #endif +#if (NGX_HAVE_FILE_AIO) + + if (ctx->aio) { + n = ngx_file_aio_read(src->file, dst->pos, (size_t) size, + src->file_pos, ctx->pool); + if (n == NGX_AGAIN) { + ctx->aio(ctx, src->file); + return NGX_AGAIN; + } + + } else { + n = ngx_read_file(src->file, dst->pos, (size_t) size, + src->file_pos); + } +#else + n = ngx_read_file(src->file, dst->pos, (size_t) size, src->file_pos); +#endif + #if (NGX_HAVE_ALIGNED_DIRECTIO) if (ctx->unaligned) { @@ -545,12 +563,6 @@ ngx_output_chain_copy_buf(ngx_output_cha return (ngx_int_t) n; } -#if (NGX_FILE_AIO_READ) - if (n == NGX_AGAIN) { - return (ngx_int_t) n; - } -#endif - if (n != size) { ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0, ngx_read_file_n " read only %z of %O from \"%s\"",