From: Claudio Jeker Subject: snmpd: use imsg_get_fd() To: tech@openbsd.org Date: Tue, 16 Jan 2024 12:27:50 +0100 Convert snmpd to use imsg_get_fd(). Remove proc_forward_imsg() since this function is not used by snmpd. OK? -- :wq Claudio Index: snmpd/proc.c =================================================================== RCS file: /cvs/src/usr.sbin/snmpd/proc.c,v diff -u -p -r1.29 proc.c --- snmpd/proc.c 21 Dec 2023 12:43:31 -0000 1.29 +++ snmpd/proc.c 27 Dec 2023 11:45:49 -0000 @@ -644,7 +644,7 @@ proc_dispatch(int fd, short event, void 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: @@ -768,14 +768,6 @@ proc_composev(struct privsep *ps, enum p uint16_t type, const struct iovec *iov, int iovcnt) { 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 * Index: snmpd/snmpd.h =================================================================== RCS file: /cvs/src/usr.sbin/snmpd/snmpd.h,v diff -u -p -r1.116 snmpd.h --- snmpd/snmpd.h 21 Dec 2023 13:54:05 -0000 1.116 +++ snmpd/snmpd.h 27 Dec 2023 11:45:49 -0000 @@ -506,8 +506,6 @@ int proc_composev_imsg(struct privsep * 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 * Index: snmpd/snmpe.c =================================================================== RCS file: /cvs/src/usr.sbin/snmpd/snmpe.c,v diff -u -p -r1.93 snmpe.c --- snmpd/snmpe.c 21 Dec 2023 12:43:31 -0000 1.93 +++ snmpd/snmpe.c 27 Dec 2023 11:45:49 -0000 @@ -138,7 +138,7 @@ snmpe_dispatch_parent(int fd, struct pri { 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;