72 cur_handler =
fd_table[fd].read_handler;
76 cur_handler =
fd_table[fd].write_handler;
93 kep_flags = (EV_ADD | EV_ONESHOT);
95 kep_flags = EV_DELETE;
98 EV_SET(kep, (uintptr_t) fd, filter, kep_flags, 0, 0, 0);
108 perror(
"kq_update_events(): kevent()");
134 fatal(
"comm_select_init: Couldn't open kqueue fd!\n");
137 kqmax = getdtablesize();
158 debugs(5, 5,
"FD " << fd <<
", type=" << type <<
159 ", handler=" <<
handler <<
", client_data=" << client_data <<
160 ", timeout=" << timeout);
163 if (
F->flags.read_pending)
169 F->read_data = client_data;
175 F->write_data = client_data;
205 struct timespec poll_time;
210 poll_time.tv_sec = msec / 1000;
212 poll_time.tv_nsec = (msec % 1000) * 1000000;
237 for (i = 0; i < num; ++i) {
238 int fd = (
int) ke[i].ident;
242 if (ke[i].flags & EV_ERROR) {
248 if (ke[i].filter == EVFILT_READ ||
F->flags.read_pending) {
249 if ((hdl =
F->read_handler) !=
NULL) {
250 F->read_handler =
nullptr;
251 hdl(fd,
F->read_data);
255 if (ke[i].filter == EVFILT_WRITE) {
256 if ((hdl =
F->write_handler) !=
NULL) {
257 F->write_handler =
nullptr;
258 hdl(fd,
F->write_data);
262 if (ke[i].filter != EVFILT_WRITE && ke[i].filter != EVFILT_READ) {
static void commKQueueRegisterWithCacheManager(void)
static struct kevent * kqlst
static void kq_update_events(int, short, PF *)
static struct timespec zero_timespec
unsigned long int select_loops
int ignoreErrno(int ierrno)
#define debugs(SECTION, LEVEL, CONTENT)
#define COMM_SELECT_WRITE
void fatal(const char *message)
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.
static void handler(int signo)
time_t getCurrentTime() STUB_RETVAL(0) int tvSubUsec(struct timeval