grow AF_UNIX receive buffer size
This commit is contained in:
parent
5e984cf5ac
commit
2ed636d665
|
@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993, 1994\
|
|||
#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 @@ typedef struct deadq_entry {
|
|||
*/
|
||||
#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 @@ static inline void
|
|||
#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 @@ getgroup:
|
|||
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 @@ usage(void)
|
|||
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
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue