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. */
|
||||
sys_syslog(1, NULL, 0);
|
||||
#ifdef DEBRELEASE
|
||||
Syslog(LOG_INFO, "klogd %s-%s#%s, log source = sys_syslog "
|
||||
"started.", VERSION, PATCHLEVEL, DEBRELEASE);
|
||||
#else
|
||||
Syslog(LOG_INFO, "klogd %s-%s, log source = sys_syslog "
|
||||
"started.", VERSION, PATCHLEVEL);
|
||||
#endif
|
||||
return(kernel);
|
||||
}
|
||||
|
||||
@ -366,8 +371,13 @@ static enum LOGSRC GetKernelLogSrc(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef DEBRELEASE
|
||||
Syslog(LOG_INFO, "klogd %s-%s#%s, log source = %s started.", \
|
||||
VERSION, PATCHLEVEL, DEBRELEASE, _PATH_KLOG);
|
||||
#else
|
||||
Syslog(LOG_INFO, "klogd %s-%s, log source = %s started.", \
|
||||
VERSION, PATCHLEVEL, _PATH_KLOG);
|
||||
#endif
|
||||
return(proc);
|
||||
}
|
||||
|
||||
@ -602,8 +612,11 @@ int main(argc, argv)
|
||||
use_syscall = 1;
|
||||
break;
|
||||
case 'v':
|
||||
printf("klogd %s-%s#%s\n", VERSION, PATCHLEVEL,DEBRELEASE);
|
||||
exit (1);
|
||||
#ifdef DEBRELEASE
|
||||
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
|
||||
* 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",
|
||||
"/boot/System.map",
|
||||
"/usr/src/linux/System.map",
|
||||
#if defined(TEST)
|
||||
"./System.map",
|
||||
#endif
|
||||
@ -195,7 +198,7 @@ extern int InitKsyms(mapfile)
|
||||
if ( fscanf(sym_file, "%8lx %c %s\n", &address, &type, sym)
|
||||
!= 3 )
|
||||
{
|
||||
Syslog(LOG_ERR, "Error in symbol table input.");
|
||||
Syslog(LOG_ERR, "Error in symbol table input (#1).");
|
||||
fclose(sym_file);
|
||||
return(0);
|
||||
}
|
||||
@ -279,21 +282,34 @@ static char * FindSymbolFile()
|
||||
sym[512];
|
||||
|
||||
auto int version;
|
||||
|
||||
auto struct utsname utsname;
|
||||
char symfile[100];
|
||||
|
||||
auto unsigned long int address;
|
||||
|
||||
auto FILE *sym_file = (FILE *) 0;
|
||||
|
||||
if ( uname(&utsname) < 0 )
|
||||
{
|
||||
Syslog(LOG_ERR, "Cannot get kernel version information.");
|
||||
return(0);
|
||||
}
|
||||
|
||||
if ( debugging )
|
||||
fputs("Searching for symbol map.\n", stderr);
|
||||
|
||||
for (mf = system_maps; *mf != (char *) 0; ++mf)
|
||||
{
|
||||
sprintf (symfile, "%s", *mf);
|
||||
if ( debugging )
|
||||
fprintf(stderr, "Trying %s.\n", *mf);
|
||||
if ( (sym_file = fopen(*mf, "r")) == (FILE *) 0 )
|
||||
continue;
|
||||
fprintf(stderr, "Trying %s.\n", symfile);
|
||||
if ( (sym_file = fopen(symfile, "r")) == (FILE *) 0 ) {
|
||||
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
|
||||
@ -306,7 +322,7 @@ static char * FindSymbolFile()
|
||||
if ( fscanf(sym_file, "%8lx %c %s\n", &address, \
|
||||
&type, sym) != 3 )
|
||||
{
|
||||
Syslog(LOG_ERR, "Error in symbol table input.");
|
||||
Syslog(LOG_ERR, "Error in symbol table input (#2).");
|
||||
fclose(sym_file);
|
||||
return((char *) 0);
|
||||
}
|
||||
@ -334,14 +350,14 @@ static char * FindSymbolFile()
|
||||
{
|
||||
if ( debugging )
|
||||
fputs("Saving filename.\n", stderr);
|
||||
file = *mf;
|
||||
file = symfile;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if ( debugging )
|
||||
fprintf(stderr, "Found table with " \
|
||||
"matching version number.\n");
|
||||
return(*mf);
|
||||
return(symfile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,12 @@ priorities belonging to the specified action.
|
||||
|
||||
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
|
||||
The selector field itself again consists of two parts, a
|
||||
.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.
|
||||
|
||||
This
|
||||
|
||||
.BR syslogd (8)
|
||||
has a syntax extension to the original BSD source, that makes its use
|
||||
more intuitively. You may precede every priority with an equation sign
|
||||
@ -201,7 +208,7 @@ configuration, if not, drop me (Joey) a line.
|
||||
.LP
|
||||
This will store all messages with the priority
|
||||
.B crit
|
||||
or higher in the file
|
||||
in the file
|
||||
.IR /var/adm/critical ,
|
||||
except for any kernel message.
|
||||
|
||||
@ -286,7 +293,8 @@ and store them in the file
|
||||
.nf
|
||||
# Log info and notice messages to messages file
|
||||
#
|
||||
*.=info;*.=notice;mail.none /var/log/messages
|
||||
*.=info;*.=notice;\\
|
||||
mail.none /var/log/messages
|
||||
.fi
|
||||
.LP
|
||||
This lets the
|
||||
@ -303,7 +311,8 @@ facility.
|
||||
.nf
|
||||
# Log info messages to messages file
|
||||
#
|
||||
*.=info;mail,news.none /var/log/messages
|
||||
*.=info;\\
|
||||
mail,news.none /var/log/messages
|
||||
.fi
|
||||
.LP
|
||||
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
|
||||
* <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
|
||||
* Corrected behaviour of blocking pipes - i.e. the whole system
|
||||
* 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
|
||||
* Improved debug code to decode the numeric facility/priority
|
||||
* 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 TIMERINTVL 30 /* interval for checking flush, mark */
|
||||
|
||||
#define CONT_LINE 1 /* Allow continuation lines */
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@ -625,8 +640,6 @@ int main(argc, argv)
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
|
||||
int quitpid = 0;
|
||||
|
||||
while ((ch = getopt(argc, argv, "dhf:l:m:np:rs:v")) != EOF)
|
||||
switch((char)ch) {
|
||||
case 'd': /* debug */
|
||||
@ -681,13 +694,11 @@ int main(argc, argv)
|
||||
dprintf("Checking pidfile.\n");
|
||||
if (!check_pid(PidFile))
|
||||
{
|
||||
quitpid = getpid();
|
||||
if (fork())
|
||||
{
|
||||
/* We try to wait the end of initialization */
|
||||
sleep(10);
|
||||
/*
|
||||
* Parent process
|
||||
*/
|
||||
exit(0);
|
||||
}
|
||||
num_fds = getdtablesize();
|
||||
for (i= 0; i < num_fds; i++)
|
||||
(void) close(i);
|
||||
@ -842,11 +853,7 @@ int main(argc, argv)
|
||||
dprintf("Debugging disabled, SIGUSR1 to turn on debugging.\n");
|
||||
debugging_on = 0;
|
||||
}
|
||||
/*
|
||||
if (quitpid) {
|
||||
kill(quitpid, SIGINT);
|
||||
}
|
||||
*/
|
||||
|
||||
/* Main loop begins here. */
|
||||
FD_ZERO(&unixm);
|
||||
FD_ZERO(&readfds);
|
||||
@ -1904,23 +1911,23 @@ void init()
|
||||
register FILE *cf;
|
||||
register struct filed *f, **nextp = (struct filed **) 0;
|
||||
register char *p;
|
||||
#ifdef CONT_LINE
|
||||
char cbuf[BUFSIZ];
|
||||
char *cline;
|
||||
#else
|
||||
char cline[BUFSIZ];
|
||||
#endif
|
||||
|
||||
dprintf("Called init.\n");
|
||||
|
||||
/*
|
||||
* Close all open log files.
|
||||
*
|
||||
* This is needed especially when HUPing syslogd as the
|
||||
* structure would grow infinitively.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
Initialized = 0;
|
||||
if ( nlogs > -1 )
|
||||
{
|
||||
dprintf("Initializing log structures.\n");
|
||||
nlogs = -1;
|
||||
free((void *) Files);
|
||||
Files = (struct filed *) 0;
|
||||
}
|
||||
*/
|
||||
|
||||
#ifdef SYSV
|
||||
for (lognum = 0; lognum <= nlogs; lognum++ ) {
|
||||
@ -1943,11 +1950,17 @@ void init()
|
||||
#ifdef SYSV
|
||||
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
|
||||
next = f->f_next;
|
||||
free((char *) f);
|
||||
}
|
||||
Files = NULL;
|
||||
nextp = &OBFiles;
|
||||
#endif
|
||||
|
||||
@ -1974,7 +1987,12 @@ void init()
|
||||
#else
|
||||
f = NULL;
|
||||
#endif
|
||||
#if CONT_LINE
|
||||
cline = cbuf;
|
||||
while (fgets(cline, sizeof(cbuf) - (cline - cbuf), cf) != NULL) {
|
||||
#else
|
||||
while (fgets(cline, sizeof(cline), cf) != NULL) {
|
||||
#endif
|
||||
/*
|
||||
* check for end-of-section, comments, strip off trailing
|
||||
* spaces and newline character.
|
||||
@ -1982,7 +2000,23 @@ void init()
|
||||
for (p = cline; isspace(*p); ++p);
|
||||
if (*p == '\0' || *p == '#')
|
||||
continue;
|
||||
#if CONT_LINE
|
||||
strcpy(cline, p);
|
||||
#endif
|
||||
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';
|
||||
#ifndef SYSV
|
||||
f = (struct filed *)calloc(1, sizeof(*f));
|
||||
@ -1991,7 +2025,11 @@ void init()
|
||||
#endif
|
||||
allocate_log();
|
||||
f = &Files[lognum++];
|
||||
#if CONT_LINE
|
||||
cfline(cbuf, f);
|
||||
#else
|
||||
cfline(cline, f);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* close the configuration file */
|
||||
@ -2042,12 +2080,23 @@ void init()
|
||||
}
|
||||
|
||||
if ( AcceptRemote )
|
||||
#ifdef DEBRELEASE
|
||||
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL "#" DEBRELEASE \
|
||||
": restart (remote reception)." , LocalHostName, \
|
||||
ADDDATE);
|
||||
#else
|
||||
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL \
|
||||
": restart (remote reception)." , LocalHostName, \
|
||||
ADDDATE);
|
||||
#endif
|
||||
else
|
||||
#ifdef DEBRELEASE
|
||||
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL "#" DEBRELEASE \
|
||||
": restart." , LocalHostName, ADDDATE);
|
||||
#else
|
||||
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL \
|
||||
": restart." , LocalHostName, ADDDATE);
|
||||
#endif
|
||||
(void) signal(SIGHUP, sighup_handler);
|
||||
dprintf("syslogd: restarted.\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user