summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-04-26 15:18:23 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-04-26 15:18:23 +0000
commit6e5845073dbe0c4d3009e926ef0a224e6b4fd2cf (patch)
tree2f0a9a5edc2acd3591ad54579598e491531a4b36
parent6891686af4046a405bebe35f12c0494b2329718b (diff)
unify shared code a bit again to make future syncs easier
From: Alexander von Gernler <grunk@pestilenz.org>
-rw-r--r--usr.sbin/bgpd/bgpd.h4
-rw-r--r--usr.sbin/bgpd/buffer.c7
-rw-r--r--usr.sbin/bgpd/imsg.c6
-rw-r--r--usr.sbin/ntpd/buffer.c10
-rw-r--r--usr.sbin/ntpd/imsg.c5
-rw-r--r--usr.sbin/ntpd/ntpd.h6
-rw-r--r--usr.sbin/ospfd/buffer.c9
-rw-r--r--usr.sbin/ospfd/imsg.c11
8 files changed, 28 insertions, 30 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 909f7fe5c0b..d7bdc63af57 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.163 2005/04/12 14:32:00 claudio Exp $ */
+/* $OpenBSD: bgpd.h,v 1.164 2005/04/26 15:18:22 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -93,7 +93,7 @@ struct buf {
};
struct msgbuf {
- TAILQ_HEAD(bufs, buf) bufs;
+ TAILQ_HEAD(, buf) bufs;
u_int32_t queued;
int fd;
};
diff --git a/usr.sbin/bgpd/buffer.c b/usr.sbin/bgpd/buffer.c
index fc48d49a644..dec909625c3 100644
--- a/usr.sbin/bgpd/buffer.c
+++ b/usr.sbin/bgpd/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.30 2005/03/28 14:40:04 henning Exp $ */
+/* $OpenBSD: buffer.c,v 1.31 2005/04/26 15:18:22 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -19,11 +19,10 @@
#include <sys/types.h>
#include <sys/uio.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <err.h>
#include <errno.h>
#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
diff --git a/usr.sbin/bgpd/imsg.c b/usr.sbin/bgpd/imsg.c
index 2ff98af6d82..d631db135eb 100644
--- a/usr.sbin/bgpd/imsg.c
+++ b/usr.sbin/bgpd/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.35 2005/03/23 10:46:27 henning Exp $ */
+/* $OpenBSD: imsg.c,v 1.36 2005/04/26 15:18:22 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -136,7 +136,7 @@ imsg_compose(struct imsgbuf *ibuf, enum imsg_type type, u_int32_t peerid,
wbuf->fd = fd;
if ((n = imsg_close(ibuf, wbuf)) < 0)
- return (-1);
+ return (-1);
return (n);
}
@@ -149,7 +149,7 @@ imsg_create(struct imsgbuf *ibuf, enum imsg_type type, u_int32_t peerid,
struct imsg_hdr hdr;
if (datalen > MAX_IMSGSIZE - IMSG_HEADER_SIZE) {
- log_warnx("imsg_create_core: len %u > MAX_IMSGSIZE; "
+ log_warnx("imsg_create: len %u > MAX_IMSGSIZE; "
"type %u peerid %lu", datalen + IMSG_HEADER_SIZE,
type, peerid);
return (NULL);
diff --git a/usr.sbin/ntpd/buffer.c b/usr.sbin/ntpd/buffer.c
index fe4e0abba19..de63071714c 100644
--- a/usr.sbin/ntpd/buffer.c
+++ b/usr.sbin/ntpd/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.6 2005/03/23 11:36:35 henning Exp $ */
+/* $OpenBSD: buffer.c,v 1.7 2005/04/26 15:18:22 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -98,7 +98,7 @@ msgbuf_write(struct msgbuf *msgbuf)
ssize_t n;
bzero(&iov, sizeof(iov));
- TAILQ_FOREACH(buf, &msgbuf->bufs, entries) {
+ TAILQ_FOREACH(buf, &msgbuf->bufs, entry) {
if (i >= IOV_MAX)
break;
iov[i].iov_base = buf->buf + buf->rpos;
@@ -120,7 +120,7 @@ msgbuf_write(struct msgbuf *msgbuf)
for (buf = TAILQ_FIRST(&msgbuf->bufs); buf != NULL && n > 0;
buf = next) {
- next = TAILQ_NEXT(buf, entries);
+ next = TAILQ_NEXT(buf, entry);
if (buf->rpos + n >= buf->size) {
n -= buf->size - buf->rpos;
buf_dequeue(msgbuf, buf);
@@ -136,14 +136,14 @@ msgbuf_write(struct msgbuf *msgbuf)
void
buf_enqueue(struct msgbuf *msgbuf, struct buf *buf)
{
- TAILQ_INSERT_TAIL(&msgbuf->bufs, buf, entries);
+ TAILQ_INSERT_TAIL(&msgbuf->bufs, buf, entry);
msgbuf->queued++;
}
void
buf_dequeue(struct msgbuf *msgbuf, struct buf *buf)
{
- TAILQ_REMOVE(&msgbuf->bufs, buf, entries);
+ TAILQ_REMOVE(&msgbuf->bufs, buf, entry);
msgbuf->queued--;
buf_free(buf);
}
diff --git a/usr.sbin/ntpd/imsg.c b/usr.sbin/ntpd/imsg.c
index 99e46297840..52a8062e422 100644
--- a/usr.sbin/ntpd/imsg.c
+++ b/usr.sbin/ntpd/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.10 2005/03/23 10:42:04 henning Exp $ */
+/* $OpenBSD: imsg.c,v 1.11 2005/04/26 15:18:22 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -67,7 +67,8 @@ imsg_get(struct imsgbuf *ibuf, struct imsg *imsg)
memcpy(&imsg->hdr, ibuf->r.buf, sizeof(imsg->hdr));
if (imsg->hdr.len < IMSG_HEADER_SIZE ||
imsg->hdr.len > MAX_IMSGSIZE) {
- log_warnx("imsg_get: imsg hdr len out of bounds");
+ log_warnx("imsg_get: imsg hdr len %u out of bounds, type=%u",
+ imsg->hdr.len, imsg->hdr.type);
return (-1);
}
if (imsg->hdr.len > av)
diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h
index 39ec4f68785..7387c3751f9 100644
--- a/usr.sbin/ntpd/ntpd.h
+++ b/usr.sbin/ntpd/ntpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.h,v 1.54 2005/03/23 10:42:04 henning Exp $ */
+/* $OpenBSD: ntpd.h,v 1.55 2005/04/26 15:18:22 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -127,7 +127,7 @@ struct ntpd_conf {
};
struct buf {
- TAILQ_ENTRY(buf) entries;
+ TAILQ_ENTRY(buf) entry;
u_char *buf;
size_t size;
size_t wpos;
@@ -135,7 +135,7 @@ struct buf {
};
struct msgbuf {
- TAILQ_HEAD(bufs, buf) bufs;
+ TAILQ_HEAD(, buf) bufs;
u_int32_t queued;
int fd;
};
diff --git a/usr.sbin/ospfd/buffer.c b/usr.sbin/ospfd/buffer.c
index 8a70cf3ac63..ad8f1e91067 100644
--- a/usr.sbin/ospfd/buffer.c
+++ b/usr.sbin/ospfd/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.5 2005/04/05 12:59:18 claudio Exp $ */
+/* $OpenBSD: buffer.c,v 1.6 2005/04/26 15:18:22 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -17,13 +17,12 @@
*/
#include <sys/types.h>
-#include <sys/socket.h>
#include <sys/uio.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <err.h>
+
#include <errno.h>
#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
diff --git a/usr.sbin/ospfd/imsg.c b/usr.sbin/ospfd/imsg.c
index 4759ca7a7d9..16f0dccb3a4 100644
--- a/usr.sbin/ospfd/imsg.c
+++ b/usr.sbin/ospfd/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.3 2005/03/23 10:46:26 henning Exp $ */
+/* $OpenBSD: imsg.c,v 1.4 2005/04/26 15:18:22 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -17,8 +17,8 @@
*/
#include <sys/types.h>
-#include <sys/socket.h>
#include <sys/uio.h>
+
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -30,7 +30,6 @@
void
imsg_init(struct imsgbuf *ibuf, int fd, void (*handler)(int, short, void *))
{
-
msgbuf_init(&ibuf->w);
bzero(&ibuf->r, sizeof(ibuf->r));
ibuf->fd = fd;
@@ -75,7 +74,7 @@ imsg_read(struct imsgbuf *ibuf)
cmsg->cmsg_type == SCM_RIGHTS) {
fd = (*(int *)CMSG_DATA(cmsg));
if ((ifd = calloc(1, sizeof(struct imsg_fd))) == NULL)
- fatal("imsg_read");
+ fatal("imsg_read calloc");
ifd->fd = fd;
TAILQ_INSERT_TAIL(&ibuf->fds, ifd, entry);
} else
@@ -139,7 +138,7 @@ imsg_compose(struct imsgbuf *ibuf, enum imsg_type type, u_int32_t peerid,
wbuf->fd = fd;
if ((n = imsg_close(ibuf, wbuf)) < 0)
- return (-1);
+ return (-1);
return (n);
}
@@ -152,7 +151,7 @@ imsg_create(struct imsgbuf *ibuf, enum imsg_type type, u_int32_t peerid,
struct imsg_hdr hdr;
if (datalen > MAX_IMSGSIZE - IMSG_HEADER_SIZE) {
- log_warnx("imsg_create_core: len %u > MAX_IMSGSIZE; "
+ log_warnx("imsg_create: len %u > MAX_IMSGSIZE; "
"type %u peerid %lu", datalen + IMSG_HEADER_SIZE,
type, peerid);
return (NULL);