summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_process.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-06-23 19:19:41 +0300
committerMax Romanov <max.romanov@nginx.com>2017-06-23 19:19:41 +0300
commitac43bfcc72b3a92abc8d935dce8306b05b8c8185 (patch)
tree7512aa8f4a1602a7da81518e31b4349ca49faecf /src/nxt_process.c
parente5fe254e1e741f24d53f5199cc4f187efd6a9924 (diff)
downloadunit-ac43bfcc72b3a92abc8d935dce8306b05b8c8185.tar.gz
unit-ac43bfcc72b3a92abc8d935dce8306b05b8c8185.tar.bz2
nxt_process_create() changed to add process to runtime before callbacks.
Diffstat (limited to '')
-rw-r--r--src/nxt_process.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/nxt_process.c b/src/nxt_process.c
index b8414b93..ce16cf7f 100644
--- a/src/nxt_process.c
+++ b/src/nxt_process.c
@@ -20,9 +20,12 @@ nxt_pid_t nxt_ppid;
nxt_pid_t
-nxt_process_create(nxt_task_t *task, nxt_process_init_t *process)
+nxt_process_create(nxt_task_t *task, nxt_process_t *process)
{
- nxt_pid_t pid;
+ nxt_pid_t pid;
+ nxt_runtime_t *rt;
+
+ rt = task->thread->runtime;
pid = fork();
@@ -30,7 +33,7 @@ nxt_process_create(nxt_task_t *task, nxt_process_init_t *process)
case -1:
nxt_log(task, NXT_LOG_CRIT, "fork() failed while creating \"%s\" %E",
- process->name, nxt_errno);
+ process->init->name, nxt_errno);
break;
case 0:
@@ -40,12 +43,23 @@ nxt_process_create(nxt_task_t *task, nxt_process_init_t *process)
/* Clean inherited cached thread tid. */
task->thread->tid = 0;
- nxt_process_start(task, process);
+ process->pid = nxt_pid;
+ process->init->port->pid = nxt_pid;
+
+ nxt_runtime_process_add(rt, process);
+
+ nxt_process_start(task, process->init);
break;
default:
/* A parent. */
- nxt_debug(task, "fork(\"%s\"): %PI", process->name, pid);
+ nxt_debug(task, "fork(\"%s\"): %PI", process->init->name, pid);
+
+ process->pid = pid;
+ process->init->port->pid = pid;
+
+ nxt_runtime_process_add(rt, process);
+
break;
}