diff --git a/man/syslogp.3 b/man/syslogp.3 index bc78a37..2096b80 100644 --- a/man/syslogp.3 +++ b/man/syslogp.3 @@ -236,6 +236,8 @@ Critical conditions, e.g., hard device errors. Errors. .It Dv LOG_WARNING Warning messages. +.It Dv LOG_WARN +Warning messages, alias. .It Dv LOG_NOTICE Conditions that are not error conditions, but should possibly be handled specially. diff --git a/src/klogd.c b/src/klogd.c index 6defff1..41cca9c 100644 --- a/src/klogd.c +++ b/src/klogd.c @@ -218,8 +218,7 @@ static enum LOGSRC GetKernelLogSrc(void) * issue an error message and simply shut-off console * logging completely. */ - Syslog(LOG_WARNING, "Cannot set console log level - disabling " - "console output."); + Syslog(LOG_WARN, "Cannot set console log level - disabling console output."); } /* @@ -230,15 +229,12 @@ static enum LOGSRC GetKernelLogSrc(void) ((stat(_PATH_KLOG, &sb) < 0) && (errno == ENOENT))) { /* Initialize kernel logging. */ ksyslog(1, NULL, 0); - Syslog(LOG_INFO, "klogd v%s, log source = ksyslog " - "started.", - PACKAGE_VERSION); + Syslog(LOG_INFO, "klogd v%s, log source = ksyslog started.", PACKAGE_VERSION); return kernel; } if ((kmsg = open(_PATH_KLOG, O_RDONLY)) < 0) { - fprintf(stderr, "klogd: Cannot open proc file system, " - "%d - %s.\n", + fprintf(stderr, "klogd: Cannot open proc file system, %d - %s.\n", errno, strerror(errno)); ksyslog(7, NULL, 0); exit(1); @@ -293,7 +289,7 @@ extern void Syslog(int priority, char *fmt, ...) priority = LOG_ERR; break; case '4': - priority = LOG_WARNING; + priority = LOG_WARN; break; case '5': priority = LOG_NOTICE; @@ -565,8 +561,7 @@ static void LogKernelLine(void) if (errno == EINTR) return; - fprintf(stderr, - "klogd: Error return from sys_sycall: %d - %s\n", + fprintf(stderr, "klogd: Error return from sys_sycall: %d - %s\n", errno, strerror(errno)); return; } @@ -695,9 +690,7 @@ int main(int argc, char *argv[]) if (log_level != NULL) { if ((strlen(log_level) > 1) || (strchr("12345678", *log_level) == NULL)) { - fprintf(stderr, "klogd: Invalid console logging " - "level <%s> specified.\n", - log_level); + fprintf(stderr, "klogd: Invalid console logging level <%s>.\n", log_level); return 1; } console_log_level = *log_level - '0'; diff --git a/src/klogd.h b/src/klogd.h index 1dc85d6..f6a7b08 100644 --- a/src/klogd.h +++ b/src/klogd.h @@ -24,8 +24,8 @@ #define SYSKLOGD_KLOGD_H_ #include -#include #include +#include "syslog.h" extern int InitKsyms(char *); extern int InitMsyms(void); diff --git a/src/ksym.c b/src/ksym.c index a80250c..c4284be 100644 --- a/src/ksym.c +++ b/src/ksym.c @@ -99,7 +99,7 @@ int InitKsyms(char *mapfile) */ if (mapfile == NULL) { if ((mapfile = FindSymbolFile()) == NULL) { - Syslog(LOG_WARNING, "Cannot find a map file."); + Syslog(LOG_WARN, "Cannot find a map file."); if (debugging) fputs("Cannot find a map file.\n", stderr); return 0; @@ -107,7 +107,7 @@ int InitKsyms(char *mapfile) } if ((sym_file = fopen(mapfile, "r")) == NULL) { - Syslog(LOG_WARNING, "Cannot open map file: %s.", mapfile); + Syslog(LOG_WARN, "Cannot open map file: %s.", mapfile); if (debugging) fprintf(stderr, "Cannot open map file: %s.\n", mapfile); return 0; @@ -144,12 +144,12 @@ int InitKsyms(char *mapfile) Syslog(LOG_INFO, "Loaded %d symbols from %s.", num_syms, mapfile); switch (version) { case -1: - Syslog(LOG_WARNING, "Symbols do not match kernel version."); + Syslog(LOG_WARN, "Symbols do not match kernel version."); num_syms = 0; break; case 0: - Syslog(LOG_WARNING, "Cannot verify that symbols match " + Syslog(LOG_WARN, "Cannot verify that symbols match " "kernel version."); break; @@ -599,7 +599,7 @@ char *ExpandKadds(char *line, char *el) */ if (i_am_paranoid && (strstr(line, "Oops:") != NULL) && !InitMsyms()) - Syslog(LOG_WARNING, "Cannot load kernel module symbols.\n"); + Syslog(LOG_WARN, "Cannot load kernel module symbols.\n"); /* * Early return if there do not appear to be any kernel diff --git a/src/ksym_mod.c b/src/ksym_mod.c index dda9374..cc052c2 100644 --- a/src/ksym_mod.c +++ b/src/ksym_mod.c @@ -242,7 +242,7 @@ struct Module *AddModule(const char *module) if (num_modules == 0) { sym_array_modules = (struct Module *)malloc(sizeof(struct Module)); if (sym_array_modules == NULL) { - Syslog(LOG_WARNING, "Cannot allocate Module array.\n"); + Syslog(LOG_WARN, "Cannot allocate Module array.\n"); return NULL; } mp = sym_array_modules; @@ -250,7 +250,7 @@ struct Module *AddModule(const char *module) /* Allocate space for the module. */ mp = realloc(sym_array_modules, (num_modules + 1) * sizeof(struct Module)); if (mp == NULL) { - Syslog(LOG_WARNING, "Cannot allocate Module array.\n"); + Syslog(LOG_WARN, "Cannot allocate Module array.\n"); return NULL; } diff --git a/src/syslog.h b/src/syslog.h index b7ea768..953baa4 100644 --- a/src/syslog.h +++ b/src/syslog.h @@ -63,6 +63,7 @@ #define LOG_ALERT 1 /* action must be taken immediately */ #define LOG_CRIT 2 /* critical conditions */ #define LOG_ERR 3 /* error conditions */ +#define LOG_WARN 4 /* warning conditions, alias */ #define LOG_WARNING 4 /* warning conditions */ #define LOG_NOTICE 5 /* normal but significant condition */ #define LOG_INFO 6 /* informational */ diff --git a/src/syslogd.c b/src/syslogd.c index ec36f08..8c244de 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -1641,12 +1641,12 @@ void fprintlog(struct filed *f, struct buf_msg *buffer) logit("Failure resolving %s:%s: %s\n", host, service, gai_strerror(err)); logit("Retries: %d\n", f->f_prevcount); if (--f->f_prevcount < 0) { - flog(LOG_SYSLOG | LOG_WARNING, "Still cannot find %s, " + flog(LOG_SYSLOG | LOG_WARN, "Still cannot find %s, " "giving up: %s", host, gai_strerror(err)); logit("Giving up.\n"); f->f_type = F_UNUSED; } else { - flog(LOG_SYSLOG | LOG_WARNING, "Still cannot find %s, " + flog(LOG_SYSLOG | LOG_WARN, "Still cannot find %s, " "will try again later: %s", host, gai_strerror(err)); logit("Left retries: %d\n", f->f_prevcount); } @@ -2606,7 +2606,7 @@ static struct filed *cfline(char *line) err = nslookup(p, service, &ai); if (err) { - flog(LOG_SYSLOG | LOG_WARNING, "Cannot find %s, " + flog(LOG_SYSLOG | LOG_WARN, "Cannot find %s, " "will try again later: %s", p, gai_strerror(err)); /* * The host might be unknown due to an inaccessible