diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG index 8cdd03694097125624fa8f7cbb4b1327bb6135e5..e09971cee0c6b488c4debfb84995cfb295c9f84a 100644 --- a/sm5/CHANGELOG +++ b/sm5/CHANGELOG @@ -1,6 +1,6 @@ CHANGELOG for smartmontools -$Id: CHANGELOG,v 1.400 2004/04/17 11:57:43 ballen4705 Exp $ +$Id: CHANGELOG,v 1.401 2004/04/18 15:02:49 chrfranke Exp $ The most recent version of this file is: http://cvs.sourceforge.net/viewcvs.py/smartmontools/sm5/CHANGELOG?sortby=date&view=markup @@ -27,6 +27,9 @@ NOTES FOR FUTURE RELEASES: see TODO file. <ADDITIONS TO THE CHANGE LOG SHOULD BE ADDED JUST BELOW HERE, PLEASE> + [CF] Cygwin smartd: Added workaround for missing SIGQUIT via keyboard: + To exit smartd in debug mode, type CONTROL-C twice. + [BA] smartctl: printing of the selective self-test log is now controlled by a new option: -l selective diff --git a/sm5/smartd.8.in b/sm5/smartd.8.in index 42fd9f5344aaedc0e854d3e94b1d7eb7bd9c0f43..8ab412a5db01a4b1f85cb7a1c51f34573ad3a689 100644 --- a/sm5/smartd.8.in +++ b/sm5/smartd.8.in @@ -1,7 +1,7 @@ .ig Copyright (C) 2002-4 Bruce Allen <smartmontools-support@lists.sourceforge.net> -$Id: smartd.8.in,v 1.61 2004/04/14 13:27:19 chrfranke Exp $ +$Id: smartd.8.in,v 1.62 2004/04/18 15:02:52 chrfranke 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 @@ -53,10 +53,10 @@ every 30 minutes. See the \fB\'\-i\'\fP option below for additional details. \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: +file \fB/etc/smartd.conf\fP (Windows: \fB./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 @@ -74,7 +74,7 @@ When \fBsmartd\fP is running in debug mode, the \fBQUIT\fP signal (normally generated from a shell with CONTROL\-C) is treated in the same way as a \fBHUP\fP signal: it makes \fBsmartd\fP reload its configuration file. To exit \fBsmartd\fP use CONTROL-\e -(Windows: CONTROL-Break). +(Cygwin: 2x CONTROL\-C, Windows: CONTROL\-Break). On startup, in the absence of the configuration file \fB/etc/smartd.conf\fP, the \fBsmartd\fP daemon first scans for all @@ -119,10 +119,10 @@ Long options are not supported on all systems. Use \fB\'smartd .B \-c FILE, \-\-configfile=FILE Read \fBsmartd\fP configuration Directives from FILE, instead of from -the default location \fB/etc/smartd.conf\fP. If FILE does \fBnot\fP -exist, then \fBsmartd\fP will print an error message and exit with -nonzero status. Thus, \'\-c /etc/smartd.conf\' can be used to verify -the existence of the default configuration file. +the default location \fB/etc/smartd.conf\fP (Windows: \fB./smartd.conf\fP). +If FILE does \fBnot\fP exist, then \fBsmartd\fP will print an error +message and exit with nonzero status. Thus, \'\-c /etc/smartd.conf\' +can be used to verify the existence of the default configuration file. By using \'\-\' for FILE, the configuration is read from standard input. This is useful for commands like: @@ -140,7 +140,8 @@ terminal. In this mode, \fBsmartd\fP also prints more verbose information about what it is doing than when operating in "daemon" mode. In this mode, the \fBQUIT\fP signal (normally generated from a terminal with CONTROL\-C) makes \fBsmartd\fP reload its configuration -file. Please use CONTROL-\e to exit (Windows: CONTROL-Break). +file. Please use CONTROL-\e to exit +(Cygwin: 2x CONTROL\-C, Windows: CONTROL\-Break). Windows only: The "debug" mode can be toggled by the command \fBsmartd sigusr2\fP. A new console for debug output is opened when @@ -1653,4 +1654,4 @@ smartmontools home page at \fBhttp://smartmontools.sourceforge.net/\fP . .SH CVS ID OF THIS PAGE: -$Id: smartd.8.in,v 1.61 2004/04/14 13:27:19 chrfranke Exp $ +$Id: smartd.8.in,v 1.62 2004/04/18 15:02:52 chrfranke Exp $ diff --git a/sm5/smartd.c b/sm5/smartd.c index 764bd990739d1ba4cb08836ea0a9983197c17858..d4ab5209be07208cf05e229977343dc0b582aa12 100644 --- a/sm5/smartd.c +++ b/sm5/smartd.c @@ -85,7 +85,12 @@ typedef int pid_t; #define SIGQUIT SIGBREAK #define SIGQUIT_KEYNAME "CONTROL-Break" #else // _WIN32 +#ifdef __CYGWIN__ +// 2x CONTROL-C simulates missing SIGQUIT via keyboard +#define SIGQUIT_KEYNAME "2x CONTROL-C" +#else // __CYGWIN__ #define SIGQUIT_KEYNAME "CONTROL-\\" +#endif // __CYGWIN__ #endif // _WIN32 #if defined (__SVR4) && defined (__sun) @@ -98,7 +103,7 @@ int getdomainname(char *, int); /* no declaration in header files! */ 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; -static const char *filenameandversion="$Id: smartd.c,v 1.317 2004/04/17 10:44:47 ballen4705 Exp $"; +static const char *filenameandversion="$Id: smartd.c,v 1.318 2004/04/18 15:02:52 chrfranke Exp $"; #ifdef NEED_SOLARIS_ATA_CODE extern const char *os_solaris_ata_s_cvsid; #endif @@ -109,7 +114,7 @@ extern const char *syslog_win32_c_cvsid; extern const char *int64_vc6_c_cvsid; #endif #endif -const char *smartd_c_cvsid="$Id: smartd.c,v 1.317 2004/04/17 10:44:47 ballen4705 Exp $" +const char *smartd_c_cvsid="$Id: smartd.c,v 1.318 2004/04/18 15:02:52 chrfranke Exp $" ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID KNOWNDRIVES_H_CVSID SCSICMDS_H_CVSID SMARTD_H_CVSID #ifdef SYSLOG_H_CVSID @@ -3717,13 +3722,27 @@ int main(int argc, char **argv){ if (firstpass || caughtsigHUP){ int entries, scanning=0; - if (!firstpass) + if (!firstpass) { +#ifdef __CYGWIN__ + // Workaround for missing SIGQUIT via keyboard on Cygwin + if (caughtsigHUP==2) { + // Simulate SIGQUIT if another SIGINT arrives soon + caughtsigHUP=0; + sleep(1); + if (caughtsigHUP==2) { + caughtsigEXIT=SIGQUIT; + continue; + } + caughtsigHUP=2; + } +#endif PrintOut(LOG_INFO, caughtsigHUP==1? "Signal HUP - rereading configuration file %s\n": "\a\nSignal INT - rereading configuration file %s ("SIGQUIT_KEYNAME" quits)\n\n", configfile); - + } + // clears cfgentries, (re)reads config file, makes >=0 entries entries=ReadOrMakeConfigEntries(&scanning); diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp index 0955750883d0175d5879652a0c218a85aff91d7d..8ccd6a5f37057916ea58889a1a4b90d541ee8589 100644 --- a/sm5/smartd.cpp +++ b/sm5/smartd.cpp @@ -85,7 +85,12 @@ typedef int pid_t; #define SIGQUIT SIGBREAK #define SIGQUIT_KEYNAME "CONTROL-Break" #else // _WIN32 +#ifdef __CYGWIN__ +// 2x CONTROL-C simulates missing SIGQUIT via keyboard +#define SIGQUIT_KEYNAME "2x CONTROL-C" +#else // __CYGWIN__ #define SIGQUIT_KEYNAME "CONTROL-\\" +#endif // __CYGWIN__ #endif // _WIN32 #if defined (__SVR4) && defined (__sun) @@ -98,7 +103,7 @@ int getdomainname(char *, int); /* no declaration in header files! */ 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; -static const char *filenameandversion="$Id: smartd.cpp,v 1.317 2004/04/17 10:44:47 ballen4705 Exp $"; +static const char *filenameandversion="$Id: smartd.cpp,v 1.318 2004/04/18 15:02:52 chrfranke Exp $"; #ifdef NEED_SOLARIS_ATA_CODE extern const char *os_solaris_ata_s_cvsid; #endif @@ -109,7 +114,7 @@ extern const char *syslog_win32_c_cvsid; extern const char *int64_vc6_c_cvsid; #endif #endif -const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.317 2004/04/17 10:44:47 ballen4705 Exp $" +const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.318 2004/04/18 15:02:52 chrfranke Exp $" ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID KNOWNDRIVES_H_CVSID SCSICMDS_H_CVSID SMARTD_H_CVSID #ifdef SYSLOG_H_CVSID @@ -3717,13 +3722,27 @@ int main(int argc, char **argv){ if (firstpass || caughtsigHUP){ int entries, scanning=0; - if (!firstpass) + if (!firstpass) { +#ifdef __CYGWIN__ + // Workaround for missing SIGQUIT via keyboard on Cygwin + if (caughtsigHUP==2) { + // Simulate SIGQUIT if another SIGINT arrives soon + caughtsigHUP=0; + sleep(1); + if (caughtsigHUP==2) { + caughtsigEXIT=SIGQUIT; + continue; + } + caughtsigHUP=2; + } +#endif PrintOut(LOG_INFO, caughtsigHUP==1? "Signal HUP - rereading configuration file %s\n": "\a\nSignal INT - rereading configuration file %s ("SIGQUIT_KEYNAME" quits)\n\n", configfile); - + } + // clears cfgentries, (re)reads config file, makes >=0 entries entries=ReadOrMakeConfigEntries(&scanning);