summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_unit.c
diff options
context:
space:
mode:
authorTiago Natel de Moura <t.nateldemoura@f5.com>2021-11-09 15:48:44 +0300
committerTiago Natel de Moura <t.nateldemoura@f5.com>2021-11-09 15:48:44 +0300
commite207415a78ae67b937faf7e5bcd6e5192993180a (patch)
tree8f26521322b194af7c22134ebd8fdc393e649718 /src/nxt_unit.c
parent1de660b6df93c09719361e364211c7c6388c01ce (diff)
downloadunit-e207415a78ae67b937faf7e5bcd6e5192993180a.tar.gz
unit-e207415a78ae67b937faf7e5bcd6e5192993180a.tar.bz2
Introducing application prototype processes.
Diffstat (limited to 'src/nxt_unit.c')
-rw-r--r--src/nxt_unit.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nxt_unit.c b/src/nxt_unit.c
index a29c3fb9..06ad1636 100644
--- a/src/nxt_unit.c
+++ b/src/nxt_unit.c
@@ -418,6 +418,9 @@ typedef struct {
} nxt_unit_port_hash_id_t;
+static pid_t nxt_unit_pid;
+
+
nxt_unit_ctx_t *
nxt_unit_init(nxt_unit_init_t *init)
{
@@ -428,6 +431,8 @@ nxt_unit_init(nxt_unit_init_t *init)
nxt_unit_impl_t *lib;
nxt_unit_port_t ready_port, router_port, read_port;
+ nxt_unit_pid = getpid();
+
lib = nxt_unit_create(init);
if (nxt_slow_path(lib == NULL)) {
return NULL;
@@ -471,6 +476,7 @@ nxt_unit_init(nxt_unit_init_t *init)
}
lib->pid = read_port.id.pid;
+ nxt_unit_pid = lib->pid;
ctx = &lib->main_ctx.ctx;
@@ -6571,7 +6577,7 @@ nxt_unit_log(nxt_unit_ctx_t *ctx, int level, const char *fmt, ...)
log_fd = lib->log_fd;
} else {
- pid = getpid();
+ pid = nxt_unit_pid;
log_fd = STDERR_FILENO;
}
@@ -6615,7 +6621,7 @@ nxt_unit_req_log(nxt_unit_request_info_t *req, int level, const char *fmt, ...)
log_fd = lib->log_fd;
} else {
- pid = getpid();
+ pid = nxt_unit_pid;
log_fd = STDERR_FILENO;
}