diff src/event/modules/ngx_kqueue_module.c @ 4:4b2dafa26fe2 NGINX_0_1_2

nginx 0.1.2 *) Feature: the --user=USER, --group=GROUP, and --with-ld-opt=OPTIONS options in configure. *) Feature: the server_name directive supports *.domain.tld. *) Bugfix: the portability improvements. *) Bugfix: if configuration file was set in command line, the reconfiguration was impossible; bug appeared in 0.1.1. *) Bugfix: proxy module may get caught in an endless loop when sendfile is not used. *) Bugfix: with sendfile the response was not recoded according to the charset module directives; bug appeared in 0.1.1. *) Bugfix: very seldom bug in the kqueue processing. *) Bugfix: the gzip module compressed the proxied responses that was already compressed.
author Igor Sysoev <http://sysoev.ru>
date Thu, 21 Oct 2004 00:00:00 +0400
parents f0b350454894
children 46833bd150cb
line wrap: on
line diff
--- a/src/event/modules/ngx_kqueue_module.c
+++ b/src/event/modules/ngx_kqueue_module.c
@@ -194,10 +194,10 @@ static ngx_int_t ngx_kqueue_init(ngx_cyc
 #else
                      |NGX_USE_LEVEL_EVENT
 #endif
-#if (HAVE_LOWAT_EVENT)
-                     |NGX_HAVE_LOWAT_EVENT
+#if (NGX_HAVE_LOWAT_EVENT)
+                     |NGX_USE_LOWAT_EVENT
 #endif
-                     |NGX_HAVE_KQUEUE_EVENT;
+                     |NGX_USE_KQUEUE_EVENT;
 
     return NGX_OK;
 }
@@ -245,6 +245,8 @@ static ngx_int_t ngx_kqueue_add_event(ng
         return NGX_ERROR;
     }
 
+#if 1
+
     if (nchanges > 0
         && ev->index < (u_int) nchanges
         && ((uintptr_t) change_list[ev->index].udata & (uintptr_t) ~1)
@@ -262,7 +264,8 @@ static ngx_int_t ngx_kqueue_add_event(ng
                            ngx_event_ident(ev->data), event);
 
             if (ev->index < (u_int) --nchanges) {
-                e = (ngx_event_t *) change_list[nchanges].udata;
+                e = (ngx_event_t *)
+                    ((uintptr_t) change_list[nchanges].udata & (uintptr_t) ~1);
                 change_list[ev->index] = change_list[nchanges];
                 e->index = ev->index;
             }
@@ -282,6 +285,8 @@ static ngx_int_t ngx_kqueue_add_event(ng
         return NGX_ERROR;
     }
 
+#endif
+
     rc = ngx_kqueue_set_event(ev, event, EV_ADD|EV_ENABLE|flags);
 
     ngx_mutex_unlock(list_mutex);
@@ -302,6 +307,8 @@ static ngx_int_t ngx_kqueue_del_event(ng
         return NGX_ERROR;
     }
 
+#if 1
+
     if (nchanges > 0
         && ev->index < (u_int) nchanges
         && ((uintptr_t) change_list[ev->index].udata & (uintptr_t) ~1)
@@ -314,7 +321,8 @@ static ngx_int_t ngx_kqueue_del_event(ng
         /* if the event is still not passed to a kernel we will not pass it */
 
         if (ev->index < (u_int) --nchanges) {
-            e = (ngx_event_t *) change_list[nchanges].udata;
+            e = (ngx_event_t *)
+                    ((uintptr_t) change_list[nchanges].udata & (uintptr_t) ~1);
             change_list[ev->index] = change_list[nchanges];
             e->index = ev->index;
         }
@@ -324,6 +332,8 @@ static ngx_int_t ngx_kqueue_del_event(ng
         return NGX_OK;
     }
 
+#endif
+
     /*
      * when the file descriptor is closed the kqueue automatically deletes
      * its filters so we do not need to delete explicity the event
@@ -393,7 +403,7 @@ static ngx_int_t ngx_kqueue_set_event(ng
         kev->data = 0;
 
     } else {
-#if (HAVE_LOWAT_EVENT)
+#if (NGX_HAVE_LOWAT_EVENT)
         if (flags & NGX_LOWAT_EVENT) {
             kev->fflags = NOTE_LOWAT;
             kev->data = ev->available;