Lines Matching refs:fd

57 static void	listener(evContext ctx, void *uap, int fd, int evmask);
58 static void connector(evContext ctx, void *uap, int fd, int evmask);
63 evListen(evContext opaqueCtx, int fd, int maxconn,
72 OKFREE(mode = fcntl(fd, F_GETFL, NULL), new); /*%< side effect: validate fd. */
75 * has not been done to this fd, or that if it has then the caller
83 OKFREE(ioctl(fd, FIONBIO, (char *)&on), new);
85 OKFREE(fcntl(fd, F_SETFL, mode | PORT_NONBLOCK), new);
89 OKFREE(listen(fd, maxconn), new);
90 if (evSelectFD(opaqueCtx, fd, EV_READ, listener, new, &new->file) < 0){
100 new->fd = fd;
112 evConnect(evContext opaqueCtx, int fd, const void *ra, int ralen,
121 if (evSelectFD(opaqueCtx, fd, EV_MASK_ALL,
130 if (connect(fd, ra, ralen) < 0 &&
144 new->fd = fd;
165 mode = fcntl(this->fd, F_GETFL, NULL);
172 OK(ioctl(this->fd, FIONBIO, (char *)&off));
174 OK(fcntl(this->fd, F_SETFL, mode & ~PORT_NONBLOCK));
197 close(acc->fd);
230 ret = evSelectFD(opaqueCtx, this->fd, EV_READ, listener, this,
250 new->fd = accept(conn->fd, &new->ra.sa, &new->ralen);
251 if (new->fd > ctx->highestFD) {
252 close(new->fd);
253 new->fd = -1;
256 if (new->fd >= 0) {
258 if (GETXXXNAME(getsockname, new->fd, new->la.sa, new->lalen) < 0) {
260 (void) close(new->fd);
261 new->fd = -1;
280 listener(evContext opaqueCtx, void *uap, int fd, int evmask) {
295 new = accept(fd, &ra.sa, &ralen);
316 connector(evContext opaqueCtx, void *uap, int fd, int evmask) {
344 if (fd < 0 &&
345 getsockopt(conn->fd, SOL_SOCKET, SO_ERROR, (char *)&socket_errno,
356 read(fd, buf, 0) < 0 ||
358 GETXXXNAME(getsockname, fd, la.sa, lalen) < 0 ||
359 GETXXXNAME(getpeername, fd, ra.sa, ralen) < 0) {
362 (void) close(fd); /*%< XXX closing caller's fd */
364 fd = -1;
366 (*conn_func)(opaqueCtx, conn_uap, fd, &la.sa, lalen, &ra.sa, ralen);