|
@ -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> |
|
|
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> |
|
@ -163,8 +163,8 @@ imsg_get(struct imsgbuf *ibuf, struct imsg *imsg) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int |
|
|
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; |
|
|
struct ibuf *wbuf; |
|
|
|
|
|
|
|
@ -182,8 +182,8 @@ imsg_compose(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int |
|
|
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; |
|
|
struct ibuf *wbuf; |
|
|
int i, datalen = 0; |
|
|
int i, datalen = 0; |
|
@ -207,8 +207,8 @@ imsg_composev(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, |
|
|
|
|
|
|
|
|
/* ARGSUSED */ |
|
|
/* ARGSUSED */ |
|
|
struct ibuf * |
|
|
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 ibuf *wbuf; |
|
|
struct imsg_hdr hdr; |
|
|
struct imsg_hdr hdr; |
|
@ -234,7 +234,7 @@ imsg_create(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int |
|
|
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 (datalen) |
|
|
if (ibuf_add(msg, data, datalen) == -1) { |
|
|
if (ibuf_add(msg, data, datalen) == -1) { |
|
@ -255,7 +255,7 @@ imsg_close(struct imsgbuf *ibuf, struct ibuf *msg) |
|
|
if (msg->fd != -1) |
|
|
if (msg->fd != -1) |
|
|
hdr->flags |= IMSGF_HASFD; |
|
|
hdr->flags |= IMSGF_HASFD; |
|
|
|
|
|
|
|
|
hdr->len = (u_int16_t)msg->wpos; |
|
|
|
|
|
|
|
|
hdr->len = (uint16_t)msg->wpos; |
|
|
|
|
|
|
|
|
ibuf_close(&ibuf->w, msg); |
|
|
ibuf_close(&ibuf->w, msg); |
|
|
} |
|
|
} |
|
|