]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/comm/ModEpoll.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / comm / ModEpoll.cc
index 3e53cce0a00c5e2d887bec336562ab65d506e676..c0e7ea872568f79912b2785794f890311c134758 100644 (file)
  *
  */
 
-#include "config.h"
+#include "squid.h"
 
 #if USE_EPOLL
 
-#include "squid.h"
 #include "comm/Loops.h"
 #include "fde.h"
+#include "globals.h"
 #include "mgr/Registration.h"
+#include "profiler/Profiler.h"
 #include "SquidTime.h"
 #include "StatCounters.h"
 #include "StatHist.h"
@@ -69,6 +70,9 @@
 #if HAVE_SYS_EPOLL_H
 #include <sys/epoll.h>
 #endif
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 static int kdpfd;
 static int max_poll_time = 1000;
@@ -77,11 +81,9 @@ static struct epoll_event *pevents;
 
 static void commEPollRegisterWithCacheManager(void);
 
-
 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
 /* Public functions */
 
-
 /*
  * This is a needed exported function which will be called to initialise
  * the network loop code.
@@ -212,7 +214,6 @@ Comm::ResetSelect(int fd)
     SetSelect(fd, 0, NULL, NULL, 0);
 }
 
-
 static void commIncomingStats(StoreEntry * sentry);
 
 static void
@@ -258,7 +259,7 @@ Comm::DoSelect(int msec)
 
     for (;;) {
         num = epoll_wait(kdpfd, pevents, SQUID_MAXFD, msec);
-        ++statCounter.select_loops;
+        ++ statCounter.select_loops;
 
         if (num >= 0)
             break;
@@ -283,7 +284,7 @@ Comm::DoSelect(int msec)
 
     PROF_start(comm_handle_ready_fd);
 
-    for (i = 0, cevents = pevents; i < num; i++, cevents++) {
+    for (i = 0, cevents = pevents; i < num; ++i, ++cevents) {
         fd = cevents->data.fd;
         F = &fd_table[fd];
         debugs(5, DEBUG_EPOLL ? 0 : 8, HERE << "got FD " << fd << " events=" <<
@@ -300,7 +301,7 @@ Comm::DoSelect(int msec)
                 F->read_handler = NULL;
                 hdl(fd, F->read_data);
                 PROF_stop(comm_write_handler);
-                statCounter.select_fds++;
+                ++ statCounter.select_fds;
             } else {
                 debugs(5, DEBUG_EPOLL ? 0 : 8, HERE << "no read handler for FD " << fd);
                 // remove interest since no handler exist for this event.
@@ -315,7 +316,7 @@ Comm::DoSelect(int msec)
                 F->write_handler = NULL;
                 hdl(fd, F->write_data);
                 PROF_stop(comm_read_handler);
-                statCounter.select_fds++;
+                ++ statCounter.select_fds;
             } else {
                 debugs(5, DEBUG_EPOLL ? 0 : 8, HERE << "no write handler for FD " << fd);
                 // remove interest since no handler exist for this event.