Go to the documentation of this file.
   49 #include <sys/epoll.h> 
   69     pevents = (
struct epoll_event *) 
xmalloc(SQUID_MAXFD * 
sizeof(
struct epoll_event));
 
   73         fatalf(
"comm_select_init: xmalloc() failed: %s\n", 
xstrerr(xerrno));
 
   76     kdpfd = epoll_create(SQUID_MAXFD);
 
   80         fatalf(
"comm_select_init: epoll_create(): %s\n", 
xstrerr(xerrno));
 
   91         return "EPOLL_CTL_ADD";
 
   94         return "EPOLL_CTL_DEL";
 
   97         return "EPOLL_CTL_MOD";
 
  100         return "UNKNOWN_EPOLLCTL_OP";
 
  109 Comm::SetSelect(
int fd, 
unsigned int type, 
PF * handler, 
void *client_data, time_t timeout)
 
  112     int epoll_ctl_type = 0;
 
  115     debugs(5, 5, 
"FD " << fd << 
", type=" << type <<
 
  116            ", handler=" << handler << 
", client_data=" << client_data <<
 
  117            ", timeout=" << timeout);
 
  119     struct epoll_event ev;
 
  120     memset(&ev, 0, 
sizeof(ev));
 
  124         epoll_ctl(
kdpfd, EPOLL_CTL_DEL, fd, &ev);
 
  134                 ev.events |= EPOLLOUT;
 
  135             ev.events |= EPOLLIN;
 
  144         ev.events |= EPOLLIN;
 
  150             ev.events |= EPOLLOUT;
 
  158         ev.events |= EPOLLOUT;
 
  162         ev.events |= EPOLLHUP | EPOLLERR;
 
  166             epoll_ctl_type = ev.events ? EPOLL_CTL_MOD : EPOLL_CTL_DEL;
 
  168             epoll_ctl_type = EPOLL_CTL_ADD;
 
  172         if (epoll_ctl(
kdpfd, epoll_ctl_type, fd, &ev) < 0) {
 
  175                    ",,): failed on FD " << fd << 
": " << 
xstrerr(xerrno));
 
  182     if (timeout || handler) 
 
  195                         "comm_incoming() stats",
 
  225     struct epoll_event *cevents;
 
  252     for (i = 0, cevents = 
pevents; i < num; ++i, ++cevents) {
 
  253         fd = cevents->data.fd;
 
  275         if (cevents->events & (EPOLLOUT|EPOLLHUP|EPOLLERR)) {
 
  
const char * xstrerr(int error)
bool read_pending
buffering readMethod_ has data to give (regardless of socket state)
static void commEPollRegisterWithCacheManager(void)
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Comm::Flag DoSelect(int)
Do poll and trigger callback functions as appropriate.
static void commIncomingStats(StoreEntry *sentry)
static struct epoll_event * pevents
static void Reset()
forgets the current context, setting it to nil/unknown
time_t getCurrentTime() STUB_RETVAL(0) int tvSubUsec(struct timeval
void dump(StoreEntry *sentry, StatHistBinDumper *bd) const
struct fde::_fde_flags flags
AsHex< Integer > asHex(const Integer n)
a helper to ease AsHex object creation
void fatalf(const char *fmt,...)
static const char * epolltype_atoi(int x)
void SelectLoopInit(void)
Initialize the module on Squid startup.
int ignoreErrno(int ierrno)
unsigned long int select_loops
static const Pointer & Current()
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)
CodeContextPointer codeContext
What the I/O handlers are supposed to work on.
#define debugs(SECTION, LEVEL, CONTENT)
#define COMM_SELECT_WRITE
void QuickPollRequired(void)