diff --git a/src/lib/libutil/imsg.c b/src/lib/libutil/imsg.c index 9047997c..ab9ef851 100644 --- a/src/lib/libutil/imsg.c +++ b/src/lib/libutil/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.13 2015/12/09 11:54:12 tb Exp $ */ +/* $OpenBSD: imsg.c,v 1.14 2017/03/24 09:34:12 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -163,8 +163,8 @@ imsg_get(struct imsgbuf *ibuf, struct imsg *imsg) } int -imsg_compose(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, - pid_t pid, int fd, const void *data, u_int16_t datalen) +imsg_compose(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid, pid_t pid, + int fd, const void *data, uint16_t datalen) { struct ibuf *wbuf; @@ -182,8 +182,8 @@ imsg_compose(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, } int -imsg_composev(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, - pid_t pid, int fd, const struct iovec *iov, int iovcnt) +imsg_composev(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid, pid_t pid, + int fd, const struct iovec *iov, int iovcnt) { struct ibuf *wbuf; int i, datalen = 0; @@ -207,8 +207,8 @@ imsg_composev(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, /* ARGSUSED */ struct ibuf * -imsg_create(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, - pid_t pid, u_int16_t datalen) +imsg_create(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid, pid_t pid, + uint16_t datalen) { struct ibuf *wbuf; struct imsg_hdr hdr; @@ -234,7 +234,7 @@ imsg_create(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, } int -imsg_add(struct ibuf *msg, const void *data, u_int16_t datalen) +imsg_add(struct ibuf *msg, const void *data, uint16_t datalen) { if (datalen) if (ibuf_add(msg, data, datalen) == -1) { @@ -255,7 +255,7 @@ imsg_close(struct imsgbuf *ibuf, struct ibuf *msg) if (msg->fd != -1) hdr->flags |= IMSGF_HASFD; - hdr->len = (u_int16_t)msg->wpos; + hdr->len = (uint16_t)msg->wpos; ibuf_close(&ibuf->w, msg); } diff --git a/src/lib/libutil/imsg.h b/src/lib/libutil/imsg.h index 89946578..8bf94147 100644 --- a/src/lib/libutil/imsg.h +++ b/src/lib/libutil/imsg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.h,v 1.3 2013/12/26 17:32:33 eric Exp $ */ +/* $OpenBSD: imsg.h,v 1.4 2017/03/24 09:34:12 nicm Exp $ */ /* * Copyright (c) 2006, 2007 Pierre-Yves Ritschard @@ -37,7 +37,7 @@ struct ibuf { struct msgbuf { TAILQ_HEAD(, ibuf) bufs; - u_int32_t queued; + uint32_t queued; int fd; }; @@ -63,11 +63,11 @@ struct imsgbuf { #define IMSGF_HASFD 1 struct imsg_hdr { - u_int32_t type; - u_int16_t len; - u_int16_t flags; - u_int32_t peerid; - u_int32_t pid; + uint32_t type; + uint16_t len; + uint16_t flags; + uint32_t peerid; + uint32_t pid; }; struct imsg { @@ -97,13 +97,12 @@ void msgbuf_drain(struct msgbuf *, size_t); 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_int32_t, u_int32_t, pid_t, - int, const void *, u_int16_t); -int imsg_composev(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, - int, const struct iovec *, int); -struct ibuf *imsg_create(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, - u_int16_t); -int imsg_add(struct ibuf *, const void *, u_int16_t); +int imsg_compose(struct imsgbuf *, uint32_t, uint32_t, pid_t, int, + const void *, uint16_t); +int imsg_composev(struct imsgbuf *, uint32_t, uint32_t, pid_t, int, + const struct iovec *, int); +struct ibuf *imsg_create(struct imsgbuf *, uint32_t, uint32_t, pid_t, uint16_t); +int imsg_add(struct ibuf *, const void *, uint16_t); void imsg_close(struct imsgbuf *, struct ibuf *); void imsg_free(struct imsg *); int imsg_flush(struct imsgbuf *); diff --git a/src/lib/libutil/imsg_init.3 b/src/lib/libutil/imsg_init.3 index 995b137f..25b5f549 100644 --- a/src/lib/libutil/imsg_init.3 +++ b/src/lib/libutil/imsg_init.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: imsg_init.3,v 1.17 2016/10/15 12:33:22 jmc Exp $ +.\" $OpenBSD: imsg_init.3,v 1.18 2017/03/24 09:34:12 nicm Exp $ .\" .\" Copyright (c) 2010 Nicholas Marriott .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: October 15 2016 $ +.Dd $Mdocdate: March 24 2017 $ .Dt IMSG_INIT 3 .Os .Sh NAME @@ -48,6 +48,7 @@ .In sys/types.h .In sys/queue.h .In sys/uio.h +.In stdint.h .In imsg.h .Ft void .Fn imsg_init "struct imsgbuf *ibuf" "int fd" @@ -56,16 +57,16 @@ .Ft ssize_t .Fn imsg_get "struct imsgbuf *ibuf" "struct imsg *imsg" .Ft int -.Fn imsg_compose "struct imsgbuf *ibuf" "u_int32_t type" "uint32_t peerid" \ - "pid_t pid" "int fd" "const void *data" "u_int16_t datalen" +.Fn imsg_compose "struct imsgbuf *ibuf" "uint32_t type" "uint32_t peerid" \ + "pid_t pid" "int fd" "const void *data" "uint16_t datalen" .Ft int -.Fn imsg_composev "struct imsgbuf *ibuf" "u_int32_t type" "u_int32_t peerid" \ +.Fn imsg_composev "struct imsgbuf *ibuf" "uint32_t type" "uint32_t peerid" \ "pid_t pid" "int fd" "const struct iovec *iov" "int iovcnt" .Ft "struct ibuf *" -.Fn imsg_create "struct imsgbuf *ibuf" "u_int32_t type" "u_int32_t peerid" \ - "pid_t pid" "u_int16_t datalen" +.Fn imsg_create "struct imsgbuf *ibuf" "uint32_t type" "uint32_t peerid" \ + "pid_t pid" "uint16_t datalen" .Ft int -.Fn imsg_add "struct ibuf *buf" "const void *data" "u_int16_t datalen" +.Fn imsg_add "struct ibuf *buf" "const void *data" "uint16_t datalen" .Ft void .Fn imsg_close "struct imsgbuf *ibuf" "struct ibuf *msg" .Ft void @@ -262,11 +263,11 @@ struct imsg { }; struct imsg_hdr { - u_int32_t type; - u_int16_t len; - u_int16_t flags; - u_int32_t peerid; - u_int32_t pid; + uint32_t type; + uint16_t len; + uint16_t flags; + uint32_t peerid; + uint32_t pid; }; .Ed .Pp @@ -329,7 +330,7 @@ struct ibuf { struct msgbuf { TAILQ_HEAD(, ibuf) bufs; - u_int32_t queued; + uint32_t queued; int fd; }; .Ed