comparison src/core/ngx_conf_file.c @ 571:458b6c3fea65 release-0.3.7

nginx-0.3.7-RELEASE import *) Feature: the "access_log" supports the "buffer=" parameter. *) Bugfix: nginx could not be built on platforms different from i386, amd64, sparc, and ppc; the bug had appeared in 0.3.2.
author Igor Sysoev <igor@sysoev.ru>
date Thu, 27 Oct 2005 15:46:13 +0000
parents 9c2f3ed7a247
children 326634fb9d47
comparison
equal deleted inserted replaced
570:2cdf120d8970 571:458b6c3fea65
9 9
10 10
11 static ngx_int_t ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last); 11 static ngx_int_t ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last);
12 static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf); 12 static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf);
13 static char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); 13 static char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
14 static void ngx_conf_flush_files(ngx_cycle_t *cycle);
14 15
15 16
16 static ngx_command_t ngx_conf_commands[] = { 17 static ngx_command_t ngx_conf_commands[] = {
17 18
18 { ngx_string("include"), 19 { ngx_string("include"),
34 NULL, /* init master */ 35 NULL, /* init master */
35 NULL, /* init module */ 36 NULL, /* init module */
36 NULL, /* init process */ 37 NULL, /* init process */
37 NULL, /* init thread */ 38 NULL, /* init thread */
38 NULL, /* exit thread */ 39 NULL, /* exit thread */
39 NULL, /* exit process */ 40 ngx_conf_flush_files, /* exit process */
40 NULL, /* exit master */ 41 NULL, /* exit master */
41 NGX_MODULE_V1_PADDING 42 NGX_MODULE_V1_PADDING
42 }; 43 };
43 44
44 45
740 file->fd = ngx_stderr_fileno; 741 file->fd = ngx_stderr_fileno;
741 file->name.len = 0; 742 file->name.len = 0;
742 file->name.data = NULL; 743 file->name.data = NULL;
743 } 744 }
744 745
746 file->buffer = NULL;
747
745 return file; 748 return file;
749 }
750
751
752 static void
753 ngx_conf_flush_files(ngx_cycle_t *cycle)
754 {
755 ngx_uint_t i;
756 ngx_list_part_t *part;
757 ngx_open_file_t *file;
758
759 ngx_log_debug0(NGX_LOG_DEBUG_CORE, cycle->log, 0, "flush files");
760
761 part = &cycle->open_files.part;
762 file = part->elts;
763
764 for (i = 0; /* void */ ; i++) {
765
766 if (i >= part->nelts) {
767 if (part->next == NULL) {
768 break;
769 }
770 part = part->next;
771 file = part->elts;
772 i = 0;
773 }
774
775 if (file[i].buffer == NULL || file[i].pos - file[i].buffer == 0) {
776 continue;
777 }
778
779 ngx_write_fd(file[i].fd, file[i].buffer, file[i].pos - file[i].buffer);
780 }
746 } 781 }
747 782
748 783
749 void ngx_cdecl 784 void ngx_cdecl
750 ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf, ngx_err_t err, 785 ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf, ngx_err_t err,