Lines Matching refs:ctx

42 static evFile *FindFD(const evContext_p *ctx, int fd, int eventmask);
52 evContext_p *ctx = opaqueCtx.opaque;
56 evPrintf(ctx, 1,
57 "evSelectFD(ctx %p, fd %d, mask 0x%x, func %p, uap %p)\n",
58 ctx, fd, eventmask, func, uap);
62 if (fd > ctx->highestFD)
73 /* Make sure both ctx->pollfds[] and ctx->fdTable[] are large enough */
74 if (fd >= ctx->maxnfds && evPollfdRealloc(ctx, 1, fd) != 0)
77 id = FindFD(ctx, fd, EV_MASK_ALL);
80 FD_SET(fd, &ctx->nonblockBefore);
88 FD_CLR(fd, &ctx->nonblockBefore);
98 if (id != NULL && FindFD(ctx, fd, eventmask) != NULL)
120 * Maintaining a "tail" pointer for ctx->files would fix this, but I'm
123 if (ctx->files != NULL)
124 ctx->files->prev = id;
126 id->next = ctx->files;
127 ctx->files = id;
130 if (ctx->fdTable[fd] != NULL)
131 ctx->fdTable[fd]->fdprev = id;
133 id->fdnext = ctx->fdTable[fd];
134 ctx->fdTable[fd] = id;
138 FD_SET(fd, &ctx->rdNext);
140 FD_SET(fd, &ctx->wrNext);
142 FD_SET(fd, &ctx->exNext);
145 if (fd > ctx->fdMax)
146 ctx->fdMax = fd;
157 evContext_p *ctx = opaqueCtx.opaque;
163 evPrintf(ctx, 11, "evDeselectFD(NULL) ignored\n");
168 evPrintf(ctx, 1, "evDeselectFD(fd %d, mask 0x%x)\n",
180 ctx->files = del->next;
188 ctx->fdTable[del->fd] = del->fdnext;
197 if (!(cur = FindFD(ctx, del->fd, EV_MASK_ALL)) &&
198 !FD_ISSET(del->fd, &ctx->nonblockBefore) &&
228 FD_CLR(del->fd, &ctx->rdNext);
229 if (FD_ISSET(del->fd, &ctx->rdLast)) {
230 FD_CLR(del->fd, &ctx->rdLast);
231 ctx->fdCount--;
235 FD_CLR(del->fd, &ctx->wrNext);
236 if (FD_ISSET(del->fd, &ctx->wrLast)) {
237 FD_CLR(del->fd, &ctx->wrLast);
238 ctx->fdCount--;
242 FD_CLR(del->fd, &ctx->exNext);
243 if (FD_ISSET(del->fd, &ctx->exLast)) {
244 FD_CLR(del->fd, &ctx->exLast);
245 ctx->fdCount--;
250 if (del->fd == ctx->fdMax) {
251 ctx->fdMax = -1;
252 for (cur = ctx->files; cur; cur = cur->next)
253 if (cur->fd > ctx->fdMax)
254 ctx->fdMax = cur->fd;
258 if (del == ctx->fdNext)
259 ctx->fdNext = del->next;
268 FindFD(const evContext_p *ctx, int fd, int eventmask) {
271 for (id = ctx->fdTable[fd]; id != NULL; id = id->fdnext)