summaryrefslogtreecommitdiffstats
path: root/usr.sbin/syslogd/ringbuf.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2004-06-25 19:10:54 +0000
committerdjm <djm@openbsd.org>2004-06-25 19:10:54 +0000
commit35b969541e64fc711bac159214df286d5b03035c (patch)
tree2f1f476f3434299a2532c39837e0cb546dadc148 /usr.sbin/syslogd/ringbuf.c
parentinterface groups (diff)
downloadwireguard-openbsd-35b969541e64fc711bac159214df286d5b03035c.tar.xz
wireguard-openbsd-35b969541e64fc711bac159214df286d5b03035c.zip
extend memory buffer control protocol to support transmission of flags,
starting with one to indicate whether the memory ringbuffers have overflowed; idea & ok markus@ NB if you are using memory buffered logging make sure you update both syslogd and syslogc _and_ restart syslogd because the protocol has changed
Diffstat (limited to 'usr.sbin/syslogd/ringbuf.c')
-rw-r--r--usr.sbin/syslogd/ringbuf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/syslogd/ringbuf.c b/usr.sbin/syslogd/ringbuf.c
index 2b3a16d96e8..43b4b1c83d7 100644
--- a/usr.sbin/syslogd/ringbuf.c
+++ b/usr.sbin/syslogd/ringbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ringbuf.c,v 1.2 2004/02/26 11:02:32 avsm Exp $ */
+/* $OpenBSD: ringbuf.c,v 1.3 2004/06/25 19:10:54 djm Exp $ */
/*
* Copyright (c) 2004 Damien Miller
@@ -73,6 +73,7 @@ int
ringbuf_append_line(struct ringbuf *rb, char *line)
{
size_t llen, used, copy_len;
+ int overflow = 0;
if (rb == NULL || line == NULL)
return (-1);
@@ -98,6 +99,8 @@ ringbuf_append_line(struct ringbuf *rb, char *line)
rb->start = (rb->start + 1) % rb->len;
/* Skip it */
rb->start = (rb->start + 1) % rb->len;
+
+ overflow = 1;
}
/*
@@ -116,7 +119,7 @@ ringbuf_append_line(struct ringbuf *rb, char *line)
rb->end = (rb->end + llen) % rb->len;
- return (0);
+ return (overflow);
}
/*