From f8ba5d6c0093090e81819481e523af5fd27ab1e3 Mon Sep 17 00:00:00 2001 From: Tiago Natel de Moura Date: Tue, 23 Jun 2020 12:11:27 +0100 Subject: Isolation: fixed build when features aren't detected. --- src/nxt_process.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/nxt_process.c') diff --git a/src/nxt_process.c b/src/nxt_process.c index c4c44d14..215c529c 100644 --- a/src/nxt_process.c +++ b/src/nxt_process.c @@ -35,17 +35,14 @@ static void nxt_process_created_error(nxt_task_t *task, #if (NXT_HAVE_ISOLATION_ROOTFS) static nxt_int_t nxt_process_chroot(nxt_task_t *task, const char *path); -#endif -#if (NXT_HAVE_PIVOT_ROOT) +#if (NXT_HAVE_PIVOT_ROOT) && (NXT_HAVE_CLONE_NEWNS) static nxt_int_t nxt_process_pivot_root(nxt_task_t *task, const char *rootfs); static nxt_int_t nxt_process_private_mount(nxt_task_t *task, const char *rootfs); -#endif - -#if (NXT_HAVE_PIVOT_ROOT) static int nxt_pivot_root(const char *new_root, const char *old_root); #endif +#endif /* A cached process pid. */ nxt_pid_t nxt_pid; @@ -590,11 +587,6 @@ nxt_process_change_root(nxt_task_t *task, nxt_process_t *process) #endif -#endif - - -#if (NXT_HAVE_ISOLATION_ROOTFS) - static nxt_int_t nxt_process_chroot(nxt_task_t *task, const char *path) { @@ -625,8 +617,6 @@ nxt_process_unmount_all(nxt_task_t *task, nxt_process_t *process) } } -#endif - #if (NXT_HAVE_PIVOT_ROOT) && (NXT_HAVE_CLONE_NEWNS) @@ -856,6 +846,8 @@ nxt_pivot_root(const char *new_root, const char *old_root) #endif +#endif + static nxt_int_t nxt_process_send_ready(nxt_task_t *task, nxt_process_t *process) -- cgit From ec3389b63bd7a9159d2be4a2863140f75095c7d3 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Tue, 11 Aug 2020 19:19:55 +0300 Subject: Libunit refactoring: port management. - Changed the port management callbacks to notifications, which e. g. avoids the need to call the libunit function - Added context and library instance reference counts for a safer resource release - Added the router main port initialization --- src/nxt_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nxt_process.c') diff --git a/src/nxt_process.c b/src/nxt_process.c index 215c529c..5a01c21e 100644 --- a/src/nxt_process.c +++ b/src/nxt_process.c @@ -61,7 +61,7 @@ nxt_bool_t nxt_proc_conn_matrix[NXT_PROCESS_MAX][NXT_PROCESS_MAX] = { { 1, 0, 0, 0, 0 }, { 1, 0, 0, 1, 0 }, { 1, 0, 1, 0, 1 }, - { 1, 0, 0, 0, 0 }, + { 1, 0, 0, 1, 0 }, }; nxt_bool_t nxt_proc_remove_notify_matrix[NXT_PROCESS_MAX][NXT_PROCESS_MAX] = { -- cgit From 3cbc22a6dc45abdeade4deb364601230ddca02c1 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Tue, 11 Aug 2020 19:20:10 +0300 Subject: Changing router to application port exchange protocol. The application process needs to request the port from the router instead of the latter pushing the port before sending a request to the application. This is required to simplify the communication between the router and the application and to prepare the router to use the application shared port and then the queue. --- src/nxt_process.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'src/nxt_process.c') diff --git a/src/nxt_process.c b/src/nxt_process.c index 5a01c21e..0b3aa40f 100644 --- a/src/nxt_process.c +++ b/src/nxt_process.c @@ -1107,43 +1107,6 @@ nxt_process_close_ports(nxt_task_t *task, nxt_process_t *process) } -void -nxt_process_connected_port_add(nxt_process_t *process, nxt_port_t *port) -{ - nxt_thread_mutex_lock(&process->cp_mutex); - - nxt_port_hash_add(&process->connected_ports, port); - - nxt_thread_mutex_unlock(&process->cp_mutex); -} - - -void -nxt_process_connected_port_remove(nxt_process_t *process, nxt_port_t *port) -{ - nxt_thread_mutex_lock(&process->cp_mutex); - - nxt_port_hash_remove(&process->connected_ports, port); - - nxt_thread_mutex_unlock(&process->cp_mutex); -} - - -nxt_port_t * -nxt_process_connected_port_find(nxt_process_t *process, nxt_port_t *port) -{ - nxt_port_t *res; - - nxt_thread_mutex_lock(&process->cp_mutex); - - res = nxt_port_hash_find(&process->connected_ports, port->pid, port->id); - - nxt_thread_mutex_unlock(&process->cp_mutex); - - return res; -} - - void nxt_process_quit(nxt_task_t *task, nxt_uint_t exit_status) { -- cgit From 2f3d27fa22d2e5566dfdeddfb6a1f8c927a5c73d Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Tue, 11 Aug 2020 19:20:17 +0300 Subject: Process structures refactoring in runtime and libunit. Generic process-to-process shared memory exchange is no more required. Here, it is transformed into a router-to-application pattern. The outgoing shared memory segments collection is now the property of the application structure. The applications connect to the router only, and the process only needs to group the ports. --- src/nxt_process.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nxt_process.c') diff --git a/src/nxt_process.c b/src/nxt_process.c index 0b3aa40f..9bfae395 100644 --- a/src/nxt_process.c +++ b/src/nxt_process.c @@ -146,7 +146,6 @@ nxt_process_child_fixup(nxt_task_t *task, nxt_process_t *process) } nxt_port_mmaps_destroy(&p->incoming, 0); - nxt_port_mmaps_destroy(&p->outgoing, 0); } nxt_runtime_process_loop; -- cgit