summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_main_process.c
diff options
context:
space:
mode:
authorHong Zhi Dao <hongzhidao@gmail.com>2019-10-29 16:07:21 +0300
committerHong Zhi Dao <hongzhidao@gmail.com>2019-10-29 16:07:21 +0300
commit5d42599e3318aa8f68a3cbb4b992985cc75495dc (patch)
treed761f378f9992bd5230748f0ea93468e01588eee /src/nxt_main_process.c
parent65b03a14a7b48ae0e1dc34b74e05f01574a5424f (diff)
downloadunit-5d42599e3318aa8f68a3cbb4b992985cc75495dc.tar.gz
unit-5d42599e3318aa8f68a3cbb4b992985cc75495dc.tar.bz2
Process port refactoring.
- Introduced nxt_runtime_process_port_create(). - Moved nxt_process_use() into nxt_process.c from nxt_runtime.c. - Renamed nxt_runtime_process_remove_pid() as nxt_runtime_process_remove(). - Some public functions transformed to static. This closes #327 issue on GitHub.
Diffstat (limited to '')
-rw-r--r--src/nxt_main_process.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c
index b86fb1c1..cfe0341f 100644
--- a/src/nxt_main_process.c
+++ b/src/nxt_main_process.c
@@ -397,31 +397,19 @@ nxt_main_process_port_create(nxt_task_t *task, nxt_runtime_t *rt)
nxt_port_t *port;
nxt_process_t *process;
- process = nxt_runtime_process_get(rt, nxt_pid);
- if (nxt_slow_path(process == NULL)) {
- return NXT_ERROR;
- }
-
- port = nxt_port_new(task, 0, nxt_pid, NXT_PROCESS_MAIN);
+ port = nxt_runtime_process_port_create(task, rt, nxt_pid, 0,
+ NXT_PROCESS_MAIN);
if (nxt_slow_path(port == NULL)) {
- nxt_process_use(task, process, -1);
return NXT_ERROR;
}
- nxt_process_port_add(task, process, port);
-
- nxt_process_use(task, process, -1);
+ process = port->process;
ret = nxt_port_socket_init(task, port, 0);
if (nxt_slow_path(ret != NXT_OK)) {
- nxt_port_use(task, port, -1);
return ret;
}
- nxt_runtime_port_add(task, port);
-
- nxt_port_use(task, port, -1);
-
/*
* A main process port. A write port is not closed
* since it should be inherited by worker processes.