46#include <sys/devpoll.h>
49#define DEBUG_DEVPOLL 0
52#define DEVPOLL_UPDATESIZE OPEN_MAX
53#define DEVPOLL_QUERYSIZE OPEN_MAX
136 "FD " << fd <<
", events=" << events
161 "comm_devpoll_incoming",
162 "comm_incoming() stats",
200 fatalf(
"comm_select_init: can't open /dev/poll: %s\n",
xstrerr(xerrno));
226 debugs(5, 5,
"FD " << fd <<
", type=" << type <<
227 ", handler=" <<
handler <<
", client_data=" << client_data <<
228 ", timeout=" << timeout);
232 if (!
F->flags.open) {
245 if (
F->flags.read_pending)
246 state_new |= POLLOUT;
254 F->read_data = client_data;
255 }
else if ( state_old & POLLIN ) {
263 state_new |= POLLOUT;
269 F->write_data = client_data;
270 }
else if ( state_old & POLLOUT ) {
272 state_new |= POLLOUT;
279 if ( bits_changed & state_old ) {
347 for (i = 0; i < num; ++i) {
354 <<
",events=" << std::hex <<
do_poll.dp_fds[i].revents
356 <<
",F->read_handler=" <<
F->read_handler
357 <<
",F->write_handler=" <<
F->write_handler
361 if (
do_poll.dp_fds[i].revents & (POLLERR | POLLHUP | POLLNVAL)) {
363 "ERROR: devpoll event failure: fd " << fd
369 if (
do_poll.dp_fds[i].revents & POLLIN ||
F->flags.read_pending) {
370 if ( (hdl =
F->read_handler) !=
NULL ) {
374 "Calling read handler on FD " << fd
376 F->read_handler =
nullptr;
377 hdl(fd,
F->read_data);
383 "no read handler for FD " << fd
391 if (
do_poll.dp_fds[i].revents & POLLOUT) {
392 if ((hdl =
F->write_handler) !=
NULL) {
396 "Calling write handler on FD " << fd
398 F->write_handler =
nullptr;
399 hdl(fd,
F->write_data);
405 "no write handler for FD " << fd
static void comm_update_fd(int fd, int events)
Register change in desired polling state for file descriptor.
static struct @40 devpoll_update
Update list.
#define DEVPOLL_UPDATESIZE
#define DEVPOLL_QUERYSIZE
static void commIncomingStats(StoreEntry *sentry)
static void comm_flush_updates(void)
Write batched file descriptor event changes to poll device.
static void commDevPollRegisterWithCacheManager(void)
static struct _devpoll_state * devpoll_state
static struct dvpoll do_poll
StatHistBinDumper statHistIntDumper
unsigned long int select_loops
void dump(StoreEntry *sentry, StatHistBinDumper *bd) const
void fd_open(const int fd, unsigned int, const char *description)
int ignoreErrno(int ierrno)
#define debugs(SECTION, LEVEL, CONTENT)
#define COMM_SELECT_WRITE
void fatalf(const char *fmt,...)
static uint32 F(uint32 X, uint32 Y, uint32 Z)
void QuickPollRequired(void)
Comm::Flag DoSelect(int)
Do poll and trigger callback functions as appropriate.
void SelectLoopInit(void)
Initialize the module on Squid startup.
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, int pw_req_flag, int atomic)
static void handler(int signo)
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
time_t getCurrentTime() STUB_RETVAL(0) int tvSubUsec(struct timeval
void * xcalloc(size_t n, size_t sz)
const char * xstrerr(int error)