__func__, ifp->name);
return;
}
- eloop_event_add(ifp->ctx->eloop, state->fd,
- arp_packet, ifp, NULL, NULL);
+ eloop_event_add(ifp->ctx->eloop, state->fd, arp_packet, ifp);
}
}
TAILQ_INIT(&l->queue);
TAILQ_INIT(&l->free_queue);
TAILQ_INSERT_TAIL(&ctx->control_fds, l, next);
- eloop_event_add(ctx->eloop, l->fd,
- control_handle_data, l, NULL, NULL);
+ eloop_event_add(ctx->eloop, l->fd, control_handle_data, l);
} else
close(fd);
}
return -1;
ctx->control_fd = fd;
- eloop_event_add(ctx->eloop, fd, control_handle, ctx, NULL, NULL);
+ eloop_event_add(ctx->eloop, fd, control_handle, ctx);
if (ifname == NULL && (fd = control_start1(ctx, NULL, S_UNPRIV)) != -1){
/* We must be in master mode, so create an unpriviledged socket
* to allow normal users to learn the status of dhcpcd. */
ctx->control_unpriv_fd = fd;
- eloop_event_add(ctx->eloop, fd, control_handle_unpriv,
- ctx, NULL, NULL);
+ eloop_event_add(ctx->eloop, fd, control_handle_unpriv, ctx);
}
return ctx->control_fd;
}
d->data_len = data_len;
d->freeit = fit;
TAILQ_INSERT_TAIL(&fd->queue, d, next);
- eloop_event_add(fd->ctx->eloop, fd->fd,
- NULL, NULL, control_writeone, fd);
+ eloop_event_add_w(fd->ctx->eloop, fd->fd, control_writeone, fd);
return 0;
}
return -1;
}
eloop_event_add(ifp->ctx->eloop,
- state->raw_fd, dhcp_handlepacket, ifp, NULL, NULL);
+ state->raw_fd, dhcp_handlepacket, ifp);
}
return 0;
}
"%s: dhcp_openudp: %m", __func__);
} else
eloop_event_add(ifp->ctx->eloop,
- ifp->ctx->udp_fd, dhcp_handleudp,
- ifp->ctx, NULL, NULL);
+ ifp->ctx->udp_fd, dhcp_handleudp, ifp->ctx);
}
if (dhcp_init(ifp) == -1) {
&n, sizeof(n)) == -1)
goto errexit;
- eloop_event_add(dctx->eloop, ctx->dhcp_fd,
- dhcp6_handledata, dctx, NULL, NULL);
+ eloop_event_add(dctx->eloop, ctx->dhcp_fd, dhcp6_handledata, dctx);
return 0;
errexit:
return control_queue(fd, UNCONST(fd->ctx->cffile),
strlen(fd->ctx->cffile) + 1, 0);
} else if (strcmp(*argv, "--getinterfaces") == 0) {
- eloop_event_add(fd->ctx->eloop, fd->fd, NULL, NULL,
+ eloop_event_add_w(fd->ctx->eloop, fd->fd,
dhcpcd_getinterfaces, fd);
return 0;
} else if (strcmp(*argv, "--listen") == 0) {
/* Start handling kernel messages for interfaces, addreses and
* routes. */
- eloop_event_add(ctx.eloop, ctx.link_fd, handle_link, &ctx, NULL, NULL);
+ eloop_event_add(ctx.eloop, ctx.link_fd, handle_link, &ctx);
/* Start any dev listening plugin which may want to
* change the interface name provided by the kernel */
#endif /* HAVE_POLL */
int
-eloop_event_add(struct eloop *eloop, int fd,
+eloop_event_add_rw(struct eloop *eloop, int fd,
void (*read_cb)(void *), void *read_cb_arg,
void (*write_cb)(void *), void *write_cb_arg)
{
return -1;
}
+int
+eloop_event_add(struct eloop *eloop, int fd,
+ void (*read_cb)(void *), void *read_cb_arg)
+{
+
+ return eloop_event_add_rw(eloop, fd, read_cb, read_cb_arg, NULL, NULL);
+}
+
+int
+eloop_event_add_w(struct eloop *eloop, int fd,
+ void (*write_cb)(void *), void *write_cb_arg)
+{
+
+ return eloop_event_add_rw(eloop, fd, NULL,NULL, write_cb, write_cb_arg);
+}
+
void
eloop_event_delete_write(struct eloop *eloop, int fd, int write_only)
{
/* Forward declare eloop - the content should be invisible to the outside */
struct eloop;
-int eloop_event_add(struct eloop *, int,
+int eloop_event_add_rw(struct eloop *, int,
void (*)(void *), void *,
void (*)(void *), void *);
+int eloop_event_add(struct eloop *, int,
+ void (*)(void *), void *);
+int eloop_event_add_w(struct eloop *, int,
+ void (*)(void *), void *);
#define eloop_event_delete(eloop, fd) \
eloop_event_delete_write((eloop), (fd), 0)
#define eloop_event_remove_writecb(eloop, fd) \
&filt, sizeof(filt)) == -1)
goto eexit;
- eloop_event_add(dctx->eloop, ctx->nd_fd,
- ipv6nd_handledata, dctx, NULL, NULL);
+ eloop_event_add(dctx->eloop, ctx->nd_fd, ipv6nd_handledata, dctx);
return ctx->nd_fd;
eexit: