Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/syslogd grow AF_UNIX receive buffer size
details: https://anonhg.NetBSD.org/src/rev/ae54f8504f46
branches: trunk
changeset: 318842:ae54f8504f46
user: christos <christos%NetBSD.org@localhost>
date: Sun May 06 19:16:36 2018 +0000
description:
grow AF_UNIX receive buffer size
diffstat:
usr.sbin/syslogd/syslogd.c | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
diffs (68 lines):
diff -r e235c2febaae -r ae54f8504f46 usr.sbin/syslogd/syslogd.c
--- a/usr.sbin/syslogd/syslogd.c Sun May 06 15:14:12 2018 +0000
+++ b/usr.sbin/syslogd/syslogd.c Sun May 06 19:16:36 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syslogd.c,v 1.124 2017/09/10 17:01:07 ginsbach Exp $ */
+/* $NetBSD: syslogd.c,v 1.125 2018/05/06 19:16:36 christos Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
#else
-__RCSID("$NetBSD: syslogd.c,v 1.124 2017/09/10 17:01:07 ginsbach Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.125 2018/05/06 19:16:36 christos Exp $");
#endif
#endif /* not lint */
@@ -113,6 +113,7 @@
*/
#define DQ_TIMO_INIT 2
+#define RCVBUFLEN 16384
/*
* Intervals at which we flush out "message repeated" messages,
* in seconds after previous message is logged. After each flush,
@@ -272,6 +273,8 @@
#endif /* !DISABLE_TLS */
static int writev1(int, struct iovec *, size_t);
+static void setsockbuf(int, const char *);
+
/* for make_timestamp() */
char timestamp[MAX_TIMESTAMPLEN + 1];
/*
@@ -492,6 +495,7 @@
logerror("Cannot create `%s'", *pp);
die(0, 0, NULL);
}
+ setsockbuf(funix[j], *pp);
DPRINTF(D_NET, "Listening on unix dgram socket `%s'\n", *pp);
}
@@ -660,6 +664,24 @@
exit(1);
}
+static void
+setsockbuf(int fd, const char *name)
+{
+ int buflen;
+ socklen_t socklen = sizeof(buflen);
+ if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &buflen, &socklen) == -1) {
+ logerror("getsockopt: SO_RCVBUF: `%s'", name);
+ return;
+ }
+ if (buflen >= RCVBUFLEN)
+ return;
+ buflen = RCVBUFLEN;
+ if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &buflen, socklen) == -1) {
+ logerror("setsockopt: SO_RCVBUF: `%s'", name);
+ return;
+ }
+}
+
/*
* Dispatch routine for reading /dev/klog
*
Home |
Main Index |
Thread Index |
Old Index