Lines Matching refs: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,
162 event_set(&c->iev.ev, c->iev.ibuf.fd, c->iev.events,
170 control_connbyfd(int fd)
175 if (c->iev.ibuf.fd == fd)
196 control_close(int fd)
200 if ((c = control_connbyfd(fd)) == NULL) {
201 log_warnx("%s: fd %d: not found", __func__, fd);
209 close(c->iev.ibuf.fd);
221 control_dispatch_imsg(int fd, short event, void *bula)
228 if ((c = control_connbyfd(fd)) == NULL) {
229 log_warnx("%s: fd %d: not found", __func__, fd);
236 control_close(fd);
242 control_close(fd);
249 control_close(fd);