Welcome! Log In Create A New Profile

Advanced

[nginx] Removed "ch" argument from ngx_pass_open_channel().

March 11, 2021 02:22AM
details: https://hg.nginx.org/nginx/rev/0215ec9aaa8a
branches:
changeset: 7802:0215ec9aaa8a
user: Ruslan Ermilov <ru@nginx.com>
date: Thu Mar 11 09:58:45 2021 +0300
description:
Removed "ch" argument from ngx_pass_open_channel().

diffstat:

src/os/unix/ngx_process_cycle.c | 59 +++++++++++++---------------------------
1 files changed, 19 insertions(+), 40 deletions(-)

diffs (130 lines):

diff -r 777373b5a169 -r 0215ec9aaa8a src/os/unix/ngx_process_cycle.c
--- a/src/os/unix/ngx_process_cycle.c Thu Mar 11 04:46:26 2021 +0300
+++ b/src/os/unix/ngx_process_cycle.c Thu Mar 11 09:58:45 2021 +0300
@@ -15,7 +15,7 @@ static void ngx_start_worker_processes(n
ngx_int_t type);
static void ngx_start_cache_manager_processes(ngx_cycle_t *cycle,
ngx_uint_t respawn);
-static void ngx_pass_open_channel(ngx_cycle_t *cycle, ngx_channel_t *ch);
+static void ngx_pass_open_channel(ngx_cycle_t *cycle);
static void ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo);
static ngx_uint_t ngx_reap_children(ngx_cycle_t *cycle);
static void ngx_master_process_exit(ngx_cycle_t *cycle);
@@ -335,25 +335,16 @@ ngx_single_process_cycle(ngx_cycle_t *cy
static void
ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n, ngx_int_t type)
{
- ngx_int_t i;
- ngx_channel_t ch;
+ ngx_int_t i;

ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "start worker processes");

- ngx_memzero(&ch, sizeof(ngx_channel_t));
-
- ch.command = NGX_CMD_OPEN_CHANNEL;
-
for (i = 0; i < n; i++) {

ngx_spawn_process(cycle, ngx_worker_process_cycle,
(void *) (intptr_t) i, "worker process", type);

- ch.pid = ngx_processes[ngx_process_slot].pid;
- ch.slot = ngx_process_slot;
- ch.fd = ngx_processes[ngx_process_slot].channel[0];
-
- ngx_pass_open_channel(cycle, &ch);
+ ngx_pass_open_channel(cycle);
}
}

@@ -361,9 +352,8 @@ ngx_start_worker_processes(ngx_cycle_t *
static void
ngx_start_cache_manager_processes(ngx_cycle_t *cycle, ngx_uint_t respawn)
{
- ngx_uint_t i, manager, loader;
- ngx_path_t **path;
- ngx_channel_t ch;
+ ngx_uint_t i, manager, loader;
+ ngx_path_t **path;

manager = 0;
loader = 0;
@@ -388,14 +378,7 @@ ngx_start_cache_manager_processes(ngx_cy
&ngx_cache_manager_ctx, "cache manager process",
respawn ? NGX_PROCESS_JUST_RESPAWN : NGX_PROCESS_RESPAWN);

- ngx_memzero(&ch, sizeof(ngx_channel_t));
-
- ch.command = NGX_CMD_OPEN_CHANNEL;
- ch.pid = ngx_processes[ngx_process_slot].pid;
- ch.slot = ngx_process_slot;
- ch.fd = ngx_processes[ngx_process_slot].channel[0];
-
- ngx_pass_open_channel(cycle, &ch);
+ ngx_pass_open_channel(cycle);

if (loader == 0) {
return;
@@ -405,20 +388,21 @@ ngx_start_cache_manager_processes(ngx_cy
&ngx_cache_loader_ctx, "cache loader process",
respawn ? NGX_PROCESS_JUST_SPAWN : NGX_PROCESS_NORESPAWN);

+ ngx_pass_open_channel(cycle);
+}
+
+
+static void
+ngx_pass_open_channel(ngx_cycle_t *cycle)
+{
+ ngx_int_t i;
+ ngx_channel_t ch;
+
ch.command = NGX_CMD_OPEN_CHANNEL;
ch.pid = ngx_processes[ngx_process_slot].pid;
ch.slot = ngx_process_slot;
ch.fd = ngx_processes[ngx_process_slot].channel[0];

- ngx_pass_open_channel(cycle, &ch);
-}
-
-
-static void
-ngx_pass_open_channel(ngx_cycle_t *cycle, ngx_channel_t *ch)
-{
- ngx_int_t i;
-
for (i = 0; i < ngx_last_process; i++) {

if (i == ngx_process_slot
@@ -430,14 +414,14 @@ ngx_pass_open_channel(ngx_cycle_t *cycle

ngx_log_debug6(NGX_LOG_DEBUG_CORE, cycle->log, 0,
"pass channel s:%i pid:%P fd:%d to s:%i pid:%P fd:%d",
- ch->slot, ch->pid, ch->fd,
+ ch.slot, ch.pid, ch.fd,
i, ngx_processes[i].pid,
ngx_processes[i].channel[0]);

/* TODO: NGX_AGAIN */

ngx_write_channel(ngx_processes[i].channel[0],
- ch, sizeof(ngx_channel_t), cycle->log);
+ &ch, sizeof(ngx_channel_t), cycle->log);
}
}

@@ -621,12 +605,7 @@ ngx_reap_children(ngx_cycle_t *cycle)
}


- ch.command = NGX_CMD_OPEN_CHANNEL;
- ch.pid = ngx_processes[ngx_process_slot].pid;
- ch.slot = ngx_process_slot;
- ch.fd = ngx_processes[ngx_process_slot].channel[0];
-
- ngx_pass_open_channel(cycle, &ch);
+ ngx_pass_open_channel(cycle);

live = 1;

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Removed "ch" argument from ngx_pass_open_channel().

ru@nginx.com 83 March 11, 2021 02:22AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 57
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready