From d11817a0e54cc95e864ab36a4e979622a46ba263 Mon Sep 17 00:00:00 2001 From: eric <> Date: Sat, 6 Jun 2009 22:11:25 +0000 Subject: [PATCH] change the imsg header fields a bit to prepare for upcoming changes. add a flag field, use u_int32_t for pid_t and extend type to 32 bits for padding. ok pyr@ --- src/usr.sbin/ntpd/imsg.c | 9 +++++---- src/usr.sbin/ntpd/imsg.h | 13 +++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/usr.sbin/ntpd/imsg.c b/src/usr.sbin/ntpd/imsg.c index efe3e3a4..0815b1c6 100644 --- a/src/usr.sbin/ntpd/imsg.c +++ b/src/usr.sbin/ntpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.13 2009/06/06 18:14:25 pyr Exp $ */ +/* $OpenBSD: imsg.c,v 1.14 2009/06/06 22:11:25 eric Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -125,7 +125,7 @@ imsg_get(struct imsgbuf *ibuf, struct imsg *imsg) } int -imsg_compose(struct imsgbuf *ibuf, u_int16_t type, u_int32_t peerid, +imsg_compose(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, pid_t pid, int fd, void *data, u_int16_t datalen) { struct buf *wbuf; @@ -144,7 +144,7 @@ imsg_compose(struct imsgbuf *ibuf, u_int16_t type, u_int32_t peerid, } int -imsg_composev(struct imsgbuf *ibuf, u_int16_t type, u_int32_t peerid, +imsg_composev(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, pid_t pid, int fd, const struct iovec *iov, int iovcnt) { struct buf *wbuf; @@ -169,7 +169,7 @@ imsg_composev(struct imsgbuf *ibuf, u_int16_t type, u_int32_t peerid, /* ARGSUSED */ struct buf * -imsg_create(struct imsgbuf *ibuf, u_int16_t type, u_int32_t peerid, +imsg_create(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, pid_t pid, u_int16_t datalen) { struct buf *wbuf; @@ -182,6 +182,7 @@ imsg_create(struct imsgbuf *ibuf, u_int16_t type, u_int32_t peerid, } hdr.type = type; + hdr.flags = 0; hdr.peerid = peerid; if ((hdr.pid = pid) == 0) hdr.pid = ibuf->pid; diff --git a/src/usr.sbin/ntpd/imsg.h b/src/usr.sbin/ntpd/imsg.h index 10559d45..f70ddb04 100644 --- a/src/usr.sbin/ntpd/imsg.h +++ b/src/usr.sbin/ntpd/imsg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.h,v 1.1 2009/06/06 18:14:25 pyr Exp $ */ +/* $OpenBSD: imsg.h,v 1.2 2009/06/06 22:11:25 eric Exp $ */ /* * Copyright (c) 2006, 2007 Pierre-Yves Ritschard @@ -60,10 +60,11 @@ struct imsgbuf { }; struct imsg_hdr { - u_int16_t type; + u_int32_t type; u_int16_t len; + u_int16_t flags; u_int32_t peerid; - pid_t pid; + u_int32_t pid; }; struct imsg { @@ -91,11 +92,11 @@ int msgbuf_write(struct msgbuf *); void imsg_init(struct imsgbuf *, int); ssize_t imsg_read(struct imsgbuf *); ssize_t imsg_get(struct imsgbuf *, struct imsg *); -int imsg_compose(struct imsgbuf *, u_int16_t, u_int32_t, pid_t, +int imsg_compose(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, int, void *, u_int16_t); -int imsg_composev(struct imsgbuf *, u_int16_t, u_int32_t, pid_t, +int imsg_composev(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, int, const struct iovec *, int); -struct buf *imsg_create(struct imsgbuf *, u_int16_t, u_int32_t, pid_t, +struct buf *imsg_create(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, u_int16_t); int imsg_add(struct buf *, void *, u_int16_t); void imsg_close(struct imsgbuf *, struct buf *);