diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-08-28 08:12:35 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2009-08-28 08:12:35 +0000 |
commit | a962506498d3930bea4e34bc21d261613065f98f (patch) | |
tree | f401951eaab82203accb72c8b2205b9d91f7ee07 /src/core/ngx_output_chain.c | |
parent | 1163af9fae396700700824cca21309476cf5dd51 (diff) | |
download | nginx-a962506498d3930bea4e34bc21d261613065f98f.tar.gz nginx-a962506498d3930bea4e34bc21d261613065f98f.zip |
FreeBSD and Linux AIO support
Diffstat (limited to 'src/core/ngx_output_chain.c')
-rw-r--r-- | src/core/ngx_output_chain.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c index 6d6d241c1..99e0a9434 100644 --- 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_chain_ctx_t *ctx) #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_chain_ctx_t *ctx) 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\"", |