summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2024-11-21 13:17:04 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2024-11-21 13:17:04 +0000
commitcaba869c8447fc7ef9f32581e1d02262e51ec18a (patch)
treec06988b36b6677e805071a9673b04b5360e2e36d /sbin
parent9c8d00dd06d79ba9fccf07c45cd1bdae73e744c5 (diff)
Rename imsg_init, imsg_clear, imsg_read, imsg_write and imsg_flush to
imsgbuf_init, imsgbuf_clear, imsgbuf_read, imsgbuf_write and imsgbuf_flush. This separates the imsgbuf API from the per-imsg API. OK tb@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/dhcp6leased/control.c10
-rw-r--r--sbin/dhcp6leased/dhcp6leased.c26
-rw-r--r--sbin/dhcp6leased/engine.c22
-rw-r--r--sbin/dhcp6leased/frontend.c26
-rw-r--r--sbin/dhcpleased/control.c10
-rw-r--r--sbin/dhcpleased/dhcpleased.c26
-rw-r--r--sbin/dhcpleased/engine.c22
-rw-r--r--sbin/dhcpleased/frontend.c26
-rw-r--r--sbin/iked/control.c10
-rw-r--r--sbin/iked/proc.c25
-rw-r--r--sbin/mountd/mountd.c18
-rw-r--r--sbin/slaacd/control.c10
-rw-r--r--sbin/slaacd/engine.c22
-rw-r--r--sbin/slaacd/frontend.c26
-rw-r--r--sbin/slaacd/slaacd.c26
-rw-r--r--sbin/unwind/control.c10
-rw-r--r--sbin/unwind/frontend.c26
-rw-r--r--sbin/unwind/resolver.c22
-rw-r--r--sbin/unwind/unwind.c22
19 files changed, 193 insertions, 192 deletions
diff --git a/sbin/dhcp6leased/control.c b/sbin/dhcp6leased/control.c
index 20dbd9118ba..12c149a5a01 100644
--- a/sbin/dhcp6leased/control.c
+++ b/sbin/dhcp6leased/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.5 2024/11/21 13:14:44 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.6 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -156,7 +156,7 @@ control_accept(int listenfd, short event, void *bula)
return;
}
- imsg_init(&c->iev.ibuf, connfd);
+ imsgbuf_init(&c->iev.ibuf, connfd);
c->iev.handler = control_dispatch_imsg;
c->iev.events = EV_READ;
event_set(&c->iev.ev, c->iev.ibuf.fd, c->iev.events,
@@ -231,14 +231,14 @@ control_dispatch_imsg(int fd, short event, void *bula)
}
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);
return;
}
}
if (event & EV_WRITE) {
- if (imsg_write(&c->iev.ibuf) == -1) {
+ if (imsgbuf_write(&c->iev.ibuf) == -1) {
control_close(fd);
return;
}
diff --git a/sbin/dhcp6leased/dhcp6leased.c b/sbin/dhcp6leased/dhcp6leased.c
index 4bf33691729..d1706e80edd 100644
--- a/sbin/dhcp6leased/dhcp6leased.c
+++ b/sbin/dhcp6leased/dhcp6leased.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcp6leased.c,v 1.14 2024/11/21 13:14:44 claudio Exp $ */
+/* $OpenBSD: dhcp6leased.c,v 1.15 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2017, 2021, 2024 Florian Obser <florian@openbsd.org>
@@ -260,9 +260,9 @@ main(int argc, char *argv[])
if ((iev_frontend = malloc(sizeof(struct imsgev))) == NULL ||
(iev_engine = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsg_init(&iev_frontend->ibuf, pipe_main2frontend[0]);
+ imsgbuf_init(&iev_frontend->ibuf, pipe_main2frontend[0]);
iev_frontend->handler = main_dispatch_frontend;
- imsg_init(&iev_engine->ibuf, pipe_main2engine[0]);
+ imsgbuf_init(&iev_engine->ibuf, pipe_main2engine[0]);
iev_engine->handler = main_dispatch_engine;
/* Setup event handlers for pipes to engine & frontend. */
@@ -426,17 +426,17 @@ main_dispatch_frontend(int fd, short event, void *bula)
ibuf = &iev->ibuf;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -504,17 +504,17 @@ main_dispatch_engine(int fd, short event, void *bula)
ibuf = &iev->ibuf;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -634,11 +634,11 @@ main_imsg_send_ipc_sockets(struct imsgbuf *frontend_buf,
if (imsg_compose(frontend_buf, IMSG_SOCKET_IPC, 0, 0,
pipe_frontend2engine[0], NULL, 0) == -1)
return (-1);
- imsg_flush(frontend_buf);
+ imsgbuf_flush(frontend_buf);
if (imsg_compose(engine_buf, IMSG_SOCKET_IPC, 0, 0,
pipe_frontend2engine[1], NULL, 0) == -1)
return (-1);
- imsg_flush(engine_buf);
+ imsgbuf_flush(engine_buf);
return (0);
}
diff --git a/sbin/dhcp6leased/engine.c b/sbin/dhcp6leased/engine.c
index e18e5da366a..8e74cd38048 100644
--- a/sbin/dhcp6leased/engine.c
+++ b/sbin/dhcp6leased/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.26 2024/11/21 13:14:44 claudio Exp $ */
+/* $OpenBSD: engine.c,v 1.27 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2017, 2021, 2024 Florian Obser <florian@openbsd.org>
@@ -215,7 +215,7 @@ engine(int debug, int verbose)
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsg_init(&iev_main->ibuf, 3);
+ imsgbuf_init(&iev_main->ibuf, 3);
iev_main->handler = engine_dispatch_main;
/* Setup event handlers. */
@@ -276,17 +276,17 @@ engine_dispatch_frontend(int fd, short event, void *bula)
uint32_t if_index;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -385,17 +385,17 @@ engine_dispatch_main(int fd, short event, void *bula)
int shut = 0;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -423,7 +423,7 @@ engine_dispatch_main(int fd, short event, void *bula)
if (iev_frontend == NULL)
fatal(NULL);
- imsg_init(&iev_frontend->ibuf, fd);
+ imsgbuf_init(&iev_frontend->ibuf, fd);
iev_frontend->handler = engine_dispatch_frontend;
iev_frontend->events = EV_READ;
diff --git a/sbin/dhcp6leased/frontend.c b/sbin/dhcp6leased/frontend.c
index 42630ec1056..3cf5e5125a9 100644
--- a/sbin/dhcp6leased/frontend.c
+++ b/sbin/dhcp6leased/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.16 2024/11/21 13:14:44 claudio Exp $ */
+/* $OpenBSD: frontend.c,v 1.17 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2017, 2021, 2024 Florian Obser <florian@openbsd.org>
@@ -180,7 +180,7 @@ frontend(int debug, int verbose)
/* Setup pipe and event handler to the parent process. */
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsg_init(&iev_main->ibuf, 3);
+ imsgbuf_init(&iev_main->ibuf, 3);
iev_main->handler = frontend_dispatch_main;
iev_main->events = EV_READ;
event_set(&iev_main->ev, iev_main->ibuf.fd, iev_main->events,
@@ -197,10 +197,10 @@ __dead void
frontend_shutdown(void)
{
/* Close pipes. */
- imsg_write(&iev_engine->ibuf);
+ imsgbuf_write(&iev_engine->ibuf);
msgbuf_clear(&iev_engine->ibuf.w);
close(iev_engine->ibuf.fd);
- imsg_write(&iev_main->ibuf);
+ imsgbuf_write(&iev_main->ibuf);
msgbuf_clear(&iev_main->ibuf.w);
close(iev_main->ibuf.fd);
@@ -243,17 +243,17 @@ frontend_dispatch_main(int fd, short event, void *bula)
int shut = 0, udpsock, if_index;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -282,7 +282,7 @@ frontend_dispatch_main(int fd, short event, void *bula)
if (iev_engine == NULL)
fatal(NULL);
- imsg_init(&iev_engine->ibuf, fd);
+ imsgbuf_init(&iev_engine->ibuf, fd);
iev_engine->handler = frontend_dispatch_engine;
iev_engine->events = EV_READ;
@@ -449,17 +449,17 @@ frontend_dispatch_engine(int fd, short event, void *bula)
int shut = 0;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
diff --git a/sbin/dhcpleased/control.c b/sbin/dhcpleased/control.c
index ac2f4d41699..e6e708351bc 100644
--- a/sbin/dhcpleased/control.c
+++ b/sbin/dhcpleased/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.8 2024/11/21 13:14:44 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.9 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -156,7 +156,7 @@ control_accept(int listenfd, short event, void *bula)
return;
}
- imsg_init(&c->iev.ibuf, connfd);
+ imsgbuf_init(&c->iev.ibuf, connfd);
c->iev.handler = control_dispatch_imsg;
c->iev.events = EV_READ;
event_set(&c->iev.ev, c->iev.ibuf.fd, c->iev.events,
@@ -233,14 +233,14 @@ control_dispatch_imsg(int fd, short event, void *bula)
}
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);
return;
}
}
if (event & EV_WRITE) {
- if (imsg_write(&c->iev.ibuf) == -1) {
+ if (imsgbuf_write(&c->iev.ibuf) == -1) {
control_close(fd);
return;
}
diff --git a/sbin/dhcpleased/dhcpleased.c b/sbin/dhcpleased/dhcpleased.c
index 83a910e1074..a4dfd42d3e0 100644
--- a/sbin/dhcpleased/dhcpleased.c
+++ b/sbin/dhcpleased/dhcpleased.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpleased.c,v 1.34 2024/11/21 13:14:44 claudio Exp $ */
+/* $OpenBSD: dhcpleased.c,v 1.35 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -273,9 +273,9 @@ main(int argc, char *argv[])
if ((iev_frontend = malloc(sizeof(struct imsgev))) == NULL ||
(iev_engine = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsg_init(&iev_frontend->ibuf, pipe_main2frontend[0]);
+ imsgbuf_init(&iev_frontend->ibuf, pipe_main2frontend[0]);
iev_frontend->handler = main_dispatch_frontend;
- imsg_init(&iev_engine->ibuf, pipe_main2engine[0]);
+ imsgbuf_init(&iev_engine->ibuf, pipe_main2engine[0]);
iev_engine->handler = main_dispatch_engine;
/* Setup event handlers for pipes to engine & frontend. */
@@ -444,17 +444,17 @@ main_dispatch_frontend(int fd, short event, void *bula)
ibuf = &iev->ibuf;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -526,17 +526,17 @@ main_dispatch_engine(int fd, short event, void *bula)
ibuf = &iev->ibuf;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -698,11 +698,11 @@ main_imsg_send_ipc_sockets(struct imsgbuf *frontend_buf,
if (imsg_compose(frontend_buf, IMSG_SOCKET_IPC, 0, 0,
pipe_frontend2engine[0], NULL, 0) == -1)
return (-1);
- imsg_flush(frontend_buf);
+ imsgbuf_flush(frontend_buf);
if (imsg_compose(engine_buf, IMSG_SOCKET_IPC, 0, 0,
pipe_frontend2engine[1], NULL, 0) == -1)
return (-1);
- imsg_flush(engine_buf);
+ imsgbuf_flush(engine_buf);
return (0);
}
diff --git a/sbin/dhcpleased/engine.c b/sbin/dhcpleased/engine.c
index 44567694176..d0c54f65f0d 100644
--- a/sbin/dhcpleased/engine.c
+++ b/sbin/dhcpleased/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.51 2024/11/21 13:14:44 claudio Exp $ */
+/* $OpenBSD: engine.c,v 1.52 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -226,7 +226,7 @@ engine(int debug, int verbose)
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsg_init(&iev_main->ibuf, 3);
+ imsgbuf_init(&iev_main->ibuf, 3);
iev_main->handler = engine_dispatch_main;
/* Setup event handlers. */
@@ -289,17 +289,17 @@ engine_dispatch_frontend(int fd, short event, void *bula)
uint32_t if_index, type;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -406,17 +406,17 @@ engine_dispatch_main(int fd, short event, void *bula)
int shut = 0;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -446,7 +446,7 @@ engine_dispatch_main(int fd, short event, void *bula)
if (iev_frontend == NULL)
fatal(NULL);
- imsg_init(&iev_frontend->ibuf, fd);
+ imsgbuf_init(&iev_frontend->ibuf, fd);
iev_frontend->handler = engine_dispatch_frontend;
iev_frontend->events = EV_READ;
diff --git a/sbin/dhcpleased/frontend.c b/sbin/dhcpleased/frontend.c
index a9df813375c..9663ba7ebbc 100644
--- a/sbin/dhcpleased/frontend.c
+++ b/sbin/dhcpleased/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.41 2024/11/21 13:14:44 claudio Exp $ */
+/* $OpenBSD: frontend.c,v 1.42 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -177,7 +177,7 @@ frontend(int debug, int verbose)
/* Setup pipe and event handler to the parent process. */
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsg_init(&iev_main->ibuf, 3);
+ imsgbuf_init(&iev_main->ibuf, 3);
iev_main->handler = frontend_dispatch_main;
iev_main->events = EV_READ;
event_set(&iev_main->ev, iev_main->ibuf.fd, iev_main->events,
@@ -194,10 +194,10 @@ __dead void
frontend_shutdown(void)
{
/* Close pipes. */
- imsg_write(&iev_engine->ibuf);
+ imsgbuf_write(&iev_engine->ibuf);
msgbuf_clear(&iev_engine->ibuf.w);
close(iev_engine->ibuf.fd);
- imsg_write(&iev_main->ibuf);
+ imsgbuf_write(&iev_main->ibuf);
msgbuf_clear(&iev_main->ibuf.w);
close(iev_main->ibuf.fd);
@@ -242,17 +242,17 @@ frontend_dispatch_main(int fd, short event, void *bula)
int shut = 0, bpfsock, if_index, udpsock;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -283,7 +283,7 @@ frontend_dispatch_main(int fd, short event, void *bula)
if (iev_engine == NULL)
fatal(NULL);
- imsg_init(&iev_engine->ibuf, fd);
+ imsgbuf_init(&iev_engine->ibuf, fd);
iev_engine->handler = frontend_dispatch_engine;
iev_engine->events = EV_READ;
@@ -485,17 +485,17 @@ frontend_dispatch_engine(int fd, short event, void *bula)
int shut = 0;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
diff --git a/sbin/iked/control.c b/sbin/iked/control.c
index 854a1aab9d5..b59e4d8450c 100644
--- a/sbin/iked/control.c
+++ b/sbin/iked/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.41 2024/11/21 13:14:44 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.42 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -191,7 +191,7 @@ control_accept(int listenfd, short event, void *arg)
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;
@@ -261,14 +261,14 @@ control_dispatch_imsg(int fd, short event, void *arg)
}
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;
}
diff --git a/sbin/iked/proc.c b/sbin/iked/proc.c
index e3f9774de40..a6bc9c3e4b3 100644
--- a/sbin/iked/proc.c
+++ b/sbin/iked/proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.c,v 1.47 2024/11/21 13:14:44 claudio Exp $ */
+/* $OpenBSD: proc.c,v 1.48 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
@@ -162,7 +162,8 @@ proc_connect(struct privsep *ps, void (*connected)(struct privsep *))
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);
@@ -292,7 +293,7 @@ proc_accept(struct privsep *ps, int fd, enum privsep_procid dst,
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);
}
@@ -322,7 +323,7 @@ proc_setup(struct privsep *ps, struct privsep_proc *procs, unsigned int nproc)
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;
@@ -451,7 +452,7 @@ proc_open(struct privsep *ps, int src, int dst)
*/
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__);
}
}
}
@@ -477,7 +478,7 @@ proc_close(struct privsep *ps)
/* 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;
}
@@ -616,8 +617,8 @@ proc_dispatch(int fd, short event, void *arg)
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);
@@ -627,13 +628,13 @@ proc_dispatch(int fd, short event, void *arg)
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) { /* Connection closed. */
event_del(&iev->ev);
event_loopexit(NULL);
return;
} else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -726,7 +727,7 @@ void
imsg_event_add(struct imsgev *iev)
{
if (iev->handler == NULL) {
- imsg_flush(&iev->ibuf);
+ imsgbuf_flush(&iev->ibuf);
return;
}
@@ -860,7 +861,7 @@ proc_flush_imsg(struct privsep *ps, enum privsep_procid id, int n)
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]);
}
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c
index 943b2fe7fad..a8c9c1b6555 100644
--- a/sbin/mountd/mountd.c
+++ b/sbin/mountd/mountd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mountd.c,v 1.93 2024/11/04 21:59:15 jca Exp $ */
+/* $OpenBSD: mountd.c,v 1.94 2024/11/21 13:17:01 claudio Exp $ */
/* $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */
/*
@@ -321,7 +321,7 @@ main(int argc, char *argv[])
}
signal(SIGTERM, (void (*)(int)) send_umntall);
- imsg_init(&ibuf, socks[0]);
+ imsgbuf_init(&ibuf, socks[0]);
setproctitle("parent");
if (debug)
@@ -370,7 +370,7 @@ privchild(int sock)
char *path;
int error, size;
- imsg_init(&ibuf, sock);
+ imsgbuf_init(&ibuf, sock);
setproctitle("[priv]");
fp = NULL;
@@ -398,9 +398,9 @@ privchild(int sock)
if (!(pfd[0].revents & POLLIN))
continue;
- switch (imsg_read(&ibuf)) {
+ switch (imsgbuf_read(&ibuf)) {
case -1:
- syslog(LOG_ERR, "imsg_read: %m");
+ syslog(LOG_ERR, "imsgbuf_read: %m");
_exit(1);
case 0:
syslog(LOG_ERR, "Socket disconnected");
@@ -623,9 +623,9 @@ recv_imsg(struct imsg *imsg)
{
ssize_t n;
- n = imsg_read(&ibuf);
+ n = imsgbuf_read(&ibuf);
if (n == -1) {
- syslog(LOG_ERR, "imsg_read: %m");
+ syslog(LOG_ERR, "imsgbuf_read: %m");
return (-1);
}
if (n == 0) {
@@ -656,8 +656,8 @@ send_imsg(u_int32_t type, void *data, u_int16_t size)
return (-1);
}
- if (imsg_flush(&ibuf) == -1) {
- syslog(LOG_ERR, "imsg_flush: %m");
+ if (imsgbuf_flush(&ibuf) == -1) {
+ syslog(LOG_ERR, "imsgbuf_flush: %m");
return (-1);
}
diff --git a/sbin/slaacd/control.c b/sbin/slaacd/control.c
index 15cd39a5810..6fbb2822350 100644
--- a/sbin/slaacd/control.c
+++ b/sbin/slaacd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.13 2024/11/21 13:14:44 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.14 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -157,7 +157,7 @@ control_accept(int listenfd, short event, void *bula)
return;
}
- imsg_init(&c->iev.ibuf, connfd);
+ imsgbuf_init(&c->iev.ibuf, connfd);
c->iev.handler = control_dispatch_imsg;
c->iev.events = EV_READ;
event_set(&c->iev.ev, c->iev.ibuf.fd, c->iev.events,
@@ -234,14 +234,14 @@ control_dispatch_imsg(int fd, short event, void *bula)
}
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);
return;
}
}
if (event & EV_WRITE) {
- if (imsg_write(&c->iev.ibuf) == -1) {
+ if (imsgbuf_write(&c->iev.ibuf) == -1) {
control_close(fd);
return;
}
diff --git a/sbin/slaacd/engine.c b/sbin/slaacd/engine.c
index 933743ab6e2..fc06a319e1d 100644
--- a/sbin/slaacd/engine.c
+++ b/sbin/slaacd/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.95 2024/11/21 13:14:44 claudio Exp $ */
+/* $OpenBSD: engine.c,v 1.96 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -396,7 +396,7 @@ engine(int debug, int verbose)
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsg_init(&iev_main->ibuf, 3);
+ imsgbuf_init(&iev_main->ibuf, 3);
iev_main->handler = engine_dispatch_main;
/* Setup event handlers. */
@@ -465,17 +465,17 @@ engine_dispatch_frontend(int fd, short event, void *bula)
uint32_t if_index, type;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -633,17 +633,17 @@ engine_dispatch_main(int fd, short event, void *bula)
int shut = 0;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -673,7 +673,7 @@ engine_dispatch_main(int fd, short event, void *bula)
if (iev_frontend == NULL)
fatal(NULL);
- imsg_init(&iev_frontend->ibuf, fd);
+ imsgbuf_init(&iev_frontend->ibuf, fd);
iev_frontend->handler = engine_dispatch_frontend;
iev_frontend->events = EV_READ;
diff --git a/sbin/slaacd/frontend.c b/sbin/slaacd/frontend.c
index de551a42a4e..02f2dfbbfe0 100644
--- a/sbin/slaacd/frontend.c
+++ b/sbin/slaacd/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.70 2024/11/21 13:14:44 claudio Exp $ */
+/* $OpenBSD: frontend.c,v 1.71 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -179,7 +179,7 @@ frontend(int debug, int verbose)
/* Setup pipe and event handler to the parent process. */
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsg_init(&iev_main->ibuf, 3);
+ imsgbuf_init(&iev_main->ibuf, 3);
iev_main->handler = frontend_dispatch_main;
iev_main->events = EV_READ;
event_set(&iev_main->ev, iev_main->ibuf.fd, iev_main->events,
@@ -245,10 +245,10 @@ __dead void
frontend_shutdown(void)
{
/* Close pipes. */
- imsg_write(&iev_engine->ibuf);
+ imsgbuf_write(&iev_engine->ibuf);
msgbuf_clear(&iev_engine->ibuf.w);
close(iev_engine->ibuf.fd);
- imsg_write(&iev_main->ibuf);
+ imsgbuf_write(&iev_main->ibuf);
msgbuf_clear(&iev_main->ibuf.w);
close(iev_main->ibuf.fd);
@@ -286,17 +286,17 @@ frontend_dispatch_main(int fd, short event, void *bula)
int shut = 0, icmp6sock, rdomain;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -327,7 +327,7 @@ frontend_dispatch_main(int fd, short event, void *bula)
if (iev_engine == NULL)
fatal(NULL);
- imsg_init(&iev_engine->ibuf, fd);
+ imsgbuf_init(&iev_engine->ibuf, fd);
iev_engine->handler = frontend_dispatch_engine;
iev_engine->events = EV_READ;
@@ -398,17 +398,17 @@ frontend_dispatch_engine(int fd, short event, void *bula)
uint32_t if_index, type;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
diff --git a/sbin/slaacd/slaacd.c b/sbin/slaacd/slaacd.c
index b53371de7cb..71e43759814 100644
--- a/sbin/slaacd/slaacd.c
+++ b/sbin/slaacd/slaacd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slaacd.c,v 1.74 2024/11/21 13:14:44 claudio Exp $ */
+/* $OpenBSD: slaacd.c,v 1.75 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -230,9 +230,9 @@ main(int argc, char *argv[])
if ((iev_frontend = malloc(sizeof(struct imsgev))) == NULL ||
(iev_engine = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsg_init(&iev_frontend->ibuf, pipe_main2frontend[0]);
+ imsgbuf_init(&iev_frontend->ibuf, pipe_main2frontend[0]);
iev_frontend->handler = main_dispatch_frontend;
- imsg_init(&iev_engine->ibuf, pipe_main2engine[0]);
+ imsgbuf_init(&iev_engine->ibuf, pipe_main2engine[0]);
iev_engine->handler = main_dispatch_engine;
/* Setup event handlers for pipes to engine & frontend. */
@@ -391,17 +391,17 @@ main_dispatch_frontend(int fd, short event, void *bula)
ibuf = &iev->ibuf;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -472,17 +472,17 @@ main_dispatch_engine(int fd, short event, void *bula)
ibuf = &iev->ibuf;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -614,11 +614,11 @@ main_imsg_send_ipc_sockets(struct imsgbuf *frontend_buf,
if (imsg_compose(frontend_buf, IMSG_SOCKET_IPC, 0, 0,
pipe_frontend2engine[0], NULL, 0) == -1)
return (-1);
- imsg_flush(frontend_buf);
+ imsgbuf_flush(frontend_buf);
if (imsg_compose(engine_buf, IMSG_SOCKET_IPC, 0, 0,
pipe_frontend2engine[1], NULL, 0) == -1)
return (-1);
- imsg_flush(engine_buf);
+ imsgbuf_flush(engine_buf);
return (0);
}
diff --git a/sbin/unwind/control.c b/sbin/unwind/control.c
index abea0bae0b1..1284783e49e 100644
--- a/sbin/unwind/control.c
+++ b/sbin/unwind/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.19 2024/11/21 13:14:45 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.20 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -156,7 +156,7 @@ control_accept(int listenfd, short event, void *bula)
return;
}
- imsg_init(&c->iev.ibuf, connfd);
+ imsgbuf_init(&c->iev.ibuf, connfd);
c->iev.handler = control_dispatch_imsg;
c->iev.events = EV_READ;
event_set(&c->iev.ev, c->iev.ibuf.fd, c->iev.events, c->iev.handler,
@@ -233,14 +233,14 @@ control_dispatch_imsg(int fd, short event, void *bula)
}
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);
return;
}
}
if (event & EV_WRITE) {
- if (imsg_write(&c->iev.ibuf) == -1) {
+ if (imsgbuf_write(&c->iev.ibuf) == -1) {
control_close(fd);
return;
}
diff --git a/sbin/unwind/frontend.c b/sbin/unwind/frontend.c
index bf731bf637e..8373d112e4e 100644
--- a/sbin/unwind/frontend.c
+++ b/sbin/unwind/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.85 2024/11/21 13:14:45 claudio Exp $ */
+/* $OpenBSD: frontend.c,v 1.86 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -233,7 +233,7 @@ frontend(int debug, int verbose)
fatal("iev_main");
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsg_init(&iev_main->ibuf, 3);
+ imsgbuf_init(&iev_main->ibuf, 3);
iev_main->handler = frontend_dispatch_main;
iev_main->events = EV_READ;
event_set(&iev_main->ev, iev_main->ibuf.fd, iev_main->events,
@@ -271,10 +271,10 @@ __dead void
frontend_shutdown(void)
{
/* Close pipes. */
- imsg_write(&iev_resolver->ibuf);
+ imsgbuf_write(&iev_resolver->ibuf);
msgbuf_clear(&iev_resolver->ibuf.w);
close(iev_resolver->ibuf.fd);
- imsg_write(&iev_main->ibuf);
+ imsgbuf_write(&iev_main->ibuf);
msgbuf_clear(&iev_main->ibuf.w);
close(iev_main->ibuf.fd);
@@ -311,17 +311,17 @@ frontend_dispatch_main(int fd, short event, void *bula)
int n, shut = 0;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -355,7 +355,7 @@ frontend_dispatch_main(int fd, short event, void *bula)
if (iev_resolver == NULL)
fatal(NULL);
- imsg_init(&iev_resolver->ibuf, fd);
+ imsgbuf_init(&iev_resolver->ibuf, fd);
iev_resolver->handler = frontend_dispatch_resolver;
iev_resolver->events = EV_READ;
@@ -492,17 +492,17 @@ frontend_dispatch_resolver(int fd, short event, void *bula)
int n, shut = 0, chg;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
diff --git a/sbin/unwind/resolver.c b/sbin/unwind/resolver.c
index e510fb98f2c..9485c28a8ba 100644
--- a/sbin/unwind/resolver.c
+++ b/sbin/unwind/resolver.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resolver.c,v 1.169 2024/11/21 13:14:45 claudio Exp $ */
+/* $OpenBSD: resolver.c,v 1.170 2024/11/21 13:17:01 claudio Exp $ */
/*
@@ -415,7 +415,7 @@ resolver(int debug, int verbose)
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsg_init(&iev_main->ibuf, 3);
+ imsgbuf_init(&iev_main->ibuf, 3);
iev_main->handler = resolver_dispatch_main;
/* Setup event handlers. */
@@ -495,17 +495,17 @@ resolver_dispatch_frontend(int fd, short event, void *bula)
ibuf = &iev->ibuf;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -633,17 +633,17 @@ resolver_dispatch_main(int fd, short event, void *bula)
ibuf = &iev->ibuf;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -671,7 +671,7 @@ resolver_dispatch_main(int fd, short event, void *bula)
if (iev_frontend == NULL)
fatal(NULL);
- imsg_init(&iev_frontend->ibuf, fd);
+ imsgbuf_init(&iev_frontend->ibuf, fd);
iev_frontend->handler = resolver_dispatch_frontend;
iev_frontend->events = EV_READ;
diff --git a/sbin/unwind/unwind.c b/sbin/unwind/unwind.c
index b2217bb7faf..7cfe6a77d57 100644
--- a/sbin/unwind/unwind.c
+++ b/sbin/unwind/unwind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unwind.c,v 1.70 2024/11/21 13:14:45 claudio Exp $ */
+/* $OpenBSD: unwind.c,v 1.71 2024/11/21 13:17:01 claudio Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -239,9 +239,9 @@ main(int argc, char *argv[])
if ((iev_frontend = malloc(sizeof(struct imsgev))) == NULL ||
(iev_resolver = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsg_init(&iev_frontend->ibuf, pipe_main2frontend[0]);
+ imsgbuf_init(&iev_frontend->ibuf, pipe_main2frontend[0]);
iev_frontend->handler = main_dispatch_frontend;
- imsg_init(&iev_resolver->ibuf, pipe_main2resolver[0]);
+ imsgbuf_init(&iev_resolver->ibuf, pipe_main2resolver[0]);
iev_resolver->handler = main_dispatch_resolver;
/* Setup event handlers for pipes. */
@@ -398,17 +398,17 @@ main_dispatch_frontend(int fd, short event, void *bula)
ibuf = &iev->ibuf;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}
@@ -463,17 +463,17 @@ main_dispatch_resolver(int fd, short event, void *bula)
ibuf = &iev->ibuf;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_read error");
+ if ((n = imsgbuf_read(ibuf)) == -1 && errno != EAGAIN)
+ fatal("imsgbuf_read error");
if (n == 0) /* Connection closed. */
shut = 1;
}
if (event & EV_WRITE) {
- if (imsg_write(ibuf) == -1) {
+ if (imsgbuf_write(ibuf) == -1) {
if (errno == EPIPE) /* Connection closed. */
shut = 1;
else
- fatal("imsg_write");
+ fatal("imsgbuf_write");
}
}