diff options
author | Igor Sysoev <igor@sysoev.ru> | 2003-07-11 08:50:59 +0400 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2003-07-11 08:50:59 +0400 |
commit | a7f7fa878ce271af23bbb6e1586bae1273eb10d2 (patch) | |
tree | 31684f5316ff58e748bf588cde8dd41bb7249f94 | |
parent | b8c367c7b9155857f1c068624aa059830db57fa8 (diff) |
nginx-0.0.1-2003-07-11-08:50:59 import
-rw-r--r-- | src/core/ngx_config.h | 13 | ||||
-rw-r--r-- | src/core/ngx_log.c | 3 | ||||
-rw-r--r-- | src/event/modules/ngx_devpoll_module.c | 20 | ||||
-rw-r--r-- | src/event/modules/ngx_poll_module.c | 10 | ||||
-rw-r--r-- | src/http/modules/ngx_http_log_handler.c | 1 | ||||
-rw-r--r-- | src/http/ngx_http.c | 3 | ||||
-rw-r--r-- | src/http/ngx_http_output_filter.c | 3 | ||||
-rw-r--r-- | src/os/unix/ngx_posix_init.c | 8 |
8 files changed, 39 insertions, 22 deletions
diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h index 807ca06dc..4d7f86d59 100644 --- a/src/core/ngx_config.h +++ b/src/core/ngx_config.h @@ -33,6 +33,19 @@ +#if !(WIN32) + +#define ngx_signal_helper(n) SIG##n +#define ngx_signal_value(n) ngx_signal_helper(n) + +/* TODO: #ifndef */ +#define NGX_RESTART_SIGNAL HUP +#define NGX_ROTATE_SIGNAL USR1 + +#endif + + + /* TODO: platform specific: array[NGX_INVALID_ARRAY_INDEX] must cause SIGSEGV */ #define NGX_INVALID_ARRAY_INDEX 0x80000000 diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c index c3cec3862..9ebac94e6 100644 --- a/src/core/ngx_log.c +++ b/src/core/ngx_log.c @@ -37,7 +37,8 @@ ngx_module_t ngx_errlog_module = { &errlog_name, /* module context */ ngx_errlog_commands, /* module directives */ NGX_CORE_MODULE, /* module type */ - NULL /* init module */ + NULL, /* init module */ + NULL /* init child */ }; diff --git a/src/event/modules/ngx_devpoll_module.c b/src/event/modules/ngx_devpoll_module.c index 9c374491a..d6f2596c6 100644 --- a/src/event/modules/ngx_devpoll_module.c +++ b/src/event/modules/ngx_devpoll_module.c @@ -26,8 +26,8 @@ struct dvpoll { typedef struct { - int changes; - int events; + u_int changes; + u_int events; } ngx_devpoll_conf_t; @@ -43,8 +43,7 @@ static char *ngx_devpoll_init_conf(ngx_cycle_t *cycle, void *conf); static int dp; static struct pollfd *change_list, *event_list; -static u_int nchanges, max_changes; -static int nevents; +static u_int nchanges, max_changes, nevents; static ngx_event_t **change_index; @@ -95,7 +94,8 @@ ngx_module_t ngx_devpoll_module = { &ngx_devpoll_module_ctx, /* module context */ ngx_devpoll_commands, /* module directives */ NGX_EVENT_MODULE, /* module type */ - NULL /* init module */ + NULL, /* init module */ + NULL /* init child */ }; @@ -321,7 +321,7 @@ static int ngx_devpoll_set_event(ngx_event_t *ev, int event, u_int flags) int ngx_devpoll_process_events(ngx_log_t *log) { - int events, n, i; + int events, n, i, j; ngx_msec_t timer, delta; ngx_err_t err; ngx_cycle_t **cycle; @@ -397,11 +397,11 @@ int ngx_devpoll_process_events(ngx_log_t *log) if (c->fd == -1) { cycle = ngx_old_cycles.elts; - for (i = 0; i < ngx_old_cycles.nelts; i++) { + for (j = 0; j < ngx_old_cycles.nelts; j++) { if (cycle[i] == NULL) { continue; } - c = &cycle[i]->connections[event_list[i].fd]; + c = &cycle[j]->connections[event_list[i].fd]; if (c->fd != -1) { break; } @@ -471,8 +471,8 @@ static char *ngx_devpoll_init_conf(ngx_cycle_t *cycle, void *conf) { ngx_devpoll_conf_t *dpcf = conf; - ngx_conf_init_value(dpcf->changes, 512); - ngx_conf_init_value(dpcf->events, 512); + ngx_conf_init_unsigned_value(dpcf->changes, 512); + ngx_conf_init_unsigned_value(dpcf->events, 512); return NGX_CONF_OK; } diff --git a/src/event/modules/ngx_poll_module.c b/src/event/modules/ngx_poll_module.c index 278375b5a..a3a0fb12b 100644 --- a/src/event/modules/ngx_poll_module.c +++ b/src/event/modules/ngx_poll_module.c @@ -224,8 +224,8 @@ static int ngx_poll_del_event(ngx_event_t *ev, int event, u_int flags) static int ngx_poll_process_events(ngx_log_t *log) { - int ready, found; - u_int i, nready; + int ready, found, j; + u_int nready, i; ngx_msec_t timer, delta; ngx_err_t err; ngx_cycle_t **cycle; @@ -293,11 +293,11 @@ static int ngx_poll_process_events(ngx_log_t *log) if (c->fd == -1) { cycle = ngx_old_cycles.elts; - for (i = 0; i < ngx_old_cycles.nelts; i++) { - if (cycle[i] == NULL) { + for (j = 0; j < ngx_old_cycles.nelts; j++) { + if (cycle[j] == NULL) { continue; } - c = &cycle[i]->connections[event_list[i].fd]; + c = &cycle[j]->connections[event_list[i].fd]; if (c->fd != -1) { break; } diff --git a/src/http/modules/ngx_http_log_handler.c b/src/http/modules/ngx_http_log_handler.c index 1ddca3241..c186ac904 100644 --- a/src/http/modules/ngx_http_log_handler.c +++ b/src/http/modules/ngx_http_log_handler.c @@ -45,6 +45,7 @@ ngx_module_t ngx_http_log_module = { ngx_http_log_commands, /* module directives */ NGX_HTTP_MODULE, /* module type */ NULL, /* init module */ + NULL /* init child */ }; diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c index cc1f8e894..945502669 100644 --- a/src/http/ngx_http.c +++ b/src/http/ngx_http.c @@ -36,7 +36,8 @@ ngx_module_t ngx_http_module = { &http_name, /* module context */ ngx_http_commands, /* module directives */ NGX_CORE_MODULE, /* module type */ - NULL /* init module */ + NULL, /* init module */ + NULL /* init child */ }; diff --git a/src/http/ngx_http_output_filter.c b/src/http/ngx_http_output_filter.c index 09b7bfab5..dbc56def5 100644 --- a/src/http/ngx_http_output_filter.c +++ b/src/http/ngx_http_output_filter.c @@ -53,7 +53,8 @@ ngx_module_t ngx_http_output_filter_module = { &ngx_http_output_filter_module_ctx, /* module context */ ngx_http_output_filter_commands, /* module directives */ NGX_HTTP_MODULE, /* module type */ - NULL /* init module */ + NULL, /* init module */ + NULL /* init child */ }; diff --git a/src/os/unix/ngx_posix_init.c b/src/os/unix/ngx_posix_init.c index 364df118e..fe91408ac 100644 --- a/src/os/unix/ngx_posix_init.c +++ b/src/os/unix/ngx_posix_init.c @@ -26,16 +26,16 @@ int ngx_posix_init(ngx_log_t *log) } sa.sa_handler = ngx_restart_signal_handler; - if (sigaction(SIGHUP, &sa, NULL) == -1) { + if (sigaction(ngx_signal_value(NGX_RESTART_SIGNAL), &sa, NULL) == -1) { ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, - "sigaction(SIGHUP) failed"); + "sigaction(SIG" ngx_value(NGX_RESTART_SIGNAL) ") failed"); return NGX_ERROR; } sa.sa_handler = ngx_rotate_signal_handler; - if (sigaction(SIGUSR1, &sa, NULL) == -1) { + if (sigaction(ngx_signal_value(NGX_ROTATE_SIGNAL), &sa, NULL) == -1) { ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, - "sigaction(SIGUSR1) failed"); + "sigaction(SIG" ngx_value(NGX_ROTATE_SIGNAL) ") failed"); return NGX_ERROR; } |