Included improvements and bugfixes
This commit is contained in:
parent
251da95efb
commit
8947ba8d2f
17
klogd.c
17
klogd.c
@ -354,8 +354,13 @@ static enum LOGSRC GetKernelLogSrc(void)
|
|||||||
{
|
{
|
||||||
/* Initialize kernel logging. */
|
/* Initialize kernel logging. */
|
||||||
sys_syslog(1, NULL, 0);
|
sys_syslog(1, NULL, 0);
|
||||||
|
#ifdef DEBRELEASE
|
||||||
Syslog(LOG_INFO, "klogd %s-%s#%s, log source = sys_syslog "
|
Syslog(LOG_INFO, "klogd %s-%s#%s, log source = sys_syslog "
|
||||||
"started.", VERSION, PATCHLEVEL, DEBRELEASE);
|
"started.", VERSION, PATCHLEVEL, DEBRELEASE);
|
||||||
|
#else
|
||||||
|
Syslog(LOG_INFO, "klogd %s-%s, log source = sys_syslog "
|
||||||
|
"started.", VERSION, PATCHLEVEL);
|
||||||
|
#endif
|
||||||
return(kernel);
|
return(kernel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,8 +371,13 @@ static enum LOGSRC GetKernelLogSrc(void)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBRELEASE
|
||||||
Syslog(LOG_INFO, "klogd %s-%s#%s, log source = %s started.", \
|
Syslog(LOG_INFO, "klogd %s-%s#%s, log source = %s started.", \
|
||||||
VERSION, PATCHLEVEL, DEBRELEASE, _PATH_KLOG);
|
VERSION, PATCHLEVEL, DEBRELEASE, _PATH_KLOG);
|
||||||
|
#else
|
||||||
|
Syslog(LOG_INFO, "klogd %s-%s, log source = %s started.", \
|
||||||
|
VERSION, PATCHLEVEL, _PATH_KLOG);
|
||||||
|
#endif
|
||||||
return(proc);
|
return(proc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,8 +612,11 @@ int main(argc, argv)
|
|||||||
use_syscall = 1;
|
use_syscall = 1;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("klogd %s-%s#%s\n", VERSION, PATCHLEVEL,DEBRELEASE);
|
#ifdef DEBRELEASE
|
||||||
exit (1);
|
printf("klogd %s-%s#%s\n", VERSION, PATCHLEVEL, DEBRELEASE);
|
||||||
|
#else
|
||||||
|
printf("klogd %s-%s\n", VERSION, PATCHLEVEL);
|
||||||
|
#endif exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
34
ksym.c
34
ksym.c
@ -61,6 +61,10 @@
|
|||||||
* Added patch from beta-testers to allow for reading of both
|
* Added patch from beta-testers to allow for reading of both
|
||||||
* ELF and a.out map files.
|
* ELF and a.out map files.
|
||||||
*
|
*
|
||||||
|
* Mon Jun 9 17:12:42 CST 1997: Martin Schulze
|
||||||
|
* Added #1 and #2 to some error messages in order to being able
|
||||||
|
* to divide them (ulmo@Q.Net)
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -95,7 +99,6 @@ static char *system_maps[] =
|
|||||||
{
|
{
|
||||||
"/System.map",
|
"/System.map",
|
||||||
"/boot/System.map",
|
"/boot/System.map",
|
||||||
"/usr/src/linux/System.map",
|
|
||||||
#if defined(TEST)
|
#if defined(TEST)
|
||||||
"./System.map",
|
"./System.map",
|
||||||
#endif
|
#endif
|
||||||
@ -195,7 +198,7 @@ extern int InitKsyms(mapfile)
|
|||||||
if ( fscanf(sym_file, "%8lx %c %s\n", &address, &type, sym)
|
if ( fscanf(sym_file, "%8lx %c %s\n", &address, &type, sym)
|
||||||
!= 3 )
|
!= 3 )
|
||||||
{
|
{
|
||||||
Syslog(LOG_ERR, "Error in symbol table input.");
|
Syslog(LOG_ERR, "Error in symbol table input (#1).");
|
||||||
fclose(sym_file);
|
fclose(sym_file);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@ -279,21 +282,34 @@ static char * FindSymbolFile()
|
|||||||
sym[512];
|
sym[512];
|
||||||
|
|
||||||
auto int version;
|
auto int version;
|
||||||
|
auto struct utsname utsname;
|
||||||
|
char symfile[100];
|
||||||
|
|
||||||
auto unsigned long int address;
|
auto unsigned long int address;
|
||||||
|
|
||||||
auto FILE *sym_file = (FILE *) 0;
|
auto FILE *sym_file = (FILE *) 0;
|
||||||
|
|
||||||
|
if ( uname(&utsname) < 0 )
|
||||||
|
{
|
||||||
|
Syslog(LOG_ERR, "Cannot get kernel version information.");
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
if ( debugging )
|
if ( debugging )
|
||||||
fputs("Searching for symbol map.\n", stderr);
|
fputs("Searching for symbol map.\n", stderr);
|
||||||
|
|
||||||
for (mf = system_maps; *mf != (char *) 0; ++mf)
|
for (mf = system_maps; *mf != (char *) 0; ++mf)
|
||||||
{
|
{
|
||||||
|
sprintf (symfile, "%s", *mf);
|
||||||
if ( debugging )
|
if ( debugging )
|
||||||
fprintf(stderr, "Trying %s.\n", *mf);
|
fprintf(stderr, "Trying %s.\n", symfile);
|
||||||
if ( (sym_file = fopen(*mf, "r")) == (FILE *) 0 )
|
if ( (sym_file = fopen(symfile, "r")) == (FILE *) 0 ) {
|
||||||
continue;
|
sprintf (symfile, "%s-%s", *mf, utsname.release);
|
||||||
|
if ( debugging )
|
||||||
|
fprintf(stderr, "Trying %s.\n", symfile);
|
||||||
|
if ( (sym_file = fopen(symfile, "r")) == (FILE *) 0 )
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* At this point a map file was successfully opened. We
|
* At this point a map file was successfully opened. We
|
||||||
@ -306,7 +322,7 @@ static char * FindSymbolFile()
|
|||||||
if ( fscanf(sym_file, "%8lx %c %s\n", &address, \
|
if ( fscanf(sym_file, "%8lx %c %s\n", &address, \
|
||||||
&type, sym) != 3 )
|
&type, sym) != 3 )
|
||||||
{
|
{
|
||||||
Syslog(LOG_ERR, "Error in symbol table input.");
|
Syslog(LOG_ERR, "Error in symbol table input (#2).");
|
||||||
fclose(sym_file);
|
fclose(sym_file);
|
||||||
return((char *) 0);
|
return((char *) 0);
|
||||||
}
|
}
|
||||||
@ -334,14 +350,14 @@ static char * FindSymbolFile()
|
|||||||
{
|
{
|
||||||
if ( debugging )
|
if ( debugging )
|
||||||
fputs("Saving filename.\n", stderr);
|
fputs("Saving filename.\n", stderr);
|
||||||
file = *mf;
|
file = symfile;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if ( debugging )
|
if ( debugging )
|
||||||
fprintf(stderr, "Found table with " \
|
fprintf(stderr, "Found table with " \
|
||||||
"matching version number.\n");
|
"matching version number.\n");
|
||||||
return(*mf);
|
return(symfile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,12 @@ priorities belonging to the specified action.
|
|||||||
|
|
||||||
Lines starting with a hash mark (``#'') and empty lines are ignored.
|
Lines starting with a hash mark (``#'') and empty lines are ignored.
|
||||||
|
|
||||||
|
This release of
|
||||||
|
.B syslogd
|
||||||
|
is able to understand an extended syntax. One rule can be divided
|
||||||
|
into several lines if the leading line is terminated with an backslash
|
||||||
|
(``\\'').
|
||||||
|
|
||||||
.SH SELECTORS
|
.SH SELECTORS
|
||||||
The selector field itself again consists of two parts, a
|
The selector field itself again consists of two parts, a
|
||||||
.I facility
|
.I facility
|
||||||
@ -114,6 +120,7 @@ field is capable to overwrite the preceding ones. Using this
|
|||||||
behavior you can exclude some priorities from the pattern.
|
behavior you can exclude some priorities from the pattern.
|
||||||
|
|
||||||
This
|
This
|
||||||
|
|
||||||
.BR syslogd (8)
|
.BR syslogd (8)
|
||||||
has a syntax extension to the original BSD source, that makes its use
|
has a syntax extension to the original BSD source, that makes its use
|
||||||
more intuitively. You may precede every priority with an equation sign
|
more intuitively. You may precede every priority with an equation sign
|
||||||
@ -201,7 +208,7 @@ configuration, if not, drop me (Joey) a line.
|
|||||||
.LP
|
.LP
|
||||||
This will store all messages with the priority
|
This will store all messages with the priority
|
||||||
.B crit
|
.B crit
|
||||||
or higher in the file
|
in the file
|
||||||
.IR /var/adm/critical ,
|
.IR /var/adm/critical ,
|
||||||
except for any kernel message.
|
except for any kernel message.
|
||||||
|
|
||||||
@ -286,7 +293,8 @@ and store them in the file
|
|||||||
.nf
|
.nf
|
||||||
# Log info and notice messages to messages file
|
# Log info and notice messages to messages file
|
||||||
#
|
#
|
||||||
*.=info;*.=notice;mail.none /var/log/messages
|
*.=info;*.=notice;\\
|
||||||
|
mail.none /var/log/messages
|
||||||
.fi
|
.fi
|
||||||
.LP
|
.LP
|
||||||
This lets the
|
This lets the
|
||||||
@ -303,7 +311,8 @@ facility.
|
|||||||
.nf
|
.nf
|
||||||
# Log info messages to messages file
|
# Log info messages to messages file
|
||||||
#
|
#
|
||||||
*.=info;mail,news.none /var/log/messages
|
*.=info;\\
|
||||||
|
mail,news.none /var/log/messages
|
||||||
.fi
|
.fi
|
||||||
.LP
|
.LP
|
||||||
This statement causes the
|
This statement causes the
|
||||||
|
93
syslogd.c
93
syslogd.c
@ -276,6 +276,10 @@ static char sccsid[] = "@(#)syslogd.c 5.27 (Berkeley) 10/10/88";
|
|||||||
* the wrong error code. Thanks to Michael Nonweiler
|
* the wrong error code. Thanks to Michael Nonweiler
|
||||||
* <mrn20@hermes.cam.ac.uk> for sending me a patch.
|
* <mrn20@hermes.cam.ac.uk> for sending me a patch.
|
||||||
*
|
*
|
||||||
|
* Mon May 20 13:29:32 MET DST 1996: Miquel van Smoorenburg <miquels@cistron.nl>
|
||||||
|
* Added continuation line supported and fixed a bug in
|
||||||
|
* the init() code.
|
||||||
|
*
|
||||||
* Tue May 28 00:58:45 MET DST 1996: Martin Schulze
|
* Tue May 28 00:58:45 MET DST 1996: Martin Schulze
|
||||||
* Corrected behaviour of blocking pipes - i.e. the whole system
|
* Corrected behaviour of blocking pipes - i.e. the whole system
|
||||||
* hung. Michael Nonweiler <mrn20@hermes.cam.ac.uk> has sent us
|
* hung. Michael Nonweiler <mrn20@hermes.cam.ac.uk> has sent us
|
||||||
@ -293,6 +297,15 @@ static char sccsid[] = "@(#)syslogd.c 5.27 (Berkeley) 10/10/88";
|
|||||||
* Mon Feb 10 00:09:11 MET DST 1997: Martin Schulze
|
* Mon Feb 10 00:09:11 MET DST 1997: Martin Schulze
|
||||||
* Improved debug code to decode the numeric facility/priority
|
* Improved debug code to decode the numeric facility/priority
|
||||||
* pair into textual information.
|
* pair into textual information.
|
||||||
|
*
|
||||||
|
* Tue Jun 10 12:35:10 MET DST 1997: Martin Schulze
|
||||||
|
* Corrected freeing of logfiles. Thanks to Jos Vos <jos@xos.nl>
|
||||||
|
* for reporting the bug and sending an idea to fix the problem.
|
||||||
|
*
|
||||||
|
* Tue Jun 10 12:51:41 MET DST 1997: Martin Schulze
|
||||||
|
* Removed sleep(10) from parent process. This has caused a slow
|
||||||
|
* startup in former times - and I don't see any reason for this.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -302,6 +315,8 @@ static char sccsid[] = "@(#)syslogd.c 5.27 (Berkeley) 10/10/88";
|
|||||||
#define DEFSPRI (LOG_KERN|LOG_CRIT)
|
#define DEFSPRI (LOG_KERN|LOG_CRIT)
|
||||||
#define TIMERINTVL 30 /* interval for checking flush, mark */
|
#define TIMERINTVL 30 /* interval for checking flush, mark */
|
||||||
|
|
||||||
|
#define CONT_LINE 1 /* Allow continuation lines */
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -625,8 +640,6 @@ int main(argc, argv)
|
|||||||
extern int optind;
|
extern int optind;
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
|
|
||||||
int quitpid = 0;
|
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "dhf:l:m:np:rs:v")) != EOF)
|
while ((ch = getopt(argc, argv, "dhf:l:m:np:rs:v")) != EOF)
|
||||||
switch((char)ch) {
|
switch((char)ch) {
|
||||||
case 'd': /* debug */
|
case 'd': /* debug */
|
||||||
@ -681,13 +694,11 @@ int main(argc, argv)
|
|||||||
dprintf("Checking pidfile.\n");
|
dprintf("Checking pidfile.\n");
|
||||||
if (!check_pid(PidFile))
|
if (!check_pid(PidFile))
|
||||||
{
|
{
|
||||||
quitpid = getpid();
|
|
||||||
if (fork())
|
if (fork())
|
||||||
{
|
/*
|
||||||
/* We try to wait the end of initialization */
|
* Parent process
|
||||||
sleep(10);
|
*/
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
|
||||||
num_fds = getdtablesize();
|
num_fds = getdtablesize();
|
||||||
for (i= 0; i < num_fds; i++)
|
for (i= 0; i < num_fds; i++)
|
||||||
(void) close(i);
|
(void) close(i);
|
||||||
@ -842,11 +853,7 @@ int main(argc, argv)
|
|||||||
dprintf("Debugging disabled, SIGUSR1 to turn on debugging.\n");
|
dprintf("Debugging disabled, SIGUSR1 to turn on debugging.\n");
|
||||||
debugging_on = 0;
|
debugging_on = 0;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (quitpid) {
|
|
||||||
kill(quitpid, SIGINT);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/* Main loop begins here. */
|
/* Main loop begins here. */
|
||||||
FD_ZERO(&unixm);
|
FD_ZERO(&unixm);
|
||||||
FD_ZERO(&readfds);
|
FD_ZERO(&readfds);
|
||||||
@ -1904,23 +1911,23 @@ void init()
|
|||||||
register FILE *cf;
|
register FILE *cf;
|
||||||
register struct filed *f, **nextp = (struct filed **) 0;
|
register struct filed *f, **nextp = (struct filed **) 0;
|
||||||
register char *p;
|
register char *p;
|
||||||
|
#ifdef CONT_LINE
|
||||||
|
char cbuf[BUFSIZ];
|
||||||
|
char *cline;
|
||||||
|
#else
|
||||||
char cline[BUFSIZ];
|
char cline[BUFSIZ];
|
||||||
|
#endif
|
||||||
|
|
||||||
dprintf("Called init.\n");
|
dprintf("Called init.\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close all open log files.
|
* Close all open log files.
|
||||||
|
*
|
||||||
|
* This is needed especially when HUPing syslogd as the
|
||||||
|
* structure would grow infinitively.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
Initialized = 0;
|
Initialized = 0;
|
||||||
if ( nlogs > -1 )
|
|
||||||
{
|
|
||||||
dprintf("Initializing log structures.\n");
|
|
||||||
nlogs = -1;
|
|
||||||
free((void *) Files);
|
|
||||||
Files = (struct filed *) 0;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef SYSV
|
#ifdef SYSV
|
||||||
for (lognum = 0; lognum <= nlogs; lognum++ ) {
|
for (lognum = 0; lognum <= nlogs; lognum++ ) {
|
||||||
@ -1943,11 +1950,17 @@ void init()
|
|||||||
#ifdef SYSV
|
#ifdef SYSV
|
||||||
f->f_type = F_UNUSED; /* clear entry - ASP */
|
f->f_type = F_UNUSED; /* clear entry - ASP */
|
||||||
}
|
}
|
||||||
|
if ( nlogs > -1 )
|
||||||
|
{
|
||||||
|
dprintf("Freeing log structures.\n");
|
||||||
|
nlogs = -1;
|
||||||
|
free((void *) Files);
|
||||||
|
}
|
||||||
|
Files = (struct filed *) 0;
|
||||||
#else
|
#else
|
||||||
next = f->f_next;
|
next = f->f_next;
|
||||||
free((char *) f);
|
free((char *) f);
|
||||||
}
|
}
|
||||||
Files = NULL;
|
|
||||||
nextp = &OBFiles;
|
nextp = &OBFiles;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1974,7 +1987,12 @@ void init()
|
|||||||
#else
|
#else
|
||||||
f = NULL;
|
f = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#if CONT_LINE
|
||||||
|
cline = cbuf;
|
||||||
|
while (fgets(cline, sizeof(cbuf) - (cline - cbuf), cf) != NULL) {
|
||||||
|
#else
|
||||||
while (fgets(cline, sizeof(cline), cf) != NULL) {
|
while (fgets(cline, sizeof(cline), cf) != NULL) {
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* check for end-of-section, comments, strip off trailing
|
* check for end-of-section, comments, strip off trailing
|
||||||
* spaces and newline character.
|
* spaces and newline character.
|
||||||
@ -1982,7 +2000,23 @@ void init()
|
|||||||
for (p = cline; isspace(*p); ++p);
|
for (p = cline; isspace(*p); ++p);
|
||||||
if (*p == '\0' || *p == '#')
|
if (*p == '\0' || *p == '#')
|
||||||
continue;
|
continue;
|
||||||
|
#if CONT_LINE
|
||||||
|
strcpy(cline, p);
|
||||||
|
#endif
|
||||||
for (p = index(cline, '\0'); isspace(*--p););
|
for (p = index(cline, '\0'); isspace(*--p););
|
||||||
|
#if CONT_LINE
|
||||||
|
if (*p == '\\') {
|
||||||
|
if ((p - cbuf) > BUFSIZ - 30) {
|
||||||
|
/* Oops the buffer is full - what now? */
|
||||||
|
cline = cbuf;
|
||||||
|
} else {
|
||||||
|
*p = 0;
|
||||||
|
cline = p;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
cline = cbuf;
|
||||||
|
#endif
|
||||||
*++p = '\0';
|
*++p = '\0';
|
||||||
#ifndef SYSV
|
#ifndef SYSV
|
||||||
f = (struct filed *)calloc(1, sizeof(*f));
|
f = (struct filed *)calloc(1, sizeof(*f));
|
||||||
@ -1991,7 +2025,11 @@ void init()
|
|||||||
#endif
|
#endif
|
||||||
allocate_log();
|
allocate_log();
|
||||||
f = &Files[lognum++];
|
f = &Files[lognum++];
|
||||||
|
#if CONT_LINE
|
||||||
|
cfline(cbuf, f);
|
||||||
|
#else
|
||||||
cfline(cline, f);
|
cfline(cline, f);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close the configuration file */
|
/* close the configuration file */
|
||||||
@ -2042,12 +2080,23 @@ void init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( AcceptRemote )
|
if ( AcceptRemote )
|
||||||
|
#ifdef DEBRELEASE
|
||||||
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL "#" DEBRELEASE \
|
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL "#" DEBRELEASE \
|
||||||
": restart (remote reception)." , LocalHostName, \
|
": restart (remote reception)." , LocalHostName, \
|
||||||
ADDDATE);
|
ADDDATE);
|
||||||
|
#else
|
||||||
|
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL \
|
||||||
|
": restart (remote reception)." , LocalHostName, \
|
||||||
|
ADDDATE);
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
|
#ifdef DEBRELEASE
|
||||||
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL "#" DEBRELEASE \
|
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL "#" DEBRELEASE \
|
||||||
": restart." , LocalHostName, ADDDATE);
|
": restart." , LocalHostName, ADDDATE);
|
||||||
|
#else
|
||||||
|
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL \
|
||||||
|
": restart." , LocalHostName, ADDDATE);
|
||||||
|
#endif
|
||||||
(void) signal(SIGHUP, sighup_handler);
|
(void) signal(SIGHUP, sighup_handler);
|
||||||
dprintf("syslogd: restarted.\n");
|
dprintf("syslogd: restarted.\n");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user