nxt_main_process.c (1253:b225cd619dbb) nxt_main_process.c (1254:aae6699f4eee)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8#include <nxt_runtime.h>

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

392
393static nxt_int_t
394nxt_main_process_port_create(nxt_task_t *task, nxt_runtime_t *rt)
395{
396 nxt_int_t ret;
397 nxt_port_t *port;
398 nxt_process_t *process;
399
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8#include <nxt_runtime.h>

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

392
393static nxt_int_t
394nxt_main_process_port_create(nxt_task_t *task, nxt_runtime_t *rt)
395{
396 nxt_int_t ret;
397 nxt_port_t *port;
398 nxt_process_t *process;
399
400 process = nxt_runtime_process_get(rt, nxt_pid);
401 if (nxt_slow_path(process == NULL)) {
402 return NXT_ERROR;
403 }
404
405 port = nxt_port_new(task, 0, nxt_pid, NXT_PROCESS_MAIN);
400 port = nxt_runtime_process_port_create(task, rt, nxt_pid, 0,
401 NXT_PROCESS_MAIN);
406 if (nxt_slow_path(port == NULL)) {
402 if (nxt_slow_path(port == NULL)) {
407 nxt_process_use(task, process, -1);
408 return NXT_ERROR;
409 }
410
403 return NXT_ERROR;
404 }
405
411 nxt_process_port_add(task, process, port);
406 process = port->process;
412
407
413 nxt_process_use(task, process, -1);
414
415 ret = nxt_port_socket_init(task, port, 0);
416 if (nxt_slow_path(ret != NXT_OK)) {
408 ret = nxt_port_socket_init(task, port, 0);
409 if (nxt_slow_path(ret != NXT_OK)) {
417 nxt_port_use(task, port, -1);
418 return ret;
419 }
420
410 return ret;
411 }
412
421 nxt_runtime_port_add(task, port);
422
423 nxt_port_use(task, port, -1);
424
425 /*
426 * A main process port. A write port is not closed
427 * since it should be inherited by worker processes.
428 */
429 nxt_port_enable(task, port, &nxt_main_process_port_handlers);
430
431 process->ready = 1;
432

--- 1170 unchanged lines hidden ---
413 /*
414 * A main process port. A write port is not closed
415 * since it should be inherited by worker processes.
416 */
417 nxt_port_enable(task, port, &nxt_main_process_port_handlers);
418
419 process->ready = 1;
420

--- 1170 unchanged lines hidden ---