From f7b4bdfd892a0b479dc946896435a3ba7f9615dd Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Fri, 12 May 2017 20:32:41 +0300 Subject: 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); --- src/nxt_process.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/nxt_process.h') diff --git a/src/nxt_process.h b/src/nxt_process.h index 92f673a2..b6262106 100644 --- a/src/nxt_process.h +++ b/src/nxt_process.h @@ -49,9 +49,15 @@ struct nxt_process_init_s { typedef struct { + nxt_mem_pool_t *mem_pool; + nxt_pid_t pid; - nxt_array_t *ports; /* of nxt_port_t */ + nxt_queue_t ports; /* of nxt_port_t */ + nxt_port_id_t last_port_id; + nxt_process_init_t *init; + nxt_array_t *incoming; /* of nxt_mmap_t */ + nxt_array_t *outgoing; /* of nxt_mmap_t */ } nxt_process_t; @@ -65,6 +71,22 @@ NXT_EXPORT void nxt_nanosleep(nxt_nsec_t ns); NXT_EXPORT void nxt_process_arguments(nxt_task_t *task, char **orig_argv, char ***orig_envp); +NXT_EXPORT nxt_port_t * nxt_process_port_new(nxt_process_t *process); + +#define nxt_process_port_remove(port) \ + nxt_queue_remove(&port->link) + +#define nxt_process_port_first(process) \ + nxt_queue_link_data(nxt_queue_first(&process->ports), nxt_port_t, link) + +#define nxt_process_port_add(process, port) \ + nxt_queue_insert_tail(&process->ports, &port->link) + +#define nxt_process_port_each(process, port) \ + nxt_queue_each(port, &process->ports, nxt_port_t, link) + +#define nxt_process_port_loop \ + nxt_queue_loop #if (NXT_HAVE_SETPROCTITLE) -- cgit