diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2024-11-21 13:17:04 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2024-11-21 13:17:04 +0000 |
commit | caba869c8447fc7ef9f32581e1d02262e51ec18a (patch) | |
tree | c06988b36b6677e805071a9673b04b5360e2e36d /usr.sbin/ldpd | |
parent | 9c8d00dd06d79ba9fccf07c45cd1bdae73e744c5 (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 'usr.sbin/ldpd')
-rw-r--r-- | usr.sbin/ldpd/control.c | 10 | ||||
-rw-r--r-- | usr.sbin/ldpd/lde.c | 22 | ||||
-rw-r--r-- | usr.sbin/ldpd/ldpd.c | 22 | ||||
-rw-r--r-- | usr.sbin/ldpd/ldpe.c | 26 |
4 files changed, 40 insertions, 40 deletions
diff --git a/usr.sbin/ldpd/control.c b/usr.sbin/ldpd/control.c index 9ad6eb58f55..4a2ce22ae52 100644 --- a/usr.sbin/ldpd/control.c +++ b/usr.sbin/ldpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.34 2024/11/21 13:16:07 claudio Exp $ */ +/* $OpenBSD: control.c,v 1.35 2024/11/21 13:17:02 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -133,7 +133,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, @@ -203,14 +203,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/usr.sbin/ldpd/lde.c b/usr.sbin/ldpd/lde.c index 97bfc2c3920..2b5940f3455 100644 --- a/usr.sbin/ldpd/lde.c +++ b/usr.sbin/ldpd/lde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lde.c,v 1.80 2024/11/21 13:16:07 claudio Exp $ */ +/* $OpenBSD: lde.c,v 1.81 2024/11/21 13:17:02 claudio Exp $ */ /* * Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org> @@ -128,7 +128,7 @@ lde(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 = lde_dispatch_parent; iev_main->events = EV_READ; event_set(&iev_main->ev, iev_main->ibuf.fd, iev_main->events, @@ -198,17 +198,17 @@ lde_dispatch_imsg(int fd, short event, void *bula) int shut = 0, verbose; 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"); } } @@ -395,17 +395,17 @@ lde_dispatch_parent(int fd, short event, void *bula) struct fec fec; 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"); } } @@ -464,7 +464,7 @@ lde_dispatch_parent(int fd, short event, void *bula) if ((iev_ldpe = malloc(sizeof(struct imsgev))) == NULL) fatal(NULL); - imsg_init(&iev_ldpe->ibuf, fd); + imsgbuf_init(&iev_ldpe->ibuf, fd); iev_ldpe->handler = lde_dispatch_imsg; iev_ldpe->events = EV_READ; event_set(&iev_ldpe->ev, iev_ldpe->ibuf.fd, diff --git a/usr.sbin/ldpd/ldpd.c b/usr.sbin/ldpd/ldpd.c index f51d4886934..64cbde25732 100644 --- a/usr.sbin/ldpd/ldpd.c +++ b/usr.sbin/ldpd/ldpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldpd.c,v 1.71 2024/11/21 13:16:07 claudio Exp $ */ +/* $OpenBSD: ldpd.c,v 1.72 2024/11/21 13:17:02 claudio Exp $ */ /* * Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org> @@ -242,9 +242,9 @@ main(int argc, char *argv[]) if ((iev_ldpe = malloc(sizeof(struct imsgev))) == NULL || (iev_lde = malloc(sizeof(struct imsgev))) == NULL) fatal(NULL); - imsg_init(&iev_ldpe->ibuf, pipe_parent2ldpe[0]); + imsgbuf_init(&iev_ldpe->ibuf, pipe_parent2ldpe[0]); iev_ldpe->handler = main_dispatch_ldpe; - imsg_init(&iev_lde->ibuf, pipe_parent2lde[0]); + imsgbuf_init(&iev_lde->ibuf, pipe_parent2lde[0]); iev_lde->handler = main_dispatch_lde; /* setup event handler */ @@ -379,17 +379,17 @@ main_dispatch_ldpe(int fd, short event, void *bula) int shut = 0, verbose; 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"); } } @@ -460,17 +460,17 @@ main_dispatch_lde(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/usr.sbin/ldpd/ldpe.c b/usr.sbin/ldpd/ldpe.c index be154d0bb83..3705b0cef70 100644 --- a/usr.sbin/ldpd/ldpe.c +++ b/usr.sbin/ldpd/ldpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldpe.c,v 1.84 2024/11/21 13:16:07 claudio Exp $ */ +/* $OpenBSD: ldpe.c,v 1.85 2024/11/21 13:17:02 claudio Exp $ */ /* * Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org> @@ -123,7 +123,7 @@ ldpe(int debug, int verbose, char *sockname) /* 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 = ldpe_dispatch_main; iev_main->events = EV_READ; event_set(&iev_main->ev, iev_main->ibuf.fd, iev_main->events, @@ -159,10 +159,10 @@ ldpe_shutdown(void) struct adj *adj; /* close pipes */ - imsg_write(&iev_lde->ibuf); + imsgbuf_write(&iev_lde->ibuf); msgbuf_clear(&iev_lde->ibuf.w); close(iev_lde->ibuf.fd); - imsg_write(&iev_main->ibuf); + imsgbuf_write(&iev_main->ibuf); msgbuf_clear(&iev_main->ibuf.w); close(iev_main->ibuf.fd); @@ -231,17 +231,17 @@ ldpe_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"); } } @@ -306,7 +306,7 @@ ldpe_dispatch_main(int fd, short event, void *bula) if ((iev_lde = malloc(sizeof(struct imsgev))) == NULL) fatal(NULL); - imsg_init(&iev_lde->ibuf, fd); + imsgbuf_init(&iev_lde->ibuf, fd); iev_lde->handler = ldpe_dispatch_lde; iev_lde->events = EV_READ; event_set(&iev_lde->ev, iev_lde->ibuf.fd, @@ -497,17 +497,17 @@ ldpe_dispatch_lde(int fd, short event, void *bula) struct nbr *nbr = NULL; 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"); } } |