diff options
Diffstat (limited to '')
-rw-r--r-- | src/nxt_application.c | 2 | ||||
-rw-r--r-- | src/nxt_external.c | 8 | ||||
-rw-r--r-- | src/nxt_process.c | 5 | ||||
-rw-r--r-- | src/nxt_unit.c | 12 |
4 files changed, 17 insertions, 10 deletions
diff --git a/src/nxt_application.c b/src/nxt_application.c index 6935346c..3d08643c 100644 --- a/src/nxt_application.c +++ b/src/nxt_application.c @@ -723,7 +723,7 @@ nxt_unit_default_init(nxt_task_t *task, nxt_unit_init_t *init) init->read_port.id.pid = my_port->pid; init->read_port.id.id = my_port->id; init->read_port.in_fd = my_port->pair[0]; - init->read_port.out_fd = -1; + init->read_port.out_fd = my_port->pair[1]; init->log_fd = 2; diff --git a/src/nxt_external.c b/src/nxt_external.c index 1adb839c..5703e294 100644 --- a/src/nxt_external.c +++ b/src/nxt_external.c @@ -101,18 +101,24 @@ nxt_external_start(nxt_task_t *task, nxt_process_data_t *data) return NXT_ERROR; } + rc = nxt_external_fd_no_cloexec(task, my_port->pair[1]); + if (nxt_slow_path(rc != NXT_OK)) { + return NXT_ERROR; + } + end = buf + sizeof(buf); p = nxt_sprintf(buf, end, "%s;%uD;" "%PI,%ud,%d;" "%PI,%ud,%d;" - "%PI,%ud,%d;" + "%PI,%ud,%d,%d;" "%d,%z,%Z", NXT_VERSION, my_port->process->stream, main_port->pid, main_port->id, main_port->pair[1], router_port->pid, router_port->id, router_port->pair[1], my_port->pid, my_port->id, my_port->pair[0], + my_port->pair[1], 2, conf->shm_limit); if (nxt_slow_path(p == end)) { diff --git a/src/nxt_process.c b/src/nxt_process.c index 9be7974f..87419313 100644 --- a/src/nxt_process.c +++ b/src/nxt_process.c @@ -248,8 +248,6 @@ nxt_process_setup(nxt_task_t *task, nxt_process_t *process) port = nxt_process_port_first(process); - nxt_port_write_close(port); - nxt_port_enable(task, port, init->port_handlers); ret = init->setup(task, process); @@ -272,6 +270,9 @@ nxt_process_setup(nxt_task_t *task, nxt_process_t *process) } ret = init->start(task, &process->data); + + nxt_port_write_close(port); + break; default: diff --git a/src/nxt_unit.c b/src/nxt_unit.c index 7e97c050..23848f5b 100644 --- a/src/nxt_unit.c +++ b/src/nxt_unit.c @@ -780,7 +780,7 @@ nxt_unit_read_env(nxt_unit_port_t *ready_port, nxt_unit_port_t *router_port, uint32_t *shm_limit) { int rc; - int ready_fd, router_fd, read_fd; + int ready_fd, router_fd, read_in_fd, read_out_fd; char *unit_init, *version_end; long version_length; int64_t ready_pid, router_pid, read_pid; @@ -812,15 +812,15 @@ nxt_unit_read_env(nxt_unit_port_t *ready_port, nxt_unit_port_t *router_port, "%"PRIu32";" "%"PRId64",%"PRIu32",%d;" "%"PRId64",%"PRIu32",%d;" - "%"PRId64",%"PRIu32",%d;" + "%"PRId64",%"PRIu32",%d,%d;" "%d,%"PRIu32, &ready_stream, &ready_pid, &ready_id, &ready_fd, &router_pid, &router_id, &router_fd, - &read_pid, &read_id, &read_fd, + &read_pid, &read_id, &read_in_fd, &read_out_fd, log_fd, shm_limit); - if (nxt_slow_path(rc != 12)) { + if (nxt_slow_path(rc != 13)) { nxt_unit_alert(NULL, "failed to scan variables: %d", rc); return NXT_UNIT_ERROR; @@ -840,8 +840,8 @@ nxt_unit_read_env(nxt_unit_port_t *ready_port, nxt_unit_port_t *router_port, nxt_unit_port_id_init(&read_port->id, (pid_t) read_pid, read_id); - read_port->in_fd = read_fd; - read_port->out_fd = -1; + read_port->in_fd = read_in_fd; + read_port->out_fd = read_out_fd; read_port->data = NULL; *stream = ready_stream; |