+#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
&errlog_name, /* module context */
ngx_errlog_commands, /* module directives */
NGX_CORE_MODULE, /* module type */
- NULL /* init module */
+ NULL, /* init module */
+ NULL /* init child */
};
typedef struct {
- int changes;
- int events;
+ u_int changes;
+ u_int events;
} ngx_devpoll_conf_t;
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;
&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 */
};
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;
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;
}
{
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;
}
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;
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;
}
ngx_http_log_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init module */
+ NULL /* init child */
};
&http_name, /* module context */
ngx_http_commands, /* module directives */
NGX_CORE_MODULE, /* module type */
- NULL /* init module */
+ NULL, /* init module */
+ NULL /* init child */
};
&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 */
};
}
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;
}