static char *ngx_devpoll_init_conf(ngx_cycle_t *cycle, void *conf) { ngx_devpoll_conf_t *dpcf = conf; ngx_conf_init_unsigned_value(dpcf->changes, 512); ngx_conf_init_unsigned_value(dpcf->events, 512); return NGX_CONF_OK; }
static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf) { ngx_event_conf_t *ecf = conf; #if (HAVE_RTSIG) ngx_core_conf_t *ccf; #endif #if (HAVE_KQUEUE) ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS); ngx_conf_init_unsigned_value(ecf->use, ngx_kqueue_module.ctx_index); ngx_conf_init_ptr_value(ecf->name, ngx_kqueue_module_ctx.name->data); #elif (HAVE_DEVPOLL) ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS); ngx_conf_init_unsigned_value(ecf->use, ngx_devpoll_module.ctx_index); ngx_conf_init_ptr_value(ecf->name, ngx_devpoll_module_ctx.name->data); #elif (HAVE_EPOLL) ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS); ngx_conf_init_unsigned_value(ecf->use, ngx_epoll_module.ctx_index); ngx_conf_init_ptr_value(ecf->name, ngx_epoll_module_ctx.name->data); #elif (HAVE_RTSIG) ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS); ngx_conf_init_unsigned_value(ecf->use, ngx_rtsig_module.ctx_index); ngx_conf_init_ptr_value(ecf->name, ngx_rtsig_module_ctx.name->data); #elif (HAVE_SELECT) #if (WIN32) ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS); #else ngx_conf_init_unsigned_value(ecf->connections, FD_SETSIZE < DEFAULT_CONNECTIONS ? FD_SETSIZE : DEFAULT_CONNECTIONS); #endif ngx_conf_init_unsigned_value(ecf->use, ngx_select_module.ctx_index); ngx_conf_init_ptr_value(ecf->name, ngx_select_module_ctx.name->data); #else ngx_int_t i, m; ngx_event_module_t *module; m = -1; module = NULL; for (i = 0; ngx_modules[i]; i++) { if (ngx_modules[i]->type == NGX_EVENT_MODULE) { module = ngx_modules[i]->ctx; if (ngx_strcmp(module->name->data, event_core_name.data) == 0) { continue; } m = ngx_modules[i]->ctx_index; break; } } if (m == -1) { ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, "no events module found"); return NGX_CONF_ERROR; } ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS); ngx_conf_init_unsigned_value(ecf->use, m); ngx_conf_init_ptr_value(ecf->name, module->name->data); #endif cycle->connection_n = ecf->connections; ngx_conf_init_value(ecf->multi_accept, 0); ngx_conf_init_value(ecf->accept_mutex, 1); ngx_conf_init_msec_value(ecf->accept_mutex_delay, 500); #if (HAVE_RTSIG) if (ecf->use == ngx_rtsig_module.ctx_index && ecf->accept_mutex == 0) { ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); if (ccf->worker_processes) { ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, "the \"rtsig\" method requires " "\"accept_mutex\" to be on"); return NGX_CONF_ERROR; } } #endif return NGX_CONF_OK; }