From ba91f08b676cdb873326906656bad68790a01301 Mon Sep 17 00:00:00 2001 From: Gary Mills Date: Tue, 19 Nov 2013 13:08:45 -0600 Subject: [PATCH] 4211 Some syslog facility names and symbols are missing 1762 Syslogd man page: missing reference. Reviewed by: Robert Mustacchi Reviewed by: Josef 'Jeff' Sipek Reviewed by: Garrett D'Amore Approved by: Richard Lowe --- usr/src/cmd/logger/logger.c | 21 ++++++----- usr/src/cmd/syslogd/syslogd.c | 18 ++++++---- usr/src/man/man1m/syslogd.1m | 9 ++--- usr/src/man/man4/syslog.conf.4 | 78 ++++++++++++++++++++++++++++++++++------- usr/src/uts/common/os/logsubr.c | 5 +-- usr/src/uts/common/sys/syslog.h | 9 +++-- 6 files changed, 104 insertions(+), 36 deletions(-) diff --git a/usr/src/cmd/logger/logger.c b/usr/src/cmd/logger/logger.c index 5103750e22..35e3b322cb 100644 --- a/usr/src/cmd/logger/logger.c +++ b/usr/src/cmd/logger/logger.c @@ -19,6 +19,7 @@ * CDDL HEADER END */ /* + * Copyright (c) 2013 Gary Mills * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -36,7 +37,6 @@ * contributors. */ -#pragma ident "%Z%%M% %I% %E% SMI" #include #include @@ -85,8 +85,13 @@ static struct code FacNames[] = { "lpr", LOG_LPR, "news", LOG_NEWS, "uucp", LOG_UUCP, - "cron", LOG_CRON, + "altcron", LOG_ALTCRON, + "authpriv", LOG_AUTHPRIV, + "ftp", LOG_FTP, + "ntp", LOG_NTP, "audit", LOG_AUDIT, + "console", LOG_CONSOLE, + "cron", LOG_CRON, "local0", LOG_LOCAL0, "local1", LOG_LOCAL1, "local2", LOG_LOCAL2, @@ -140,21 +145,21 @@ main(int argc, char **argv) while ((opt = getopt(argc, argv, "it:p:f:")) != EOF) switch (opt) { - case 't': /* tag */ + case 't': /* tag */ tag = optarg; break; - case 'p': /* priority */ + case 'p': /* priority */ pri = pencode(optarg); break; - case 'i': /* log process id also */ + case 'i': /* log process id also */ logflags |= LOG_PID; pid_len = sprintf(tmp, "%ld", (long)getpid()); pid_len = (pid_len <= 0) ? 0 : pid_len +2; break; - case 'f': /* file to log */ + case 'f': /* file to log */ if (strcmp(optarg, "-") == 0) break; infile = optarg; @@ -165,7 +170,7 @@ main(int argc, char **argv) } break; - default: + default: usage(); } @@ -359,6 +364,6 @@ usage(void) (void) fprintf(stderr, gettext( "Usage:\tlogger string\n" "\tlogger [-i] [-f filename] [-p priority] [-t tag] " - "[message] ...\n")); + "[message] ...\n")); exit(1); } diff --git a/usr/src/cmd/syslogd/syslogd.c b/usr/src/cmd/syslogd/syslogd.c index 7b9e352d48..ed9d41ec60 100644 --- a/usr/src/cmd/syslogd/syslogd.c +++ b/usr/src/cmd/syslogd/syslogd.c @@ -22,6 +22,7 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright 2012 Milan Jurik. All rights reserved. + * Copyright (c) 2013 Gary Mills */ /* @@ -155,7 +156,12 @@ static struct code FacNames[] = { "lpr", LOG_LPR, "news", LOG_NEWS, "uucp", LOG_UUCP, + "altcron", LOG_ALTCRON, + "authpriv", LOG_AUTHPRIV, + "ftp", LOG_FTP, + "ntp", LOG_NTP, "audit", LOG_AUDIT, + "console", LOG_CONSOLE, "cron", LOG_CRON, "local0", LOG_LOCAL0, "local1", LOG_LOCAL1, @@ -617,12 +623,10 @@ sys_poll(void *ap) DPRINT1(1, "sys_poll(%u): sys_thread started\n", mythreadno); /* - * Try to process as many messages as we can without blocking on poll. - * We count such "initial" messages with sys_init_msg_count and - * enqueue them without the SYNC_FILE flag. When no more data is - * waiting on the local log device, we set timeout to INFTIM, - * clear sys_init_msg_count, and generate a flush message to sync - * the previously counted initial messages out to disk. + * Process messages, blocking on poll because timeout is set + * to INFTIM. When poll returns with a message, call getkmsg + * to pull up one message from the log driver and enqueue it + * with the sync flag set. */ sys_init_msg_count = 0; @@ -695,7 +699,7 @@ getkmsg(int timeout) lastline = &dat.buf[dat.len]; *lastline = '\0'; - DPRINT2(5, "sys_poll:(%u): getmsg: dat.len = %d\n", + DPRINT2(5, "getkmsg:(%u): getmsg: dat.len = %d\n", mythreadno, dat.len); buflen = strlen(buf); len = findnl_bkwd(buf, buflen); diff --git a/usr/src/man/man1m/syslogd.1m b/usr/src/man/man1m/syslogd.1m index ad6c828457..9e1c58e64f 100644 --- a/usr/src/man/man1m/syslogd.1m +++ b/usr/src/man/man1m/syslogd.1m @@ -1,9 +1,10 @@ '\" te +.\" Copyright (c) 2013 Gary Mills .\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH SYSLOGD 1M "Oct 31, 2008" +.TH SYSLOGD 1M "Oct 17, 2013" .SH NAME syslogd \- log system messages .SH SYNOPSIS @@ -62,7 +63,7 @@ message \fBID\fR generation enabled. .LP In an effort to reduce visual clutter, message \fBID\fRs are not displayed when writing to the console; message \fBID\fRs are only written to the log file. -See . +See \fBEXAMPLES\fR. .sp .LP The \fB/etc/default/syslogd\fR file contains the following default parameter @@ -152,7 +153,7 @@ Specify an alternative log device name. The default is \fB/dev/log\fR. .sp .6 .RS 4n Enable the \fBsyslogd\fR \fBUDP\fR port to turn on logging of remote messages. -This is the default behavior. See . +This is the default behavior. See \fBEXAMPLES\fR. .RE .sp @@ -163,7 +164,7 @@ This is the default behavior. See . .sp .6 .RS 4n Disable the \fBsyslogd\fR \fBUDP\fR port to turn off logging of remote -messages. See . +messages. See \fBEXAMPLES\fR. .RE .SH EXAMPLES diff --git a/usr/src/man/man4/syslog.conf.4 b/usr/src/man/man4/syslog.conf.4 index e05bef219b..310e5bcdd6 100644 --- a/usr/src/man/man4/syslog.conf.4 +++ b/usr/src/man/man4/syslog.conf.4 @@ -1,7 +1,8 @@ '\" te +.\" Copyright (c) 2013 Gary Mills .\" Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. .\" Copyright (c) 1983 Regents of the University of California. All rights reserved. The Berkeley software License Agreement specifies the terms and conditions for redistribution. -.TH SYSLOG.CONF 4 "Apr 26, 2006" +.TH SYSLOG.CONF 4 "Nov 19, 2013" .SH NAME syslog.conf \- configuration file for syslogd system log daemon .SH SYNOPSIS @@ -44,24 +45,29 @@ specifications of the form: .LP where \fIfacility\fR is a system facility, or comma-separated list of facilities, and \fIlevel\fR is an indication of the severity of the condition -being logged. Recognized values for \fIfacility\fR include: +being logged. +The presence of a facility name only implies that it is available. +Each individual service determines which facility it will use for logging. +In particular, many facilities are only useful for \fBsyslog\fR messages +that are forwarded from other operating systems. +Recognized values for \fIfacility\fR include: .sp .ne 2 .na -\fB\fBuser\fR\fR +\fB\fBkern\fR\fR .ad .RS 12n -Messages generated by user processes. This is the default priority for messages -from programs or facilities not listed in this file. +Messages generated by the kernel. .RE .sp .ne 2 .na -\fB\fBkern\fR\fR +\fB\fBuser\fR\fR .ad .RS 12n -Messages generated by the kernel. +Messages generated by user processes. This is the default priority for messages +from programs or facilities not listed in this file. .RE .sp @@ -79,7 +85,7 @@ The mail system. \fB\fBdaemon\fR\fR .ad .RS 12n -System daemons, such as \fBin.ftpd\fR(1M) +Various system daemons. .RE .sp @@ -123,12 +129,39 @@ mechanism. .sp .ne 2 .na -\fB\fBcron\fR\fR +\fB\fBaltcron\fR\fR .ad .RS 12n -Designated for \fBcron\fR/\fBat\fR messages generated by systems that do -logging through \fBsyslog\fR. The current version of the Solaris Operating -Environment does not use this facility for logging. +Designated for the BSD cron/at system. +.RE + +.sp +.ne 2 +.na +\fB\fBauthpriv\fR\fR +.ad +.RS 12n +Designated for the BSD security/authorization system. +.RE + +.sp +.ne 2 +.na +\fB\fBftp\fR\fR +.ad +.RS 12n +Designated for the file transfer system. +The current version of \fBin.ftpd\fR(1M) does not use this facility +for logging. +.RE + +.sp +.ne 2 +.na +\fB\fBntp\fR\fR +.ad +.RS 12n +Designated for the network time system. .RE .sp @@ -144,6 +177,27 @@ syslog. .sp .ne 2 .na +\fB\fBconsole\fR\fR +.ad +.RS 12n +Designated for the BSD console system. +.RE + +.sp +.ne 2 +.na +\fB\fBcron\fR\fR +.ad +.RS 12n +Designated for \fBcron\fR/\fBat\fR messages generated by systems that do +logging through \fBsyslog\fR. +The current versions of \fBcron\fR and \fBat\fR do not use this facility +for logging. +.RE + +.sp +.ne 2 +.na \fB\fBlocal0-7\fR\fR .ad .RS 12n diff --git a/usr/src/uts/common/os/logsubr.c b/usr/src/uts/common/os/logsubr.c index f5cebbf82e..149f5f8a88 100644 --- a/usr/src/uts/common/os/logsubr.c +++ b/usr/src/uts/common/os/logsubr.c @@ -20,6 +20,7 @@ */ /* + * Copyright (c) 2013 Gary Mills * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -73,8 +74,8 @@ static char log_pri[LOG_PRIMASK + 1][LOG_PRISIZE] = { static char log_fac[LOG_NFACILITIES + 1][LOG_FACSIZE] = { "kern", "user", "mail", "daemon", "auth", "syslog", "lpr", "news", - "uucp", "resv9", "resv10", "resv11", - "resv12", "audit", "resv14", "cron", + "uucp", "altcron", "authpriv", "ftp", + "ntp", "audit", "console", "cron", "local0", "local1", "local2", "local3", "local4", "local5", "local6", "local7", "unknown" diff --git a/usr/src/uts/common/sys/syslog.h b/usr/src/uts/common/sys/syslog.h index 6f073959b2..605cae78d9 100644 --- a/usr/src/uts/common/sys/syslog.h +++ b/usr/src/uts/common/sys/syslog.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2013 Gary Mills * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -19,8 +20,6 @@ #ifndef _SYS_SYSLOG_H #define _SYS_SYSLOG_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -37,9 +36,13 @@ extern "C" { #define LOG_LPR (6<<3) /* line printer subsystem */ #define LOG_NEWS (7<<3) /* netnews subsystem */ #define LOG_UUCP (8<<3) /* uucp subsystem */ +#define LOG_ALTCRON (9<<3) /* BSD cron/at subsystem */ +#define LOG_AUTHPRIV (10<<3) /* BSD security/authorization messages */ +#define LOG_FTP (11<<3) /* file transfer subsystem */ +#define LOG_NTP (12<<3) /* network time subsystem */ #define LOG_AUDIT (13<<3) /* audit subsystem */ +#define LOG_CONSOLE (14<<3) /* BSD console messages */ #define LOG_CRON (15<<3) /* cron/at subsystem */ - /* other codes through 15 reserved for system use */ #define LOG_LOCAL0 (16<<3) /* reserved for local use */ #define LOG_LOCAL1 (17<<3) /* reserved for local use */ #define LOG_LOCAL2 (18<<3) /* reserved for local use */ -- 2.11.4.GIT