Skip to content

Commit

Permalink
nginx: Share more global data
Browse files Browse the repository at this point in the history
  • Loading branch information
rinon committed Sep 27, 2023
1 parent 95e1c1e commit 3a770e2
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 22 deletions.
6 changes: 3 additions & 3 deletions external/nginx-rtmp-module/ngx_rtmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
6 changes: 3 additions & 3 deletions external/nginx/src/core/ngx_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down
24 changes: 12 additions & 12 deletions external/nginx/src/core/ngx_times.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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" };
Expand Down
2 changes: 1 addition & 1 deletion external/nginx/src/event/ngx_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions external/nginx/src/event/ngx_event_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
#include <ngx_core.h>
#include <ngx_event.h>

#include <ia2.h>

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,
Expand Down
2 changes: 1 addition & 1 deletion external/nginx/src/os/unix/ngx_process_cycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3a770e2

Please sign in to comment.