diff src/os/unix/ngx_process_cycle.c @ 50:72eb30262aac NGINX_0_1_25

nginx 0.1.25 *) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
author Igor Sysoev <http://sysoev.ru>
date Sat, 19 Mar 2005 00:00:00 +0300
parents 7ca9bdc82b3f
children bcb5fce0b038
line wrap: on
line diff
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -11,7 +11,7 @@
 
 
 static void ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n,
-                                       ngx_int_t type);
+    ngx_int_t type);
 static void ngx_start_garbage_collector(ngx_cycle_t *cycle, ngx_int_t type);
 static void ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo);
 static ngx_uint_t ngx_reap_childs(ngx_cycle_t *cycle);
@@ -23,7 +23,9 @@ static void ngx_channel_handler(ngx_even
 static void ngx_wakeup_worker_threads(ngx_cycle_t *cycle);
 static void *ngx_worker_thread_cycle(void *data);
 #endif
+#if 0
 static void ngx_garbage_collector_cycle(ngx_cycle_t *cycle, void *data);
+#endif
 
 
 ngx_uint_t    ngx_process;
@@ -59,7 +61,8 @@ ngx_int_t              ngx_threads_n;
 u_char  master_process[] = "master process";
 
 
-void ngx_master_process_cycle(ngx_cycle_t *cycle)
+void
+ngx_master_process_cycle(ngx_cycle_t *cycle)
 {
     char              *title;
     u_char            *p;
@@ -254,7 +257,8 @@ void ngx_master_process_cycle(ngx_cycle_
 }
 
 
-void ngx_single_process_cycle(ngx_cycle_t *cycle)
+void
+ngx_single_process_cycle(ngx_cycle_t *cycle)
 {
     ngx_uint_t  i;
 
@@ -300,8 +304,8 @@ void ngx_single_process_cycle(ngx_cycle_
 }
 
 
-static void ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n,
-                                       ngx_int_t type)
+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;
@@ -359,12 +363,12 @@ static void ngx_start_worker_processes(n
 }
 
 
-static void ngx_start_garbage_collector(ngx_cycle_t *cycle, ngx_int_t type)
+static void
+ngx_start_garbage_collector(ngx_cycle_t *cycle, ngx_int_t type)
 {
-    ngx_int_t         i;
-    ngx_channel_t     ch;
-
-    return;
+#if 0
+    ngx_int_t      i;
+    ngx_channel_t  ch;
 
     ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "start garbage collector");
 
@@ -397,16 +401,17 @@ static void ngx_start_garbage_collector(
         ngx_write_channel(ngx_processes[i].channel[0],
                           &ch, sizeof(ngx_channel_t), cycle->log);
     }
+#endif
 }
 
 
-static void ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo)
+static void
+ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo)
 {
     ngx_int_t      i;
     ngx_err_t      err;
     ngx_channel_t  ch;
 
-
     switch (signo) {
 
     case ngx_signal_value(NGX_SHUTDOWN_SIGNAL):
@@ -492,7 +497,8 @@ static void ngx_signal_worker_processes(
 }
 
 
-static ngx_uint_t ngx_reap_childs(ngx_cycle_t *cycle)
+static ngx_uint_t
+ngx_reap_childs(ngx_cycle_t *cycle)
 {
     ngx_int_t      i, n;
     ngx_uint_t     live;
@@ -619,7 +625,8 @@ static ngx_uint_t ngx_reap_childs(ngx_cy
 }
 
 
-static void ngx_master_exit(ngx_cycle_t *cycle)
+static void
+ngx_master_exit(ngx_cycle_t *cycle)
 {
     ngx_delete_pidfile(cycle);
 
@@ -631,11 +638,14 @@ static void ngx_master_exit(ngx_cycle_t 
 }
 
 
-static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
+static void
+ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
 {
+#if (NGX_THREADS)
     ngx_int_t          n;
     ngx_err_t          err;
     ngx_core_conf_t   *ccf;
+#endif
 
     ngx_worker_process_init(cycle, 1);
 
@@ -668,7 +678,9 @@ static void ngx_worker_process_cycle(ngx
 
         for (n = 0; n < ngx_threads_n; n++) {
 
-            if (!(ngx_threads[n].cv = ngx_cond_init(cycle->log))) {
+            ngx_threads[n].cv = ngx_cond_init(cycle->log);
+
+            if (ngx_threads[n].cv == NULL) {
                 /* fatal */
                 exit(2);
             }
@@ -748,7 +760,8 @@ static void ngx_worker_process_cycle(ngx
 }
 
 
-static void ngx_worker_process_init(ngx_cycle_t *cycle, ngx_uint_t priority)
+static void
+ngx_worker_process_init(ngx_cycle_t *cycle, ngx_uint_t priority)
 {
     sigset_t           set;
     ngx_int_t          n;
@@ -873,7 +886,8 @@ static void ngx_worker_process_init(ngx_
 }
 
 
-static void ngx_channel_handler(ngx_event_t *ev)
+static void
+ngx_channel_handler(ngx_event_t *ev)
 {
     ngx_int_t          n;
     ngx_channel_t      ch;
@@ -952,7 +966,8 @@ static void ngx_channel_handler(ngx_even
 
 #if (NGX_THREADS)
 
-static void ngx_wakeup_worker_threads(ngx_cycle_t *cycle)
+static void
+ngx_wakeup_worker_threads(ngx_cycle_t *cycle)
 {
     ngx_int_t   i;
     ngx_uint_t  live;
@@ -994,7 +1009,8 @@ static void ngx_wakeup_worker_threads(ng
 }
 
 
-static void *ngx_worker_thread_cycle(void *data)
+static void *
+ngx_worker_thread_cycle(void *data)
 {
     ngx_thread_t  *thr = data;
 
@@ -1022,7 +1038,8 @@ static void *ngx_worker_thread_cycle(voi
 
     ngx_setthrtitle("worker thread");
 
-    if (!(tls = ngx_calloc(sizeof(ngx_core_tls_t), cycle->log))) {
+    tls = ngx_calloc(sizeof(ngx_core_tls_t), cycle->log);
+    if (tls == NULL) {
         return (void *) 1;
     }
 
@@ -1077,7 +1094,10 @@ static void *ngx_worker_thread_cycle(voi
 #endif
 
 
-static void ngx_garbage_collector_cycle(ngx_cycle_t *cycle, void *data)
+#if 0
+
+static void
+ngx_garbage_collector_cycle(ngx_cycle_t *cycle, void *data)
 {
     ngx_uint_t         i;
     ngx_gc_t           ctx;
@@ -1123,3 +1143,5 @@ static void ngx_garbage_collector_cycle(
         ngx_process_events(cycle);
     }
 }
+
+#endif