Don't fsync() kernel messages by default -- enable it with the "-S" flag.
This avoids some seriously gratuitous disk hosage in various cases. XXX It would probably be better to allow this to be specified in the config file somehow.
This commit is contained in:
parent
82f913eae9
commit
ad19a75b36
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: syslogd.8,v 1.33 2003/10/17 01:39:25 lukem Exp $
|
||||
.\" $NetBSD: syslogd.8,v 1.34 2004/10/08 17:25:52 mycroft Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1983, 1986, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -116,6 +116,8 @@ which
|
|||
runs is subject to attack over the network and it is desired
|
||||
that the machine be protected from attempts to remotely fill logs
|
||||
and similar attacks.
|
||||
.It Fl S
|
||||
Sync kernel messages to disk immediately.
|
||||
.It Fl t Ar chroot_dir
|
||||
.Xr chroot 2
|
||||
to
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: syslogd.c,v 1.65 2004/03/06 20:29:25 itojun Exp $ */
|
||||
/* $NetBSD: syslogd.c,v 1.66 2004/10/08 17:25:52 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1988, 1993, 1994
|
||||
|
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993, 1994\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: syslogd.c,v 1.65 2004/03/06 20:29:25 itojun Exp $");
|
||||
__RCSID("$NetBSD: syslogd.c,v 1.66 2004/10/08 17:25:52 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -198,6 +198,7 @@ int UseNameService = 1; /* make domain name queries */
|
|||
int NumForwards = 0; /* number of forwarding actions in conf file */
|
||||
char **LogPaths; /* array of pathnames to read messages from */
|
||||
int NoRepeat = 0; /* disable "repeated"; log always */
|
||||
int SyncKernel = 0; /* write kernel messages synchronously */
|
||||
volatile sig_atomic_t gothup = 0; /* got SIGHUP */
|
||||
|
||||
void cfline(char *, struct filed *);
|
||||
|
@ -243,7 +244,7 @@ main(int argc, char *argv[])
|
|||
|
||||
(void)setlocale(LC_ALL, "");
|
||||
|
||||
while ((ch = getopt(argc, argv, "dnsf:m:p:P:ru:g:t:")) != -1)
|
||||
while ((ch = getopt(argc, argv, "dnsSf:m:p:P:ru:g:t:")) != -1)
|
||||
switch(ch) {
|
||||
case 'd': /* debug */
|
||||
Debug++;
|
||||
|
@ -276,6 +277,9 @@ main(int argc, char *argv[])
|
|||
case 's': /* no network listen mode */
|
||||
SecureMode++;
|
||||
break;
|
||||
case 'S':
|
||||
SyncKernel = 1;
|
||||
break;
|
||||
case 't':
|
||||
root = optarg;
|
||||
if (*root == '\0')
|
||||
|
@ -686,7 +690,9 @@ printsys(char *msg)
|
|||
(void)strlcat(line, ": ", sizeof(line));
|
||||
lp = line + strlen(line);
|
||||
for (p = msg; *p != '\0'; ) {
|
||||
flags = SYNC_FILE | ADDDATE; /* fsync file after write */
|
||||
flags = ADDDATE;
|
||||
if (SyncKernel)
|
||||
flags |= SYNC_FILE;
|
||||
pri = DEFSPRI;
|
||||
if (*p == '<') {
|
||||
pri = 0;
|
||||
|
|
Loading…
Reference in New Issue