diff src/event/modules/ngx_kqueue_module.c @ 59:e8cdc2989cee

nginx-0.0.1-2003-02-06-20:21:13 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 06 Feb 2003 17:21:13 +0000
parents d1e42f1b8fd4
children 50186b49f2ad
line wrap: on
line diff
--- a/src/event/modules/ngx_kqueue_module.c
+++ b/src/event/modules/ngx_kqueue_module.c
@@ -23,7 +23,11 @@
 
 
 /* should be per-thread */
+#if 1
+int              kq;
+#else
 static int              kq;
+#endif
 static struct kevent   *change_list, *event_list;
 static unsigned int     nchanges;
 static int              nevents;
@@ -63,7 +67,12 @@ int ngx_kqueue_init(int max_connections,
     ngx_event_actions.process = ngx_kqueue_process_events;
 
     ngx_event_flags = NGX_HAVE_LEVEL_EVENT
-                      |NGX_HAVE_ONESHOT_EVENT|NGX_HAVE_CLEAR_EVENT;
+                     |NGX_HAVE_ONESHOT_EVENT
+#if (HAVE_AIO_EVENT)
+                     |NGX_HAVE_AIO_EVENT;
+#else
+                     |NGX_HAVE_CLEAR_EVENT;
+#endif
 #endif
 
     return NGX_OK;
@@ -221,10 +230,19 @@ int ngx_kqueue_process_events(ngx_log_t 
     for (i = 0; i < events; i++) {
 
 #if (NGX_DEBUG_EVENT)
-        ngx_log_debug(log, "kevent: %d: ft:%d f:%08x ff:%08x d:%d ud:%08x" _
-                      event_list[i].ident _ event_list[i].filter _
-                      event_list[i].flags _ event_list[i].fflags _
-                      event_list[i].data _ event_list[i].udata);
+        if (event_list[i].ident > 0x8000000) {
+            ngx_log_debug(log,
+                          "kevent: %08x: ft:%d f:%08x ff:%08x d:%d ud:%08x" _
+                          event_list[i].ident _ event_list[i].filter _
+                          event_list[i].flags _ event_list[i].fflags _
+                          event_list[i].data _ event_list[i].udata);
+        } else {
+            ngx_log_debug(log,
+                          "kevent: %d: ft:%d f:%08x ff:%08x d:%d ud:%08x" _
+                          event_list[i].ident _ event_list[i].filter _
+                          event_list[i].flags _ event_list[i].fflags _
+                          event_list[i].data _ event_list[i].udata);
+        }
 #endif
 
         if (event_list[i].flags & EV_ERROR) {
@@ -243,7 +261,6 @@ int ngx_kqueue_process_events(ngx_log_t 
 
         case EVFILT_READ:
         case EVFILT_WRITE:
-            ev->ready = 1;
             ev->available = event_list[i].data;
 
             if (event_list[i].flags & EV_EOF) {
@@ -255,12 +272,18 @@ int ngx_kqueue_process_events(ngx_log_t 
                 ngx_del_timer(ev);
             }
 
+            /* fall through */
+
+        case EVFILT_AIO:
+            ev->ready = 1;
+
             if (ev->event_handler(ev) == NGX_ERROR) {
                 ev->close_handler(ev);
             }
 
             break;
 
+
         default:
             ngx_log_error(NGX_LOG_ALERT, log, 0,
                           "unknown kevent filter %d" _ event_list[i].filter);