Go to the documentation of this file.
42 #if HAVE_SYS_DEVPOLL_H
44 #include <sys/devpoll.h>
47 #define DEBUG_DEVPOLL 0
130 "FD " << fd <<
", events=" << events
155 "comm_devpoll_incoming",
156 "comm_incoming() stats",
197 fatalf(
"comm_select_init: can't open /dev/poll: %s\n",
xstrerr(xerrno));
223 debugs(5, 5,
"FD " << fd <<
", type=" << type <<
224 ", handler=" << handler <<
", client_data=" << client_data <<
225 ", timeout=" << timeout);
229 if (!
F->flags.open) {
240 if ( handler !=
NULL ) {
242 if (
F->flags.read_pending)
243 state_new |= POLLOUT;
250 F->read_handler = handler;
251 F->read_data = client_data;
252 }
else if ( state_old & POLLIN ) {
258 if ( handler !=
NULL ) {
260 state_new |= POLLOUT;
265 F->write_handler = handler;
266 F->write_data = client_data;
267 }
else if ( state_old & POLLOUT ) {
269 state_new |= POLLOUT;
276 if ( bits_changed & state_old ) {
344 for (i = 0; i < num; ++i) {
353 <<
",F->read_handler=" <<
F->read_handler
354 <<
",F->write_handler=" <<
F->write_handler
358 if (
do_poll.dp_fds[i].revents & (POLLERR | POLLHUP | POLLNVAL)) {
360 "ERROR: devpoll event failure: fd " << fd
366 if (
do_poll.dp_fds[i].revents & POLLIN ||
F->flags.read_pending) {
367 if ( (hdl =
F->read_handler) !=
NULL ) {
371 "Calling read handler on FD " << fd
373 F->read_handler =
nullptr;
374 hdl(fd,
F->read_data);
380 "no read handler for FD " << fd
388 if (
do_poll.dp_fds[i].revents & POLLOUT) {
389 if ((hdl =
F->write_handler) !=
NULL) {
393 "Calling write handler on FD " << fd
395 F->write_handler =
nullptr;
396 hdl(fd,
F->write_data);
402 "no write handler for FD " << fd
const char * xstrerr(int error)
void * xcalloc(size_t n, size_t sz)
static struct _devpoll_state * devpoll_state
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Comm::Flag DoSelect(int)
Do poll and trigger callback functions as appropriate.
static uint32 F(uint32 X, uint32 Y, uint32 Z)
static void comm_flush_updates(void)
Write batched file descriptor event changes to poll device.
void fd_open(const int fd, unsigned int, const char *description)
static void commIncomingStats(StoreEntry *sentry)
static struct @39 devpoll_update
Update list.
time_t getCurrentTime() STUB_RETVAL(0) int tvSubUsec(struct timeval
void dump(StoreEntry *sentry, StatHistBinDumper *bd) const
AsHex< Integer > asHex(const Integer n)
a helper to ease AsHex object creation
static void commDevPollRegisterWithCacheManager(void)
void fatalf(const char *fmt,...)
void SelectLoopInit(void)
Initialize the module on Squid startup.
int ignoreErrno(int ierrno)
unsigned long int select_loops
StatHistBinDumper statHistIntDumper
void SetSelect(int, unsigned int, PF *, void *, time_t)
Mark an FD to be watched for its IO status.
void RegisterAction(char const *action, char const *desc, OBJH *handler, Protected, Atomic, Format)
static void comm_update_fd(int fd, pollfd_events_t events)
Register change in desired polling state for file descriptor.
static struct dvpoll do_poll
#define debugs(SECTION, LEVEL, CONTENT)
#define COMM_SELECT_WRITE
void QuickPollRequired(void)