From 3a770e25f8cfa4afce9bba6d80810d97b153b407 Mon Sep 17 00:00:00 2001 From: Stephen Crane Date: Mon, 21 Aug 2023 15:17:23 -0700 Subject: [PATCH] nginx: Share more global data --- external/nginx-rtmp-module/ngx_rtmp.c | 6 ++--- external/nginx/src/core/ngx_log.c | 6 ++--- external/nginx/src/core/ngx_times.c | 24 +++++++++---------- external/nginx/src/event/ngx_event.c | 2 +- external/nginx/src/event/ngx_event_timer.c | 6 +++-- .../nginx/src/os/unix/ngx_process_cycle.c | 2 +- 6 files changed, 24 insertions(+), 22 deletions(-) diff --git a/external/nginx-rtmp-module/ngx_rtmp.c b/external/nginx-rtmp-module/ngx_rtmp.c index 31bf10b8ea..364cf04061 100644 --- a/external/nginx-rtmp-module/ngx_rtmp.c +++ b/external/nginx-rtmp-module/ngx_rtmp.c @@ -37,11 +37,11 @@ static ngx_int_t ngx_rtmp_init_process(ngx_cycle_t *cycle); #if (nginx_version >= 1007011) -ngx_queue_t ngx_rtmp_init_queue; +ngx_queue_t ngx_rtmp_init_queue IA2_SHARED_DATA; #elif (nginx_version >= 1007005) -ngx_thread_volatile ngx_queue_t ngx_rtmp_init_queue; +ngx_thread_volatile ngx_queue_t ngx_rtmp_init_queue IA2_SHARED_DATA; #else -ngx_thread_volatile ngx_event_t *ngx_rtmp_init_queue; +ngx_thread_volatile ngx_event_t *ngx_rtmp_init_queue IA2_SHARED_DATA; #endif diff --git a/external/nginx/src/core/ngx_log.c b/external/nginx/src/core/ngx_log.c index ef46b6844f..11fbec9b65 100644 --- a/external/nginx/src/core/ngx_log.c +++ b/external/nginx/src/core/ngx_log.c @@ -68,9 +68,9 @@ ngx_module_t ngx_errlog_module IA2_SHARED_DATA = { }; -static ngx_log_t ngx_log; -static ngx_open_file_t ngx_log_file; -ngx_uint_t ngx_use_stderr = 1; +static ngx_log_t ngx_log IA2_SHARED_DATA; +static ngx_open_file_t ngx_log_file IA2_SHARED_DATA; +ngx_uint_t ngx_use_stderr IA2_SHARED_DATA = 1; static const ngx_str_t err_levels[] = { diff --git a/external/nginx/src/core/ngx_times.c b/external/nginx/src/core/ngx_times.c index 0193c7df6e..701e201a1e 100644 --- a/external/nginx/src/core/ngx_times.c +++ b/external/nginx/src/core/ngx_times.c @@ -27,13 +27,13 @@ static ngx_msec_t ngx_monotonic_time(time_t sec, ngx_uint_t msec); static ngx_uint_t slot; static ngx_atomic_t ngx_time_lock; -volatile ngx_msec_t ngx_current_msec; +volatile ngx_msec_t ngx_current_msec IA2_SHARED_DATA; volatile ngx_time_t *ngx_cached_time IA2_SHARED_DATA; -volatile ngx_str_t ngx_cached_err_log_time; -volatile ngx_str_t ngx_cached_http_time; -volatile ngx_str_t ngx_cached_http_log_time; -volatile ngx_str_t ngx_cached_http_log_iso8601; -volatile ngx_str_t ngx_cached_syslog_time; +volatile ngx_str_t ngx_cached_err_log_time IA2_SHARED_DATA; +volatile ngx_str_t ngx_cached_http_time IA2_SHARED_DATA; +volatile ngx_str_t ngx_cached_http_log_time IA2_SHARED_DATA; +volatile ngx_str_t ngx_cached_http_log_iso8601 IA2_SHARED_DATA; +volatile ngx_str_t ngx_cached_syslog_time IA2_SHARED_DATA; #if !(NGX_WIN32) @@ -46,17 +46,17 @@ volatile ngx_str_t ngx_cached_syslog_time; static ngx_int_t cached_gmtoff; #endif -static ngx_time_t cached_time[NGX_TIME_SLOTS]; +static ngx_time_t cached_time[NGX_TIME_SLOTS] IA2_SHARED_DATA; static u_char cached_err_log_time[NGX_TIME_SLOTS] - [sizeof("1970/09/28 12:00:00")]; + [sizeof("1970/09/28 12:00:00")] IA2_SHARED_DATA; static u_char cached_http_time[NGX_TIME_SLOTS] - [sizeof("Mon, 28 Sep 1970 06:00:00 GMT")]; + [sizeof("Mon, 28 Sep 1970 06:00:00 GMT")] IA2_SHARED_DATA; static u_char cached_http_log_time[NGX_TIME_SLOTS] - [sizeof("28/Sep/1970:12:00:00 +0600")]; + [sizeof("28/Sep/1970:12:00:00 +0600")] IA2_SHARED_DATA; static u_char cached_http_log_iso8601[NGX_TIME_SLOTS] - [sizeof("1970-09-28T12:00:00+06:00")]; + [sizeof("1970-09-28T12:00:00+06:00")] IA2_SHARED_DATA; static u_char cached_syslog_time[NGX_TIME_SLOTS] - [sizeof("Sep 28 12:00:00")]; + [sizeof("Sep 28 12:00:00")] IA2_SHARED_DATA; static char *week[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; diff --git a/external/nginx/src/event/ngx_event.c b/external/nginx/src/event/ngx_event.c index b4ff5de99e..dddf36a140 100644 --- a/external/nginx/src/event/ngx_event.c +++ b/external/nginx/src/event/ngx_event.c @@ -42,7 +42,7 @@ sig_atomic_t ngx_event_timer_alarm; static ngx_uint_t ngx_event_max_module; ngx_uint_t ngx_event_flags; -ngx_event_actions_t ngx_event_actions; +ngx_event_actions_t ngx_event_actions IA2_SHARED_DATA; static ngx_atomic_t connection_counter = 1; diff --git a/external/nginx/src/event/ngx_event_timer.c b/external/nginx/src/event/ngx_event_timer.c index 35052bc294..b80139ef0c 100644 --- a/external/nginx/src/event/ngx_event_timer.c +++ b/external/nginx/src/event/ngx_event_timer.c @@ -9,9 +9,11 @@ #include #include +#include -ngx_rbtree_t ngx_event_timer_rbtree; -static ngx_rbtree_node_t ngx_event_timer_sentinel; + +ngx_rbtree_t ngx_event_timer_rbtree IA2_SHARED_DATA; +static ngx_rbtree_node_t ngx_event_timer_sentinel IA2_SHARED_DATA; /* * the event timer rbtree may contain the duplicate keys, however, diff --git a/external/nginx/src/os/unix/ngx_process_cycle.c b/external/nginx/src/os/unix/ngx_process_cycle.c index e80a69fc55..9a0b1dda9e 100644 --- a/external/nginx/src/os/unix/ngx_process_cycle.c +++ b/external/nginx/src/os/unix/ngx_process_cycle.c @@ -31,7 +31,7 @@ static void ngx_cache_loader_process_handler(ngx_event_t *ev); ngx_uint_t ngx_process IA2_SHARED_DATA; ngx_uint_t ngx_worker; -ngx_pid_t ngx_pid; +ngx_pid_t ngx_pid IA2_SHARED_DATA; ngx_pid_t ngx_parent; sig_atomic_t ngx_reap;