summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_process.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-05-12 20:32:41 +0300
committerMax Romanov <max.romanov@nginx.com>2017-05-12 20:32:41 +0300
commitf7b4bdfd892a0b479dc946896435a3ba7f9615dd (patch)
treea6f0c4ebaeed2d9f0fcb1c07178b52a684a53280 /src/nxt_process.c
parent1782c771fab999b37a8c04ed72760e3528205be7 (diff)
downloadunit-f7b4bdfd892a0b479dc946896435a3ba7f9615dd.tar.gz
unit-f7b4bdfd892a0b479dc946896435a3ba7f9615dd.tar.bz2
Using shared memory to send data via nxt_port.
Usage: b = nxt_port_mmap_get_buf(task, port, size); b->mem.free = nxt_cpymem(b->mem.free, data, size); nxt_port_socket_write(task, port, NXT_PORT_MSG_DATA, -1, 0, b);
Diffstat (limited to '')
-rw-r--r--src/nxt_process.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/nxt_process.c b/src/nxt_process.c
index d24be580..64fd1f19 100644
--- a/src/nxt_process.c
+++ b/src/nxt_process.c
@@ -506,3 +506,22 @@ nxt_user_cred_set(nxt_task_t *task, nxt_user_cred_t *uc)
return NXT_OK;
}
+
+
+nxt_port_t *
+nxt_process_port_new(nxt_process_t *process)
+{
+ nxt_port_t *port;
+
+ port = nxt_mem_cache_zalloc0(process->mem_pool, sizeof(nxt_port_t));
+ if (nxt_fast_path(port != NULL)) {
+ port->id = process->last_port_id++;
+ port->pid = process->pid;
+ port->process = process;
+
+ nxt_process_port_add(process, port);
+ }
+
+ return port;
+}
+