aboutsummaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
Diffstat (limited to 'compat')
-rw-r--r--compat/asprintf.c4
-rw-r--r--compat/bitstring.h1
-rw-r--r--compat/cfmakeraw.c2
-rw-r--r--compat/closefrom.c2
-rw-r--r--compat/daemon.c1
-rw-r--r--compat/fgetln.c1
-rw-r--r--compat/forkpty-aix.c26
-rw-r--r--compat/forkpty-hpux.c4
-rw-r--r--compat/forkpty-sunos.c4
-rw-r--r--compat/fparseln.c221
-rw-r--r--compat/getopt.c2
-rw-r--r--compat/imsg-buffer.c39
-rw-r--r--compat/imsg.c100
-rw-r--r--compat/imsg.h12
-rw-r--r--compat/openat.c2
-rw-r--r--compat/setenv.c2
-rw-r--r--compat/strcasestr.c1
-rw-r--r--compat/strlcat.c1
-rw-r--r--compat/strlcpy.c1
-rw-r--r--compat/strsep.c1
-rw-r--r--compat/strtonum.c1
-rw-r--r--compat/tree.h1
-rw-r--r--compat/unvis.c1
-rw-r--r--compat/vis.c1
-rw-r--r--compat/vis.h1
25 files changed, 356 insertions, 76 deletions
diff --git a/compat/asprintf.c b/compat/asprintf.c
index 66f00996..09020b35 100644
--- a/compat/asprintf.c
+++ b/compat/asprintf.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/*
* Copyright (c) 2006 Nicholas Marriott <nicm@users.sourceforge.net>
*
@@ -56,10 +54,12 @@ vasprintf(char **ret, const char *fmt, va_list ap)
free(*ret);
goto error;
}
+ va_end(ap2);
return (n);
error:
+ va_end(ap2);
*ret = NULL;
return (-1);
}
diff --git a/compat/bitstring.h b/compat/bitstring.h
index 28817c08..8fc3423e 100644
--- a/compat/bitstring.h
+++ b/compat/bitstring.h
@@ -1,4 +1,3 @@
-/* $Id$ */
/* $OpenBSD: bitstring.h,v 1.5 2003/06/02 19:34:12 millert Exp $ */
/* $NetBSD: bitstring.h,v 1.5 1997/05/14 15:49:55 pk Exp $ */
diff --git a/compat/cfmakeraw.c b/compat/cfmakeraw.c
index 3f8dc7e5..85b2c9bc 100644
--- a/compat/cfmakeraw.c
+++ b/compat/cfmakeraw.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/*
* Copyright (c) 2013 Dagobert Michelsen
* Copyright (c) 2013 Nicholas Marriott <nicm@users.sourceforge.net>
diff --git a/compat/closefrom.c b/compat/closefrom.c
index 74714c13..591769dd 100644
--- a/compat/closefrom.c
+++ b/compat/closefrom.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/*
* Copyright (c) 2004-2005 Todd C. Miller <Todd.Miller@courtesan.com>
*
diff --git a/compat/daemon.c b/compat/daemon.c
index 661f7fd5..3e87874b 100644
--- a/compat/daemon.c
+++ b/compat/daemon.c
@@ -1,4 +1,3 @@
-/* $Id$ */
/* $OpenBSD: daemon.c,v 1.6 2005/08/08 08:05:33 espie Exp $ */
/*-
* Copyright (c) 1990, 1993
diff --git a/compat/fgetln.c b/compat/fgetln.c
index 08ddc840..a5c2489d 100644
--- a/compat/fgetln.c
+++ b/compat/fgetln.c
@@ -1,4 +1,3 @@
-/* $Id$ */
/* $NetBSD: fgetln.c,v 1.3 2007/08/07 02:06:58 lukem Exp $ */
/*-
diff --git a/compat/forkpty-aix.c b/compat/forkpty-aix.c
index db9c2e71..fd558eb8 100644
--- a/compat/forkpty-aix.c
+++ b/compat/forkpty-aix.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
*
@@ -23,19 +21,23 @@
#include <stdlib.h>
#include <stropts.h>
#include <unistd.h>
+#include <errno.h>
#include "tmux.h"
pid_t
forkpty(int *master, unused char *name, struct termios *tio, struct winsize *ws)
{
- int slave, fd;
- char *path;
+ int slave = -1, fd, pipe_fd[2];
+ char *path, dummy;
pid_t pid;
- if ((*master = open("/dev/ptc", O_RDWR|O_NOCTTY)) == -1)
+ if (pipe(pipe_fd) == -1)
return (-1);
+ if ((*master = open("/dev/ptc", O_RDWR|O_NOCTTY)) == -1)
+ goto out;
+
if ((path = ttyname(*master)) == NULL)
goto out;
if ((slave = open(path, O_RDWR|O_NOCTTY)) == -1)
@@ -47,6 +49,13 @@ forkpty(int *master, unused char *name, struct termios *tio, struct winsize *ws)
case 0:
close(*master);
+ close(pipe_fd[1]);
+ while (read(pipe_fd[0], &dummy, 1) == -1) {
+ if (errno != EINTR)
+ break;
+ }
+ close(pipe_fd[0]);
+
fd = open(_PATH_TTY, O_RDWR|O_NOCTTY);
if (fd >= 0) {
ioctl(fd, TIOCNOTTY, NULL);
@@ -80,10 +89,14 @@ forkpty(int *master, unused char *name, struct termios *tio, struct winsize *ws)
dup2(slave, 2);
if (slave > 2)
close(slave);
+
return (0);
}
close(slave);
+
+ close(pipe_fd[0]);
+ close(pipe_fd[1]);
return (pid);
out:
@@ -91,5 +104,8 @@ out:
close(*master);
if (slave != -1)
close(slave);
+
+ close(pipe_fd[0]);
+ close(pipe_fd[1]);
return (-1);
}
diff --git a/compat/forkpty-hpux.c b/compat/forkpty-hpux.c
index 90452f8d..59130e1b 100644
--- a/compat/forkpty-hpux.c
+++ b/compat/forkpty-hpux.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
*
@@ -29,7 +27,7 @@
pid_t
forkpty(int *master, char *name, struct termios *tio, struct winsize *ws)
{
- int slave;
+ int slave = -1;
char *path;
pid_t pid;
diff --git a/compat/forkpty-sunos.c b/compat/forkpty-sunos.c
index 7b254d82..554e51ac 100644
--- a/compat/forkpty-sunos.c
+++ b/compat/forkpty-sunos.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
*
@@ -30,7 +28,7 @@
pid_t
forkpty(int *master, char *name, struct termios *tio, struct winsize *ws)
{
- int slave;
+ int slave = -1;
char *path;
pid_t pid;
diff --git a/compat/fparseln.c b/compat/fparseln.c
new file mode 100644
index 00000000..348bfa14
--- /dev/null
+++ b/compat/fparseln.c
@@ -0,0 +1,221 @@
+/* $OpenBSD: fparseln.c,v 1.6 2005/08/02 21:46:23 espie Exp $ */
+/* $NetBSD: fparseln.c,v 1.7 1999/07/02 15:49:12 simonb Exp $ */
+
+/*
+ * Copyright (c) 1997 Christos Zoulas. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christos Zoulas.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* OPENBSD ORIGINAL: lib/libutil/fparseln.c */
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "tmux.h"
+
+/*
+ * fparseln() specific operation flags.
+ */
+#define FPARSELN_UNESCESC 0x01
+#define FPARSELN_UNESCCONT 0x02
+#define FPARSELN_UNESCCOMM 0x04
+#define FPARSELN_UNESCREST 0x08
+#define FPARSELN_UNESCALL 0x0f
+
+static int isescaped(const char *, const char *, int);
+
+/* isescaped():
+ * Return true if the character in *p that belongs to a string
+ * that starts in *sp, is escaped by the escape character esc.
+ */
+static int
+isescaped(const char *sp, const char *p, int esc)
+{
+ const char *cp;
+ size_t ne;
+
+ /* No escape character */
+ if (esc == '\0')
+ return 1;
+
+ /* Count the number of escape characters that precede ours */
+ for (ne = 0, cp = p; --cp >= sp && *cp == esc; ne++)
+ continue;
+
+ /* Return true if odd number of escape characters */
+ return (ne & 1) != 0;
+}
+
+
+/* fparseln():
+ * Read a line from a file parsing continuations ending in \
+ * and eliminating trailing newlines, or comments starting with
+ * the comment char.
+ */
+char *
+fparseln(FILE *fp, size_t *size, size_t *lineno, const char str[3],
+ int flags)
+{
+ static const char dstr[3] = { '\\', '\\', '#' };
+ char *buf = NULL, *ptr, *cp, esc, con, nl, com;
+ size_t s, len = 0;
+ int cnt = 1;
+
+ if (str == NULL)
+ str = dstr;
+
+ esc = str[0];
+ con = str[1];
+ com = str[2];
+
+ /*
+ * XXX: it would be cool to be able to specify the newline character,
+ * but unfortunately, fgetln does not let us
+ */
+ nl = '\n';
+
+ while (cnt) {
+ cnt = 0;
+
+ if (lineno)
+ (*lineno)++;
+
+ if ((ptr = fgetln(fp, &s)) == NULL)
+ break;
+
+ if (s && com) { /* Check and eliminate comments */
+ for (cp = ptr; cp < ptr + s; cp++)
+ if (*cp == com && !isescaped(ptr, cp, esc)) {
+ s = cp - ptr;
+ cnt = s == 0 && buf == NULL;
+ break;
+ }
+ }
+
+ if (s && nl) { /* Check and eliminate newlines */
+ cp = &ptr[s - 1];
+
+ if (*cp == nl)
+ s--; /* forget newline */
+ }
+
+ if (s && con) { /* Check and eliminate continuations */
+ cp = &ptr[s - 1];
+
+ if (*cp == con && !isescaped(ptr, cp, esc)) {
+ s--; /* forget escape */
+ cnt = 1;
+ }
+ }
+
+ if (s == 0 && buf != NULL)
+ continue;
+
+ if ((cp = realloc(buf, len + s + 1)) == NULL) {
+ free(buf);
+ return NULL;
+ }
+ buf = cp;
+
+ (void) memcpy(buf + len, ptr, s);
+ len += s;
+ buf[len] = '\0';
+ }
+
+ if ((flags & FPARSELN_UNESCALL) != 0 && esc && buf != NULL &&
+ strchr(buf, esc) != NULL) {
+ ptr = cp = buf;
+ while (cp[0] != '\0') {
+ int skipesc;
+
+ while (cp[0] != '\0' && cp[0] != esc)
+ *ptr++ = *cp++;
+ if (cp[0] == '\0' || cp[1] == '\0')
+ break;
+
+ skipesc = 0;
+ if (cp[1] == com)
+ skipesc += (flags & FPARSELN_UNESCCOMM);
+ if (cp[1] == con)
+ skipesc += (flags & FPARSELN_UNESCCONT);
+ if (cp[1] == esc)
+ skipesc += (flags & FPARSELN_UNESCESC);
+ if (cp[1] != com && cp[1] != con && cp[1] != esc)
+ skipesc = (flags & FPARSELN_UNESCREST);
+
+ if (skipesc)
+ cp++;
+ else
+ *ptr++ = *cp++;
+ *ptr++ = *cp++;
+ }
+ *ptr = '\0';
+ len = strlen(buf);
+ }
+
+ if (size)
+ *size = len;
+ return buf;
+}
+
+#ifdef TEST
+
+int main(int, char **);
+
+int
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ char *ptr;
+ size_t size, line;
+
+ line = 0;
+ while ((ptr = fparseln(stdin, &size, &line, NULL,
+ FPARSELN_UNESCALL)) != NULL)
+ printf("line %d (%d) |%s|\n", line, size, ptr);
+ return 0;
+}
+
+/*
+
+# This is a test
+line 1
+line 2 \
+line 3 # Comment
+line 4 \# Not comment \\\\
+
+# And a comment \
+line 5 \\\
+line 6
+
+*/
+
+#endif /* TEST */
diff --git a/compat/getopt.c b/compat/getopt.c
index 38c317cc..a93f368a 100644
--- a/compat/getopt.c
+++ b/compat/getopt.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/*
* Copyright (c) 1987, 1993, 1994
* The Regents of the University of California. All rights reserved.
diff --git a/compat/imsg-buffer.c b/compat/imsg-buffer.c
index 2ddf0f77..450fdf1b 100644
--- a/compat/imsg-buffer.c
+++ b/compat/imsg-buffer.c
@@ -1,5 +1,4 @@
-/* $Id$ */
-/* $OpenBSD: imsg-buffer.c,v 1.3 2010/05/26 13:56:07 nicm Exp $ */
+/* $OpenBSD: imsg-buffer.c,v 1.4 2014/06/30 00:25:17 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -17,17 +16,19 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/uio.h>
+#include <limits.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
-#include <strings.h>
#include <unistd.h>
#include "tmux.h"
+#include "imsg.h"
int ibuf_realloc(struct ibuf *, size_t);
void ibuf_enqueue(struct msgbuf *, struct ibuf *);
@@ -158,22 +159,23 @@ ibuf_write(struct msgbuf *msgbuf)
i++;
}
+again:
if ((n = writev(msgbuf->fd, iov, i)) == -1) {
- if (errno == EAGAIN || errno == ENOBUFS ||
- errno == EINTR) /* try later */
- return (0);
- else
- return (-1);
+ if (errno == EINTR)
+ goto again;
+ if (errno == ENOBUFS)
+ errno = EAGAIN;
+ return (-1);
}
if (n == 0) { /* connection closed */
errno = 0;
- return (-2);
+ return (0);
}
msgbuf_drain(msgbuf, n);
- return (0);
+ return (1);
}
void
@@ -257,17 +259,18 @@ msgbuf_write(struct msgbuf *msgbuf)
*(int *)CMSG_DATA(cmsg) = buf->fd;
}
+again:
if ((n = sendmsg(msgbuf->fd, &msg, 0)) == -1) {
- if (errno == EAGAIN || errno == ENOBUFS ||
- errno == EINTR) /* try later */
- return (0);
- else
- return (-1);
+ if (errno == EINTR)
+ goto again;
+ if (errno == ENOBUFS)
+ errno = EAGAIN;
+ return (-1);
}
if (n == 0) { /* connection closed */
errno = 0;
- return (-2);
+ return (0);
}
/*
@@ -281,7 +284,7 @@ msgbuf_write(struct msgbuf *msgbuf)
msgbuf_drain(msgbuf, n);
- return (0);
+ return (1);
}
void
diff --git a/compat/imsg.c b/compat/imsg.c
index c4dd191d..af0da44f 100644
--- a/compat/imsg.c
+++ b/compat/imsg.c
@@ -1,5 +1,4 @@
-/* $Id$ */
-/* $OpenBSD: imsg.c,v 1.3 2010/05/26 13:56:07 nicm Exp $ */
+/* $OpenBSD: imsg.c,v 1.6 2014/06/30 00:26:22 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -17,20 +16,55 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
-#include <strings.h>
#include <unistd.h>
#include "tmux.h"
+#include "imsg.h"
+
+int imsg_fd_overhead = 0;
int imsg_get_fd(struct imsgbuf *);
+int available_fds(unsigned int);
+
+/* TA: 2014-09-08: Note that the original code calls getdtablecount() which is
+ * OpenBSD specific. Until such time that it's ported elsewhere from
+ * <unistd.h>, I've mimicked what OpenSMTPD are doing, by using available_fds()
+ * instead.
+ */
+
+int
+available_fds(unsigned int n)
+{
+ unsigned int i;
+ int ret, fds[256];
+
+ if (n > (sizeof(fds)/sizeof(fds[0])))
+ return (1);
+
+ ret = 0;
+ for (i = 0; i < n; i++) {
+ fds[i] = -1;
+ if ((fds[i] = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ ret = 1;
+ break;
+ }
+ }
+
+ for (i = 0; i < n && fds[i] >= 0; i++)
+ close(fds[i]);
+
+ return (ret);
+}
+
void
imsg_init(struct imsgbuf *ibuf, int fd)
{
@@ -49,10 +83,10 @@ imsg_read(struct imsgbuf *ibuf)
struct cmsghdr *cmsg;
union {
struct cmsghdr hdr;
- char buf[CMSG_SPACE(sizeof(int) * 16)];
+ char buf[CMSG_SPACE(sizeof(int) * 1)];
} cmsgbuf;
struct iovec iov;
- ssize_t n;
+ ssize_t n = -1;
int fd;
struct imsg_fd *ifd;
@@ -65,11 +99,23 @@ imsg_read(struct imsgbuf *ibuf)
msg.msg_control = &cmsgbuf.buf;
msg.msg_controllen = sizeof(cmsgbuf.buf);
+ if ((ifd = calloc(1, sizeof(struct imsg_fd))) == NULL)
+ return (-1);
+
+again:
+ if (available_fds(imsg_fd_overhead +
+ (CMSG_SPACE(sizeof(int))-CMSG_SPACE(0))/sizeof(int))) {
+ errno = EAGAIN;
+ free(ifd);
+ return (-1);
+ }
+
if ((n = recvmsg(ibuf->fd, &msg, 0)) == -1) {
- if (errno != EINTR && errno != EAGAIN) {
- return (-1);
- }
- return (-2);
+ if (errno == EMSGSIZE)
+ goto fail;
+ if (errno != EINTR && errno != EAGAIN)
+ goto fail;
+ goto again;
}
ibuf->r.wpos += n;
@@ -78,17 +124,33 @@ imsg_read(struct imsgbuf *ibuf)
cmsg = CMSG_NXTHDR(&msg, cmsg)) {
if (cmsg->cmsg_level == SOL_SOCKET &&
cmsg->cmsg_type == SCM_RIGHTS) {
- fd = (*(int *)CMSG_DATA(cmsg));
- if ((ifd = calloc(1, sizeof(struct imsg_fd))) == NULL) {
- close(fd);
- return (-1);
+ int i;
+ int j;
+
+ /*
+ * We only accept one file descriptor. Due to C
+ * padding rules, our control buffer might contain
+ * more than one fd, and we must close them.
+ */
+ j = ((char *)cmsg + cmsg->cmsg_len -
+ (char *)CMSG_DATA(cmsg)) / sizeof(int);
+ for (i = 0; i < j; i++) {
+ fd = ((int *)CMSG_DATA(cmsg))[i];
+ if (ifd != NULL) {
+ ifd->fd = fd;
+ TAILQ_INSERT_TAIL(&ibuf->fds, ifd,
+ entry);
+ ifd = NULL;
+ } else
+ close(fd);
}
- ifd->fd = fd;
- TAILQ_INSERT_TAIL(&ibuf->fds, ifd, entry);
}
/* we do not handle other ctl data level */
}
+fail:
+ if (ifd)
+ free(ifd);
return (n);
}
@@ -112,7 +174,7 @@ imsg_get(struct imsgbuf *ibuf, struct imsg *imsg)
return (0);
datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
ibuf->r.rptr = ibuf->r.buf + IMSG_HEADER_SIZE;
- if ((imsg->data = malloc(datalen)) == NULL && datalen != 0)
+ if ((imsg->data = malloc(datalen)) == NULL)
return (-1);
if (imsg->hdr.flags & IMSGF_HASFD)
@@ -134,7 +196,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;
@@ -204,7 +266,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/compat/imsg.h b/compat/imsg.h
index f8a78e22..06fe1bc1 100644
--- a/compat/imsg.h
+++ b/compat/imsg.h
@@ -1,5 +1,4 @@
-/* $Id$ */
-/* $OpenBSD: imsg.h,v 1.4 2010/05/26 13:56:07 nicm Exp $ */
+/* $OpenBSD: imsg.h,v 1.3 2013/12/26 17:32:33 eric Exp $ */
/*
* Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -21,6 +20,9 @@
#include "tmux.h"
+#ifndef _IMSG_H_
+#define _IMSG_H_
+
#define IBUF_READ_SIZE 65535
#define IMSG_HEADER_SIZE sizeof(struct imsg_hdr)
#define MAX_IMSGSIZE 16384
@@ -98,13 +100,15 @@ 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 *);
void imsg_clear(struct imsgbuf *);
+
+#endif
diff --git a/compat/openat.c b/compat/openat.c
index 005235b4..5cd9e551 100644
--- a/compat/openat.c
+++ b/compat/openat.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/*
* Copyright (c) 2013 Nicholas Marriott <nicm@users.sourceforge.net>
*
diff --git a/compat/setenv.c b/compat/setenv.c
index 43122ba5..6c7d29ec 100644
--- a/compat/setenv.c
+++ b/compat/setenv.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/*
* Copyright (c) 2010 Dagobert Michelsen
* Copyright (c) 2010 Nicholas Marriott <nicm@users.sourceforge.net>
diff --git a/compat/strcasestr.c b/compat/strcasestr.c
index 5e03bbb0..aa74c017 100644
--- a/compat/strcasestr.c
+++ b/compat/strcasestr.c
@@ -1,4 +1,3 @@
-/* $Id$ */
/* $OpenBSD: strcasestr.c,v 1.3 2006/03/31 05:34:55 deraadt Exp $ */
/* $NetBSD: strcasestr.c,v 1.2 2005/02/09 21:35:47 kleink Exp $ */
diff --git a/compat/strlcat.c b/compat/strlcat.c
index 1ba236e2..e081c4f6 100644
--- a/compat/strlcat.c
+++ b/compat/strlcat.c
@@ -1,4 +1,3 @@
-/* $Id$ */
/* $OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $ */
/*
diff --git a/compat/strlcpy.c b/compat/strlcpy.c
index 80e13a8f..d6e8e77c 100644
--- a/compat/strlcpy.c
+++ b/compat/strlcpy.c
@@ -1,4 +1,3 @@
-/* $Id$ */
/* $OpenBSD: strlcpy.c,v 1.10 2005/08/08 08:05:37 espie Exp $ */
/*
diff --git a/compat/strsep.c b/compat/strsep.c
index 0a7aa328..c44bc5b2 100644
--- a/compat/strsep.c
+++ b/compat/strsep.c
@@ -1,4 +1,3 @@
-/* $Id$ */
/* $OpenBSD: strsep.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */
/*-
diff --git a/compat/strtonum.c b/compat/strtonum.c
index 860e5508..4c7b0c9f 100644
--- a/compat/strtonum.c
+++ b/compat/strtonum.c
@@ -1,4 +1,3 @@
-/* $Id$ */
/* $OpenBSD: strtonum.c,v 1.6 2004/08/03 19:38:01 millert Exp $ */
/*
diff --git a/compat/tree.h b/compat/tree.h
index 73041340..80d0f538 100644
--- a/compat/tree.h
+++ b/compat/tree.h
@@ -1,4 +1,3 @@
-/* $Id$ */
/* $OpenBSD: tree.h,v 1.13 2011/07/09 00:19:45 pirofti Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
diff --git a/compat/unvis.c b/compat/unvis.c
index 874b2275..e1f09ec9 100644
--- a/compat/unvis.c
+++ b/compat/unvis.c
@@ -1,4 +1,3 @@
-/* $Id$ */
/* $OpenBSD: unvis.c,v 1.12 2005/08/08 08:05:34 espie Exp $ */
/*-
* Copyright (c) 1989, 1993
diff --git a/compat/vis.c b/compat/vis.c
index da4ac7cd..97eb5271 100644
--- a/compat/vis.c
+++ b/compat/vis.c
@@ -1,4 +1,3 @@
-/* $Id$ */
/* $OpenBSD: vis.c,v 1.19 2005/09/01 17:15:49 millert Exp $ */
/*-
* Copyright (c) 1989, 1993
diff --git a/compat/vis.h b/compat/vis.h
index e43e9adc..d6ff235d 100644
--- a/compat/vis.h
+++ b/compat/vis.h
@@ -1,4 +1,3 @@
-/* $Id$ */
/* $OpenBSD: vis.h,v 1.11 2005/08/09 19:38:31 millert Exp $ */
/* $NetBSD: vis.h,v 1.4 1994/10/26 00:56:41 cgd Exp $ */