commit - 7ab7287f2568cf0384497707d95581957ec29e56
commit + 59aee4e5b492bad8dcaaaad9dd710b9619a07a50
blob - 5c4ddf7a18b062babdc0a2473f7c73053daf77cc
blob + 9ed1af5902217dc08b2a36d90d9b2dad17fa6758
--- control.c
+++ control.c
-/* $OpenBSD: control.c,v 1.17 2024/11/21 13:16:07 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.18 2024/11/21 13:17:02 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
return;
}
- imsg_init(&c->iev.ibuf, connfd);
+ imsgbuf_init(&c->iev.ibuf, connfd);
c->iev.handler = control_dispatch_imsg;
c->iev.events = EV_READ;
c->iev.data = cs; /* proc.c cheats (reuses the handler) */
}
if (event & EV_READ) {
- if (((n = imsg_read(&c->iev.ibuf)) == -1 && errno != EAGAIN) ||
- n == 0) {
+ if (((n = imsgbuf_read(&c->iev.ibuf)) == -1 &&
+ errno != EAGAIN) || n == 0) {
control_close(fd, cs);
return;
}
}
if (event & EV_WRITE) {
- if (imsg_write(&c->iev.ibuf) == -1) {
+ if (imsgbuf_write(&c->iev.ibuf) == -1) {
control_close(fd, cs);
return;
}
blob - 49fc73e7f63830434cab260f509615c20f7d659e
blob + 3e2d4ce0e8c5ca9e5db79869e7ab6e307c13d0c6
--- proc.c
+++ proc.c
-/* $OpenBSD: proc.c,v 1.48 2024/11/21 13:16:07 claudio Exp $ */
+/* $OpenBSD: proc.c,v 1.49 2024/11/21 13:17:02 claudio Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
for (inst = 0; inst < ps->ps_instances[dst]; inst++) {
iev = &ps->ps_ievs[dst][inst];
- imsg_init(&iev->ibuf, ps->ps_pp->pp_pipes[dst][inst]);
+ imsgbuf_init(&iev->ibuf,
+ ps->ps_pp->pp_pipes[dst][inst]);
event_set(&iev->ev, iev->ibuf.fd, iev->events,
iev->handler, iev->data);
event_add(&iev->ev, NULL);
pp->pp_pipes[dst][n] = fd;
iev = &ps->ps_ievs[dst][n];
- imsg_init(&iev->ibuf, fd);
+ imsgbuf_init(&iev->ibuf, fd);
event_set(&iev->ev, iev->ibuf.fd, iev->events, iev->handler, iev->data);
event_add(&iev->ev, NULL);
}
sizeof(struct imsgev))) == NULL)
fatal("%s: calloc", __func__);
- /* With this set up, we are ready to call imsg_init(). */
+ /* With this set up, we are ready to call imsgbuf_init(). */
for (i = 0; i < ps->ps_instances[id]; i++) {
ps->ps_ievs[id][i].handler = proc_dispatch;
ps->ps_ievs[id][i].events = EV_READ;
*/
if (proc_flush_imsg(ps, src, i) == -1 ||
proc_flush_imsg(ps, dst, j) == -1)
- fatal("%s: imsg_flush", __func__);
+ fatal("%s: imsgbuf_flush", __func__);
}
}
}
/* Cancel the fd, close and invalidate the fd */
event_del(&(ps->ps_ievs[dst][n].ev));
- imsg_clear(&(ps->ps_ievs[dst][n].ibuf));
+ imsgbuf_clear(&(ps->ps_ievs[dst][n].ibuf));
close(pp->pp_pipes[dst][n]);
pp->pp_pipes[dst][n] = -1;
}
ibuf = &iev->ibuf;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("%s: imsg_read", __func__);
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("%s: imsgbuf_read", __func__);
if (n == 0) {
/* this pipe is dead, so remove the event handler */
event_del(&iev->ev);
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) { /* connection closed */
/* remove the event handler */
event_del(&iev->ev);
event_loopexit(NULL);
return;
} else
- fatal("%s: imsg_write", __func__);
+ fatal("%s: imsgbuf_write", __func__);
}
}
imsg_event_add(struct imsgev *iev)
{
if (iev->handler == NULL) {
- imsg_flush(&iev->ibuf);
+ imsgbuf_flush(&iev->ibuf);
return;
}
for (; n < m; n++) {
if ((ibuf = proc_ibuf(ps, id, n)) == NULL)
return (-1);
- if ((ret = imsg_flush(ibuf)) == -1)
+ if ((ret = imsgbuf_flush(ibuf)) == -1)
break;
imsg_event_add(&ps->ps_ievs[id][n]);
}