summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-03-24 09:34:13 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-03-24 09:34:13 +0000
commit375d6fccc1a672837da55cbe975272d7247135d9 (patch)
tree5441bc8dc42d19d7c374707155a0f7bca1388e12 /lib
parentf45e8690cee77dec1a8149be7b9935b3d17c0920 (diff)
Use C99 types (uint32_t) instead of BSD (u_int32_t) - the former are
more portable. Add stdint.h to the headers in imsg_init(3). No objections from millert@.
Diffstat (limited to 'lib')
-rw-r--r--lib/libutil/imsg.c18
-rw-r--r--lib/libutil/imsg.h27
-rw-r--r--lib/libutil/imsg_init.329
3 files changed, 37 insertions, 37 deletions
diff --git a/lib/libutil/imsg.c b/lib/libutil/imsg.c
index 9047997c156..ab9ef851ce2 100644
--- a/lib/libutil/imsg.c
+++ b/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 <henning@openbsd.org>
@@ -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/lib/libutil/imsg.h b/lib/libutil/imsg.h
index 89946578b90..8bf9414789b 100644
--- a/lib/libutil/imsg.h
+++ b/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 <pyr@openbsd.org>
@@ -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/lib/libutil/imsg_init.3 b/lib/libutil/imsg_init.3
index 995b137fc63..25b5f549664 100644
--- a/lib/libutil/imsg_init.3
+++ b/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 <nicm@openbsd.org>
.\"
@@ -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