From e60163e5c7040e6c02e86c44b0ef4db63fac35d9 Mon Sep 17 00:00:00 2001 From: claudio Date: Tue, 16 Jan 2024 13:33:12 +0000 Subject: [PATCH] Convert to imsg_get_fd() and remove unused proc_forward_imsg(). OK martijn@ --- usr.sbin/snmpd/proc.c | 12 ++---------- usr.sbin/snmpd/snmpd.h | 4 +--- usr.sbin/snmpd/snmpe.c | 4 ++-- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/usr.sbin/snmpd/proc.c b/usr.sbin/snmpd/proc.c index 94a78a9a778..941857b7124 100644 --- a/usr.sbin/snmpd/proc.c +++ b/usr.sbin/snmpd/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.29 2023/12/21 12:43:31 martijn Exp $ */ +/* $OpenBSD: proc.c,v 1.30 2024/01/16 13:33:12 claudio Exp $ */ /* * Copyright (c) 2010 - 2016 Reyk Floeter @@ -644,7 +644,7 @@ proc_dispatch(int fd, short event, void *arg) case IMSG_CTL_PROCFD: IMSG_SIZE_CHECK(&imsg, &pf); memcpy(&pf, imsg.data, sizeof(pf)); - proc_accept(ps, imsg.fd, pf.pf_procid, + proc_accept(ps, imsg_get_fd(&imsg), pf.pf_procid, pf.pf_instance); break; default: @@ -770,14 +770,6 @@ proc_composev(struct privsep *ps, enum privsep_procid id, return (proc_composev_imsg(ps, id, -1, type, -1, -1, iov, iovcnt)); } -int -proc_forward_imsg(struct privsep *ps, struct imsg *imsg, - enum privsep_procid id, int n) -{ - return (proc_compose_imsg(ps, id, n, imsg->hdr.type, - imsg->hdr.peerid, imsg->fd, imsg->data, IMSG_DATA_SIZE(imsg))); -} - struct imsgbuf * proc_ibuf(struct privsep *ps, enum privsep_procid id, int n) { diff --git a/usr.sbin/snmpd/snmpd.h b/usr.sbin/snmpd/snmpd.h index 8582abe017f..a25ad588083 100644 --- a/usr.sbin/snmpd/snmpd.h +++ b/usr.sbin/snmpd/snmpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpd.h,v 1.116 2023/12/21 13:54:05 martijn Exp $ */ +/* $OpenBSD: snmpd.h,v 1.117 2024/01/16 13:33:12 claudio Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -506,8 +506,6 @@ int proc_composev_imsg(struct privsep *, enum privsep_procid, int, u_int16_t, u_int32_t, int, const struct iovec *, int); int proc_composev(struct privsep *, enum privsep_procid, uint16_t, const struct iovec *, int); -int proc_forward_imsg(struct privsep *, struct imsg *, - enum privsep_procid, int); struct imsgbuf * proc_ibuf(struct privsep *, enum privsep_procid, int); struct imsgev * diff --git a/usr.sbin/snmpd/snmpe.c b/usr.sbin/snmpd/snmpe.c index 73e25ba32a0..055d11724d7 100644 --- a/usr.sbin/snmpd/snmpe.c +++ b/usr.sbin/snmpd/snmpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpe.c,v 1.93 2023/12/21 12:43:31 martijn Exp $ */ +/* $OpenBSD: snmpe.c,v 1.94 2024/01/16 13:33:13 claudio Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -138,7 +138,7 @@ snmpe_dispatch_parent(int fd, struct privsep_proc *p, struct imsg *imsg) { switch (imsg->hdr.type) { case IMSG_AX_FD: - appl_agentx_backend(imsg->fd); + appl_agentx_backend(imsg_get_fd(imsg)); return 0; default: return -1; -- 2.20.1