--- src/usr.sbin/syslogd/syslogd.c 2004/12/18 22:48:14 1.5 +++ src/usr.sbin/syslogd/syslogd.c 2007/08/09 02:19:20 1.5.10.1 @@ -311,6 +311,7 @@ static void dofsync(void); static void domark(int); static void fprintlog(struct filed *, int, const char *); static int *socksetup(int, const char *); +static void setsockbuffer(int); static void init(int); static void logerror(const char *); static void logmsg(int, const char *, const char *, int); @@ -477,6 +478,8 @@ main(int argc, char *argv[]) if (i == 0) die(0); } + if (funix[i] >= 0) + setsockbuffer(funix[i]); } if (SecureMode <= 1) finet = socksetup(family, bindhostname); @@ -2573,6 +2576,8 @@ socksetup(int af, const char *bindhostna logerror("socket"); continue; } + if (r->ai_socktype != SOCK_STREAM) + setsockbuffer(*s); if (r->ai_family == AF_INET6) { int on = 1; if (setsockopt(*s, IPPROTO_IPV6, IPV6_V6ONLY, @@ -2605,6 +2610,19 @@ socksetup(int af, const char *bindhostna return (socks); } +/* + * Most systems default to a fairly small amount of receive buffer space, + * set a reasonable buffer size. + */ +static +void +setsockbuffer(int fd) +{ + int bytes = 65536; + + setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bytes, sizeof(bytes)); +} + ssize_t rbwritev(struct filed *f, struct iovec *iov, int iovcnt) {