diff options
author | Igor Sysoev <igor@sysoev.ru> | 2005-09-23 15:02:22 +0400 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2005-09-23 15:02:22 +0400 |
commit | 31eb8c015d58a5b36b9578d4ee6c217e16cb776f (patch) | |
tree | 28ebccc10deba4132e05414aac1874d5013fdf58 /src/core | |
parent | f44a1f5f579e19441db2d477a7c81d8894ba2262 (diff) |
nginx-0.2.0-RELEASE importrelease-0.2.0
*) The pid-file names used during online upgrade was changed and now is
not required a manual rename operation. The old master process adds
the ".oldbin" suffix to its pid-file and executes a new binary file.
The new master process creates usual pid-file without the ".newbin"
suffix. If the master process exits, then old master process renames
back its pid-file with the ".oldbin" suffix to the pid-file without
suffix.
*) Change: the "worker_connections" directive, new name of the
"connections" directive; now the directive specifies maximum number
of connections, but not maximum socket descriptor number.
*) Feature: SSL supports the session cache inside one worker process.
*) Feature: the "satisfy_any" directive.
*) Change: the ngx_http_access_module and ngx_http_auth_basic_module do
not run for subrequests.
*) Feature: the "worker_rlimit_nofile" and "worker_rlimit_sigpending"
directives.
*) Bugfix: if all backend using in load-balancing failed after one
error, then nginx did not try do connect to them during 60 seconds.
*) Bugfix: in IMAP/POP3 command argument parsing.
Thanks to Rob Mueller.
*) Bugfix: errors while using SSL in IMAP/POP3 proxy.
*) Bugfix: errors while using SSI and gzipping.
*) Bugfix: the "Expires" and "Cache-Control" header lines were omitted
from the 304 responses.
Thanks to Alexandr Kukushkin.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/nginx.c | 106 | ||||
-rw-r--r-- | src/core/nginx.h | 4 | ||||
-rw-r--r-- | src/core/ngx_conf_file.c | 23 | ||||
-rw-r--r-- | src/core/ngx_connection.c | 96 | ||||
-rw-r--r-- | src/core/ngx_connection.h | 94 | ||||
-rw-r--r-- | src/core/ngx_cycle.c | 18 | ||||
-rw-r--r-- | src/core/ngx_cycle.h | 17 | ||||
-rw-r--r-- | src/core/ngx_log.h | 26 |
8 files changed, 259 insertions, 125 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c index 10db55540..09edae5b8 100644 --- a/src/core/nginx.c +++ b/src/core/nginx.c @@ -42,6 +42,13 @@ static ngx_command_t ngx_core_commands[] = { offsetof(ngx_core_conf_t, master), NULL }, + { ngx_string("pid"), + NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, + ngx_conf_set_str_slot, + 0, + offsetof(ngx_core_conf_t, pid), + NULL }, + { ngx_string("worker_processes"), NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, ngx_conf_set_num_slot, @@ -56,24 +63,6 @@ static ngx_command_t ngx_core_commands[] = { offsetof(ngx_core_conf_t, debug_points), &ngx_debug_points }, -#if (NGX_THREADS) - - { ngx_string("worker_threads"), - NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, - ngx_conf_set_num_slot, - 0, - offsetof(ngx_core_conf_t, worker_threads), - NULL }, - - { ngx_string("thread_stack_size"), - NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, - ngx_conf_set_size_slot, - 0, - offsetof(ngx_core_conf_t, thread_stack_size), - NULL }, - -#endif - { ngx_string("user"), NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE12, ngx_set_user, @@ -88,11 +77,18 @@ static ngx_command_t ngx_core_commands[] = { 0, NULL }, - { ngx_string("pid"), + { ngx_string("worker_rlimit_nofile"), NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, - ngx_conf_set_str_slot, + ngx_conf_set_num_slot, 0, - offsetof(ngx_core_conf_t, pid), + offsetof(ngx_core_conf_t, rlimit_nofile), + NULL }, + + { ngx_string("worker_rlimit_sigpending"), + NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, + ngx_conf_set_num_slot, + 0, + offsetof(ngx_core_conf_t, rlimit_sigpending), NULL }, { ngx_string("working_directory"), @@ -102,6 +98,24 @@ static ngx_command_t ngx_core_commands[] = { offsetof(ngx_core_conf_t, working_directory), NULL }, +#if (NGX_THREADS) + + { ngx_string("worker_threads"), + NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, + ngx_conf_set_num_slot, + 0, + offsetof(ngx_core_conf_t, worker_threads), + NULL }, + + { ngx_string("thread_stack_size"), + NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, + ngx_conf_set_size_slot, + 0, + offsetof(ngx_core_conf_t, thread_stack_size), + NULL }, + +#endif + ngx_null_command }; @@ -324,13 +338,15 @@ ngx_add_inherited_sockets(ngx_cycle_t *cycle) } -ngx_pid_t ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv) +ngx_pid_t +ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv) { char *env[3], *var; u_char *p; ngx_uint_t i; ngx_pid_t pid; ngx_exec_ctx_t ctx; + ngx_core_conf_t *ccf; ngx_listening_t *ls; ctx.path = argv[0]; @@ -374,15 +390,42 @@ ngx_pid_t ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv) ctx.envp = (char *const *) &env; + ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); + + if (ngx_rename_file((char *) ccf->pid.data, (char *) ccf->oldpid.data) + != NGX_OK) + { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, + ngx_rename_file_n " %s to %s failed " + "before executing new binary process \"%s\"", + ccf->pid.data, ccf->oldpid.data, argv[0]); + + ngx_free(var); + + return NGX_INVALID_PID; + } + pid = ngx_execute(cycle, &ctx); + if (pid == NGX_INVALID_PID) { + if (ngx_rename_file((char *) ccf->oldpid.data, (char *) ccf->pid.data) + != NGX_OK) + { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, + ngx_rename_file_n " %s back to %s failed " + "after try to executing new binary process \"%s\"", + ccf->oldpid.data, ccf->pid.data, argv[0]); + } + } + ngx_free(var); return pid; } -static ngx_int_t ngx_getopt(ngx_cycle_t *cycle, int argc, char *const *argv) +static ngx_int_t +ngx_getopt(ngx_cycle_t *cycle, int argc, char *const *argv) { ngx_int_t i; @@ -485,7 +528,7 @@ ngx_core_module_create_conf(ngx_cycle_t *cycle) * set by pcalloc() * * ccf->pid = NULL; - * ccf->newpid = NULL; + * ccf->oldpid = NULL; * ccf->priority = 0; */ @@ -493,8 +536,13 @@ ngx_core_module_create_conf(ngx_cycle_t *cycle) ccf->master = NGX_CONF_UNSET; ccf->worker_processes = NGX_CONF_UNSET; ccf->debug_points = NGX_CONF_UNSET; + + ccf->rlimit_nofile = NGX_CONF_UNSET; + ccf->rlimit_sigpending = NGX_CONF_UNSET; + ccf->user = (ngx_uid_t) NGX_CONF_UNSET_UINT; ccf->group = (ngx_gid_t) NGX_CONF_UNSET_UINT; + #if (NGX_THREADS) ccf->worker_threads = NGX_CONF_UNSET; ccf->thread_stack_size = NGX_CONF_UNSET_SIZE; @@ -558,15 +606,15 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf) return NGX_CONF_ERROR; } - ccf->newpid.len = ccf->pid.len + sizeof(NGX_NEWPID_EXT); + ccf->oldpid.len = ccf->pid.len + sizeof(NGX_OLDPID_EXT); - ccf->newpid.data = ngx_palloc(cycle->pool, ccf->newpid.len); - if (ccf->newpid.data == NULL) { + ccf->oldpid.data = ngx_palloc(cycle->pool, ccf->oldpid.len); + if (ccf->oldpid.data == NULL) { return NGX_CONF_ERROR; } - ngx_memcpy(ngx_cpymem(ccf->newpid.data, ccf->pid.data, ccf->pid.len), - NGX_NEWPID_EXT, sizeof(NGX_NEWPID_EXT)); + ngx_memcpy(ngx_cpymem(ccf->oldpid.data, ccf->pid.data, ccf->pid.len), + NGX_OLDPID_EXT, sizeof(NGX_OLDPID_EXT)); #endif diff --git a/src/core/nginx.h b/src/core/nginx.h index 904c2ea38..22927b3c2 100644 --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -8,10 +8,10 @@ #define _NGINX_H_INCLUDED_ -#define NGINX_VER "nginx/0.1.45" +#define NGINX_VER "nginx/0.2.0" #define NGINX_VAR "NGINX" -#define NGX_NEWPID_EXT ".newbin" +#define NGX_OLDPID_EXT ".oldbin" #endif /* _NGINX_H_INCLUDED_ */ diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c index a536bd69d..110c9e2b7 100644 --- a/src/core/ngx_conf_file.c +++ b/src/core/ngx_conf_file.c @@ -62,6 +62,7 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename) char *rv; ngx_fd_t fd; ngx_int_t rc; + ngx_uint_t block; ngx_conf_file_t *prev; #if (NGX_SUPPRESS_WARN) @@ -103,13 +104,20 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename) cf->conf_file->file.offset = 0; cf->conf_file->file.log = cf->log;; cf->conf_file->line = 1; + + block = 0; + + } else { + block = 1; } + for ( ;; ) { rc = ngx_conf_read_token(cf); /* * ngx_conf_read_token() may return + * * NGX_ERROR there is error * NGX_OK the token terminated by ";" was found * NGX_CONF_BLOCK_START the token terminated by "{" was found @@ -121,6 +129,19 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename) break; } + if (rc == NGX_CONF_BLOCK_DONE) { + block = 0; + } + + if (rc == NGX_CONF_FILE_DONE && block) { + ngx_log_error(NGX_LOG_EMERG, cf->log, 0, + "unexpected end of file in %s:%ui, expecting \"}\"", + cf->conf_file->file.name.data, + cf->conf_file->line); + rc = NGX_ERROR; + break; + } + if (rc != NGX_OK && rc != NGX_CONF_BLOCK_START) { break; } @@ -639,7 +660,7 @@ ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name) name->len = cycle->root.len + old.len; - if (cycle->connections) { + if (cycle->connections0) { name->data = ngx_palloc(cycle->pool, name->len + 1); if (name->data == NULL) { return NGX_ERROR; diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c index c423c05ee..a7371bf89 100644 --- a/src/core/ngx_connection.c +++ b/src/core/ngx_connection.c @@ -237,13 +237,14 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle) } #if (NGX_WIN32) + /* * Winsock assignes a socket number divisible by 4 * so to find a connection we divide a socket number by 4. */ if (s % 4) { - ngx_log_error(NGX_LOG_EMERG, ls->log, 0, + ngx_log_error(NGX_LOG_EMERG, log, 0, ngx_socket_n " created socket %d", s); return NGX_ERROR; } @@ -329,9 +330,9 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle) void ngx_close_listening_sockets(ngx_cycle_t *cycle) { - ngx_uint_t i; - ngx_socket_t fd; - ngx_listening_t *ls; + ngx_uint_t i; + ngx_listening_t *ls; + ngx_connection_t *c; if (ngx_event_flags & NGX_USE_IOCP_EVENT) { return; @@ -342,35 +343,87 @@ ngx_close_listening_sockets(ngx_cycle_t *cycle) ls = cycle->listening.elts; for (i = 0; i < cycle->listening.nelts; i++) { - fd = ls[i].fd; -#if (NGX_WIN32) - /* - * Winsock assignes a socket number divisible by 4 - * so to find a connection we divide a socket number by 4. - */ - - fd /= 4; -#endif + c = ls[i].connection; if (ngx_event_flags & NGX_USE_RTSIG_EVENT) { - if (cycle->connections[fd].read->active) { - ngx_del_conn(&cycle->connections[fd], NGX_CLOSE_EVENT); + if (c->read->active) { + ngx_del_conn(c, NGX_CLOSE_EVENT); } } else { - if (cycle->read_events[fd].active) { - ngx_del_event(&cycle->read_events[fd], - NGX_READ_EVENT, NGX_CLOSE_EVENT); + if (c->read->active) { + ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT); } } - if (ngx_close_socket(fd) == -1) { + ngx_free_connection(c); + + c->fd = (ngx_socket_t) -1; + + if (ngx_close_socket(ls[i].fd) == -1) { ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno, ngx_close_socket_n " %V failed", &ls[i].addr_text); } + } +} + + +ngx_connection_t * +ngx_get_connection(ngx_socket_t s, ngx_log_t *log) +{ + ngx_connection_t *c; + + /* disable warning: Win32 SOCKET is u_int while UNIX socket is int */ + + if (ngx_cycle->files && (ngx_uint_t) s >= ngx_cycle->files_n) { + ngx_log_error(NGX_LOG_ALERT, log, 0, + "the new socket has number %d, " + "but only %ui files are available", + s, ngx_cycle->files_n); + return NULL; + } + + /* ngx_mutex_lock */ + + c = ngx_cycle->free_connections; - cycle->connections[fd].fd = (ngx_socket_t) -1; + if (c == NULL) { + ngx_log_error(NGX_LOG_ALERT, log, 0, + "%ui worker_connections is not enough", + ngx_cycle->connection_n); + + /* ngx_mutex_unlock */ + + return NULL; + } + + ngx_cycle->free_connections = c->data; + ngx_cycle->free_connection_n--; + + /* ngx_mutex_unlock */ + + if (ngx_cycle->files) { + ngx_cycle->files[s] = c; + } + + return c; +} + + +void +ngx_free_connection(ngx_connection_t *c) +{ + /* ngx_mutex_lock */ + + c->data = ngx_cycle->free_connections; + ngx_cycle->free_connections = c; + ngx_cycle->free_connection_n++; + + /* ngx_mutex_unlock */ + + if (ngx_cycle->files) { + ngx_cycle->files[c->fd] = NULL; } } @@ -451,9 +504,10 @@ ngx_close_connection(ngx_connection_t *c) #endif + ngx_free_connection(c); + fd = c->fd; c->fd = (ngx_socket_t) -1; - c->data = NULL; if (ngx_close_socket(fd) == -1) { diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h index 3c280bded..e13f2857f 100644 --- a/src/core/ngx_connection.h +++ b/src/core/ngx_connection.h @@ -12,54 +12,60 @@ #include <ngx_core.h> -typedef struct { - ngx_socket_t fd; - - struct sockaddr *sockaddr; - socklen_t socklen; /* size of sockaddr */ - size_t addr; /* offset to address in sockaddr */ - size_t addr_text_max_len; - ngx_str_t addr_text; - - int family; - int type; - - void (*handler)(ngx_connection_t *c); /* handler of accepted - connection */ - void *ctx; /* ngx_http_conf_ctx_t, for example */ - void *servers; /* array of ngx_http_in_addr_t, for example */ - - ngx_log_t *log; - int backlog; - - size_t pool_size; - size_t post_accept_buffer_size; /* should be here because - of the AcceptEx() preread */ - time_t post_accept_timeout; /* should be here because - of the deferred accept */ - - unsigned open:1; - unsigned remain:1; - unsigned ignore:1; - - unsigned bound:1; /* already bound */ - unsigned inherited:1; /* inherited from previous process */ - unsigned nonblocking_accept:1; - unsigned change_backlog:1; - unsigned nonblocking:1; - unsigned shared:1; /* shared between threads or processes */ - unsigned addr_ntop:1; +typedef struct ngx_listening_s ngx_listening_t; + +struct ngx_listening_s { + ngx_socket_t fd; + + struct sockaddr *sockaddr; + socklen_t socklen; /* size of sockaddr */ + size_t addr; /* offset to address in sockaddr */ + size_t addr_text_max_len; + ngx_str_t addr_text; + + int family; + int type; + int backlog; + + /* handler of accepted connection */ + void (*handler)(ngx_connection_t *c); + + void *ctx; /* ngx_http_conf_ctx_t, for example */ + void *servers; /* array of ngx_http_in_addr_t, for example */ + + ngx_log_t log; + + size_t pool_size; + /* should be here because of the AcceptEx() preread */ + size_t post_accept_buffer_size; + /* should be here because of the deferred accept */ + time_t post_accept_timeout; + + ngx_listening_t *previous; + ngx_connection_t *connection; + + unsigned open:1; + unsigned remain:1; + unsigned ignore:1; + + unsigned bound:1; /* already bound */ + unsigned inherited:1; /* inherited from previous process */ + unsigned nonblocking_accept:1; + unsigned change_backlog:1; + unsigned nonblocking:1; + unsigned shared:1; /* shared between threads or processes */ + unsigned addr_ntop:1; #if (NGX_HAVE_DEFERRED_ACCEPT) - unsigned deferred_accept:1; - unsigned delete_deferred:1; - unsigned add_deferred:1; + unsigned deferred_accept:1; + unsigned delete_deferred:1; + unsigned add_deferred:1; #ifdef SO_ACCEPTFILTER - char *accept_filter; + char *accept_filter; #endif #endif -} ngx_listening_t; +}; typedef enum { @@ -160,8 +166,8 @@ void ngx_close_listening_sockets(ngx_cycle_t *cycle); void ngx_close_connection(ngx_connection_t *c); ngx_int_t ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text); - -extern ngx_os_io_t ngx_io; +ngx_connection_t *ngx_get_connection(ngx_socket_t s, ngx_log_t *log); +void ngx_free_connection(ngx_connection_t *c); #endif /* _NGX_CONNECTION_H_INCLUDED_ */ diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c index 2c7823557..839843f2b 100644 --- a/src/core/ngx_cycle.c +++ b/src/core/ngx_cycle.c @@ -336,7 +336,7 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle) } nls[n].fd = ls[i].fd; - nls[n].remain = 1; + nls[n].previous = &ls[i]; ls[i].remain = 1; if (ls[n].backlog != nls[i].backlog) { @@ -594,7 +594,7 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle) if (ngx_close_socket(ls[i].fd) == -1) { ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, - ngx_close_socket_n " %V failed", + ngx_close_socket_n " listening socket on %V failed", &ls[i].addr_text); } } @@ -627,7 +627,7 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle) } } - if (old_cycle->connections == NULL) { + if (old_cycle->connections0 == NULL) { /* an old cycle is an init cycle */ ngx_destroy_pool(old_cycle->pool); return cycle; @@ -742,7 +742,8 @@ ngx_int_t ngx_create_pidfile(ngx_cycle_t *cycle, ngx_cycle_t *old_cycle) } ngx_memzero(&file, sizeof(ngx_file_t)); - file.name = (ngx_inherited && getppid() > 1) ? ccf->newpid : ccf->pid; + + file.name = ccf->pid; file.log = cycle->log; trunc = ngx_test_config ? 0: NGX_FILE_TRUNCATE; @@ -786,12 +787,7 @@ void ngx_delete_pidfile(ngx_cycle_t *cycle) ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); - if (ngx_inherited && getppid() > 1) { - name = ccf->newpid.data; - - } else { - name = ccf->pid.data; - } + name = ngx_new_binary ? ccf->oldpid.data : ccf->pid.data; if (ngx_delete_file(name) == NGX_FILE_ERROR) { ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, @@ -963,7 +959,7 @@ static void ngx_clean_old_cycles(ngx_event_t *ev) found = 0; for (n = 0; n < cycle[i]->connection_n; n++) { - if (cycle[i]->connections[n].fd != (ngx_socket_t) -1) { + if (cycle[i]->connections0[n].fd != (ngx_socket_t) -1) { found = 1; ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "live fd:%d", n); diff --git a/src/core/ngx_cycle.h b/src/core/ngx_cycle.h index 6ed753a93..bf1d43092 100644 --- a/src/core/ngx_cycle.h +++ b/src/core/ngx_cycle.h @@ -28,14 +28,20 @@ struct ngx_cycle_s { ngx_log_t *log; ngx_log_t *new_log; + ngx_connection_t **files; + ngx_connection_t *free_connections; + ngx_uint_t free_connection_n; + ngx_array_t listening; ngx_array_t pathes; ngx_list_t open_files; ngx_uint_t connection_n; - ngx_connection_t *connections; - ngx_event_t *read_events; - ngx_event_t *write_events; + ngx_uint_t files_n; + + ngx_connection_t *connections0; + ngx_event_t *read_events0; + ngx_event_t *write_events0; ngx_cycle_t *old_cycle; @@ -51,6 +57,9 @@ typedef struct { ngx_int_t worker_processes; ngx_int_t debug_points; + ngx_int_t rlimit_nofile; + ngx_int_t rlimit_sigpending; + int priority; char *username; @@ -60,7 +69,7 @@ typedef struct { ngx_str_t working_directory; ngx_str_t pid; - ngx_str_t newpid; + ngx_str_t oldpid; #if (NGX_THREADS) ngx_int_t worker_threads; diff --git a/src/core/ngx_log.h b/src/core/ngx_log.h index df0d52517..290ca74e3 100644 --- a/src/core/ngx_log.h +++ b/src/core/ngx_log.h @@ -72,13 +72,13 @@ struct ngx_log_s { #define NGX_HAVE_VARIADIC_MACROS 1 #define ngx_log_error(level, log, args...) \ - if (log->log_level >= level) ngx_log_error_core(level, log, args) + if ((log)->log_level >= level) ngx_log_error_core(level, log, args) void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, const char *fmt, ...); #define ngx_log_debug(level, log, args...) \ - if (log->log_level & level) \ + if ((log)->log_level & level) \ ngx_log_error_core(NGX_LOG_DEBUG, log, args) /*********************************/ @@ -88,13 +88,13 @@ void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, #define NGX_HAVE_VARIADIC_MACROS 1 #define ngx_log_error(level, log, ...) \ - if (log->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__) + if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__) void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, const char *fmt, ...); #define ngx_log_debug(level, log, ...) \ - if (log->log_level & level) \ + if ((log)->log_level & level) \ ngx_log_error_core(NGX_LOG_DEBUG, log, __VA_ARGS__) /*********************************/ @@ -134,43 +134,43 @@ void ngx_cdecl ngx_log_debug_core(ngx_log_t *log, ngx_err_t err, #else /* NO VARIADIC MACROS */ #define ngx_log_debug0(level, log, err, fmt) \ - if (log->log_level & level) \ + if ((log)->log_level & level) \ ngx_log_debug_core(log, err, fmt) #define ngx_log_debug1(level, log, err, fmt, arg1) \ - if (log->log_level & level) \ + if ((log)->log_level & level) \ ngx_log_debug_core(log, err, fmt, arg1) #define ngx_log_debug2(level, log, err, fmt, arg1, arg2) \ - if (log->log_level & level) \ + if ((log)->log_level & level) \ ngx_log_debug_core(log, err, fmt, arg1, arg2) #define ngx_log_debug3(level, log, err, fmt, arg1, arg2, arg3) \ - if (log->log_level & level) \ + if ((log)->log_level & level) \ ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3) #define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4) \ - if (log->log_level & level) \ + if ((log)->log_level & level) \ ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4) #define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5) \ - if (log->log_level & level) \ + if ((log)->log_level & level) \ ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4, arg5) #define ngx_log_debug6(level, log, err, fmt, \ arg1, arg2, arg3, arg4, arg5, arg6) \ - if (log->log_level & level) \ + if ((log)->log_level & level) \ ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6) #define ngx_log_debug7(level, log, err, fmt, \ arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - if (log->log_level & level) \ + if ((log)->log_level & level) \ ngx_log_debug_core(log, err, fmt, \ arg1, arg2, arg3, arg4, arg5, arg6, arg7) #define ngx_log_debug8(level, log, err, fmt, \ arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ - if (log->log_level & level) \ + if ((log)->log_level & level) \ ngx_log_debug_core(log, err, fmt, \ arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) |