Fix #38: add option -C file
for alt. kernel seqno cache file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
parent
39ffa1b4cb
commit
e381bc3620
@ -43,6 +43,7 @@
|
|||||||
.Op Fl a Ar name[:port]
|
.Op Fl a Ar name[:port]
|
||||||
.Op Fl b Ar addr[:port]
|
.Op Fl b Ar addr[:port]
|
||||||
.Op Fl b Ar :port
|
.Op Fl b Ar :port
|
||||||
|
.Op Fl C Ar file
|
||||||
.Op Fl f Ar file
|
.Op Fl f Ar file
|
||||||
.Op Fl m Ar interval
|
.Op Fl m Ar interval
|
||||||
.Op Fl P Ar file
|
.Op Fl P Ar file
|
||||||
@ -209,6 +210,16 @@ is
|
|||||||
.Ql syslog .
|
.Ql syslog .
|
||||||
This option can be specified multiple times to bind to
|
This option can be specified multiple times to bind to
|
||||||
multiple addresses and/or ports.
|
multiple addresses and/or ports.
|
||||||
|
.It Fl C Ar file
|
||||||
|
File to use for caching last read kernel sequence number from
|
||||||
|
.Pa /dev/kmsg ,
|
||||||
|
default:
|
||||||
|
.Pa /run/syslogd.cache .
|
||||||
|
If
|
||||||
|
.Nm
|
||||||
|
cannot write to, or read from, this file it will cause repeated kernel
|
||||||
|
log messages when restarting
|
||||||
|
.Nm .
|
||||||
.It Fl d
|
.It Fl d
|
||||||
Put
|
Put
|
||||||
.Nm
|
.Nm
|
||||||
|
@ -96,6 +96,7 @@ static char sccsid[] __attribute__((unused)) =
|
|||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|
||||||
|
char *CacheFile = _PATH_CACHE;
|
||||||
char *ConfFile = _PATH_LOGCONF;
|
char *ConfFile = _PATH_LOGCONF;
|
||||||
char *PidFile = _PATH_LOGPID;
|
char *PidFile = _PATH_LOGPID;
|
||||||
char ctty[] = _PATH_CONSOLE;
|
char ctty[] = _PATH_CONSOLE;
|
||||||
@ -202,7 +203,7 @@ static void sys_seqno_load(void)
|
|||||||
char buf[32], *str;
|
char buf[32], *str;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
fp = fopen(_PATH_CACHE, "r");
|
fp = fopen(CacheFile, "r");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -235,7 +236,7 @@ static void sys_seqno_save(void)
|
|||||||
if (prev == sys_seqno)
|
if (prev == sys_seqno)
|
||||||
return; /* no changes since last save */
|
return; /* no changes since last save */
|
||||||
|
|
||||||
fp = fopen(_PATH_CACHE, "w");
|
fp = fopen(CacheFile, "w");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return; /* best effort, ignore any errors */
|
return; /* best effort, ignore any errors */
|
||||||
|
|
||||||
@ -273,6 +274,7 @@ int usage(int code)
|
|||||||
" :port UDP port number, or service name\n"
|
" :port UDP port number, or service name\n"
|
||||||
" default: 'syslog', port 514\n"
|
" default: 'syslog', port 514\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
" -C FILE File to cache last read kernel seqno, default: %s\n"
|
||||||
" -d Enable debug mode, implicitly enables -F to prevent backgrounding\n"
|
" -d Enable debug mode, implicitly enables -F to prevent backgrounding\n"
|
||||||
" -F Run in foreground, required when monitored by init(1)\n"
|
" -F Run in foreground, required when monitored by init(1)\n"
|
||||||
" -f FILE Alternate .conf file, default: %s\n"
|
" -f FILE Alternate .conf file, default: %s\n"
|
||||||
@ -293,7 +295,7 @@ int usage(int code)
|
|||||||
" -v Show program version and exit\n"
|
" -v Show program version and exit\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Bug report address: %s\n",
|
"Bug report address: %s\n",
|
||||||
_PATH_LOGCONF, _PATH_LOGPID, _PATH_LOG, _PATH_LOGCONF, PACKAGE_BUGREPORT);
|
_PATH_CACHE, _PATH_LOGCONF, _PATH_LOGPID, _PATH_LOG, _PATH_LOGCONF, PACKAGE_BUGREPORT);
|
||||||
#ifdef PACKAGE_URL
|
#ifdef PACKAGE_URL
|
||||||
printf("Project home page: %s\n", PACKAGE_URL);
|
printf("Project home page: %s\n", PACKAGE_URL);
|
||||||
#endif
|
#endif
|
||||||
@ -308,7 +310,7 @@ int main(int argc, char *argv[])
|
|||||||
int pflag = 0, bflag = 0;
|
int pflag = 0, bflag = 0;
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "46Aa:b:dHFf:km:nP:p:r:sTv?")) != EOF) {
|
while ((ch = getopt(argc, argv, "46Aa:b:C:dHFf:km:nP:p:r:sTv?")) != EOF) {
|
||||||
switch ((char)ch) {
|
switch ((char)ch) {
|
||||||
case '4':
|
case '4':
|
||||||
family = PF_INET;
|
family = PF_INET;
|
||||||
@ -338,6 +340,10 @@ int main(int argc, char *argv[])
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'C': /* kernel seqno cache file */
|
||||||
|
CacheFile = optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'd': /* debug */
|
case 'd': /* debug */
|
||||||
Debug = 1;
|
Debug = 1;
|
||||||
Foreground = 1;
|
Foreground = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user