diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG index 8a47c573a1795708eee23a58a957c16557757dbf..40a1f03d059e1042b49ad3df9dfa01a927703195 100644 --- a/sm5/CHANGELOG +++ b/sm5/CHANGELOG @@ -1,6 +1,6 @@ CHANGELOG for smartmontools -$Id: CHANGELOG,v 1.245 2003/11/09 19:05:30 pjwilliams Exp $ +$Id: CHANGELOG,v 1.246 2003/11/09 20:22:21 ballen4705 Exp $ Maintainers / Developers Key: [BA] Bruce Allen @@ -23,6 +23,11 @@ CURRENT DEVELOPMENT VERSION (see VERSION file in this directory): <ADDITIONS TO THE CHANGE LOG SHOULD BE ADDED HERE, PLEASE> + [BA] smartd: added additional command line argument -l FACILITY + or --logfacility FACILITY. This can be used to redirect + messages from smartd to a different file than the one used + by other system daemons. + [PW] Added Seagate Barracuda 7200.7, Western Digital Protege WD400EB, and Western Digital Caviar AC38400 to knowndrives table. diff --git a/sm5/smartd.8.in b/sm5/smartd.8.in index b418dbce0cb0ebf585a7039e0d2b04c01bf99057..9fc0a409ad22a4000d046b8138003c0950c2a1f8 100644 --- a/sm5/smartd.8.in +++ b/sm5/smartd.8.in @@ -1,7 +1,7 @@ .ig Copyright (C) 2002-3 Bruce Allen <smartmontools-support@lists.sourceforge.net> -$Id: smartd.8.in,v 1.12 2003/10/21 12:00:53 arvoreen Exp $ +$Id: smartd.8.in,v 1.13 2003/11/09 20:22:21 ballen4705 Exp $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ Cornwell at the Concurrent Systems Laboratory (now part of the Storage Systems Research Center), Jack Baskin School of Engineering, University of California, Santa Cruz. http://ssrc.soe.ucsc.edu/ .. -.TH SMARTD 8 "$Date: 2003/10/21 12:00:53 $" RELEASE +.TH SMARTD 8 "$Date: 2003/11/09 20:22:21 $" RELEASE .SH NAME \fBsmartd\fP \- SMART Disk Monitoring Daemon @@ -28,45 +28,35 @@ University of California, Santa Cruz. http://ssrc.soe.ucsc.edu/ .B /usr/sbin/smartd .SH PACKAGE VERSION -\fBRELEASE\fP "$Date: 2003/10/21 12:00:53 $" +\fBRELEASE\fP "$Date: 2003/11/09 20:22:21 $" .SH DESCRIPTION -.B smartd -is a daemon that monitors the Self-Monitoring, Analysis and Reporting -Technology (SMART) system built into many ATA-3 and later ATA, -IDE and SCSI-3 hard drives. The purpose of SMART is to monitor -the reliability of the hard drive and predict drive failures, and to -carry out different types of drive self-tests. This version of -.B smartd -is compatible with ATA/ATAPI-5 and earlier standards (see -.B REFERENCES -below) - -.B smartd -will attempt to enable SMART monitoring on ATA devices (equivalent to -.B smartctl -s on -) and polls -these and SCSI devices every 30 minutes (configurable), logging -SMART errors and changes of SMART Attributes via the SYSLOG -interface. The default location for these SYSLOG notifications and -warnings is -.B /var/log/messages. - -If you send a -.B USR1 -signal to -.B smartd -it will immediately check the status of the disks, and then return to -polling the disks every 30 minutes. See the -.B \'\-i\' -option below for additional details. +\fBsmartd\fP is a daemon that monitors the Self-Monitoring, Analysis +and Reporting Technology (SMART) system built into many ATA-3 and +later ATA, IDE and SCSI-3 hard drives. The purpose of SMART is to +monitor the reliability of the hard drive and predict drive failures, +and to carry out different types of drive self-tests. This version of +\fBsmartd\fP is compatible with ATA/ATAPI-5 and earlier standards (see +\fBREFERENCES\fP below). + +\fBsmartd\fP will attempt to enable SMART monitoring on ATA devices +(equivalent to \fBsmartctl -s on\fP) and polls these and SCSI devices +every 30 minutes (configurable), logging SMART errors and changes of +SMART Attributes via the SYSLOG interface. The default location for +these SYSLOG notifications and warnings is \fB/var/log/messages\fP. +To change this default location, please see the \fB\'-l\'\fP +command-line option described below. + +If you send a \fBUSR1\fP signal to \fBsmartd\fP it will immediately +check the status of the disks, and then return to polling the disks +every 30 minutes. See the \fB\'\-i\'\fP option below for additional +details. -.B smartd -can be configured at start-up using the configuration file -.B /etc/smartd.conf. -If the configuration file is subsequently modified, \fBsmartd\fP can -be told to re-read the configuration file by sending it a \fBHUP\fP -signal, for example with the command: +\fBsmartd\fP can be configured at start-up using the configuration +file \fB/etc/smartd.conf\fP. If the configuration file is +subsequently modified, \fBsmartd\fP can be told to re-read the +configuration file by sending it a \fBHUP\fP signal, for example with +the command: .fi \fBkillall -HUP smartd\fP. .fi @@ -101,9 +91,8 @@ start-up. .SH OPTIONS -Long options are not supported on all systems. Use -.B \'smartd \-h\' -to see the available options. +Long options are not supported on all systems. Use \fB\'smartd +\-h\'\fP to see the available options. .TP .B \-d, \-\-debug Runs \fBsmartd\fP in "debug" mode. In this mode, it displays status @@ -124,32 +113,60 @@ appear in the configuration file following the device name. Prints usage message to STDOUT and exits. .TP .B \-i N, \-\-interval=N -Sets the interval between disk checks to -.I N -seconds, where -.I N -is a decimal integer. The minimum allowed value is ten and the maximum is the -largest positive integer that can be represented on your system (often 2^31-1). -The default is 1800 seconds. - -Note that the superuser can make -.B smartd -check the status of the disks at any time by sending it the -.B SIGUSR1 -signal, for example with the command: +Sets the interval between disk checks to \fIN\fP seconds, where +\fIN\fP is a decimal integer. The minimum allowed value is ten and +the maximum is the largest positive integer that can be represented on +your system (often 2^31-1). The default is 1800 seconds. + +Note that the superuser can make \fBsmartd\fP check the status of the +disks at any time by sending it the \fBSIGUSR1\fP signal, for example +with the command: .nf .B kill -SIGUSR1 <pid> .fi -where -.B <pid> -is the process id number of -.B smartd. -One may also use: +where \fB<pid>\fP is the process id number of \fBsmartd\fP. One may +also use: .nf .B killall -USR1 smartd .fi for the same purpose. .TP +.B \-l FACILITY, \-\-logfacility=FACILITY +Uses syslog facility FACILITY to log the messages from \fBsmartd\fP. +Here FACILITY is one of \fBlocal0\fP, \fBlocal1\fP, ..., \fBlocal7\fP. +If this command-line option is not used, then by default messages from +\fBsmartd\fP are logged to the facility \fBdaemon\fP. + +If you would like to have \fBsmartd\fP messages logged somewhere other +than the default \fB/var/log/messages\fP location, this can typically +be accomplished with (for example) the following steps: +.RS 7 +.IP \fB[1]\fP 4 +Modify the script that starts \fBsmartd\fP to include the \fBsmartd\fP +command-line argument \'\-l local3\'. This tells \fBsmartd\fP to log its +messages to facility \fBlocal3\fP. +.IP \fB[2]\fP 4 +Modify the \fBsyslogd\fP configuration file (typically +\fB/etc/syslog.conf\fP) to contain a line of the form: +.nf +\fBlocal3.* /var/log/smartd.log\fP +.fi +which tells \fBsyslogd\fP to log all the messages from facility \fBlocal3\fP to +the designated file: smartd.log. +.IP \fB[3]\fP 4 +Tell \fBsyslogd\fP to re-read its configuration file, typically by +sending the \fBsyslogd\fP process a \fBSIGHUP\fP hang-up signal. +.IP \fB[4]\fP 4 +restart \fBsmartd\fP. +.RE +.RS 6 + +For more detailed information, please refer to the man pages for +\fBsyslog.conf\fP, \fBsyslogd\fP, and \fBsyslog\fP. You may also want +to modify the log rotation configuration files; see the man pages for +\fBlogrotate\fP and examine your system\'s /etc/logrotate.conf file. +.RE +.TP .B \-p NAME, \-\-pidfile=NAME Writes pidfile .I NAME @@ -1337,4 +1354,4 @@ smartmontools home page at \fBhttp://smartmontools.sourceforge.net/\fP . .SH CVS ID OF THIS PAGE: -$Id: smartd.8.in,v 1.12 2003/10/21 12:00:53 arvoreen Exp $ +$Id: smartd.8.in,v 1.13 2003/11/09 20:22:21 ballen4705 Exp $ diff --git a/sm5/smartd.c b/sm5/smartd.c index eb7ebe706b1d04428a5a79f95ede23cee2aaf35b..46f5ba100eda4f53b43897f5793134a6ccfed6e6 100644 --- a/sm5/smartd.c +++ b/sm5/smartd.c @@ -65,7 +65,7 @@ extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *escalade_c_cvsid, *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *utility_c_cvsid; -const char *smartd_c_cvsid="$Id: smartd.c,v 1.230 2003/11/05 11:16:55 ballen4705 Exp $" +const char *smartd_c_cvsid="$Id: smartd.c,v 1.231 2003/11/09 20:22:21 ballen4705 Exp $" ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID KNOWNDRIVES_H_CVSID SCSICMDS_H_CVSID SMARTD_H_CVSID UTILITY_H_CVSID; @@ -91,6 +91,10 @@ static char* configfile=SYSCONFDIR "/" CONFIGFILENAME ; // command-line: when should we exit? static int quit=0; +// command-line; this is the default syslog(3) log facility to use. +// It is initialzed to LOG_DAEMON +extern int facility; + // used for control of printing, passing arguments to atacmds.c smartmonctrl *con=NULL; @@ -109,7 +113,6 @@ extern long long bytes; // exit status extern int exitstatus; - // set to one if we catch a USR1 (check devices now) volatile int caughtsigUSR1=0; @@ -122,6 +125,11 @@ volatile int caughtsigHUP=0; jmp_buf registerscsienv; #endif + + + + + // prints CVS identity information for the executable void PrintCVS(void){ char out[CVSMAXLEN]; @@ -487,7 +495,7 @@ void pout(char *fmt, ...){ vprintf(fmt,ap); // in debug==2 mode we print output from knowndrives.o functions else if (debugmode==2 || con->reportataioctl || con->reportscsiioctl || con->escalade) { - openlog("smartd", LOG_PID, LOG_DAEMON); + openlog("smartd", LOG_PID, facility); vsyslog(LOG_INFO, fmt, ap); closelog(); } @@ -619,6 +627,8 @@ return; arguments to the option opt or NULL on failure. */ const char *GetValidArgList(char opt) { switch (opt) { + case 'l': + return "local0, local1, local2, local3, local4, local5, local6, local7"; case 'q': return "nodev, errors, nodevstartup, never, onecheck"; case 'r': @@ -644,6 +654,8 @@ void Usage (void){ PrintOut(LOG_INFO," Display this help and exit\n\n"); PrintOut(LOG_INFO," -i N, --interval=N\n"); PrintOut(LOG_INFO," Set interval between disk checks to N seconds, where N >= 10\n\n"); + PrintOut(LOG_INFO," -l local[0-7], --logfacility=local[0-7]\n"); + PrintOut(LOG_INFO," Use syslog facility local0 - local7 rather than daemon\n\n"); PrintOut(LOG_INFO," -p NAME, --pidfile=NAME\n"); PrintOut(LOG_INFO," Write PID file NAME\n\n"); PrintOut(LOG_INFO," -q WHEN, --quit=WHEN\n"); @@ -653,14 +665,15 @@ void Usage (void){ PrintOut(LOG_INFO," -V, --version, --license, --copyright\n"); PrintOut(LOG_INFO," Print License, Copyright, and version information\n"); #else - PrintOut(LOG_INFO," -d Start smartd in debug mode\n"); - PrintOut(LOG_INFO," -D Print the configuration file Directives and exit\n"); - PrintOut(LOG_INFO," -h Display this help and exit\n"); - PrintOut(LOG_INFO," -i N Set interval between disk checks to N seconds, where N >= 10\n"); - PrintOut(LOG_INFO," -p NAME Write PID file NAME\n"); - PrintOut(LOG_INFO," -q WHEN Quit on one of: %s\n", GetValidArgList('q')); - PrintOut(LOG_INFO," -r TYPE Report transactions for one of: %s\n", GetValidArgList('r')); - PrintOut(LOG_INFO," -V Print License, Copyright, and version information\n"); + PrintOut(LOG_INFO," -d Start smartd in debug mode\n"); + PrintOut(LOG_INFO," -D Print the configuration file Directives and exit\n"); + PrintOut(LOG_INFO," -h Display this help and exit\n"); + PrintOut(LOG_INFO," -i N Set interval between disk checks to N seconds, where N >= 10\n"); + PrintOut(LOG_INFO," -l local? Use syslog facility local0 - local7 rather than daemon\n"); + PrintOut(LOG_INFO," -p NAME Write PID file NAME\n"); + PrintOut(LOG_INFO," -q WHEN Quit on one of: %s\n", GetValidArgList('q')); + PrintOut(LOG_INFO," -r TYPE Report transactions for one of: %s\n", GetValidArgList('r')); + PrintOut(LOG_INFO," -V Print License, Copyright, and version information\n"); #endif } @@ -2274,11 +2287,12 @@ void ParseOpts(int argc, char **argv){ char *tailptr; long lchecktime; // Please update GetValidArgList() if you edit shortopts - const char *shortopts = "q:dDi:p:r:Vh?"; + const char *shortopts = "l:q:dDi:p:r:Vh?"; #ifdef HAVE_GETOPT_LONG char *arg; // Please update GetValidArgList() if you edit longopts struct option longopts[] = { + { "logfacility", required_argument, 0, 'l' }, { "quit", required_argument, 0, 'q' }, { "debug", no_argument, 0, 'd' }, { "showdirectives", no_argument, 0, 'D' }, @@ -2309,6 +2323,7 @@ void ParseOpts(int argc, char **argv){ switch(optchar) { case 'q': + // when to quit if (!(strcmp(optarg,"nodev"))) { quit=0; } else if (!(strcmp(optarg,"nodevstartup"))) { @@ -2324,10 +2339,33 @@ void ParseOpts(int argc, char **argv){ badarg = TRUE; } break; + case 'l': + // set the log facility level + if (!strcmp(optarg, "local0")) + facility=LOG_LOCAL0; + else if (!strcmp(optarg, "local1")) + facility=LOG_LOCAL1; + else if (!strcmp(optarg, "local2")) + facility=LOG_LOCAL2; + else if (!strcmp(optarg, "local3")) + facility=LOG_LOCAL3; + else if (!strcmp(optarg, "local4")) + facility=LOG_LOCAL4; + else if (!strcmp(optarg, "local5")) + facility=LOG_LOCAL5; + else if (!strcmp(optarg, "local6")) + facility=LOG_LOCAL6; + else if (!strcmp(optarg, "local7")) + facility=LOG_LOCAL7; + else + badarg = TRUE; + break; case 'd': + // enable debug mode debugmode = TRUE; break; case 'D': + // print summary of all valid directives debugmode = TRUE; Directives(); EXIT(0); @@ -2348,6 +2386,7 @@ void ParseOpts(int argc, char **argv){ checktime = (int)lchecktime; break; case 'r': + // report IOCTL transactions { int i; char *s; @@ -2379,13 +2418,16 @@ void ParseOpts(int argc, char **argv){ } break; case 'p': + // output file with PID number pid_file=CustomStrDup(optarg, 1, __LINE__,__FILE__); break; case 'V': + // print version and CVS info PrintCopyleft(); EXIT(0); break; case 'h': + // help: print summary of command-line options debugmode=1; PrintHead(); Usage(); @@ -2393,6 +2435,7 @@ void ParseOpts(int argc, char **argv){ break; case '?': default: + // unrecognized option debugmode=1; PrintHead(); #ifdef HAVE_GETOPT_LONG diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp index 0ad0d3b220dd31d095fdb441a5f2d99eb83f2001..38f5a24493635864b84adb458084e14f7b2e6507 100644 --- a/sm5/smartd.cpp +++ b/sm5/smartd.cpp @@ -65,7 +65,7 @@ extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *escalade_c_cvsid, *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *utility_c_cvsid; -const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.230 2003/11/05 11:16:55 ballen4705 Exp $" +const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.231 2003/11/09 20:22:21 ballen4705 Exp $" ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID KNOWNDRIVES_H_CVSID SCSICMDS_H_CVSID SMARTD_H_CVSID UTILITY_H_CVSID; @@ -91,6 +91,10 @@ static char* configfile=SYSCONFDIR "/" CONFIGFILENAME ; // command-line: when should we exit? static int quit=0; +// command-line; this is the default syslog(3) log facility to use. +// It is initialzed to LOG_DAEMON +extern int facility; + // used for control of printing, passing arguments to atacmds.c smartmonctrl *con=NULL; @@ -109,7 +113,6 @@ extern long long bytes; // exit status extern int exitstatus; - // set to one if we catch a USR1 (check devices now) volatile int caughtsigUSR1=0; @@ -122,6 +125,11 @@ volatile int caughtsigHUP=0; jmp_buf registerscsienv; #endif + + + + + // prints CVS identity information for the executable void PrintCVS(void){ char out[CVSMAXLEN]; @@ -487,7 +495,7 @@ void pout(char *fmt, ...){ vprintf(fmt,ap); // in debug==2 mode we print output from knowndrives.o functions else if (debugmode==2 || con->reportataioctl || con->reportscsiioctl || con->escalade) { - openlog("smartd", LOG_PID, LOG_DAEMON); + openlog("smartd", LOG_PID, facility); vsyslog(LOG_INFO, fmt, ap); closelog(); } @@ -619,6 +627,8 @@ return; arguments to the option opt or NULL on failure. */ const char *GetValidArgList(char opt) { switch (opt) { + case 'l': + return "local0, local1, local2, local3, local4, local5, local6, local7"; case 'q': return "nodev, errors, nodevstartup, never, onecheck"; case 'r': @@ -644,6 +654,8 @@ void Usage (void){ PrintOut(LOG_INFO," Display this help and exit\n\n"); PrintOut(LOG_INFO," -i N, --interval=N\n"); PrintOut(LOG_INFO," Set interval between disk checks to N seconds, where N >= 10\n\n"); + PrintOut(LOG_INFO," -l local[0-7], --logfacility=local[0-7]\n"); + PrintOut(LOG_INFO," Use syslog facility local0 - local7 rather than daemon\n\n"); PrintOut(LOG_INFO," -p NAME, --pidfile=NAME\n"); PrintOut(LOG_INFO," Write PID file NAME\n\n"); PrintOut(LOG_INFO," -q WHEN, --quit=WHEN\n"); @@ -653,14 +665,15 @@ void Usage (void){ PrintOut(LOG_INFO," -V, --version, --license, --copyright\n"); PrintOut(LOG_INFO," Print License, Copyright, and version information\n"); #else - PrintOut(LOG_INFO," -d Start smartd in debug mode\n"); - PrintOut(LOG_INFO," -D Print the configuration file Directives and exit\n"); - PrintOut(LOG_INFO," -h Display this help and exit\n"); - PrintOut(LOG_INFO," -i N Set interval between disk checks to N seconds, where N >= 10\n"); - PrintOut(LOG_INFO," -p NAME Write PID file NAME\n"); - PrintOut(LOG_INFO," -q WHEN Quit on one of: %s\n", GetValidArgList('q')); - PrintOut(LOG_INFO," -r TYPE Report transactions for one of: %s\n", GetValidArgList('r')); - PrintOut(LOG_INFO," -V Print License, Copyright, and version information\n"); + PrintOut(LOG_INFO," -d Start smartd in debug mode\n"); + PrintOut(LOG_INFO," -D Print the configuration file Directives and exit\n"); + PrintOut(LOG_INFO," -h Display this help and exit\n"); + PrintOut(LOG_INFO," -i N Set interval between disk checks to N seconds, where N >= 10\n"); + PrintOut(LOG_INFO," -l local? Use syslog facility local0 - local7 rather than daemon\n"); + PrintOut(LOG_INFO," -p NAME Write PID file NAME\n"); + PrintOut(LOG_INFO," -q WHEN Quit on one of: %s\n", GetValidArgList('q')); + PrintOut(LOG_INFO," -r TYPE Report transactions for one of: %s\n", GetValidArgList('r')); + PrintOut(LOG_INFO," -V Print License, Copyright, and version information\n"); #endif } @@ -2274,11 +2287,12 @@ void ParseOpts(int argc, char **argv){ char *tailptr; long lchecktime; // Please update GetValidArgList() if you edit shortopts - const char *shortopts = "q:dDi:p:r:Vh?"; + const char *shortopts = "l:q:dDi:p:r:Vh?"; #ifdef HAVE_GETOPT_LONG char *arg; // Please update GetValidArgList() if you edit longopts struct option longopts[] = { + { "logfacility", required_argument, 0, 'l' }, { "quit", required_argument, 0, 'q' }, { "debug", no_argument, 0, 'd' }, { "showdirectives", no_argument, 0, 'D' }, @@ -2309,6 +2323,7 @@ void ParseOpts(int argc, char **argv){ switch(optchar) { case 'q': + // when to quit if (!(strcmp(optarg,"nodev"))) { quit=0; } else if (!(strcmp(optarg,"nodevstartup"))) { @@ -2324,10 +2339,33 @@ void ParseOpts(int argc, char **argv){ badarg = TRUE; } break; + case 'l': + // set the log facility level + if (!strcmp(optarg, "local0")) + facility=LOG_LOCAL0; + else if (!strcmp(optarg, "local1")) + facility=LOG_LOCAL1; + else if (!strcmp(optarg, "local2")) + facility=LOG_LOCAL2; + else if (!strcmp(optarg, "local3")) + facility=LOG_LOCAL3; + else if (!strcmp(optarg, "local4")) + facility=LOG_LOCAL4; + else if (!strcmp(optarg, "local5")) + facility=LOG_LOCAL5; + else if (!strcmp(optarg, "local6")) + facility=LOG_LOCAL6; + else if (!strcmp(optarg, "local7")) + facility=LOG_LOCAL7; + else + badarg = TRUE; + break; case 'd': + // enable debug mode debugmode = TRUE; break; case 'D': + // print summary of all valid directives debugmode = TRUE; Directives(); EXIT(0); @@ -2348,6 +2386,7 @@ void ParseOpts(int argc, char **argv){ checktime = (int)lchecktime; break; case 'r': + // report IOCTL transactions { int i; char *s; @@ -2379,13 +2418,16 @@ void ParseOpts(int argc, char **argv){ } break; case 'p': + // output file with PID number pid_file=CustomStrDup(optarg, 1, __LINE__,__FILE__); break; case 'V': + // print version and CVS info PrintCopyleft(); EXIT(0); break; case 'h': + // help: print summary of command-line options debugmode=1; PrintHead(); Usage(); @@ -2393,6 +2435,7 @@ void ParseOpts(int argc, char **argv){ break; case '?': default: + // unrecognized option debugmode=1; PrintHead(); #ifdef HAVE_GETOPT_LONG diff --git a/sm5/utility.c b/sm5/utility.c index 1a50f512ce1c7ee366d9b6dc6d673245533c0734..260a63781b82144409f5e2f27758259ad1568d12 100644 --- a/sm5/utility.c +++ b/sm5/utility.c @@ -39,7 +39,7 @@ #include "config.h" // Any local header files should be represented by a CVSIDX just below. -const char* utility_c_cvsid="$Id: utility.c,v 1.27 2003/10/21 01:45:50 arvoreen Exp $" CONFIG_H_CVSID UTILITY_H_CVSID; +const char* utility_c_cvsid="$Id: utility.c,v 1.28 2003/11/09 20:22:21 ballen4705 Exp $" CONFIG_H_CVSID UTILITY_H_CVSID; const char * packet_types[] = { "Direct-access (disk)", @@ -68,6 +68,10 @@ const char *reportbug="Please report this bug to the Smartmontools developers at // functionality and still check our exit code int exitstatus = 0; +// facility used by syslog(3). smartctl should NEVER use this, and +// smartd can reset it with a command-line argument +int facility=LOG_DAEMON; + // command-line argument: are we running in debug mode?. unsigned char debugmode = 0; @@ -400,6 +404,7 @@ char *CustomStrDup(char *ptr, int mustexist, int whatline, char* file){ // values. This means the objects of type char or short int (whether // signed or not) are promoted to either int or unsigned int, as // appropriate.] +extern int facility; void PrintOut(int priority,char *fmt, ...){ va_list ap; // initialize variable argument list @@ -407,7 +412,7 @@ void PrintOut(int priority,char *fmt, ...){ if (debugmode) vprintf(fmt,ap); else { - openlog("smartd",LOG_PID,LOG_DAEMON); + openlog("smartd",LOG_PID, facility); vsyslog(priority,fmt,ap); closelog(); } diff --git a/sm5/utility.cpp b/sm5/utility.cpp index 5ad61d4f82192d42c198108397c0948d144ece83..b267ba3f154657f0b6ee771a2e7bb14d5c45b955 100644 --- a/sm5/utility.cpp +++ b/sm5/utility.cpp @@ -39,7 +39,7 @@ #include "config.h" // Any local header files should be represented by a CVSIDX just below. -const char* utility_c_cvsid="$Id: utility.cpp,v 1.27 2003/10/21 01:45:50 arvoreen Exp $" CONFIG_H_CVSID UTILITY_H_CVSID; +const char* utility_c_cvsid="$Id: utility.cpp,v 1.28 2003/11/09 20:22:21 ballen4705 Exp $" CONFIG_H_CVSID UTILITY_H_CVSID; const char * packet_types[] = { "Direct-access (disk)", @@ -68,6 +68,10 @@ const char *reportbug="Please report this bug to the Smartmontools developers at // functionality and still check our exit code int exitstatus = 0; +// facility used by syslog(3). smartctl should NEVER use this, and +// smartd can reset it with a command-line argument +int facility=LOG_DAEMON; + // command-line argument: are we running in debug mode?. unsigned char debugmode = 0; @@ -400,6 +404,7 @@ char *CustomStrDup(char *ptr, int mustexist, int whatline, char* file){ // values. This means the objects of type char or short int (whether // signed or not) are promoted to either int or unsigned int, as // appropriate.] +extern int facility; void PrintOut(int priority,char *fmt, ...){ va_list ap; // initialize variable argument list @@ -407,7 +412,7 @@ void PrintOut(int priority,char *fmt, ...){ if (debugmode) vprintf(fmt,ap); else { - openlog("smartd",LOG_PID,LOG_DAEMON); + openlog("smartd",LOG_PID, facility); vsyslog(priority,fmt,ap); closelog(); }