[nginx] Events: fixed logging.

Sergey Kandaurov pluknet at nginx.com
Wed Mar 30 23:35:08 UTC 2016


details:   http://hg.nginx.org/nginx/rev/dc92298b1852
branches:  
changeset: 6479:dc92298b1852
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Thu Mar 31 02:33:55 2016 +0300
description:
Events: fixed logging.

diffstat:

 src/event/modules/ngx_eventport_module.c |   8 ++++----
 src/event/modules/ngx_kqueue_module.c    |  23 +++++++++++++++--------
 2 files changed, 19 insertions(+), 12 deletions(-)

diffs (74 lines):

diff -r 3ef7bb882ad4 -r dc92298b1852 src/event/modules/ngx_eventport_module.c
--- a/src/event/modules/ngx_eventport_module.c	Thu Mar 31 02:33:53 2016 +0300
+++ b/src/event/modules/ngx_eventport_module.c	Thu Mar 31 02:33:55 2016 +0300
@@ -526,18 +526,18 @@ ngx_eventport_process_events(ngx_cycle_t
 
             ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
                            "eventport: fd:%d, ev:%04Xd",
-                           event_list[i].portev_object, revents);
+                           (int) event_list[i].portev_object, revents);
 
             if (revents & (POLLERR|POLLHUP|POLLNVAL)) {
                 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
                                "port_getn() error fd:%d ev:%04Xd",
-                               event_list[i].portev_object, revents);
+                               (int) event_list[i].portev_object, revents);
             }
 
             if (revents & ~(POLLIN|POLLOUT|POLLERR|POLLHUP|POLLNVAL)) {
                 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
                               "strange port_getn() events fd:%d ev:%04Xd",
-                              event_list[i].portev_object, revents);
+                              (int) event_list[i].portev_object, revents);
             }
 
             if ((revents & (POLLERR|POLLHUP|POLLNVAL))
@@ -615,7 +615,7 @@ ngx_eventport_process_events(ngx_cycle_t
         default:
             ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
                           "unexpected eventport object %d",
-                          event_list[i].portev_object);
+                          (int) event_list[i].portev_object);
             continue;
         }
     }
diff -r 3ef7bb882ad4 -r dc92298b1852 src/event/modules/ngx_kqueue_module.c
--- a/src/event/modules/ngx_kqueue_module.c	Thu Mar 31 02:33:53 2016 +0300
+++ b/src/event/modules/ngx_kqueue_module.c	Thu Mar 31 02:33:55 2016 +0300
@@ -579,7 +579,7 @@ ngx_kqueue_process_events(ngx_cycle_t *c
         if (event_list[i].flags & EV_ERROR) {
             ngx_log_error(NGX_LOG_ALERT, cycle->log, event_list[i].data,
                           "kevent() error on %d filter:%d flags:%04Xd",
-                          event_list[i].ident, event_list[i].filter,
+                          (int) event_list[i].ident, event_list[i].filter,
                           event_list[i].flags);
             continue;
         }
@@ -676,13 +676,20 @@ ngx_kqueue_process_events(ngx_cycle_t *c
 static ngx_inline void
 ngx_kqueue_dump_event(ngx_log_t *log, struct kevent *kev)
 {
-    ngx_log_debug6(NGX_LOG_DEBUG_EVENT, log, 0,
-                   (kev->ident > 0x8000000 && kev->ident != (unsigned) -1) ?
-                    "kevent: %p: ft:%d fl:%04Xd ff:%08Xd d:%d ud:%p":
-                    "kevent: %d: ft:%d fl:%04Xd ff:%08Xd d:%d ud:%p",
-                    kev->ident, kev->filter,
-                    kev->flags, kev->fflags,
-                    kev->data, kev->udata);
+    if (kev->ident > 0x8000000 && kev->ident != (unsigned) -1) {
+        ngx_log_debug6(NGX_LOG_DEBUG_EVENT, log, 0,
+                       "kevent: %p: ft:%d fl:%04Xd ff:%08Xd d:%d ud:%p",
+                       (void *) kev->ident, kev->filter,
+                       kev->flags, kev->fflags,
+                       (int) kev->data, kev->udata);
+
+    } else {
+        ngx_log_debug6(NGX_LOG_DEBUG_EVENT, log, 0,
+                       "kevent: %d: ft:%d fl:%04Xd ff:%08Xd d:%d ud:%p",
+                       (int) kev->ident, kev->filter,
+                       kev->flags, kev->fflags,
+                       (int) kev->data, kev->udata);
+    }
 }
 
 



More information about the nginx-devel mailing list