commit - 41ddc9d163020f85bddcaf4c7261ab2818848c59
commit + 585eb3254921938d12e233e6029f136bc0f8b987
blob - ea57b93e31e7a0dd6bf40e99efcd0e335b4eea45
blob + 864ee775fd53ccf0c7646bbfd2a6ffa2899b515e
--- ca.c
+++ ca.c
-/* $OpenBSD: ca.c,v 1.43 2023/07/16 09:23:33 tb Exp $ */
+/* $OpenBSD: ca.c,v 1.44 2024/11/21 13:17:02 claudio Exp $ */
/*
* Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
*/
if (imsg_composev(ibuf, cmd, 0, 0, -1, iov, cnt) == -1)
log_warn("%s: imsg_composev", __func__);
- if (imsg_flush(ibuf) == -1)
- log_warn("%s: imsg_flush", __func__);
+ if (imsgbuf_flush(ibuf) == -1)
+ log_warn("%s: imsgbuf_flush", __func__);
pfd[0].fd = ibuf->fd;
pfd[0].events = POLLIN;
default:
break;
}
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatalx("imsg_read");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatalx("imsgbuf_read");
if (n == 0)
fatalx("pipe closed");
blob - f720329485010ddde62758a78df4b9733cc80af0
blob + aa3cd0f938f6ad2dd5363f5c033a3483cc39c0c9
--- control.c
+++ control.c
-/* $OpenBSD: control.c,v 1.60 2024/11/21 13:16:07 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.61 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 - 3424f878da5fdb8775af61c3f81ee02b1e45b260
blob + fe3089220fa5ca0d0e09ec72163c85b633760c0f
--- 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: proc_flush_imsg", __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) {
/* this pipe is dead, remove the handler */
event_del(&iev->ev);
event_loopexit(NULL);
return;
}
- 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]);
}