Lines Matching refs:fd
45 int fd;
46 } control_state = {.fd = -1};
63 int fd;
66 if ((fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK,
79 close(fd);
84 if (bind(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) {
86 close(fd);
94 close(fd);
99 return (fd);
103 control_listen(int fd)
105 if (control_state.fd != -1)
108 control_state.fd = fd;
109 if (listen(control_state.fd, CONTROL_BACKLOG) == -1) {
114 event_set(&control_state.ev, control_state.fd, EV_READ,
161 event_set(&c->iev.ev, c->iev.ibuf.fd, c->iev.events,
169 control_connbyfd(int fd)
174 if (c->iev.ibuf.fd == fd)
195 control_close(int fd)
199 if ((c = control_connbyfd(fd)) == NULL) {
200 log_warnx("%s: fd %d: not found", __func__, fd);
208 close(c->iev.ibuf.fd);
220 control_dispatch_imsg(int fd, short event, void *bula)
227 if ((c = control_connbyfd(fd)) == NULL) {
228 log_warnx("%s: fd %d: not found", __func__, fd);
235 control_close(fd);
241 control_close(fd);
248 control_close(fd);