#if USE_DEVPOLL
-#include "squid-old.h"
#include "comm/Loops.h"
#include "fde.h"
#include "mgr/Registration.h"
+#include "profiler/Profiler.h"
#include "SquidTime.h"
#include "StatCounters.h"
#include "StatHist.h"
/* Solaris /dev/poll support, see "man -s 7D poll" */
#include <sys/devpoll.h>
#endif
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
#define DEBUG_DEVPOLL 0
int size; /**< maximum number of elements in array */
} devpoll_update;
-
/* STATIC VARIABLES */
static int devpoll_fd; /**< handle to /dev/poll device */
static int max_poll_time = 1000; /**< maximum milliseconds to spend in poll */
/* PROTOTYPES */
static void commDevPollRegisterWithCacheManager(void);
-
/* PRIVATE FUNCTIONS */
/** \brief Write batched file descriptor event changes to poll device
*
comm_flush_updates();
/* Push new event onto array */
- ++devpoll_update.cur;
+ ++ devpoll_update.cur;
devpoll_update.pfds[devpoll_update.cur].fd = fd;
devpoll_update.pfds[devpoll_update.cur].events = events;
devpoll_update.pfds[devpoll_update.cur].revents = 0;
}
-
static void commIncomingStats(StoreEntry *sentry)
{
storeAppendPrintf(sentry, "Total number of devpoll loops: %ld\n", statCounter.select_loops);
statCounter.select_fds_hist.dump(sentry, statHistIntDumper);
}
-
static void
commDevPollRegisterWithCacheManager(void)
{
);
}
-
/* PUBLIC FUNCTIONS */
/** \brief Initialise /dev/poll support
F->timeout = squid_curtime + timeout;
}
-
/** \brief Clear polling of file handle (both read and write)
*
* @param fd file descriptor to clear polling on
SetSelect(fd, COMM_SELECT_READ, NULL, NULL, 0);
}
-
/** \brief Do poll and trigger callback functions as appropriate
*
* Check all connections for new connections and input data that is to be
comm_flush_updates(); /* ensure latest changes are sent to /dev/poll */
num = ioctl(devpoll_fd, DP_POLL, &do_poll);
- ++statCounter.select_loops;
+ ++ statCounter.select_loops;
if (num >= 0)
break; /* no error, skip out of loop */
F->read_handler = NULL;
hdl(fd, F->read_data);
PROF_stop(comm_read_handler);
- ++statCounter.select_fds;
+ ++ statCounter.select_fds;
} else {
debugs(
5,
F->write_handler = NULL;
hdl(fd, F->write_data);
PROF_stop(comm_write_handler);
- ++statCounter.select_fds;
+ ++ statCounter.select_fds;
} else {
debugs(
5,