Lines Matching defs:fd
46 int fd;
47 } control_state = {.fd = -1};
64 int fd;
67 if ((fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK,
80 close(fd);
85 if (bind(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) {
87 close(fd);
95 close(fd);
100 return (fd);
104 control_listen(int fd)
106 if (control_state.fd != -1)
109 control_state.fd = fd;
110 if (listen(control_state.fd, CONTROL_BACKLOG) == -1) {
115 event_set(&control_state.ev, control_state.fd, EV_READ,
167 event_set(&c->iev.ev, c->iev.ibuf.fd, c->iev.events,
175 control_connbyfd(int fd)
180 if (c->iev.ibuf.fd == fd)
201 control_close(int fd)
205 if ((c = control_connbyfd(fd)) == NULL) {
206 log_warnx("%s: fd %d: not found", __func__, fd);
214 close(c->iev.ibuf.fd);
226 control_dispatch_imsg(int fd, short event, void *bula)
233 if ((c = control_connbyfd(fd)) == NULL) {
234 log_warnx("%s: fd %d: not found", __func__, fd);
240 control_close(fd);
246 control_close(fd);
253 control_close(fd);