From: eric Date: Thu, 26 Dec 2013 17:32:33 +0000 (+0000) Subject: constify data parameter in imsg_add() and imsg_compose() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=632fe4478f93fc12553795a91c4e5fb6d793da79;p=openbsd constify data parameter in imsg_add() and imsg_compose() ok deraadt@ --- diff --git a/lib/libutil/imsg.c b/lib/libutil/imsg.c index e2d0ee5c3be..7751cad1871 100644 --- a/lib/libutil/imsg.c +++ b/lib/libutil/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.4 2013/02/01 15:22:18 gilles Exp $ */ +/* $OpenBSD: imsg.c,v 1.5 2013/12/26 17:32:33 eric Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -164,7 +164,7 @@ 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, void *data, u_int16_t datalen) + pid_t pid, int fd, const void *data, u_int16_t datalen) { struct ibuf *wbuf; @@ -234,7 +234,7 @@ imsg_create(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, } int -imsg_add(struct ibuf *msg, void *data, u_int16_t datalen) +imsg_add(struct ibuf *msg, const void *data, u_int16_t datalen) { if (datalen) if (ibuf_add(msg, data, datalen) == -1) { diff --git a/lib/libutil/imsg.h b/lib/libutil/imsg.h index d691f7d36f3..89946578b90 100644 --- a/lib/libutil/imsg.h +++ b/lib/libutil/imsg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.h,v 1.2 2010/06/23 07:53:55 nicm Exp $ */ +/* $OpenBSD: imsg.h,v 1.3 2013/12/26 17:32:33 eric Exp $ */ /* * Copyright (c) 2006, 2007 Pierre-Yves Ritschard @@ -98,12 +98,12 @@ 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, void *, u_int16_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 *, void *, u_int16_t); +int imsg_add(struct ibuf *, const void *, u_int16_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 bac4a09d1cc..6c859b2ef52 100644 --- a/lib/libutil/imsg_init.3 +++ b/lib/libutil/imsg_init.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: imsg_init.3,v 1.10 2013/11/13 21:04:46 benno Exp $ +.\" $OpenBSD: imsg_init.3,v 1.11 2013/12/26 17:32:33 eric 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: November 13 2013 $ +.Dd $Mdocdate: December 26 2013 $ .Dt IMSG_INIT 3 .Os .Sh NAME @@ -57,7 +57,7 @@ .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" "void *data" "u_int16_t datalen" + "pid_t pid" "int fd" "const void *data" "u_int16_t datalen" .Ft int .Fn imsg_composev "struct imsgbuf *ibuf" "u_int32_t type" "u_int32_t peerid" \ "pid_t pid" "int fd" "const struct iovec *iov" "int iovcnt" @@ -65,7 +65,7 @@ .Fn imsg_create "struct imsgbuf *ibuf" "u_int32_t type" "u_int32_t peerid" \ "pid_t pid" "u_int16_t datalen" .Ft int -.Fn imsg_add "struct ibuf *buf" "void *data" "u_int16_t datalen" +.Fn imsg_add "struct ibuf *buf" "const void *data" "u_int16_t datalen" .Ft void .Fn imsg_close "struct imsgbuf *ibuf" "struct ibuf *msg" .Ft void