comparison src/core/ngx_output_chain.c @ 416:a8e3f1441eec NGINX_0_7_17

nginx 0.7.17 *) Feature: now the "directio" directive works on Linux. *) Feature: the $pid variable. *) Bugfix: the "directio" optimization that had appeared in 0.7.15 did not work with open_file_cache. *) Bugfix: the "access_log" with variables did not work on Linux; the bug had appeared in 0.7.7. *) Bugfix: the ngx_http_charset_module did not understand quoted charset name received from backend.
author Igor Sysoev <http://sysoev.ru>
date Mon, 15 Sep 2008 00:00:00 +0400
parents a2a3905c04ab
children ad0a34a8efa6
comparison
equal deleted inserted replaced
415:f6561f721532 416:a8e3f1441eec
353 /* 353 /*
354 * we do not set ctx->buf->tag, because we do not want 354 * we do not set ctx->buf->tag, because we do not want
355 * to reuse the buf via ctx->free list 355 * to reuse the buf via ctx->free list
356 */ 356 */
357 357
358 #if (NGX_HAVE_ALIGNED_DIRECTIO)
359 ctx->unaligned = 1;
360 #endif
361
358 return NGX_OK; 362 return NGX_OK;
359 } 363 }
360 364
361 365
362 static ngx_int_t 366 static ngx_int_t
489 dst->flush = src->flush; 493 dst->flush = src->flush;
490 dst->last_buf = src->last_buf; 494 dst->last_buf = src->last_buf;
491 } 495 }
492 496
493 } else { 497 } else {
498
499 #if (NGX_HAVE_ALIGNED_DIRECTIO)
500
501 if (ctx->unaligned) {
502 if (ngx_directio_off(src->file->fd) == -1) {
503 ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, ngx_errno,
504 ngx_directio_off_n " \"%s\" failed",
505 src->file->name.data);
506 }
507 }
508
509 #endif
510
494 n = ngx_read_file(src->file, dst->pos, (size_t) size, src->file_pos); 511 n = ngx_read_file(src->file, dst->pos, (size_t) size, src->file_pos);
512
513 #if (NGX_HAVE_ALIGNED_DIRECTIO)
514
515 if (ctx->unaligned) {
516 ngx_err_t err;
517
518 err = ngx_errno;
519
520 if (ngx_directio_on(src->file->fd) == -1) {
521 ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, ngx_errno,
522 ngx_directio_on_n " \"%s\" failed",
523 src->file->name.data);
524 }
525
526 ngx_set_errno(err);
527
528 ctx->unaligned = 0;
529 }
530
531 #endif
495 532
496 if (n == NGX_ERROR) { 533 if (n == NGX_ERROR) {
497 return (ngx_int_t) n; 534 return (ngx_int_t) n;
498 } 535 }
499 536
503 } 540 }
504 #endif 541 #endif
505 542
506 if (n != size) { 543 if (n != size) {
507 ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0, 544 ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
508 ngx_read_file_n " read only %z of %O from file", 545 ngx_read_file_n " read only %z of %O from \"%s\"",
509 n, size); 546 n, size, src->file->name.data);
510 if (n == 0) { 547 if (n == 0) {
511 return NGX_ERROR; 548 return NGX_ERROR;
512 } 549 }
513 } 550 }
514 551