Lines Matching defs:cycle

14 static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle);
17 static ngx_int_t ngx_process_options(ngx_cycle_t *cycle);
18 static ngx_int_t ngx_save_argv(ngx_cycle_t *cycle, int argc, char *const *argv);
19 static void *ngx_core_module_create_conf(ngx_cycle_t *cycle);
20 static char *ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf);
200 ngx_cycle_t *cycle, init_cycle;
284 cycle = ngx_init_cycle(&init_cycle);
285 if (cycle == NULL) {
297 cycle->conf_file.data);
301 cd = cycle->config_dump.elts;
303 for (i = 0; i < cycle->config_dump.nelts; i++) {
321 return ngx_signal_process(cycle, ngx_signal);
324 ngx_os_status(cycle->log);
326 ngx_cycle = cycle;
328 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
336 if (ngx_init_signals(cycle->log) != NGX_OK) {
341 if (ngx_daemon(cycle->log) != NGX_OK) {
354 if (ngx_create_pidfile(&ccf->pid, cycle->log) != NGX_OK) {
358 if (ngx_log_redirect_stderr(cycle) != NGX_OK) {
364 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
372 ngx_single_process_cycle(cycle);
375 ngx_master_process_cycle(cycle);
445 ngx_add_inherited_sockets(ngx_cycle_t *cycle)
457 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0,
460 if (ngx_array_init(&cycle->listening, cycle->pool, 10,
471 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
480 ls = ngx_array_push(&cycle->listening);
492 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
499 return ngx_set_inherited_sockets(cycle);
504 ngx_set_environment(ngx_cycle_t *cycle, ngx_uint_t *last)
512 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
561 env = ngx_alloc((*last + n + 1) * sizeof(char *), cycle->log);
569 cln = ngx_pool_cleanup_add(cycle->pool, 0);
574 env = ngx_alloc((n + 1) * sizeof(char *), cycle->log);
634 ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv)
651 env = ngx_set_environment(cycle, &n);
657 + cycle->listening.nelts * (NGX_INT32_LEN + 1) + 2,
658 cycle->log);
666 ls = cycle->listening.elts;
667 for (i = 0; i < cycle->listening.nelts; i++) {
693 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cycle->log, 0, "env: %s", *e);
700 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
703 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
714 pid = ngx_execute(cycle, &ctx);
720 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
863 ngx_save_argv(ngx_cycle_t *cycle, int argc, char *const *argv)
878 ngx_argv = ngx_alloc((argc + 1) * sizeof(char *), cycle->log);
886 ngx_argv[i] = ngx_alloc(len, cycle->log);
905 ngx_process_options(ngx_cycle_t *cycle)
915 p = ngx_pnalloc(cycle->pool, len + 1);
924 cycle->conf_prefix.len = len;
925 cycle->conf_prefix.data = p;
926 cycle->prefix.len = len;
927 cycle->prefix.data = p;
933 p = ngx_pnalloc(cycle->pool, NGX_MAX_PATH);
947 cycle->conf_prefix.len = len;
948 cycle->conf_prefix.data = p;
949 cycle->prefix.len = len;
950 cycle->prefix.data = p;
955 ngx_str_set(&cycle->conf_prefix, NGX_CONF_PREFIX);
957 ngx_str_set(&cycle->conf_prefix, NGX_PREFIX);
959 ngx_str_set(&cycle->prefix, NGX_PREFIX);
965 cycle->conf_file.len = ngx_strlen(ngx_conf_file);
966 cycle->conf_file.data = ngx_conf_file;
969 ngx_str_set(&cycle->conf_file, NGX_CONF_PATH);
972 if (ngx_conf_full_name(cycle, &cycle->conf_file, 0) != NGX_OK) {
976 for (p = cycle->conf_file.data + cycle->conf_file.len - 1;
977 p > cycle->conf_file.data;
981 cycle->conf_prefix.len = p - ngx_cycle->conf_file.data + 1;
982 cycle->conf_prefix.data = ngx_cycle->conf_file.data;
988 cycle->conf_param.len = ngx_strlen(ngx_conf_params);
989 cycle->conf_param.data = ngx_conf_params;
993 cycle->log->log_level = NGX_LOG_INFO;
1001 ngx_core_module_create_conf(ngx_cycle_t *cycle)
1005 ccf = ngx_pcalloc(cycle->pool, sizeof(ngx_core_conf_t));
1035 if (ngx_array_init(&ccf->env, cycle->pool, 1, sizeof(ngx_str_t))
1046 ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
1065 ngx_log_error(NGX_LOG_WARN, cycle->log, 0,
1078 if (ngx_conf_full_name(cycle, &ccf->pid, 0) != NGX_OK) {
1084 ccf->oldpid.data = ngx_pnalloc(cycle->pool, ccf->oldpid.len);
1102 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1113 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1126 if (ngx_conf_full_name(cycle, &ccf->lock_file, 0) != NGX_OK) {
1133 lock_file = cycle->old_cycle->lock_file;
1142 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
1146 cycle->lock_file.len = lock_file.len + 1;
1149 cycle->lock_file.data = ngx_pstrdup(cycle->pool, &lock_file);
1150 if (cycle->lock_file.data == NULL) {
1155 cycle->lock_file.len = ccf->lock_file.len + 1;
1156 cycle->lock_file.data = ngx_pnalloc(cycle->pool,
1158 if (cycle->lock_file.data == NULL) {
1162 ngx_memcpy(ngx_cpymem(cycle->lock_file.data, ccf->lock_file.data,
1499 if (cf->cycle->modules_used) {
1507 if (ngx_conf_full_name(cf->cycle, &file, 0) != NGX_OK) {
1511 cln = ngx_pool_cleanup_add(cf->cycle->pool, 0);