diff src/core/nginx.c @ 160:73e8476f9142 NGINX_0_3_27

nginx 0.3.27 *) Change: the "variables_hash_max_size" and "variables_hash_bucket_size" directives. *) Feature: the $body_bytes_sent variable can be used not only in the "log_format" directive. *) Feature: the $ssl_protocol and $ssl_cipher variables. *) Feature: the cache line size detection for widespread CPUs at start time. *) Feature: now the "accept_mutex" directive is supported using fcntl(2) on platforms different from i386, amd64, sparc64, and ppc. *) Feature: the "lock_file" directive and the --with-lock-path=PATH autoconfiguration directive. *) Bugfix: if the HTTPS protocol was used in the "proxy_pass" directive then the requests with the body was not transferred.
author Igor Sysoev <http://sysoev.ru>
date Wed, 08 Feb 2006 00:00:00 +0300
parents 50bd986c5d63
children 13710a1813ad
line wrap: on
line diff
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -58,6 +58,13 @@ static ngx_command_t  ngx_core_commands[
       offsetof(ngx_core_conf_t, pid),
       NULL },
 
+    { ngx_string("lock_file"),
+      NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
+      ngx_conf_set_str_slot,
+      0,
+      offsetof(ngx_core_conf_t, lock_file),
+      NULL },
+
     { ngx_string("worker_processes"),
       NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
       ngx_conf_set_num_slot,
@@ -214,11 +221,11 @@ main(int argc, char *const *argv)
         return 1;
     }
 
-    if (ngx_save_argv(&init_cycle, argc, argv) == NGX_ERROR) {
+    if (ngx_save_argv(&init_cycle, argc, argv) != NGX_OK) {
         return 1;
     }
 
-    if (ngx_getopt(&init_cycle, argc, ngx_argv) == NGX_ERROR) {
+    if (ngx_getopt(&init_cycle, argc, ngx_argv) != NGX_OK) {
         return 1;
     }
 
@@ -226,11 +233,11 @@ main(int argc, char *const *argv)
         log->log_level = NGX_LOG_INFO;
     }
 
-    if (ngx_os_init(log) == NGX_ERROR) {
+    if (ngx_os_init(log) != NGX_OK) {
         return 1;
     }
 
-    if (ngx_add_inherited_sockets(&init_cycle) == NGX_ERROR) {
+    if (ngx_add_inherited_sockets(&init_cycle) != NGX_OK) {
         return 1;
     }
 
@@ -274,7 +281,7 @@ main(int argc, char *const *argv)
     TODO:
 
     if (ccf->run_as_service) {
-        if (ngx_service(cycle->log) == NGX_ERROR) {
+        if (ngx_service(cycle->log) != NGX_OK) {
             return 1;
         }
 
@@ -284,19 +291,19 @@ main(int argc, char *const *argv)
 
 #else
 
-    if (ngx_init_signals(cycle->log) == NGX_ERROR) {
+    if (ngx_init_signals(cycle->log) != NGX_OK) {
         return 1;
     }
 
     if (!ngx_inherited && ccf->daemon) {
-        if (ngx_daemon(cycle->log) == NGX_ERROR) {
+        if (ngx_daemon(cycle->log) != NGX_OK) {
             return 1;
         }
 
         ngx_daemonized = 1;
     }
 
-    if (ngx_create_pidfile(cycle, NULL) == NGX_ERROR) {
+    if (ngx_create_pidfile(&ccf->pid, cycle->log) != NGX_OK) {
         return 1;
     }
 
@@ -666,6 +673,15 @@ ngx_core_module_init_conf(ngx_cycle_t *c
     ngx_memcpy(ngx_cpymem(ccf->oldpid.data, ccf->pid.data, ccf->pid.len),
                NGX_OLDPID_EXT, sizeof(NGX_OLDPID_EXT));
 
+    if (ccf->lock_file.len == 0) {
+        ccf->lock_file.len = sizeof(NGX_LOCK_PATH) - 1;
+        ccf->lock_file.data = (u_char *) NGX_LOCK_PATH;
+    }
+
+    if (ngx_conf_full_name(cycle, &ccf->lock_file) == NGX_ERROR) {
+        return NGX_CONF_ERROR;
+    }
+
 #endif
 
     return NGX_CONF_OK;