nxt_runtime.c (211:6738bb76ae0a) nxt_runtime.c (216:07257705cd64)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_main.h>

--- 43 unchanged lines hidden (view full) ---

52 nxt_process_t *process);
53static nxt_process_t *nxt_runtime_process_remove_pid(nxt_runtime_t *rt,
54 nxt_pid_t pid);
55
56
57nxt_int_t
58nxt_runtime_create(nxt_task_t *task)
59{
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_main.h>

--- 43 unchanged lines hidden (view full) ---

52 nxt_process_t *process);
53static nxt_process_t *nxt_runtime_process_remove_pid(nxt_runtime_t *rt,
54 nxt_pid_t pid);
55
56
57nxt_int_t
58nxt_runtime_create(nxt_task_t *task)
59{
60 nxt_mp_t *mp;
61 nxt_int_t ret;
62 nxt_array_t *listen_sockets;
63 nxt_runtime_t *rt;
60 nxt_mp_t *mp;
61 nxt_int_t ret;
62 nxt_array_t *listen_sockets;
63 nxt_runtime_t *rt;
64 nxt_app_lang_module_t *lang;
64
65 mp = nxt_mp_create(1024, 128, 256, 32);
66
67 if (nxt_slow_path(mp == NULL)) {
68 return NXT_ERROR;
69 }
70
71 rt = nxt_mp_zget(mp, sizeof(nxt_runtime_t));

--- 13 unchanged lines hidden (view full) ---

85
86 rt->conf_prefix = rt->prefix;
87
88 rt->services = nxt_services_init(mp);
89 if (nxt_slow_path(rt->services == NULL)) {
90 goto fail;
91 }
92
65
66 mp = nxt_mp_create(1024, 128, 256, 32);
67
68 if (nxt_slow_path(mp == NULL)) {
69 return NXT_ERROR;
70 }
71
72 rt = nxt_mp_zget(mp, sizeof(nxt_runtime_t));

--- 13 unchanged lines hidden (view full) ---

86
87 rt->conf_prefix = rt->prefix;
88
89 rt->services = nxt_services_init(mp);
90 if (nxt_slow_path(rt->services == NULL)) {
91 goto fail;
92 }
93
94 rt->languages = nxt_array_create(mp, 1, sizeof(nxt_app_lang_module_t));
95 if (nxt_slow_path(rt->languages == NULL)) {
96 goto fail;
97 }
98
99 /* Should not fail. */
100 lang = nxt_array_add(rt->languages);
101 lang->type = (nxt_str_t) nxt_string("go");
102 lang->version = (nxt_str_t) nxt_null_string;
103 lang->file = NULL;
104 lang->module = &nxt_go_module;
105
93 listen_sockets = nxt_array_create(mp, 1, sizeof(nxt_listen_socket_t));
94 if (nxt_slow_path(listen_sockets == NULL)) {
95 goto fail;
96 }
97
98 rt->listen_sockets = listen_sockets;
99
100 ret = nxt_runtime_inherited_listen_sockets(task, rt);

--- 218 unchanged lines hidden (view full) ---

319
320 return NXT_OK;
321}
322
323
324static void
325nxt_runtime_start(nxt_task_t *task, void *obj, void *data)
326{
106 listen_sockets = nxt_array_create(mp, 1, sizeof(nxt_listen_socket_t));
107 if (nxt_slow_path(listen_sockets == NULL)) {
108 goto fail;
109 }
110
111 rt->listen_sockets = listen_sockets;
112
113 ret = nxt_runtime_inherited_listen_sockets(task, rt);

--- 218 unchanged lines hidden (view full) ---

332
333 return NXT_OK;
334}
335
336
337static void
338nxt_runtime_start(nxt_task_t *task, void *obj, void *data)
339{
327 nxt_uint_t i;
328 nxt_runtime_t *rt;
329
330 rt = obj;
331
332 nxt_debug(task, "rt conf done");
333
334 task->thread->log->ctx_handler = NULL;
335 task->thread->log->ctx = NULL;
336
337 if (nxt_runtime_conf_init(task, rt) != NXT_OK) {
338 goto fail;
339 }
340
340 nxt_runtime_t *rt;
341
342 rt = obj;
343
344 nxt_debug(task, "rt conf done");
345
346 task->thread->log->ctx_handler = NULL;
347 task->thread->log->ctx = NULL;
348
349 if (nxt_runtime_conf_init(task, rt) != NXT_OK) {
350 goto fail;
351 }
352
341 for (i = 0; i < nxt_init_modules_n; i++) {
342 if (nxt_init_modules[i](task->thread, rt) != NXT_OK) {
343 goto fail;
344 }
345 }
346
347 if (nxt_runtime_log_files_create(task, rt) != NXT_OK) {
348 goto fail;
349 }
350
351 if (nxt_runtime_event_engine_change(task, rt) != NXT_OK) {
352 goto fail;
353 }
354

--- 1431 unchanged lines hidden ---
353 if (nxt_runtime_log_files_create(task, rt) != NXT_OK) {
354 goto fail;
355 }
356
357 if (nxt_runtime_event_engine_change(task, rt) != NXT_OK) {
358 goto fail;
359 }
360

--- 1431 unchanged lines hidden ---