watchdog-5.13/0002755000175000017500000000000012102721745013033 5ustar michaelmichaelwatchdog-5.13/suse/0002755000175000017500000000000012102721740014005 5ustar michaelmichaelwatchdog-5.13/suse/rc.watchdog.suse0000644000175000017500000000471512102721740017116 0ustar michaelmichael#! /bin/sh # Copyright (c) 1995-1998 SuSE GmbH Nuernberg, Germany. # # Author: Thorsten Bonow (Toto) , 2000 # Based on example /sbin/init.d/skeleton=20 # # /sbin/init.d/ # # and symbolic its link # # /sbin/rc # . /etc/rc.config # Determine the base and follow a runlevel link name. base=${0##*/} link=${base#*[SK][0-9][0-9]} # Force execution if not called by a runlevel directory. test $link = $base && START_FOO=yes # # Up to now, there is no support for watchdog in the main SuSE=20 # configuration file /etc/rc.config, read by the YaST setup tool # # It would look that way in /etc/rc.config: # # START_WATCHDOG=yes=20 # # Then you could use here in this script: # test "$START_WATCHDOG" = yes || exit 0 # The echo return value for success (defined in /etc/rc.config). return=$rc_done case "$1" in start) echo -n "Starting watchdog daemon" ## Start daemon with startproc(8). If this fails ## the echo return value is set appropriate. startproc /usr/sbin/watchdog --softboot || return=$rc_failed echo -e "$return" ;; stop) echo -n "Shutting down watchdog daemon" ## Stop daemon with killproc(8) and if this fails ## set echo the echo return value. killproc -TERM /usr/sbin/watchdog || return=$rc_failed echo -e "$return" ;; restart) ## If first returns OK call the second, if first or ## second command fails, set echo return value. $0 stop && $0 start || return=$rc_failed ;; reload) ## Choose ONE of the following two cases: ## First possibility: A few services accepts a signal ## to reread the (changed) configuration. #echo -n "Reload watchdog daemon" #killproc -HUP /usr/sbin/watchdog || return=$rc_failed #echo -e "$return" ## Exclusive possibility: Some services must be stopped ## and started to force a new load of the configuration. $0 stop && $0 start || return=$rc_failed ;; status) echo -n "Checking for watchdog daemon: " ## Check status with checkproc(8), if process is running ## checkproc will return with exit status 0. checkproc /usr/sbin/watchdog && echo OK || echo No process ;; probe) ## Optional: Probe for the necessity of a reload, ## give out the argument which is required for a reload. #test /etc/foo.conf -nt /var/run/foo.pid && echo reload ;; *) echo "Usage: $0 {start|stop|status|restart|reload[|probe]}" exit 1 ;; esac # Inform the caller not only verbosely and set an exit status. test "$return" = "$rc_done" || exit 1 exit 0 watchdog-5.13/INSTALL0000644000175000017500000000357712102721740014071 0ustar michaelmichaelIf you're on a Debian system, make -f debian/rules binary creates the watchdog package. It's even easier if you use debmake, just call build. (Note that the Debian files are not distributed with the original source anymore. You have to get the Debian .diff.gz file, too.) If you use redhat, you can use the .spec file to generate a package. But as with Debian you have to get the .spec file from the RedHat sources. Copy watchdog.spec to /usr/src/redhat/SPECS, copy the .tar.gz archive to /usr/src/redhat/SOURCES, cd /usr/src/redhat/SPECS, rpm -ba watchdog.spec. (Note that the watchdog.spec file not distributed with the original source either.) If your Linux distribution does not include watchdog feel free to ask the distributor to add it. Since watchdog is GPLed there should not be a problem. Okay, if you want to install it manually: $ autoreconf -i (if you're building from CVS) $ ./configure $ make $ su # make install There are several options available which can be listed by running $ ./configure --help We only list some options here which are generally useful. Symbols: *cl - can be overridden in the command line *cf - can be overridden in the config file --with-sleep-interval=sec (default 10) *cl *cf This allows you to set the default number of seconds which watchdog will sleep before acting again. --with-sysadmin=email (default root) *cf If watchdog attempts to reboot a machine, it will try to send an email out before that. You can set the email address of the recipient with this option. --with-maxload=int (default 12) *cf If the load average reaches this point, the machine will reboot. --with-watchdog=path (default /dev/watchdog) *cf --with-temperature=path (default /dev/temperature) *cf Sets the path for the respective device. Enjoy Michael watchdog-5.13/configure.in0000644000175000017500000001135712102721740015344 0ustar michaelmichaeldnl Process this file with autoconf to produce a configure script. AC_INIT(include/extern.h) MAJOR_VERSION=5 MINOR_VERSION=13 AM_INIT_AUTOMAKE(watchdog, $MAJOR_VERSION.$MINOR_VERSION) AC_PREFIX_DEFAULT(/usr) AC_DEFINE_UNQUOTED(MAJOR_VERSION, $MAJOR_VERSION, "major version number") AC_DEFINE_UNQUOTED(MINOR_VERSION, $MINOR_VERSION, "minor version number") AM_CONFIG_HEADER(include/config.h) AM_SANITY_CHECK AM_MAINTAINER_MODE dnl Checks for programs. AC_PROG_AWK AC_PROG_CC AC_PROG_INSTALL AC_PATH_PROG(PATH_SENDMAIL, sendmail, /usr/lib/sendmail, $PATH /usr/bin /usr/sbin /usr/etc /etc /usr/ucblib) if test -n "$PATH_SENDMAIL"; then AC_DEFINE_UNQUOTED(PATH_SENDMAIL, "$PATH_SENDMAIL", "path to sendmail binary") fi dnl Checks for libraries. dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h limits.h paths.h sys/ioctl.h sys/time.h syslog.h unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_PID_T AC_TYPE_SIZE_T AC_STRUCT_ST_RDEV AC_HEADER_TIME dnl Checks for library functions. AC_FUNC_ALLOCA AC_PROG_GCC_TRADITIONAL AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_CHECK_FUNCS(gethostname select socket strcspn strdup strerror strstr strtoul uname) AC_MSG_CHECKING(whether to log via syslog) AC_ARG_ENABLE(syslog, [ --disable-syslog Disable logging by syslog (deprecated)],[ if test "$enableval" = "yes"; then AC_DEFINE(USE_SYSLOG, 1, "enable syslog") AC_MSG_RESULT(yes) else AC_DEFINE(USE_SYSLOG, 0, "enable syslog") AC_MSG_RESULT(no) fi ],[ AC_DEFINE(USE_SYSLOG, 1, "enable syslog") AC_MSG_RESULT(yes) ]) AC_MSG_CHECKING(whether to include NFS support) AC_ARG_ENABLE(nfs, [ --disable-nfs Disable NFS support],[ if test "$enableval" = "yes"; then AC_DEFINE(HAVE_NFS, 1, "enable NFS") AC_MSG_RESULT(yes) else AC_DEFINE(HAVE_NFS, 0, "enable NFS") AC_MSG_RESULT(no) fi ],[ AC_DEFINE(HAVE_NFS, 1, "enable NFS") AC_MSG_RESULT(yes) ]) AC_MSG_CHECKING(for minimum value accepted as reboot cause) AC_ARG_WITH(minload, [ --with-minload=int minimum value accepted as reboot cause (default 2)],[ AC_DEFINE_UNQUOTED(MINLOAD, $withval, "minimum value accepted as reboot cause") AC_MSG_RESULT($withval) ],[ AC_DEFINE(MINLOAD, 2, "minimum value accepted as reboot cause") AC_MSG_RESULT(2) ]) AC_MSG_CHECKING(for timer margin used by kernel) AC_ARG_WITH(timermargin, [ --with-timermargin=int timer margin used by kernel (default 60)],[ AC_DEFINE_UNQUOTED(TIMER_MARGIN, $withval, "timer margin used by kernel") AC_MSG_RESULT($withval) ],[ AC_DEFINE(TIMER_MARGIN, 60, "timer margin used by kernel") AC_MSG_RESULT(60) ]) AC_MSG_CHECKING(for config filename) AC_ARG_WITH(configfile, [ --with-configfile=filename name of config file (default /etc/watchdog.conf)],[ AC_DEFINE_UNQUOTED(CONFIG_FILENAME, "$withval", "name of config file") CONFIG_FILENAME="$withval" AC_MSG_RESULT($withval) ],[ CONFIG_FILENAME="/etc/watchdog.conf" AC_DEFINE_UNQUOTED(CONFIG_FILENAME, "$CONFIG_FILENAME", "name of config file") AC_MSG_RESULT($CONFIG_FILENAME) ]) AC_SUBST(CONFIG_FILENAME) AC_MSG_CHECKING(for test binary directory) AC_ARG_WITH(test-bin-path, [ --with-test-bin-path=directory path to test binaries (default /etc/watchdog.d)],[ AC_DEFINE_UNQUOTED(TESTBIN_PATH, "$withval", "path to test binaries") TESTBIN_PATH="$withval" AC_MSG_RESULT($withval) ],[ TESTBIN_PATH="/etc/watchdog.d" AC_DEFINE_UNQUOTED(TESTBIN_PATH, "$TESTBIN_PATH", "path to test binaries") AC_MSG_RESULT($TESTBIN_PATH) ]) AC_SUBST(TESTBIN_PATH) AC_MSG_CHECKING(for pid filename) AC_ARG_WITH(pidfile, [ --with-pidfile=filename name of pid file (default /var/run/watchdog.pid)],[ AC_DEFINE_UNQUOTED(PIDFILE, "$withval", "name of pid file") AC_MSG_RESULT($withval) ],[ AC_DEFINE(PIDFILE, "/var/run/watchdog.pid", "name of pid file") AC_MSG_RESULT("/var/run/watchdog.pid") ]) AC_MSG_CHECKING(for keepalive pid filename) AC_ARG_WITH(ka_pidfile, [ --with-ka_pidfile=filename name of keepalive pid file (default /var/run/wd_keepalive.pid)],[ AC_DEFINE_UNQUOTED(KA_PIDFILE, "$withval", "name of keepalive pid file") AC_MSG_RESULT($withval) ],[ AC_DEFINE(KA_PIDFILE, "/var/run/wd_keepalive.pid", "name of keepalive pid file") AC_MSG_RESULT("/var/run/wd_keepalive.pid") ]) AC_MSG_CHECKING(for random seed filename) AC_ARG_WITH(randomseed, [ --with-randomseed=filename filename for storing random seed (default /var/run/random-seed)],[ AC_DEFINE_UNQUOTED(RANDOM_SEED, "$withval", filename for storing random seed") AC_MSG_RESULT($withval) ],[ AC_DEFINE(RANDOM_SEED, "/var/run/random-seed", "filename for storing random seed") AC_MSG_RESULT("/var/run/random-seed") ]) AC_OUTPUT([Makefile src/Makefile]) watchdog-5.13/IAFA-PACKAGE0000644000175000017500000000050712102721740014502 0ustar michaelmichaelTitle: watchdog Version: 5.13 Description: A software watchdog. Author: meskes@debian.org (Michael Meskes) Maintained-by: meskes@debian.org (Michael Meskes) Maintained-at: www.sourceforge.net /projects/watchdog Platforms: C program Copying-Policy: GPL Keywords: daemon, automatic-reboot watchdog-5.13/wd_identify.80000644000175000017500000000167512102721740015433 0ustar michaelmichael.TH WD_IDENTIFY 8 "June 2010" .UC 4 .SH NAME wd_identify \- a simplified software watchdog daemon .SH SYNOPSIS .B wd_identify .RB [ \-c " \fIfilename\fR|" \-\-config\-file " \fIfilename\fR]" .SH DESCRIPTION This utility opens .IR /dev/watchdog and gets the identification string from the watchdog which then is printed. The device is closed afterwards. .PP The wd_identify tool can only be used without causing a reboot if your kernel is compiled with the .I CONFIG_WATCHDOG_NOWAYOUT option enabled. .PP Watchdog and/or wd_keepalive may have to be stopped to make sure that wd_identify can access the watchdog device. .SH OPTIONS Available command line options are the following: .TP .BR \-c " \fIconfig-file\fR, " \-\-config\-file " \fIconfig-file" Use .I config-file as the configuration file instead of the default .IR /etc/watchdog.conf . .SH FILES .TP .I /dev/watchdog The watchdog device. .SH "SEE ALSO" .BR watchdog.conf (5) .TP .BR watchdog (8) watchdog-5.13/wd_keepalive.80000644000175000017500000000363212102721740015560 0ustar michaelmichael.TH WD_KEEPALIVE 8 "January 2005" .UC 4 .SH NAME wd_keepalive \- a simplified software watchdog daemon .SH SYNOPSIS .B wd_keepalive .RB [ \-c " \fIfilename\fR|" \-\-config\-file " \fIfilename\fR]" .SH DESCRIPTION This is a simplified version of the watchdog daemon. If configured so it only opens .IR /dev/watchdog , and keeps writing to it often enough to keep the kernel from resetting, at least once per minute. Each write delays the reboot time another minute. After a minute of inactivity the watchdog hardware will cause a reset. In the case of the software watchdog the ability to reboot will depend on the state of the machines and interrupts. .PP The wd_keepalive daemon can be stopped without causing a reboot if the device .I /dev/watchdog is closed correctly, unless your kernel is compiled with the .I CONFIG_WATCHDOG_NOWAYOUT option enabled. .PP Under high system load .B wd_keepalive might be swapped out of memory and may fail to make it back in in time. Under these circumstances the Linux kernel will reset the machine. To make sure you won't get unnecessary reboots make sure you have the variable .I realtime set to .I yes in the configuration file .IR watchdog.conf . This adds real time support to .BR wd_keepalive : it will lock itself into memory and there should be no problem even under the highest of loads. .PP On system running out of memory the kernel will try to free enough memory by killing process. The .B wd_keepalive daemon itself is exempted from this so-called out-of-memory killer. .SH OPTIONS Available command line options are the following: .TP .BR \-c " \fIconfig-file\fR, " \-\-config\-file " \fIconfig-file" Use .I config-file as the configuration file instead of the default .IR /etc/watchdog.conf . .SH FILES .TP .I /dev/watchdog The watchdog device. .TP .I /var/run/wd_keepalive.pid The pid file of the running .BR wd_keepalive . .SH "SEE ALSO" .BR watchdog.conf (5) .TP .BR watchdog (8) watchdog-5.13/watchdog.conf.50000644000175000017500000001331112102721740015635 0ustar michaelmichael.TH WATCHDOG.CONF 5 "January 2005" .UC 4 .SH NAME watchdog.conf \- configuration file for the watchdog daemon .SH DESCRIPTION This file carries all configuration options for the Linux watchdog daemon. Each option has to be written on a line for itself. Comments start with '#'. Blanks are ignored except after the '=' sign. An empty text after the '=' sign disables the feature as long as that makes sense. .SH OPTIONS .TP interval = Set the interval between two writes to the watchdog device. The kernel drivers expects a write command every minute. Otherwise the system will be rebooted. Default value is 1 second. An interval of more than a minute can only be used with the \-f command-line option. .TP logtick = If you enable verbose logging, a message is written into the syslog or a logfile. While this is nice, it is not necessary to get a message every 10 seconds which really fills up disk and needs CPU. logtick allows adjustment of the number of intervals skipped before a log message is written. If you use logtick = 60 and interval = 10, only every 10 minutes (600 seconds) a message is written. This may make the exact time of a crash harder to find but greatly reduces disk usage and administrator nerves if you're looking for a particular syslog entry in between of watchdog messages. .TP max-load-1 = Set the maximal allowed load average for a 1 minute span. Once this load average is reached the system is rebooted. Default value is 0. That means the load average check is disabled. Be careful not to this parameter too low. To set a value less then the predefined minimal value of 2, you have to use the \-f commandline option. .TP max-load-5 = Set the maximal allowed load average for a 5 minute span. Once this load average is reached the system is rebooted. Default value is 3/4*max-load-1. Be careful not to this parameter too low. To set a value less then the predefined minimal value of 2, you have to use the \-f commandline option. .TP max-load-15 = Set the maximal allowed load average for a 15 minute span. Once this load average is reached the system is rebooted. Default value is 1/2*max-load-1. Be careful not to this parameter too low. To set a value less then the predefined minimal value of 2, you have to use the \-f commandline option. .TP min-memory = Set the minimal amount of virtual memory that has to stay free. Note that this is in pages. Default value is 0 pages which means this test is disabled. The page size is taken from the system include files. .TP max-temperature = Set the maximal allowed temperature. Once this temperature is reached the system is halted. Default value is 120. There is no unit conversion, so make sure you use the same unit as your hardware. Watchdog will issue warnings once the temperature increases 90%, 95% and 98% of this temperature. .TP watchdog-device = Set the watchdog device name. Default is to disable keep alive support. .TP watchdog-timeout = Set the watchdog device timeout during startup. If not set, the default is driver-dependent. .TP temperature-device = Set the temperature device name. Default is to disable temperature checking. .TP file = Set file name for file mode. This option can be given as often as you like to check several files. .TP change = Set the change interval time for file mode. This options always belongs to the active filename, that is when finding a 'change =' line watchdog assumes it belongs to the most recently read 'file =' line. They don't neccessarily have to follow each other directly. But you cannot specify a 'change =' before a 'file ='. The default is to only stat the file and don't look for changes. Using this feature to monitor changes in /var/log/messages might require some special syslog daemon configuration, e.g. rsyslog needs "$ActionWriteAllMarkMessages on" to be set to make sure the marks are written no matter what. .TP pidfile = Set pidfile name for server test mode. This option can be given as often as you like to check several servers. .TP ping = Set IP address for ping mode. This option can be used more than once to check different connections. .TP interface = Set interface name for network mode. This option can be used more than once to check different interfaces. .TP test-binary = Execute the given binary to do some user defined tests. .TP test-timeout = User defined tests may only run for seconds. Set to 0 for unlimited. .TP repair-binary = Execute the given binary in case of a problem instead of shutting down the system. .TP repair-timeout = repair command may only run for seconds. Set to 0 for unlimited. .TP admin = Email address to send admin mail to. That is, who shall be notified that the machine is being halted or rebooted. Default is 'root'. If you want to disable notification via email just set admin to en empty string. .TP realtime = If set to yes watchdog will lock itself into memory so it is never swapped out. .TP priority = Set the schedule priority for realtime mode. .TP test-directory = Set the directory to run user test/repair scripts. Default is '/etc/watchdog.d' See the Test Directory section in watchdog(8) for more information. .TP log-dir = Set the log directory to capture the standard output and standard error from repair-binary and test-binary execution. Default is '/var/log/watchdog'. .SH FILES .TP .I /etc/watchdog.conf The watchdog configuration file .TP .I /etc/watchdog.d A directory containing test-or-repair commands. See the Test Directory section in watchdog(8) for more information. .SH "SEE ALSO" .BR watchdog (8) watchdog-5.13/watchdog.sysconfig0000644000175000017500000000023512102721740016552 0ustar michaelmichael# # /etc/sysconfig/watchdog # # Controls the behaviour of the watchdog # # VERBOSE - Enables or disables verbose operation (logging to syslog) # VERBOSE=no watchdog-5.13/README.watchdog.ipmi0000644000175000017500000001145312102721740016444 0ustar michaelmichaelThis is RedHat/Fedora specific, but can be used with other distros with minor adjustments. Instructions for how to set up the watchdog daemon to work with IPMI's hardware watchdog ---------------------------------------------------------------------------------------- First, verify that the ipmitool utility is present on the system to allow the watchdog timer to be turned off via the command line (which ipmitool). This will allow the hardware watchdog timer to be turned off gracefully should it ever become necessary. If ipmitool is not present, install it or download the latest version from http://ipmitool.sourceforge.net and build and install it on your system. Next, prior to starting up the watchdog daemon, the BMC BIOS should be set to enable the IPMI/BMC hardware watchdog timer, the OpenIPMI watchdog driver module should be inserted with the desired configuration/startup settings, and the watchdog daemon's configuration file should be modified to use /dev/watchdog: 1. To setup the IPMI/BMC BIOS to enable the hardware watchdog timer, see BMC documentation. The main settings in the BMC BIOS requiring modification to turn on the IPMI watchdog timer are: - Set the BMC POST Watchdog to "ENABLED". - Set the BMC POST Watchdog Timeout to "5 Minutes". 2. To insert the OpenIPMI watchdog driver module with the desired configuration settings, two steps are necessary: i.) Configure the OpenIPMI watchdog driver by editing the /etc/sysconfig/ipmi configuration file: - Set "IPMI_WATCHDOG=yes". - Set desired options via the IPMI_WATCHDOG_OPTIONS config entry. EXAMPLE: 'IPMI_WATCHDOG_OPTIONS="timeout=60 start_now=1 \ preop=preop_give_data action=power_cycle pretimeout=1" ' Execute "modinfo ipmi_watchdog" for more detailed information on the available ipmi watchdog timer options. - Execute "service ipmi start" (the watchdog driver starts automatically along with the other ipmi drivers). IMPORTANT: If "start_now=1" has been set as one of the configuration options, be sure to start up the watchdog daemon before the BMC timer expires! ii.) Set the OpenIPMI daemon and watchdog to start during bootup: - chkconfig ipmi on - chkconfig watchdog on 3. Configure the watchdog daemon by editing the /etc/watchdog.conf configuration file: - Uncomment the "watchdog-device = /dev/watchdog" line. - Ensure that "realtime = yes" and "priority = 1" are set and not commented-out. - Uncomment the "interval" line, and set the interval to be less than what you set the timeout option to be in the /etc/sysconfig/ipmi file (ex "timeout=60" so you might set interval to 50). So in the example described herein, the BMC BIOS setting is in minutes (5), and the "interval" and ipmi_watchdog "timeout" settings are both in seconds (50 and 60 respectively). Therefore, the BMC hardware watchdog timer is set to expire and trigger a system power cycle unless reset by the watchdog daemon within 5 minutes, and the watchdog daemon will reset the timer every 60 seconds. 4. Start the Watchdog daemon: - execute "service watchdog start" IMPORTANT: To gracefully stop/kill the watchdog daemon, be sure to use "service watchdog stop" (which executes "kill -s SIGTERM ") and do *not* use "kill -9 ". Using "kill -9 " will cause the daemon to be shut off without stopping the BMC's watchdog timer, thus a system reboot will be triggered when the BMC's watchdog timer expires. Alternately, or in case the watchdog daemon is killed "ungracefully", you can stop the BMC timer by executing the following ipmitool utility command before the watchdog timer expires: # ipmitool -v raw 0x06 0x24 0x04 0x01 0x00 0x10 0x00 0x0a ---------------------------------------------------------------------- To test the watchdog after system configuration and setup: . Use kill -9 on the watchdog daemon so it doesn't shut down the watchdog daemon gracefully. Verify that the system gets reset after the BMC timer expires. . Use "service watchdog stop" and verify that the watchdog daemon shuts off the BMC watchdog timer gracefully (the system doesn't get reset). . Set the timer on the watchdog daemon to be greater than the time set in the BMC BIOS for system reset and verify that the system is reset. . Set the timer on the daemon to be less than the time set in the BMC timer and verify that the BMC watchdog is poked regularly and the system is not reset. . Test some of the other actions the BMC can take when the watchdog timer goes off (see modinfo ipmi_watchdog for some other settings to try). watchdog-5.13/watchdog.conf0000644000175000017500000000211612102721740015473 0ustar michaelmichael#ping = 172.31.14.1 #ping = 172.26.1.255 #interface = eth0 #file = /var/log/messages #change = 1407 # Uncomment to enable test. Setting one of these values to '0' disables it. # These values will hopefully never reboot your machine during normal use # (if your machine is really hung, the loadavg will go much higher than 25) #max-load-1 = 24 #max-load-5 = 18 #max-load-15 = 12 # Note that this is the number of pages! # To get the real size, check how large the pagesize is on your machine. #min-memory = 1 #repair-binary = /usr/sbin/repair #repair-timeout = #test-binary = #test-timeout = #watchdog-device = /dev/watchdog # Defaults compiled into the binary #temperature-device = #max-temperature = 120 # Defaults compiled into the binary #admin = root #interval = 1 #logtick = 1 #log-dir = /var/log/watchdog # This greatly decreases the chance that watchdog won't be scheduled before # your machine is really loaded realtime = yes priority = 1 # Check if rsyslogd is still running by enabling the following line #pidfile = /var/run/rsyslogd.pid watchdog-5.13/AUTHORS0000644000175000017500000000112412102721740014072 0ustar michaelmichaelWatchdog developer and credits list =================================== Michael Meskes - Maintainer and overall author - Original Debian patches Sascha Schumann - GNU automake/autoconf support - some compatibility patches Johnie Ingram - more Debian patches Marc Merlin - RedHat Patches Miquel van Smoorenburg - The stuff borrowed from sysvinit Marcel Jansen - Quite a lot of additions. Several people who worked on mount/umount and/or send me patches. watchdog-5.13/aclocal.m40000644000175000017500000011036412102721744014675 0ustar michaelmichael# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, # Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.6], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.6])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # 2010, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, # 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless `enable' is passed literally. # For symmetry, `disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful (and sometimes confusing) to the casual installer], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR watchdog-5.13/create_tarball.sh0000644000175000017500000000107012102721740016322 0ustar michaelmichael#!/bin/sh # start this script inside the watchdog source tree to create a releasable tarball major=`grep MAJOR_VERSION= configure.in | cut -f2 -d"="` minor=`grep MINOR_VERSION= configure.in | cut -f2 -d"="` if [ -d ../watchdog-$major.$minor ] then echo "target directory exists" exit 1 fi cp -a . ../watchdog-$major.$minor cd ../watchdog-$major.$minor aclocal autoheader automake --add-missing --copy autoconf rm -rf autom4te.cache cd .. tar --exclude CVS --exclude .git -zcf watchdog-$major.$minor.tar.gz watchdog-$major.$minor && rm -rf watchdog-$major.$minor watchdog-5.13/NEWS0000644000175000017500000000007312102721740013523 0ustar michaelmichaelSee ChangeLog for infos about the latest changes. Michael watchdog-5.13/watchdog.lsm0000644000175000017500000000072612102721740015346 0ustar michaelmichaelBegin3 Title: watchdog Version: 5.13 Entered-date: 01Feb13 Description: A software watchdog. Keywords: daemon automatic-reboot Author: meskes@debian.org (Michael Meskes) Maintained-by: Primary-site: www.sourceforge.net /projects/watchdog 200K watchdog_5.13.tar.gz Alternate-site: ftp.debian.org /debian/pool/main/w/watchdog/ 200K watchdog_5.13.orig.tar.gz Original-site: Platforms: Linux 1.3.51+ Copying-policy: GPL End watchdog-5.13/redhat/0002755000175000017500000000000012102721740014275 5ustar michaelmichaelwatchdog-5.13/redhat/watchdog.init0000644000175000017500000000273112102721740016763 0ustar michaelmichael#! /bin/sh # # chkconfig: - 27 46 # description: A software watchdog # # rc file author: Marc Merlin # Henning P. Schmiedehausen # Source function library. . /etc/rc.d/init.d/functions [ -x /usr/sbin/watchdog -a -e /etc/watchdog.conf ] || exit 0 VERBOSE="no" if [ -f /etc/sysconfig/watchdog ]; then . /etc/sysconfig/watchdog fi RETVAL=0 prog=watchdog pidfile=/var/run/watchdog.pid lockfile=/var/lock/subsys/watchdog start() { echo -n $"Starting $prog: " if [ -n "$(pidofproc $prog)" ]; then echo -n $"$prog: already running" echo_failure echo return 1 fi if [ "$VERBOSE" = "yes" ]; then daemon /usr/sbin/${prog} -v else daemon /usr/sbin/${prog} fi RETVAL=$? [ $RETVAL -eq 0 ] && touch $lockfile [ $RETVAL -eq 0 ] && echo_success [ $RETVAL -ne 0 ] && echo_failure echo return $RETVAL } stop() { echo -n "Stopping $prog: " # We are forcing it to _only_ use -TERM as killproc could use # -KILL which would result in BMC timer not being set properly # and reboot the box. killproc $prog -TERM RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile return $RETVAL } restart() { stop sleep 6 start } case "$1" in start) start ;; stop) stop ;; reload|restart) restart ;; condrestart) if [ -f $lockfile ]; then restart fi ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|status|condrestart}" exit 1 esac watchdog-5.13/redhat/sysconf.redhat0000644000175000017500000000161612102721740017154 0ustar michaelmichael# # If wd_keepalive is used as watchdog daemon instead of # /usr/sbin/watchdog. # #WDT_DAEMON=/usr/sbin/wd_keepalive # # If you need verbose message, use following option # #VERBOSE="yes" # # Modules related with watchdog # # For some people it is a module, for others not. We force it because # for kernels < 2.1, we need kerneld, and it's not running yet. START_MOD_CMD="modprobe softdog" # If you compiled your kernel with CONFIG_WATCHDOG_NOWAYOUT, you may # not want to remove the module as sometimes /etc/rc.d/init.d/halt # will hang on umounting some remote nfs partition or for some other # reason, and you may then want the kernel to reboot by itself. # However, this means that if you stop watchdog, your system has one # minute to reboot cleanly, or it will be rebooted by the kernel. If # this behavior isn't what you want, just uncomment the following # line #STOP_MOD_CMD="rmmod softdog" watchdog-5.13/redhat/watchdog.spec0000644000175000017500000000771212102721740016756 0ustar michaelmichaelSummary: Software and/or Hardware watchdog daemon Name: watchdog Version: 5.5 Release: 2%{?dist} License: GPL+ Group: System Environment/Daemons URL: http://sourceforge.net/projects/watchdog/ Source0: http://dl.sf.net/watchdog/watchdog-%{version}.tar.gz Source1: watchdog.init Source2: README.watchdog.ipmi Source3: README.Fedora Patch0: %{name}-%{version}-cleanup.patch Patch1: %{name}-%{version}-cleanup-nfs.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires(post): /sbin/chkconfig Requires(postun): /sbin/chkconfig Requires(post): /sbin/service Requires(postun): /sbin/service %description The watchdog program can be used as a powerful software watchdog daemon or may be alternately used with a hardware watchdog device such as the IPMI hardware watchdog driver interface to a resident Baseboard Management Controller (BMC). watchdog periodically writes to /dev/watchdog; the interval between writes to /dev/watchdog is configurable through settings in the watchdog sysconfig file. This configuration file is also used to set the watchdog to be used as a hardware watchdog instead of its default software watchdog operation. In either case, if the device is open but not written to within the configured time period, the watchdog timer expiration will trigger a machine reboot. When operating as a software watchdog, the ability to reboot will depend on the state of the machine and interrupts. When operating as a hardware watchdog, the machine will experience a hard reset (or whatever action was configured to be taken upon watchdog timer expiration) initiated by the BMC. %prep %setup -q -n %{name}-%{version} cp %{SOURCE2} . cp %{SOURCE3} . %patch0 -p1 -b .cleanup %patch1 -p1 -b .cleanup-nfs mv README README.orig iconv -f ISO-8859-1 -t UTF-8 < README.orig > README %build %configure make %{?_smp_mflags} %install rm -Rf ${RPM_BUILD_ROOT} install -d -m0755 ${RPM_BUILD_ROOT}%{_sysconfdir} make DESTDIR=${RPM_BUILD_ROOT} install install -Dp -m0644 %{name}.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/watchdog install -Dp -m0755 %{SOURCE1} ${RPM_BUILD_ROOT}%{_initrddir}/watchdog %clean rm -Rf ${RPM_BUILD_ROOT} %post if [ $1 -eq 1 ]; then /sbin/chkconfig --add %{name} fi %preun if [ $1 -eq 0 ]; then /sbin/service %{name} stop >/dev/null 2>&1 /sbin/chkconfig --del %{name} fi %postun if [ $1 -ge 1 ]; then /sbin/service %{name} condrestart >/dev/null 2>&1 fi %files %defattr(-, root, root, -) %doc AUTHORS ChangeLog COPYING examples/ IAFA-PACKAGE NEWS README TODO README.watchdog.ipmi README.Fedora %config(noreplace) %{_sysconfdir}/watchdog.conf %config(noreplace) %{_sysconfdir}/sysconfig/watchdog %{_sysconfdir}/rc.d/init.d/watchdog %{_sbindir}/watchdog %{_sbindir}/wd_keepalive %{_mandir}/man5/watchdog.conf.5* %{_mandir}/man8/watchdog.8* %{_mandir}/man8/wd_keepalive.8* %changelog * Thu Mar 5 2009 Richard W.M. Jones - 5.5-2 - Use '-' in defattr line instead of explicit file mode. * Thu Feb 26 2009 Richard W.M. Jones - 5.5-1 - New upstream version 5.5. - Prepared the package for Fedora review. * Mon Jun 11 2007 Lon Hohberger - 5.3.1-7 - Rebuild for RHEL5 Update 1 - Resolves: 227401 * Wed May 30 2007 Konrad Rzeszutek - 5.3.1-6 - Fixed the init script file. * Tue May 29 2007 Konrad Rzeszutek - 5.3.1-5 - Fixed a compile warning in nfsmount_xdr file. * Wed May 23 2007 Konrad Rzeszutek - 5.3.1-4 - Fixed rpmlint warnings. * Wed May 16 2007 Konrad Rzeszutek - 5.3.1-3 - Changes to spec, init script and README file per Carol Hebert recommendation. * Thu Apr 19 2007 Konrad Rzeszutek - 5.3.1-2 - Added README.watchdog.ipmi * Mon Apr 16 2007 Konrad Rzeszutek - 5.3.1-1 - Initial copy. watchdog-5.13/redhat/README.Fedora0000644000175000017500000000237212102721740016356 0ustar michaelmichaelThis is the watchdog package for Fedora. It implements a userspace daemon which periodically pings (usually hardware) to tell the hardware that the machine is alive. If the hardware times out without receiving a ping, it assumes userspace is dead and reboots the machine. There are several major classes of watchdog available: - watchdog hardware implementing the Linux /dev/watchdog API * drivers in /lib/modules/$(uname -r)/kernel/drivers/watchdog/ * http://lxr.linux.no/linux/Documentation/watchdog/watchdog-api.txt - softdog * software watchdog (just runs inside the kernel) * implements the Linux /dev/watchdog API * won't help you if the kernel fails (obvious, right?) - IPMI * a heavyweight standard for all things server-management * separate Linux driver * ipmitool to control it * see README.watchdog.ipmi for how to use this daemon together with IPMI You can also use watchdogs inside recent QEMU/KVM virtual machines. When running qemu, specify "-watchdog i6300esb" on the qemu command line (or use libvirt). Inside the guest, the i6300esb watchdog driver should automatically load and provide you with a Linux /dev/watchdog- compatible API. - Richard W.M. Jones (rjones@redhat.com) 2009-02-26 watchdog-5.13/Makefile.in0000644000175000017500000007133412102721745015106 0ustar michaelmichael# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure \ $(top_srcdir)/include/config.h.in AUTHORS COPYING ChangeLog \ INSTALL NEWS TODO depcomp install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man5dir = $(mandir)/man5 am__installdirs = "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)" man8dir = $(mandir)/man8 NROFF = nroff MANS = $(man_MANS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFIG_FILENAME = @CONFIG_FILENAME@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SENDMAIL = @PATH_SENDMAIL@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TESTBIN_PATH = @TESTBIN_PATH@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ man_MANS = watchdog.8 wd_keepalive.8 watchdog.conf.5 wd_identify.8 # This does not work. subdirs are not copied correctly # for make dist... :( EXTRA_DIST = $(man_MANS) include examples ChangeLog watchdog.lsm \ watchdog.conf rc.watchdog.debian rc.watchdog.redhat SUBDIRS = src all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): include/config.h: include/stamp-h1 @if test ! -f $@; then rm -f include/stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) include/stamp-h1; else :; fi include/stamp-h1: $(top_srcdir)/include/config.h.in $(top_builddir)/config.status @rm -f include/stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status include/config.h $(top_srcdir)/include/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f include/stamp-h1 touch $@ distclean-hdr: -rm -f include/config.h include/stamp-h1 install-man5: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man5dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man5dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.5[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \ done; } uninstall-man5: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man5dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.5[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir) install-man8: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man8dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.8[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(MANS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-data-local install-man install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-man5 install-man8 install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man5 uninstall-man8 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-data-local install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man5 install-man8 install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-man uninstall-man5 uninstall-man8 install-etc-local: watchdog.conf @if test -e $(DESTDIR)$(CONFIG_FILENAME) ; then \ echo "NOT installing $(CONFIG_FILENAME) - exists already"; \ else \ echo "installing $(CONFIG_FILENAME)"; \ $(mkinstalldirs) `dirname $(DESTDIR)$(CONFIG_FILENAME)`; \ $(INSTALL_DATA) watchdog.conf $(DESTDIR)$(CONFIG_FILENAME); \ fi install-data-local: install-etc-local # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: watchdog-5.13/examples/0002755000175000017500000000000012102721740014644 5ustar michaelmichaelwatchdog-5.13/examples/another-chance.sh0000644000175000017500000000204512102721740020056 0ustar michaelmichael#!/bin/sh # This is a "repair binary" for watchdog that allows the tests to fail N times # within a given period before a reboot is called. Note that this "grace # period" should really be a functionality of watchdog itself, IMHO. # # Erik Rossen # If one does not change the default watchdog loop time of 10 secords, N=12 # will allow two minutes of failures before a reboot is signaled. N=12 # CMAXAGE is the age in seconds that the counter file may have before it is # considered too old and is wiped out. CMAXAGE=20 ERR=$1 COUNTER=/var/run/watchdog.counter if test -f $COUNTER; then COUNTERAGE=$(stat -c %Y $COUNTER) NOW=$(date +%s) if test $(($COUNTERAGE+$CMAXAGE)) -lt $NOW ; then rm $COUNTER else I=$(cat $COUNTER) fi fi I=${I:-0} I=$(($I+1)) logger -t "watchdog[$$]" "Failure $I of $N" logger -t "watchdog[$$]" "PROCESS LIST:" ps auxww | logger -t "watchdog[$$]" if test "$I" -ge "$N" ; then logger -t "watchdog[$$]" Too many failures. Signalling reboot. rm $COUNTER exit $ERR fi echo $I > $COUNTER exit 0 watchdog-5.13/examples/uptime.sh0000755000175000017500000000060112102721740016501 0ustar michaelmichael#!/bin/sh # # this will unconditionally cause a reboot if the uptime increases 2 days # some hard disks might need this # # # get uptime info # upt=`cat /proc/uptime | tr -d . | cut -d' ' -f1` # # calculated days uptime, note that this number will never be greater than 2 # days=`expr $upt / 8640000` if [ $days -ge 2 ] then # # return code -1 means reboot # exit -1 fi exit 0 watchdog-5.13/examples/repair.sh0000755000175000017500000000436312102721740016471 0ustar michaelmichael#!/bin/sh # # I try to get a repair script that can handle as many problems as possible. # Feel free to send me some additions. # # (C) Michael Meskes Mon Jun 23 13:40:15 CEST 1997 # Placed under GPL. # Improvements, and modification for Redhat by Marc Merlin # # # who to send mail to # admin=root # # let's see what error message we got # case $1 in # # ENFILE: file table overflow # => increase file-max by 10% # 23) fm=`cat /proc/sys/fs/file-max` fm=`expr $fm + $fm / 10` echo $fm > /proc/sys/fs/file-max # # create log entry # echo "increased file-max to "$fm | logger -i -t repair -p daemon.info # # that's it, problem disappeared # exit 0;; # # ENETDOWN: network is down # ENETUNREACH: network is unreachable # => try to reconfigure network interface, there is no guarantee that # this helps, but if it does not, reboot won't either # 100|101) if [ -x /etc/rc.d/init.d/network ]; then # Redhat /etc/rc.d/init.d/network stop elif [ -x /etc/init.d/networking ]; then # Debian /etc/init.d/networking stop else ifconfig | awk '/Link/ {print $1}' | while read device do ifconfig ${device} down done fi # Calling rmmod -a twice should remove all unused modules (including networking # ones). It might not work with very old rmmod binaries though, I don't know rmmod -a rmmod -a # # make sure the modules gets back into it in case kerneld/kmod does not run # for module in `grep "^alias" /etc/conf.modules | awk '/eth/ {print $3}'` do modprobe $module done # # bring it back up # if [ -x /etc/init.d/networking ]; then # Debian /etc/init.d/networking start elif [ -x /etc/rc.d/init.d/network ]; then # Redhat /etc/rc.d/init.d/network start else echo "Couldn't find network script to relaunch networking. Please edit $0" | logger -i -t repair -p daemon.info exit $1 fi # # create log entry # echo "re-initialized network interface eth0" | logger -i -t repair -p daemon.info # # that' all we can do here # exit 0;; esac # # couldn't do anything # tell the sysadmin what's going on # if [ -x /usr/bin/mail ] then echo `hostname`" is going down because of error "$1|/usr/bin/mail -s "System fault!" ${admin} fi # # finally tell watchdog to reboot # exit $1 watchdog-5.13/examples/dbcheck.sh0000755000175000017500000000075112102721740016567 0ustar michaelmichael#!/bin/sh # # check if ORACLE database instance is still reacting to ping requests # # # name of the instance (must be defined in tnsnames.ora) # DATABASE=$1 # # check the state: # tnsping returns 0 on success, otherise the return value is 1 # tnsping $DATABASE > /dev/null 2>&1 result=$? if [ $result -ne 0 ] then # # obviously there is no system error code for this # so we have to create our own (system codes are > 0): -2. # note that -1 means reboot # result=-2 fi exit $result watchdog-5.13/examples/README0000644000175000017500000000034412102721740015523 0ustar michaelmichaelI'd like to provide better scripts with watchdog. So if you use your own script/binary to test the state of your system resp. to act as repair script, please mail me a copy so I can include it here. Michael watchdog-5.13/examples/systemcheck.sh0000644000175000017500000000031512102721740017517 0ustar michaelmichael#!/bin/sh # This checks quite some resources of the system. If for instance libc is # destroyed you cannot start /bin/sh anymore. # Courtesy of: Zygo Blaxell exit 0 watchdog-5.13/configure0000755000175000017500000057154112102721745014755 0ustar michaelmichael#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="include/extern.h" ac_default_prefix=/usr # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS TESTBIN_PATH CONFIG_FILENAME ALLOCA EGREP GREP CPP PATH_SENDMAIL am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_maintainer_mode enable_dependency_tracking enable_syslog enable_nfs with_minload with_timermargin with_configfile with_test_bin_path with_pidfile with_ka_pidfile with_randomseed ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-syslog Disable logging by syslog (deprecated) --disable-nfs Disable NFS support Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-minload=int minimum value accepted as reboot cause (default 2) --with-timermargin=int timer margin used by kernel (default 60) --with-configfile=filename name of config file (default /etc/watchdog.conf) --with-test-bin-path=directory path to test binaries (default /etc/watchdog.d) --with-pidfile=filename name of pid file (default /var/run/watchdog.pid) --with-ka_pidfile=filename name of keepalive pid file (default /var/run/wd_keepalive.pid) --with-randomseed=filename filename for storing random seed (default /var/run/random-seed) Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu MAJOR_VERSION=5 MINOR_VERSION=13 am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=watchdog VERSION=$MAJOR_VERSION.$MINOR_VERSION cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' cat >>confdefs.h <<_ACEOF #define MAJOR_VERSION $MAJOR_VERSION _ACEOF cat >>confdefs.h <<_ACEOF #define MINOR_VERSION $MINOR_VERSION _ACEOF ac_config_headers="$ac_config_headers include/config.h" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # Extract the first word of "sendmail", so it can be a program name with args. set dummy sendmail; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PATH_SENDMAIL+:} false; then : $as_echo_n "(cached) " >&6 else case $PATH_SENDMAIL in [\\/]* | ?:[\\/]*) ac_cv_path_PATH_SENDMAIL="$PATH_SENDMAIL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH /usr/bin /usr/sbin /usr/etc /etc /usr/ucblib do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PATH_SENDMAIL="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PATH_SENDMAIL" && ac_cv_path_PATH_SENDMAIL="/usr/lib/sendmail" ;; esac fi PATH_SENDMAIL=$ac_cv_path_PATH_SENDMAIL if test -n "$PATH_SENDMAIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATH_SENDMAIL" >&5 $as_echo "$PATH_SENDMAIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -n "$PATH_SENDMAIL"; then cat >>confdefs.h <<_ACEOF #define PATH_SENDMAIL "$PATH_SENDMAIL" _ACEOF fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } if eval \${$as_ac_Header+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_ac_Header=yes" else eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$as_ac_Header { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' dir; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_opendir+:} false; then : break fi done if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' x; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_opendir+:} false; then : break fi done if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if ${ac_cv_header_sys_wait_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in fcntl.h limits.h paths.h sys/ioctl.h sys/time.h syslog.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_RDEV 1 _ACEOF $as_echo "#define HAVE_ST_RDEV 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } if ${ac_cv_working_alloca_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes else ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 $as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then $as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } if ${ac_cv_func_alloca_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ void *alloca (size_t); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes else ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 $as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext $as_echo "#define C_ALLOCA 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if ${ac_cv_os_cray+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then : ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 $as_echo "$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } if ${ac_cv_c_stack_direction+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction (int *addr, int depth) { int dir, dummy = 0; if (! addr) addr = &dummy; *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; dir = depth ? find_stack_direction (addr, depth - 1) : 0; return dir + dummy; } int main (int argc, char **argv) { return find_stack_direction (0, argc + !argv + 20) < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 else ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 $as_echo "$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi if test $ac_cv_c_compiler_gnu = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 $as_echo_n "checking whether $CC needs -traditional... " >&6; } if ${ac_cv_prog_gcc_traditional+:} false; then : $as_echo_n "(cached) " >&6 else ac_pattern="Autoconf.*'x'" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 $as_echo "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF for ac_func in vprintf do : ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" if test "x$ac_cv_func_vprintf" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VPRINTF 1 _ACEOF ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" if test "x$ac_cv_func__doprnt" = xyes; then : $as_echo "#define HAVE_DOPRNT 1" >>confdefs.h fi fi done for ac_func in gethostname select socket strcspn strdup strerror strstr strtoul uname do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to log via syslog" >&5 $as_echo_n "checking whether to log via syslog... " >&6; } # Check whether --enable-syslog was given. if test "${enable_syslog+set}" = set; then : enableval=$enable_syslog; if test "$enableval" = "yes"; then $as_echo "#define USE_SYSLOG 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else $as_echo "#define USE_SYSLOG 0" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else $as_echo "#define USE_SYSLOG 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include NFS support" >&5 $as_echo_n "checking whether to include NFS support... " >&6; } # Check whether --enable-nfs was given. if test "${enable_nfs+set}" = set; then : enableval=$enable_nfs; if test "$enableval" = "yes"; then $as_echo "#define HAVE_NFS 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else $as_echo "#define HAVE_NFS 0" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else $as_echo "#define HAVE_NFS 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for minimum value accepted as reboot cause" >&5 $as_echo_n "checking for minimum value accepted as reboot cause... " >&6; } # Check whether --with-minload was given. if test "${with_minload+set}" = set; then : withval=$with_minload; cat >>confdefs.h <<_ACEOF #define MINLOAD $withval _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 $as_echo "$withval" >&6; } else $as_echo "#define MINLOAD 2" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: 2" >&5 $as_echo "2" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for timer margin used by kernel" >&5 $as_echo_n "checking for timer margin used by kernel... " >&6; } # Check whether --with-timermargin was given. if test "${with_timermargin+set}" = set; then : withval=$with_timermargin; cat >>confdefs.h <<_ACEOF #define TIMER_MARGIN $withval _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 $as_echo "$withval" >&6; } else $as_echo "#define TIMER_MARGIN 60" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: 60" >&5 $as_echo "60" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for config filename" >&5 $as_echo_n "checking for config filename... " >&6; } # Check whether --with-configfile was given. if test "${with_configfile+set}" = set; then : withval=$with_configfile; cat >>confdefs.h <<_ACEOF #define CONFIG_FILENAME "$withval" _ACEOF CONFIG_FILENAME="$withval" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 $as_echo "$withval" >&6; } else CONFIG_FILENAME="/etc/watchdog.conf" cat >>confdefs.h <<_ACEOF #define CONFIG_FILENAME "$CONFIG_FILENAME" _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_FILENAME" >&5 $as_echo "$CONFIG_FILENAME" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for test binary directory" >&5 $as_echo_n "checking for test binary directory... " >&6; } # Check whether --with-test-bin-path was given. if test "${with_test_bin_path+set}" = set; then : withval=$with_test_bin_path; cat >>confdefs.h <<_ACEOF #define TESTBIN_PATH "$withval" _ACEOF TESTBIN_PATH="$withval" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 $as_echo "$withval" >&6; } else TESTBIN_PATH="/etc/watchdog.d" cat >>confdefs.h <<_ACEOF #define TESTBIN_PATH "$TESTBIN_PATH" _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TESTBIN_PATH" >&5 $as_echo "$TESTBIN_PATH" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pid filename" >&5 $as_echo_n "checking for pid filename... " >&6; } # Check whether --with-pidfile was given. if test "${with_pidfile+set}" = set; then : withval=$with_pidfile; cat >>confdefs.h <<_ACEOF #define PIDFILE "$withval" _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 $as_echo "$withval" >&6; } else $as_echo "#define PIDFILE \"/var/run/watchdog.pid\"" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"/var/run/watchdog.pid\"" >&5 $as_echo "\"/var/run/watchdog.pid\"" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for keepalive pid filename" >&5 $as_echo_n "checking for keepalive pid filename... " >&6; } # Check whether --with-ka_pidfile was given. if test "${with_ka_pidfile+set}" = set; then : withval=$with_ka_pidfile; cat >>confdefs.h <<_ACEOF #define KA_PIDFILE "$withval" _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 $as_echo "$withval" >&6; } else $as_echo "#define KA_PIDFILE \"/var/run/wd_keepalive.pid\"" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"/var/run/wd_keepalive.pid\"" >&5 $as_echo "\"/var/run/wd_keepalive.pid\"" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for random seed filename" >&5 $as_echo_n "checking for random seed filename... " >&6; } # Check whether --with-randomseed was given. if test "${with_randomseed+set}" = set; then : withval=$with_randomseed; cat >>confdefs.h <<_ACEOF #define RANDOM_SEED "$withval" _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 $as_echo "$withval" >&6; } else $as_echo "#define RANDOM_SEED \"/var/run/random-seed\"" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"/var/run/random-seed\"" >&5 $as_echo "\"/var/run/random-seed\"" >&6; } fi ac_config_files="$ac_config_files Makefile src/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi watchdog-5.13/TODO0000644000175000017500000000034512102721740013516 0ustar michaelmichaelIs it better to do the memory test with real allocation? Make softboot configurable via watchdog.conf. Test which applications are running. RPC calls have to be taken from libtirpc to cope with their removal from glibc 2.14. watchdog-5.13/README0000644000175000017500000000366512102721740013716 0ustar michaelmichaelWatchdog is a daemon that checks if your system is still working. If programs in user space are not longer executed it will reboot the system. However, this will not always work. From the kernel: > Watchdog Timer Interfaces For The Linux Operating System > > Alan Cox > > Custom Linux Driver And Program Development > >[...] > >All four interfaces provide /dev/watchdog, which when open must be written >to within a minute or the machine will reboot. Each write delays the reboot >time another minute. In the case of the software watchdog the ability to >reboot will depend on the state of the machines and interrupts. The hardware >boards physically pull the machine down off their own onboard timers and >will reboot from almost anything. This tool proved very useful for me, because I always run the latest kernel and the latest libc release, but rely on the machine to be up and running for email. Note, that you have to enable the software watchdog driver in your kernel for the program to be able to hard reset the system unless you have a hardware watchdog of course. Make sure you don't compile watchdog with a different timer margin than the kernel driver. As of version 4.0 watchdog is able to make itself a real-time application. It will lock all its pages in memory and set it´s scheduler to round-robin. This will take up to 900 pages of memory but guarantees you that watchdog will get its share of processor time. If you ever experienced a hard reset just because watchdog wasn´t scheduled for a minute, you will probably have no problem with the 900 pages which is not so much anyway. Of course this is not needed for machines running on low load. Don't be surprised if you see any zombie processes laying around. This is normal. They will be removed the next time watchdog wakes up. Of course a new zombie is created then, too. This zombie process is a result of the process table check. Michael meskes@debian.org watchdog-5.13/watchdog.80000644000175000017500000003222312102721740014717 0ustar michaelmichael.TH WATCHDOG 8 "January 2005" .UC 4 .SH NAME watchdog \- a software watchdog daemon .SH SYNOPSIS .B watchdog .RB [ \-F | \-\-foreground ] .RB [ \-f | \-\-force ] .RB [ \-c " \fIfilename\fR|" \-\-config\-file " \fIfilename\fR]" .RB [ \-v | \-\-verbose ] .RB [ \-s | \-\-sync ] .RB [ \-b | \-\-softboot ] .RB [ \-q | \-\-no\-action ] .SH DESCRIPTION The Linux kernel can reset the system if serious problems are detected. This can be implemented via special watchdog hardware, or via a slightly less reliable software-only watchdog inside the kernel. Either way, there needs to be a daemon that tells the kernel the system is working fine. If the daemon stops doing that, the system is reset. .PP .B watchdog is such a daemon. It opens .IR /dev/watchdog , and keeps writing to it often enough to keep the kernel from resetting, at least once per minute. Each write delays the reboot time another minute. After a minute of inactivity the watchdog hardware will cause the reset. In the case of the software watchdog the ability to reboot will depend on the state of the machines and interrupts. .PP The watchdog daemon can be stopped without causing a reboot if the device .I /dev/watchdog is closed correctly, unless your kernel is compiled with the .I CONFIG_WATCHDOG_NOWAYOUT option enabled. .SH TESTS The watchdog daemon does several tests to check the system status: .IP \(bu 3 Is the process table full? .IP \(bu 3 Is there enough free memory? .IP \(bu 3 Are some files accessible? .IP \(bu 3 Have some files changed within a given interval? .IP \(bu 3 Is the average work load too high? .IP \(bu 3 Has a file table overflow occurred? .IP \(bu 3 Is a process still running? The process is specified by a pid file. .IP \(bu 3 Do some IP addresses answer to ping? .IP \(bu 3 Do network interfaces receive traffic? .IP \(bu 3 Is the temperature too high? (Temperature data not always available.) .IP \(bu 3 Execute a user defined command to do arbitrary tests. .IP \(bu 3 Execute one or more test/repair commands found in /etc/watchdog.d. These commands are called with the argument \fBtest\fP or \fBrepair\fP. .PP If any of these checks fail watchdog will cause a shutdown. Should any of these tests except the user defined binary last longer than one minute the machine will be rebooted, too. .PP .SH OPTIONS Available command line options are the following: .TP .BR \-v ", " \-\-verbose Set verbose mode. Only implemented if compiled with .I SYSLOG feature. This mode will log each several infos in .I LOG_DAEMON with priority .IR LOG_INFO. This is useful if you want to see exactly what happened until the watchdog rebooted the system. Currently it logs the temperature (if available), the load average, the change date of the files it checks and how often it went to sleep. .TP .BR \-s ", " \-\-sync Try to synchronize the filesystem every time the process is awake. Note that the system is rebooted if for any reason the synchronizing lasts longer than a minute. .TP .BR \-b ", " \-\-softboot Soft-boot the system if an error occurs during the main loop, e.g. if a given file is not accessible via the .BR stat (2) call. Note that this does not apply to the opening of .I /dev/watchdog and .IR /proc/loadavg , which are opened before the main loop starts. .TP .BR \-F ", " \-\-foreground Run in foreground mode, useful for running under systemd (for example). .TP .BR \-f ", " \-\-force Force the usage of the interval given or the maximal load average given in the config file. .TP .BR \-c " \fIconfig-file\fR, " \-\-config\-file " \fIconfig-file" Use .I config-file as the configuration file instead of the default .IR /etc/watchdog.conf . .TP .BR \-q ", " \-\-no\-action Do not reboot or halt the machine. This is for testing purposes. All checks are executed and the results are logged as usual, but no action is taken. Also your hardware card or the kernel software watchdog driver is not enabled. Temperature checking is also disabled since this triggers the hardware watchdog on some cards. .SH FUNCTION After .B watchdog starts, it puts itself into the background and then tries all checks specified in its configuration file in turn. Between each two tests it will write to the kernel device to prevent a reset. After finishing all tests watchdog goes to sleep for some time. The kernel drivers expects a write to the watchdog device every minute. Otherwise the system will be reset. As a default .B watchdog will sleep for only 1 second so it triggers the device early enough. .PP Under high system load .B watchdog might be swapped out of memory and may fail to make it back in in time. Under these circumstances the Linux kernel will reset the machine. To make sure you won't get unnecessary reboots make sure you have the variable .I realtime set to .I yes in the configuration file .IR watchdog.conf . This adds real time support to .BR watchdog : it will lock itself into memory and there should be no problem even under the highest of loads. .PP On system running out of memory the kernel will try to free enough memory by killing process. The .B watchdog daemon itself is exempted from this so-called out-of-memory killer. .PP Also you can specify a maximal allowed load average. Once this load average is reached the system is rebooted. You may specify maximal load averages for 1 minute, 5 minutes or 15 minutes. The default values is to disable this test. Be careful not to set this parameter too low. To set a value less then the predefined minimal value of 2, you have to use the .B -f option. .PP You can also specify a minimal amount of virtual memory you want to have available as free. As soon as more virtual memory is used action is taken by .BR watchdog . Note, however, that watchdog does not distinguish between different types of memory usage. It just checks for free virtual memory. .PP If you have a watchdog card with temperature sensor you can specify the maximal allowed temperature. Once this temperature is reached the system is halted. The default value is 120. There is no unit conversion so make sure you use the same unit as your hardware. .B watchdog will issue warnings once the temperature increases 90%, 95% and 98% of this temperature. .PP When using file mode .B watchdog will try to .BR stat (2) the given files. Errors returned by stat will .B not cause a reboot. For a reboot the stat call has to last at least one minute. This may happen if the file is located on an NFS mounted filesystem. If your system relies on an NFS mounted filesystem you might try this option. However, in such a case the .I sync option may not work if the NFS server is not answering. .PP .B watchdog can read the pid from a pid file and see whether the process still exists. If not, action is taken by .BR watchdog . So you can for instance restart the server from your .IR repair-binary . .PP .B watchdog will try periodically to fork itself to see whether the process table is full. This process will leave a zombie process until watchdog wakes up again and catches it; this is harmless, don't worry about it. .PP In ping mode .B watchdog tries to ping the given IP addresses. These addresses do not have to be a single machine. It is possible to ping to a broadcast address instead to see if at least one machine in a subnet is still living. .PP .B Do not use this broadcast ping unless your MIS person a) knows about it and .B b) has given you explicit permission to use it! .PP .B watchdog will send out three ping packages and wait up to seconds for the reply with being the time it goes to sleep between two times triggering the watchdog device. Thus a unreachable network will not cause a hard reset but a soft reboot. .PP You can also test passively for an unreachable network by just monitoring a given interface for traffic. If no traffic arrives the network is considered unreachable causing a soft reboot or action from the repair binary. .PP .B watchdog can run an external command for user-defined tests. A return code not equal 0 means an error occured and watchdog should react. If the external command is killed by an uncaught signal this is considered an error by watchdog too. The command may take longer than the time slice defined for the kernel device without a problem. However, error messages are generated into the syslog facility. If you have enabled softboot on error the machine will be rebooted if the binary doesn't exit in half the time .B watchdog sleeps between two tries triggering the kernel device. .PP If you specify a repair binary it will be started instead of shutting down the system. If this binary is not able to fix the problem .B watchdog will still cause a reboot afterwards. .PP If the machine is halted an email is sent to notify a human that the machine is going down. Starting with version 4.4 .B watchdog will also notify the human in charge if the machine is rebooted. .SH "SOFT REBOOT" A soft reboot (i.e. controlled shutdown and reboot) is initiated for every error that is found. Since there might be no more processes available, watchdog does it all by himself. That means: .IP 1. 4 Kill all processes with SIGTERM. .IP 2. 4 After a short pause kill all remaining processes with SIGKILL. .IP 3. 4 Record a shutdown entry in wtmp. .IP 4. 4 Save the random seed from .IR /dev/urandom . If the device is non-existant or there is no filename for saving this step is skipped. .IP 5. 4 Turn off accounting. .IP 6. 4 Turn off quota and swap. .IP 7. 4 Unmount all partitions except the root partition. .IP 8. 4 Remount the root partition read-only. .IP 9. 4 Shut down all network interfaces. .IP 10. 4 Finally reboot. .SH "CHECK BINARY" If the return code of the check binary is not zero .B watchdog will assume an error and reboot the system. Be careful with this if you are using the real-time properties of watchdog since .B watchdog will wait for the return of this binary before proceeding. An positive exit code is interpreted as an system error code (see .I errno.h for details). Negative values are special to .BR watchdog : .TP \-1 Reboot the system. This is not exactly an error message but a command to .BR watchdog . If the return code is \-1 .B watchdog will not try to run a shutdown script instead. .TP \-2 Reset the system. This is not exactly an error message but a command to .BR watchdog . If the return code is \-2 .B watchdog will simply refuse to write the kernel device again. .TP \-3 Maximum load average exceeded. .TP \-4 The temperature inside is too high. .TP \-5 .I /proc/loadavg contains no (or not enough) data. .TP \-6 The given file was not changed in the given interval. .TP \-7 .I /proc/meminfo contains invalid data. .TP \-8 Child process was killed by a signal. .TP \-9 Child process did not return in time. .TP \-10 Free for personal use. .SH "REPAIR BINARY" The repair binary is started with one parameter: the error number that caused .B watchdog to initiate the boot process. After trying to repair the system the binary should exit with 0 if the system was successfully repaired and thus there is no need to boot anymore. A return value not equal 0 tells .B watchdog to reboot. The return code of the repair binary should be the error number of the error causing .B watchdog to reboot. Be careful with this if you are using the real-time properties since .B watchdog will wait for the return of this binary before proceeding. .SH "TEST DIRECTORY" Executables placed in the test directory are discovered by watchdog on startup and are automatically executed. They are bounded time-wise by the test-timeout directive in watchdog.conf. These executables are called with either "test" as the first argument (if a test is being performed) or "repair" as the first argument (if a repair for a previously-failed "test" operation on is being performed). The as with test binaries and repair binaries, expected exit codes for a successful test or repair operation is always zero. If an executable's test operation fails, the same executable is automatically called with the "repair" argument as well as the return code of the previously-failed test operation. For example, if the following execution returns 42: /etc/watchdog.d/my-test test The watchdog daemon will attempt to repair the problem by calling: /etc/watchdog.d/my-test repair 42 This enables administrators and application developers to make intelligent test/repair commands. If the "repair" operation is not required (or is not likely to succeed), it is important that the author of the command return a non-zero value so the machine will still reboot as expected. Note that the watchdog daemon may interpret and act upon any of the reserved return codes noted in the Check Binary section prior to calling a given command in "repair" mode. .SH BUGS None known so far. .SH AUTHORS The original code is an example written by Alan Cox , the author of the kernel driver. All additions were written by Michael Meskes . Johnie Ingram had the idea of testing the load average. He also took over the Debian specific work. Dave Cinege brought up some hardware watchdog issues and helped testing this stuff. .SH FILES .TP .I /dev/watchdog The watchdog device. .TP .I /var/run/watchdog.pid The pid file of the running .BR watchdog . .SH "SEE ALSO" .BR watchdog.conf (5) watchdog-5.13/debian/0002755000175000017500000000000012102721740014250 5ustar michaelmichaelwatchdog-5.13/debian/dirs0000644000175000017500000000004512102721740015131 0ustar michaelmichaeletc/init.d usr/sbin var/log/watchdog watchdog-5.13/debian/prerm0000644000175000017500000000022412102721740015314 0ustar michaelmichael#!/bin/sh set -e if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/watchdog ]; then rm -f /usr/doc/watchdog fi #DEBHELPER# watchdog-5.13/debian/control0000644000175000017500000000203512102721740015651 0ustar michaelmichaelSource: watchdog Section: admin Priority: extra Maintainer: Michael Meskes Build-Depends: debhelper (>= 5), po-debconf (>= 0.5.0) Standards-Version: 3.9.3 Homepage: http://watchdog.sourceforge.net Package: watchdog Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, makedev (>= 2.3.1-24) | udev, lsb-base (>= 3.2-14) Description: system health checker and software/hardware watchdog handler The watchdog program writes to /dev/watchdog every ten seconds. If the device is opened but not written to within a minute, the machine will reboot. This feature is available when the kernel is built with "software watchdog" support (standard in Debian kernels) or if the machine is equipped with a hardware watchdog (in which case this package can also be used to "pet" it, resetting its timer). . The kernel software watchdog's ability to reboot will depend on the state of the machine and interrupts. . The watchdog tool itself runs several health checks and acts appropriately if the system is not in good shape. watchdog-5.13/debian/wd_keepalive.init0000644000175000017500000000407212102721740017575 0ustar michaelmichael#!/bin/sh #/etc/init.d/wd_keepalive: start wd_keepalive daemon. ### BEGIN INIT INFO # Provides: wd_keepalive # Short-Description: Start watchdog keepalive daemon # Required-Start: $remote_fs # Required-Stop: $remote_fs # X-Start-Before: $all # Default-Start: 2 3 4 5 # Default-Stop: ### END INIT INFO PATH=/bin:/usr/bin:/sbin:/usr/sbin test -x /usr/sbin/wd_keepalive || exit 0 # For configuration of the init script use the file # /etc/default/watchdog, do not edit this init script. # Set run_watchdog to 1 to start watchdog or 0 to disable it. run_watchdog=0 # Specify additional watchdog options here (see manpage). watchdog_options="" # Specify module to load watchdog_module="none" [ -e /etc/default/watchdog ] && . /etc/default/watchdog NAME=wd_keepalive DAEMON=/usr/sbin/wd_keepalive STOP_RETRY_SCHEDULE='TERM/10/forever/KILL/1' . /lib/lsb/init-functions case "$1" in start) if [ $run_watchdog = 1 ] then [ ${watchdog_module:-none} != "none" ] && /sbin/modprobe $watchdog_module echo -n "Starting watchdog keepalive daemon: " if start-stop-daemon --start --quiet \ --exec $DAEMON -- $watchdog_options then echo wd_keepalive. else echo fi fi ;; stop) if [ $run_watchdog = 1 ] then echo -n "Stopping watchdog keepalive daemon: " if start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ --retry $STOP_RETRY_SCHEDULE then echo wd_keepalive. else echo fi fi ;; status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; restart) $0 force-reload ;; force-reload) if [ $run_watchdog = 0 ]; then exit 0; fi echo -n "Restarting $NAME daemon." start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ --retry $STOP_RETRY_SCHEDULE echo -n "." if start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ --exec $DAEMON -- $watchdog_options then echo "done." else echo fi ;; *) echo "Usage: /etc/init.d/wd_keepalive {start|stop|status|restart|force-reload}" exit 1 esac exit 0 watchdog-5.13/debian/changelog0000644000175000017500000006130112102721740016121 0ustar michaelmichaelwatchdog (5.13-1) unstable; urgency=low * New upstream version. * Added hardening build flags to Debian build. -- Michael Meskes Fri, 01 Feb 2013 12:15:10 +0100 watchdog (5.12-1) unstable; urgency=low * Fixed copyright notice. (Closes: #664624) * Updated package description. (Closes: #663911) -- Michael Meskes Thu, 05 Apr 2012 12:08:10 +0200 watchdog (5.11-2) unstable; urgency=low * Updated Dutch debconf translation. (Closes: #657588) * Bumped Standards-Version to 3.9.3 no changes needed. -- Michael Meskes Sun, 04 Mar 2012 15:32:51 +0100 watchdog (5.11-1) unstable; urgency=low * New upstream version fixing the timeout problem causing ping check to fail. (Closes: #633528) * Added support for "status" action to wd_keepalive init.d script. (Closes: #653405) - thanks to Peter Eisentraut -- Michael Meskes Wed, 28 Dec 2011 11:24:16 +0100 watchdog (5.10-1) unstable; urgency=low * New upstream version. (Closes: #597213) * Updated Danish debconf translation. (Closes: #650855) * Updated package description to better explain what this package is about. (Closes: #610271) * Bumped Standards-Version to 3.9.2 no changes needed. -- Michael Meskes Thu, 15 Dec 2011 17:36:21 +0100 watchdog (5.9-1) unstable; urgency=low * New upstream version. * Fixed check for existance of MAKEDEV. (Closes: #582766) - thanks to Timo Juhani Lindfors * Added source/format file. -- Michael Meskes Thu, 17 Jun 2010 17:01:41 +0200 watchdog (5.8-1) unstable; urgency=low * New upstream version. * Bumped Standards-Version to 3.8.4 no changes needed. -- Michael Meskes Mon, 22 Mar 2010 15:29:46 +0100 watchdog (5.7-4) unstable; urgency=low * Decreased default interval from 10 seconds to just 1. * Disable OOM killer for watchdog and wd_keepalive. In the process also make sure that the daemons do not allocate memory once they are in daemon mode as a safeguard for systems running out of memory. * Fixed typo in init script. -- Michael Meskes Thu, 11 Feb 2010 15:10:49 +0100 watchdog (5.7-3) unstable; urgency=low * Missed one line of Min Zhangg's patch resulting in an incorrect path when using log_dir option. -- Michael Meskes Wed, 13 Jan 2010 09:59:49 +0100 watchdog (5.7-2) unstable; urgency=low * Applied patch by Min Zhang to make logdir a configurable option. * Fixed init scripts to make sure one daemon really has ended before the next one is started. (Closes: #554793) - thanks to Tim Small -- Michael Meskes Sat, 09 Jan 2010 16:32:20 +0100 watchdog (5.7-1) unstable; urgency=low * New upstream version including all the changes from the Debian package and - Patch by Russell Coker to set the socket handle for raw socket access to close on exec. (Closes: #552611) - Patch by Russell Coker to give a better error message if no config file is found. (Closes: #563798) -- Michael Meskes Wed, 06 Jan 2010 13:33:25 +0100 watchdog (5.6-8) unstable; urgency=low * Next try in getting the dependencies right, wd_keepalive is supposed to be started as early as possible to cope with system that boot with the watchdog device open and watchdog is supposed to be started as late as possible to be able to monitor other process. For the very same reason watchdog should be stopped very early before the other process stop. -- Michael Meskes Tue, 22 Sep 2009 11:00:19 +0200 watchdog (5.6-7) unstable; urgency=low * Added rsyslog config option to watchdog.conf manpage, closes: #544671 -- Michael Meskes Mon, 21 Sep 2009 13:13:26 +0200 watchdog (5.6-6) unstable; urgency=low * wd_keepalive must not be started before portmap because /usr could be nfs mounted. In the process of fixing this some more dependencies were added. -- Michael Meskes Thu, 20 Aug 2009 12:29:55 +0200 watchdog (5.6-5) unstable; urgency=low * Fixed wd_keepalive init script LSB header to specify no stop level. Also removed superfluous dependencies and old links, closes: #540390 * Also made sure that watchdog itself is stopped as early as possible. This needs an insserv version that processes $all in stop lines. * Bumped Standards-Version to 3.8.3 no changes needed. -- Michael Meskes Wed, 19 Aug 2009 11:56:30 +0200 watchdog (5.6-4) unstable; urgency=low * wd_keepalive immediately terminates if no watchdog device is given, therefore it cannot be stopped when starting watchdog. Make sure we do not print an error in this case, closes: #533608 * Bumped Standards-Version to 3.8.2 no changes needed. * Remove path specification from command in maintainer script. -- Michael Meskes Sun, 21 Jun 2009 10:54:23 +0200 watchdog (5.6-3) unstable; urgency=low * Prevent usage of unset variable by applying upstream patch, closes: #530843 * Made initscript use lsb functions. * Added status argument to init script. -- Michael Meskes Thu, 28 May 2009 12:45:18 +0200 watchdog (5.6-2) unstable; urgency=low * Accept config lines with arbitrary length, closes: #529891 -- Michael Meskes Mon, 25 May 2009 02:54:51 +0200 watchdog (5.6-1) unstable; urgency=low * New upstream version, closes: #517419 * Bumped Standards-Version to 3.8.1, no change needed. * Added homepage field. * Added watch file. -- Michael Meskes Thu, 22 Mar 2009 13:56:25 +0100 watchdog (5.5-1) unstable; urgency=low * New upstream version. -- Michael Meskes Wed, 25 Feb 2009 12:08:29 +0100 watchdog (5.4-11) unstable; urgency=low * Updated Japanese debconf translation, closes: #512872 * Made init scripts cope with empty variable, closes: #514256 * Added upstream patch to prevent rare segfault on shutdown, closes: #514295 * Do not install stop links for wd_keepalive, closes: #506435, #506436 * Do not call init scripts from init scripts. Instead call start-stop-daemon directly. -- Michael Meskes Wed, 11 Feb 2009 14:53:30 +0100 watchdog (5.4-10) unstable; urgency=medium * Preserve watchdog_module setting on upgrade, closes: #506376 -- Michael Meskes Fri, 21 Nov 2008 10:13:09 +0100 watchdog (5.4-9) unstable; urgency=low * Do not start wd_keepalive on watchog restart, closes: #504336 -- Michael Meskes Mon, 03 Nov 2008 10:10:01 +0100 watchdog (5.4-8) unstable; urgency=low * Added Swedish debconf translation, closes: #504250 -- Michael Meskes Sun, 02 Nov 2008 14:03:46 +0100 watchdog (5.4-7) unstable; urgency=low * Check whether /sbin/MAKEDEV exists before calling it, closes: #503080 -- Michael Meskes Wed, 22 Oct 2008 14:38:30 +0200 watchdog (5.4-6) unstable; urgency=low * Added Spanish debconf translation, closes: #495480 * Bumped standards-version to 3.8.0, no other changes needed. -- Michael Meskes Wed, 20 Aug 2008 15:17:35 +0200 watchdog (5.4-5) unstable; urgency=low * Bumped standards-version to 3.7.3, no other changes needed. * Increased versioned build dependency on debhelper to >= 5 because we use compatibility level 5. -- Michael Meskes Sat, 29 Dec 2007 13:26:40 +0100 watchdog (5.4-4) unstable; urgency=low * Replaced broken fi.po, the first version got broken during email transfer, closes: #457455. -- Michael Meskes Sun, 23 Dec 2007 11:14:10 +0100 watchdog (5.4-3) unstable; urgency=low * Added Finish translation, closes: #457455. * Fixed remaining lintian warnings. -- Michael Meskes Sat, 22 Dec 2007 17:36:02 +0100 watchdog (5.4-2) unstable; urgency=low * Removed dependency on devfsd which does not exist anymore. -- Michael Meskes Fri, 12 Oct 2007 09:46:05 +0200 watchdog (5.4-1) unstable; urgency=low * New upstream version. * Updated to standards version 3.7.2 * Fixed po files that got mangled in 5.3.1-4 -- Michael Meskes Fri, 17 Aug 2007 12:05:04 +0200 watchdog (5.3.1-4) unstable; urgency=low * Reviewed debconf templates and debian/control, closes: #430428 * Updated Czech translation, closes: #432210 * Updated German translation, closes: #433090 * Updated Portuguese translation, closes: #433240 * Updated French translation, closes: #433288 * Added Galician translation, closes: #431440 * Added Vietnamese translation, closes: #431559 * Added Russian translation, closes: #432222 -- Michael Meskes Mon, 16 Jul 2007 08:35:57 +0200 watchdog (5.3.1-3) unstable; urgency=low * Made sure module is loaded before watchdog is started closes: #423019, #423020 -- Michael Meskes Thu, 31 May 2007 15:18:14 +0200 watchdog (5.3.1-2) unstable; urgency=low * Added Japanese debconf templates translation, closes: #413533 -- Michael Meskes Tue, 6 Mar 2007 14:09:46 +0100 watchdog (5.3.1-1) unstable; urgency=low * New upstream version, closes: #411961 -- Michael Meskes Thu, 22 Feb 2007 11:46:30 +0100 watchdog (5.3-1) unstable; urgency=low * New upstream version, closes: #224241, #409587 -- Michael Meskes Tue, 20 Feb 2007 12:16:03 +0100 watchdog (5.2.6-7) unstable; urgency=low * Add some upstream patches to wd_keepalive, install and use it, closes: #353053 -- Michael Meskes Sun, 11 Feb 2007 10:59:11 +0100 watchdog (5.2.6-6) unstable; urgency=low * Fixed postinst to allow missing entries in /etc/default/watchdog, closes: #387261 -- Michael Meskes Thu, 14 Sep 2006 09:58:37 +0200 watchdog (5.2.6-5) unstable; urgency=low * Applied upstream patch to prevent possible reboot because of uninitilized variable. * Added lsb-section to init script. -- Michael Meskes Tue, 12 Sep 2006 11:19:18 +0200 watchdog (5.2.6-4) unstable; urgency=low * Added Dutch po file, closes: #383337 -- Michael Meskes Fri, 18 Aug 2006 16:17:22 +0200 watchdog (5.2.6-3) unstable; urgency=low * Added Czech po file, closes: #380527 * Added some two bug fixes from CVS. -- Michael Meskes Mon, 31 Jul 2006 10:58:42 +0200 watchdog (5.2.6-2) unstable; urgency=low * Check for existance of /etc/default/watchdog in postinst, closes: #376864 -- Michael Meskes Thu, 6 Jul 2006 11:55:34 +0200 watchdog (5.2.6-1) unstable; urgency=low * New upstream version, closes: #32547, #351398, #361839, #361835 * Added French translation, closes: #368774 * Added Portuguese translation, closes: #372819 * Added missing db_stop to postinst, closes: #367126 * Added udev to Depends: line as alternative to makedev * Added debconf-updatepo call to clean target in debian/rules * Fixed /etc/dafault/watchdog handling in postinst, bug reported by James Harper -- Michael Meskes Thu, 22 Jun 2006 20:50:01 +0200 watchdog (5.2.5-2) unstable; urgency=low * Switched to po-debconf, closes: #351398 * Fixed lintian warnings/errors in postinst -- Michael Meskes Tue, 9 May 2006 13:16:39 +0200 watchdog (5.2.5-1) unstable; urgency=low * New upstream version, closes: #350557, #330463, #296477 * Added patch to fix usage of /etc/default/watchdog, closes: #242214 Thanks to Steffen Joeris * Added a note to README.Debian that the kernel driver has to be loaded, closes: #287969 -- Michael Meskes Mon, 17 Apr 2006 14:39:32 +0200 watchdog (5.2.4-5) unstable; urgency=low * Prompt via debconf. Store configuration in /etc/default/watchdog (not a conffile). Closes: #180094, #242214, #299629, #322510. Thanks to Matej Vela -- Michael Meskes Thu, 8 Sep 2005 15:12:07 +0200 watchdog (5.2.4-4) unstable; urgency=medium * Check for local changes to startup links before changing them -- Michael Meskes Thu, 19 May 2005 19:03:38 +0200 watchdog (5.2.4-3) unstable; urgency=medium * Changed startup priority to 89, closes: #300432 * Added path to init script, closes: #259277 -- Michael Meskes Sun, 8 May 2005 12:48:38 +0200 watchdog (5.2.4-2) unstable; urgency=low * Updated manpages closes: #289386 * Updated package descrition closes: #285367 -- Michael Meskes Tue, 25 Jan 2005 14:17:24 +0100 watchdog (5.2.4-1) unstable; urgency=low * New upstream version closes: #199727 -- Michael Meskes Tue, 8 Jul 2003 14:36:42 +0200 watchdog (5.2.3-5) unstable; urgency=low * Fixed /etc/init.d/watchdog help. closes: #180092 * Added a longer sleep between stop and start during restart. closes: #180093 -- Michael Meskes Sun, 18 May 2003 17:07:21 +0200 watchdog (5.2.3-4) unstable; urgency=low * Add build-depends. closes: #191009 -- Michael Meskes Tue, 29 Apr 2003 10:08:34 +0200 watchdog (5.2.3-3) unstable; urgency=low * Do not run make distclean if no makefile is present. closes: #190620 -- Michael Meskes Sat, 26 Apr 2003 20:31:36 +0200 watchdog (5.2.3-2) unstable; urgency=low * Add missing 0 so dir mode is correctly recognized. closes: #179357 * Also fix existing directory. * Removed "volatile" keyword so watchdog does compile on woody again. closes: #179083 -- Michael Meskes Wed, 5 Feb 2003 13:55:48 +0100 watchdog (5.2.3-1) unstable; urgency=low * Somehow I had an .o file in the orig.tar.gz. No idea how that happened. New version does not. closes: #178881 -- Michael Meskes Thu, 30 Jan 2003 13:50:51 +0100 watchdog (5.2.2-1) unstable; urgency=low * Somehow "watchdog.c " came back. Argh. * Rename to 5.2.2 since the bug was in the orig tarball and this is an unreleased beta of 6.0 anyway. * Made option writemagic disappear and set by default. closes: #178689 -- Michael Meskes Tue, 28 Jan 2003 07:44:00 +0100 watchdog (5.2.1-1) unstable; urgency=low * Clean out tarball closes: #176825 * Rename to 5.2.1 since the bug was in the orig tarball and this is an unreleased beta of 6.0 anyway. -- Michael Meskes Fri, 24 Jan 2003 10:22:33 +0100 watchdog (5.2-3) unstable; urgency=low * Only write to open file streams closes: #175986 -- Michael Meskes Sat, 11 Jan 2003 19:43:56 +0100 watchdog (5.2-2) unstable; urgency=low * Really adopted package this time closes: #79556, #104775, #79287, #174462, #122414, #136177, #174496 closes: #120744, #120745, #174644, #148653 * Added dependency on devfsd or makedev. closes: #150109 -- Michael Meskes Thu, 9 Jan 2003 12:03:53 +0100 watchdog (5.2-1) unstable; urgency=low * Adopted completely. closes: #79556, #104775, #79287 * Added lots of fixes from the 6.0 version in development Closes: #174462, #122414, #136177, #174496, #120744, #120745 * Removed second watchdog.c file. Closes: #174644 * Made sure prerm file is there. Closes: #148653 -- Michael Meskes Wed, 8 Jan 2003 13:20:02 +0100 watchdog (5.2-0.2) unstable; urgency=low * NMU * Fix gcc 3.0 build failure. Closes: #104775 -- LaMont Jones Sun, 3 Feb 2002 21:06:36 -0700 watchdog (5.2-0.1) unstable; urgency=low * Adopted for the time being. * New upstream version (not yet available from the FTP sites), closes #81681, #86500, #43166, #38071, #44018 * Fixed reboot-on-upgrade problem, closes: #79556, #79287 -- Michael Meskes Sun, 25 Mar 2001 11:08:53 +0200 watchdog (5.1-2) stable unstable; urgency=low * Uploaded to stable, adds --noscripts to debhelper invocation, closes: #53298, #61939 (grave). -- Johnie Ingram Mon, 11 Dec 2000 11:59:13 -0800 watchdog (5.1-1) frozen unstable; urgency=low * Added --noscripts to debhelper invocation, closes: #53298, #61939 (grave). * Put #DEBHELPER# tag in so usr/doc kludge works. * Previous NMU fixed /sbin/MAKEDEV problem, closes: #55683. * Postinst remembers configuration on upgrade, closes: #36298. -- Johnie Ingram Fri, 8 Dec 2000 14:26:56 -0800 watchdog (5.1-0.3) frozen unstable; urgency=low * Non-maintainer upload * Lets upload the rc-bug fix to frozen as well. geez. -- Wichert Akkerman Tue, 22 Feb 2000 14:45:12 +0100 watchdog (5.1-0.2) unstable; urgency=low * Non-maintainer upload * Use /sbin/MAKEDEV, Closes: Bug#55683 -- Wichert Akkerman Sun, 20 Feb 2000 18:39:55 +0100 watchdog (5.1-0.1) unstable; urgency=low * NMU to make sure new upstrem version makes it into potato. Sometimes 5.0 reboots because of a bug in watchdog. -- Michael Meskes Tue, 11 Jan 2000 11:29:13 +0100 watchdog (5.0-1) unstable; urgency=low * New upstrem version, fixing unexpected shutdowns, closes: #46082. -- Johnie Ingram Fri, 17 Dec 1999 19:01:15 -0600 watchdog (4.5-2) unstable; urgency=low * Updated to Standards-Version: 3.0.1.0. * Increased general level of debhelperness. * Bugs that should have been closed months ago: * Realtime mode now defaults to yes upstream, closes: #36521. * Return value of repair function is int upstream, closes: #34895. * #include is now used, closes: #34908. -- Johnie Ingram Sat, 18 Sep 1999 00:45:15 -0500 watchdog (4.5-1) unstable; urgency=low * New upstream version. * Corrected location of watchdog in test -f, closes: #36884. -- Johnie Ingram Thu, 29 Apr 1999 14:24:18 -0400 watchdog (4.4-2) unstable; urgency=low * Included patch from Bart Warmerdam for glibc 2.1, closes: #35536. -- Johnie Ingram Sun, 4 Apr 1999 16:33:04 -0400 watchdog (4.4-1) unstable; urgency=low * New upstream version, closes: #34507. * Buildable on systems without watchdog already installed, closes: #33366. * No longer creates /man directory, closes: #33387. -- Johnie Ingram Tue, 23 Mar 1999 14:43:03 -0500 watchdog (4.3-2) frozen unstable; urgency=low * Uploaded for frozen, closes: #33201 (important), also closes: #28281, #32398, #28153. * Architectue-specific dependencies removed in clean, closes: #32783. -- Johnie Ingram Thu, 11 Feb 1999 11:38:58 -0500 watchdog (4.3-1) unstable; urgency=low * New upstream version. * Zombie feature is now documented, closes: #28281, #32398. -- Johnie Ingram Thu, 4 Feb 1999 14:36:11 -0500 watchdog (4.2-1) unstable; urgency=low * New upstream version, closes: #28153 (watchdog.conf not being read). -- Johnie Ingram Sun, 31 Jan 1999 15:20:41 -0500 watchdog (4.0-6) unstable; urgency=low * Tweaked logging info. -- Johnie Ingram Wed, 30 Dec 1998 16:06:06 -0500 watchdog (4.0-5) frozen unstable; urgency=low * Uploaded to frozen the fix from 4.0-4 (post-install script now uses "misc" to create the devices /dev/temperature and /dev/watchdog if missing (#30950)) on suggestion of Wichert Akkerman. -- Johnie Ingram Mon, 21 Dec 1998 19:14:10 -0500 watchdog (4.0-4) unstable; urgency=low * Post-install script now uses "misc" to create the devices /dev/temperature and /dev/watchdog if missing (#30950). -- Johnie Ingram Mon, 21 Dec 1998 13:02:14 -0500 watchdog (4.0-3) unstable; urgency=low * Added an include fix from Ben Collins to fix sparc compilation. -- Johnie Ingram Sat, 19 Dec 1998 21:09:41 -0500 watchdog (4.0-2) unstable; urgency=low * Corrected coment in /etc/init.d/watchdog (#30896). * Patched to compile on 2.1.131. * Bugs fixed in release 4.0-1: #19763. -- Johnie Ingram Sat, 19 Dec 1998 19:32:47 -0500 watchdog (4.0-1) unstable; urgency=low * New upstream version. * Merged changes from non-maintainer release by Roman Hodek (#23444, fixing #19763). * Switched from debmake to debhelper packaging technology. * Updated to Standards-Version 2.4.1.4. -- Johnie Ingram Tue, 13 Oct 1998 15:00:52 -0400 watchdog (3.3-1.1) frozen unstable; urgency=medium * Non-maintainer release * Fix typo in /etc/init.d/watchdog ($run_watchdog instead of $run_cucipop) Fixes: #19763 * Make it compile with current libc6-dev (2.0.7pre*) again. For this an additional #undef _LINUX_TYPES_H is needed in mount/nfsmount.c. Fixes: #23444 -- Roman Hodek Tue, 23 Jun 1998 11:37:54 +0200 watchdog (3.3-1) unstable; urgency=low * New upstream version (#17984). -- Johnie Ingram Mon, 9 Feb 1998 09:51:06 -0500 watchdog (3.2-1) unstable; urgency=low * New upstream version. * Added restart and force-reload targets to init.d. * Included the example scripts for custom system monitoring. * Mofified update-rc.d parameters so watchdog is the last to stop. * Greater compliance with the standard for console messages. * Updated to Standards-Version 2.4.0.0. -- Johnie Ingram Sat, 7 Feb 1998 10:42:53 -0500 watchdog (3.1-1) unstable; urgency=low * New upstream version. -- Johnie Ingram Tue, 28 Oct 1997 17:36:20 -0500 watchdog (3.0-5) unstable; urgency=low * Protected configuration prompting with a conditional so it isn't used when dpkg is trying to abort (#12574). -- Johnie Ingram Tue, 9 Sep 1997 23:07:46 -0400 watchdog (3.0-4) unstable; urgency=low * Patched to build on sparc architecture, in the hopes that SparcLinux will one day support it. -- Johnie Ingram Sat, 30 Aug 1997 23:56:43 -0400 watchdog (3.0-3) unstable; urgency=low * Fixed /tmp/watchdog.$$ security hole in installation script (#11795). * Updated to Standards-Version 2.2.0.0. * Switched to pristine upstream tar archive. -- Johnie Ingram Sat, 9 Aug 1997 13:44:14 -0400 watchdog (3.0-2) unstable; urgency=low * Added code to create /dev/temperature during configuration. * Now uses the MAKEDEV program to generate the devices. * Corrected three sentence spacing errors in full package description. -- Johnie Ingram Sun, 13 Jul 1997 01:34:52 -0400 watchdog (3.0-1) unstable; urgency=low * New upstream version. * Compiled against libc6. -- Johnie Ingram Fri, 11 Jul 1997 13:38:56 -0400 watchdog (2.1-2) unstable; urgency=low * Init script and postinst tweaked to comply with the Standard for Console Messages. * Added file checksums (debmake 3.2.2). -- Johnie Ingram Sat, 8 Mar 1997 09:52:27 -0500 watchdog (2.1-1) unstable; urgency=low * New maintainer. * New upstream version: can now do an orderly restart if the system load starts climbing out of reach. * Updated to Standards-Version 2.1.2.2 with debmake 3.1.6. * Changed sequence code so watchdog starts early in the boot process. * Removed automatic kill of watchdog process so kernels compiled with CONFIG_WATCHDOG_NOWAYOUT won't reboot. -- Johnie Ingram Sun, 16 Feb 1997 19:21:29 -0500 watchdog (2.0-0) * New upstream version * Fixed debian.rules file to be architecture independent -- Michael Meskes Thu May 30 13:03:27 MET DST 1996 watchdog (1.2-0) * New upstream version * Fixed some minor bugs in Debian files -- Michael Meskes Thu May 23 14:21:27 MET DST 1996 watchdog (1.1-3) * Fixed debian.rules to include revision field -- Michael Meskes Thu Mar 7 14:46:38 MET 1996 watchdog (1.1-2) * Corrected prerm script * Added run_watchdog variable to /etc/init.d/watchdog * Postinst script now can start watchdog -- Michael Meskes Wed Mar 6 13:47:14 MET 1996 watchdog (1.1-1) * Added /etc/init.d/watchdog to debian.conffiles -- Michael Meskes Wed Mar 6 12:03:29 MET 1996 watchdog (1.1-0) * Updated to new upstream version -- Michael Meskes Tue Mar 5 09:10:28 MET 1996 watchdog (1.0-1) * Added postrm file -- Michael Meskes Sat Mar 2 11:23:20 MET 1996 watchdog-5.13/debian/preinst0000644000175000017500000000073412102721740015661 0ustar michaelmichael#!/bin/sh set -e if [ -f /var/lib/dpkg/info/watchdog.prerm ]; then # fix that old nasty reboot-on-upgrade bug if [ `grep "/etc/init.d/watchdog stop" /var/lib/dpkg/info/watchdog.prerm >/dev/null` ] then sed -e 's%/etc/init.d/watchdog stop%# do not stop watchdog here /etc/init.d/watchdog stop%' < /var/lib/dpkg/info/watchdog.prerm > /var/lib/dpkg/info/watchdog.prerm.new && mv /var/lib/dpkg/info/watchdog.prerm.new /var/lib/dpkg/info/watchdog.prerm fi fi #DEBHELPER# watchdog-5.13/debian/README.debian0000644000175000017500000000117712102721740016355 0ustar michaelmichaelThis is the Debian GNU/Linux prepackaged version of watchdog. This package was put together by Michael Meskes using the example driver given in the kernel. further Information: * see /usr/src/linux/Documentation/watchdog.txt Before you can use a kernel watchdog driver you have to make sure that the corresponding module is loaded. You can do that with "modprobe "or with adding the to the file "/etc/modules" to make sure it is always loaded during system startup. The software watchdog driver is called "softdog". Michael Meskes Mo Apr 17 15:05:54 CEST 2006 watchdog-5.13/debian/copyright0000644000175000017500000000200612102721740016177 0ustar michaelmichaelThis is the Debian GNU/Linux prepackaged version of watchdog. Watchdog was written by Michael Meskes . Copying: Copyright (C) 1996-2012 Michael Meskes WATCHDOG is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. WATCHDOG is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. On Debian GNU/Linux systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL'. * Michael Meskes Wed Jan 15 11:36:42 +0100 1997 Modifications for Debian are copyright (C) 1997-2012 Michael Meskes, (C) 1997-2000 Johnie Ingram, and also released under the terms of the GPL as stated above. watchdog-5.13/debian/config0000644000175000017500000000222312102721740015435 0ustar michaelmichael#!/bin/sh set -e . /usr/share/debconf/confmodule db_capb backup parse_default() { case `sed -n 's/^run_watchdog=//p' "$@"` in 0) db_set watchdog/run false;; 1) db_set watchdog/run true;; *) return 1;; esac db_set watchdog/module `sed -n 's/^watchdog_module="\(.*\)"/\1/p' "$@"` } if dpkg --compare-versions "$2" le-nl 5.2.4-4 then # Upgrade quietly from pre-debconf days (<= 5.2.4-4). if parse_default /etc/init.d/watchdog; then db_fset watchdog/run seen true db_fset watchdog/module seen true fi elif [ -f /etc/default/watchdog ] then # Load previous value (may have been changed manually). parse_default /etc/default/watchdog || true fi db_input medium watchdog/module || true db_go # Use a state machine to allow jumping back. state=1 while true do case $state in 1) db_input medium watchdog/run || true ;; 2) db_get watchdog/run [ "$RET" = false ] || db_input medium watchdog/restart || true ;; *) break ;; esac if db_go then state=$(($state + 1)) else state=$(($state - 1)) fi done # Check if the user backed up from the first question. [ $state -gt 0 ] || exit 10 watchdog-5.13/debian/postrm0000644000175000017500000000051312102721740015514 0ustar michaelmichael#!/bin/sh set -e # Remove generated default file. if [ "$1" = "purge" ]; then rm -f /etc/default/watchdog fi # Not automatically added by dh_installinit (--noscripts) if [ "$1" = "purge" ] ; then update-rc.d watchdog remove >/dev/null update-rc.d wd_keepalive remove >/dev/null fi # End manually added section #DEBHELPER# watchdog-5.13/debian/init0000644000175000017500000000537412102721740015145 0ustar michaelmichael#!/bin/sh #/etc/init.d/watchdog: start watchdog daemon. ### BEGIN INIT INFO # Provides: watchdog # Short-Description: Start software watchdog daemon # Required-Start: $all # Required-Stop: $all # Should-Start: # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 ### END INIT INFO PATH=/bin:/usr/bin:/sbin:/usr/sbin test -x /usr/sbin/watchdog || exit 0 # For configuration of the init script use the file # /etc/default/watchdog, do not edit this init script. # Set run_watchdog to 1 to start watchdog or 0 to disable it. run_watchdog=0 # Specify additional watchdog options here (see manpage). watchdog_options="" # Specify module to load watchdog_module="none" [ -e /etc/default/watchdog ] && . /etc/default/watchdog NAME=watchdog KEEPALIVE_NAME=wd_keepalive DAEMON=/usr/sbin/watchdog KEEPALIVE_DAEMON=/usr/sbin/wd_keepalive STOP_RETRY_SCHEDULE='TERM/10/forever/KILL/1' # Get lsb functions . /lib/lsb/init-functions case "$1" in start) if [ $run_watchdog = 1 ] then # do we have to load a module? [ ${watchdog_module:-none} != "none" ] && /sbin/modprobe $watchdog_module # make sure that wd_keepalive is stopped log_begin_msg "Stopping watchdog keepalive daemon..." start-stop-daemon --stop --quiet --oknodo --retry $STOP_RETRY_SCHEDULE \ --pidfile /var/run/$KEEPALIVE_NAME.pid log_end_msg $? # Unconditionally start watchdog daemon because we want to run it even # if wd_keepalive wasn't running log_begin_msg "Starting watchdog daemon..." start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ --exec $DAEMON -- $watchdog_options log_end_msg $? fi ;; stop) if [ $run_watchdog = 1 ] then log_begin_msg "Stopping watchdog daemon..." start-stop-daemon --stop --quiet --retry $STOP_RETRY_SCHEDULE \ --pidfile /var/run/$NAME.pid log_end_msg $? # make sure that wd_keepalive is started log_begin_msg "Starting watchdog keepalive daemon..." start-stop-daemon --start --quiet --pidfile /var/run/$KEEPALIVE_NAME.pid \ --exec $KEEPALIVE_DAEMON -- $watchdog_options log_end_msg $? fi ;; restart) $0 force-reload ;; force-reload) if [ $run_watchdog = 0 ]; then exit 0; fi log_daemon_msg "Restarting ${NAME}" log_progress_msg "Stopping $NAME daemon..." start-stop-daemon --stop --pidfile /var/run/$NAME.pid --quiet \ --retry $STOP_RETRY_SCHEDULE || log_end_msg $? log_progress_msg "Starting $NAME daemon..." start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ --exec $DAEMON -- $watchdog_options log_end_msg $? ;; status) status_of_proc "$DAEMON" watchdog ;; *) echo "Usage: /etc/init.d/watchdog {start|stop|restart|force-reload|status}" exit 1 esac exit 0 watchdog-5.13/debian/compat0000644000175000017500000000000312102721740015445 0ustar michaelmichael5 watchdog-5.13/debian/templates0000644000175000017500000000223312102721740016167 0ustar michaelmichael# These templates have been reviewed by the debian-l10n-english # team # # If modifications/additions/rewording are needed, please ask # for an advice to debian-l10n-english@lists.debian.org # # Even minor modifications require translation updates and such # changes should be coordinated with translators and reviewers. Template: watchdog/run Type: boolean Default: true _Description: Start watchdog at boot time? Please specify whether watchdog should be started as part of the boot process. This can be changed later by editing /etc/default/watchdog. Template: watchdog/restart Type: boolean Default: false _Description: Restart watchdog on upgrades? If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which is not the default setting), restarting watchdog will cause a spurious reboot (the kernel will assume that the watchdog daemon crashed). Template: watchdog/module Type: string Default: none _Description: Watchdog module to preload: Please choose which watchdog module should be preloaded before starting watchdog. The 'softdog' module should be suited for all installations. Enter 'none' if you don't want the script to load a module. watchdog-5.13/debian/po/0002755000175000017500000000000012102721740014666 5ustar michaelmichaelwatchdog-5.13/debian/po/vi.po0000644000175000017500000000511112102721740015640 0ustar michaelmichael# Vietnamese translation for Watchdog. # Copyright © 2007 Free Software Foundation, Inc. # Clytie Siddall , 2007 # msgid "" msgstr "" "Project-Id-Version: watchdog\n" "Report-Msgid-Bugs-To: meskes@debian.org\n" "POT-Creation-Date: 2007-07-16 08:48+0200\n" "PO-Revision-Date: 2007-07-03 22:57+0930\n" "Last-Translator: Clytie Siddall \n" "Language-Team: Vietnamese \n" "Language: vi\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: LocFactoryEditor 1.6.4a5\n" #. Type: boolean #. Description #: ../templates:2001 msgid "Start watchdog at boot time?" msgstr "Khởi chạy watchdog vào lúc khởi động không?" #. Type: boolean #. Description #: ../templates:2001 msgid "" "Please specify whether watchdog should be started as part of the boot " "process. This can be changed later by editing /etc/default/watchdog." msgstr "" "Hãy xác định có nên khởi chạy watchdog trong tiến trình khởi động hay không. " "Vẫn còn có thể sá»­a đổi sau trong tập tin « /etc/default/watchdog »." #. Type: boolean #. Description #: ../templates:3001 msgid "Restart watchdog on upgrades?" msgstr "Khởi chạy lại watchdog khi nâng cấp không?" #. Type: boolean #. Description #: ../templates:3001 msgid "" "If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which " "is not the default setting), restarting watchdog will cause a spurious " "reboot (the kernel will assume that the watchdog daemon crashed)." msgstr "" "Nếu hạt nhân được cấu hình vá»›i tùy chá»n « CONFIG_WATCHDOG_NOWAYOUT » (mà " "không phải thiết lập mặc định), việc khởi chạy lại watchdog sẽ gây ra tiến " "trình khởi động lại giả (hạt nhân sẽ giả sá»­ trình ná»n watchdog đã sụp đổ)." #. Type: string #. Description #: ../templates:4001 msgid "Watchdog module to preload:" msgstr "Mô-Ä‘un watchdog cần nạp sẵn:" #. Type: string #. Description #: ../templates:4001 msgid "" "Please choose which watchdog module should be preloaded before starting " "watchdog. The 'softdog' module should be suited for all installations. Enter " "'none' if you don't want the script to load a module." msgstr "" "Hãy chá»n mô-Ä‘un watchdog nào cần nạp sẵn trước khi khởi chạy watchdog. Mô-" "Ä‘un « softdog » nên thích hợp vá»›i má»i bản cài đặt. Nhập vào « none » (không " "có) nếu bạn không muốn văn lệnh nạp mô-Ä‘un." watchdog-5.13/debian/po/POTFILES.in0000644000175000017500000000004412102721740016437 0ustar michaelmichael[type: gettext/rfc822deb] templates watchdog-5.13/debian/po/de.po0000644000175000017500000000477712102721740015633 0ustar michaelmichael# German translation of watchdog templates # Michael Meskes , 2007 # Helge Kreutzmann , 2007 # This file is distributed under the same license as the watchdog package. # msgid "" msgstr "" "Project-Id-Version: watchdog 5.3.1-3\n" "Report-Msgid-Bugs-To: meskes@debian.org\n" "POT-Creation-Date: 2007-07-16 08:48+0200\n" "PO-Revision-Date: 2007-07-14 12:58+0200\n" "Last-Translator: Helge Kreutzmann \n" "Language-Team: German \n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:2001 msgid "Start watchdog at boot time?" msgstr "Watchdog im Bootprozess starten?" #. Type: boolean #. Description #: ../templates:2001 msgid "" "Please specify whether watchdog should be started as part of the boot " "process. This can be changed later by editing /etc/default/watchdog." msgstr "" "Bitte geben Sie an, ob Watchdog als Teil des Bootprozesses gestartet werden " "soll. Dies kann später in der Datei /etc/default/watchdog geändert werden." #. Type: boolean #. Description #: ../templates:3001 msgid "Restart watchdog on upgrades?" msgstr "Watchdog nach einem Upgrade neu starten?" #. Type: boolean #. Description #: ../templates:3001 msgid "" "If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which " "is not the default setting), restarting watchdog will cause a spurious " "reboot (the kernel will assume that the watchdog daemon crashed)." msgstr "" "Falls der Kernel mit der Option CONFIG_WATCHDOG_NOWAYOUT konfiguriert wurde " "(was nicht die Standardeinstellung ist), führt der Neustart von Watchdog zum " "Neustart des Systems, weil der Kernel denkt, der Watchdog-Prozess wäre " "abgestürzt." #. Type: string #. Description #: ../templates:4001 msgid "Watchdog module to preload:" msgstr "Watchdog-Modul, das vorgeladen werden soll:" #. Type: string #. Description #: ../templates:4001 msgid "" "Please choose which watchdog module should be preloaded before starting " "watchdog. The 'softdog' module should be suited for all installations. Enter " "'none' if you don't want the script to load a module." msgstr "" "Bitte wählen Sie aus, welches Modul vor dem Start des Servers geladen werden " "soll. Das Modul »softdog« sollte für alle Installationen geeignet sein. " "Falls kein Modul geladen werden soll, bitte »none« eingeben." #~ msgid "Load watchdog module?" #~ msgstr "Watchdog-Modul laden?" watchdog-5.13/debian/po/ru.po0000644000175000017500000000563512102721740015663 0ustar michaelmichael# translation of templates-2.po to Russian # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Yuri Kozlov , 2007. msgid "" msgstr "" "Project-Id-Version: 5.3.1-3\n" "Report-Msgid-Bugs-To: meskes@debian.org\n" "POT-Creation-Date: 2007-07-16 08:48+0200\n" "PO-Revision-Date: 2007-07-08 19:33+0400\n" "Last-Translator: Yuri Kozlov \n" "Language-Team: Russian \n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.11.4\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); \n" #. Type: boolean #. Description #: ../templates:2001 msgid "Start watchdog at boot time?" msgstr "ЗапуÑкать watchdog при загрузке ÑиÑтемы?" #. Type: boolean #. Description #: ../templates:2001 msgid "" "Please specify whether watchdog should be started as part of the boot " "process. This can be changed later by editing /etc/default/watchdog." msgstr "" "Укажите, нужно ли запуÑкать watchdog в процеÑÑе загрузки ÑиÑтемы. Это можно " "изменить позже отредактировав файл /etc/default/watchdog." #. Type: boolean #. Description #: ../templates:3001 msgid "Restart watchdog on upgrades?" msgstr "ПерезапуÑтить watchdog при обновлении?" #. Type: boolean #. Description #: ../templates:3001 msgid "" "If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which " "is not the default setting), restarting watchdog will cause a spurious " "reboot (the kernel will assume that the watchdog daemon crashed)." msgstr "" "ЕÑли в Ñдре включена Ð¾Ð¿Ñ†Ð¸Ñ CONFIG_WATCHDOG_NOWAYOUT (что не ÑвлÑетÑÑ " "наÑтройкой по умолчанию), перезапуÑк watchdog приведёт к перезагрузке машины " "(Ñдро предположило, что демон watchdog завершилÑÑ Ð½ÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð¾)." #. Type: string #. Description #: ../templates:4001 msgid "Watchdog module to preload:" msgstr "Модули, загружаемые перед watchdog:" #. Type: string #. Description #: ../templates:4001 msgid "" "Please choose which watchdog module should be preloaded before starting " "watchdog. The 'softdog' module should be suited for all installations. Enter " "'none' if you don't want the script to load a module." msgstr "" "Укажите модули, которые нужно загрузить перед запуÑком watchdog. Модуль " "'softdog' обычно подходит Ð´Ð»Ñ Ð²Ñех Ñлучаев. Введите 'none', еÑли не хотите, " "чтобы Ñценарий загружал модуль." watchdog-5.13/debian/po/sv.po0000644000175000017500000000461712102721740015664 0ustar michaelmichael# translation of watchdog.po to swedish # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Martin Bagge , 2008. msgid "" msgstr "" "Project-Id-Version: watchdog\n" "Report-Msgid-Bugs-To: meskes@debian.org\n" "POT-Creation-Date: 2007-07-16 08:48+0200\n" "PO-Revision-Date: 2008-11-02 05:27+0100\n" "Last-Translator: Martin Bagge \n" "Language-Team: swedish \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.11.4\n" #. Type: boolean #. Description #: ../templates:2001 msgid "Start watchdog at boot time?" msgstr "Ska watchdog startas vid systemets uppstart?" #. Type: boolean #. Description #: ../templates:2001 msgid "" "Please specify whether watchdog should be started as part of the boot " "process. This can be changed later by editing /etc/default/watchdog." msgstr "" "Ange om watchdog ska startas vid systemets uppstart. Detta kan ändras senare " "genom att redigera /etc/default/watchdog." #. Type: boolean #. Description #: ../templates:3001 msgid "Restart watchdog on upgrades?" msgstr "Ska watchdog startas om vid uppgraderingar?" #. Type: boolean #. Description #: ../templates:3001 msgid "" "If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which " "is not the default setting), restarting watchdog will cause a spurious " "reboot (the kernel will assume that the watchdog daemon crashed)." msgstr "" "Om kärnan har alternativet CONFIG_WATCHDOG_NOWAYOUT aktiverat (vilket inte " "är standard) sÃ¥ kan en omstart av watchdog initera en oönskad omstart av " "systemet (eftersom kärnan i sÃ¥ fall kan anta att watchdog-tjönsten " "kraschade)." #. Type: string #. Description #: ../templates:4001 msgid "Watchdog module to preload:" msgstr "Watchdog-moduler som ska förladdas:" #. Type: string #. Description #: ../templates:4001 msgid "" "Please choose which watchdog module should be preloaded before starting " "watchdog. The 'softdog' module should be suited for all installations. Enter " "'none' if you don't want the script to load a module." msgstr "" "Ange vilka watchdog-moduler som ska förladdas innan watchdog startas. " "Modulen 'softdog' passar de flesta installationerna. Ange 'none' om du inte " "vill att skriptet ska ladda nÃ¥gon modul." watchdog-5.13/debian/po/fi.po0000644000175000017500000000450512102721740015626 0ustar michaelmichaelmsgid "" msgstr "" "Project-Id-Version: watchdog_5.4-2\n" "Report-Msgid-Bugs-To: meskes@debian.org\n" "POT-Creation-Date: 2007-07-16 08:48+0200\n" "PO-Revision-Date: 2007-12-22 16:12+0200\n" "Last-Translator: Esko Arajärvi \n" "Language-Team: Finnish \n" "Language: fi\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Finnish\n" "X-Poedit-Country: Finland\n" #. Type: boolean #. Description #: ../templates:2001 msgid "Start watchdog at boot time?" msgstr "Käynnistetäänkö watchdog käynnistettäessä tietokone?" #. Type: boolean #. Description #: ../templates:2001 msgid "" "Please specify whether watchdog should be started as part of the boot " "process. This can be changed later by editing /etc/default/watchdog." msgstr "" "Valitse tulisiko watchdog käynnistää osana tietokoneen käynnistystä. Tätä " "asetusta voidaan muuttaa myöhemmin muokkaamalla tiedostoa /etc/default/" "watchdog." #. Type: boolean #. Description #: ../templates:3001 msgid "Restart watchdog on upgrades?" msgstr "Käynnistetäänkö watchdog uudelleen päivitysten yhteydessä?" #. Type: boolean #. Description #: ../templates:3001 msgid "" "If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which " "is not the default setting), restarting watchdog will cause a spurious " "reboot (the kernel will assume that the watchdog daemon crashed)." msgstr "" "Jos ydin on käännetty asetuksen CONFIG_WATCHDOG_NOWAYOUT kanssa (mikä ei ole " "oletusasetus), watchdogin käynnistäminen uudelleen aiheuttaa tarpeettoman " "tietokoneen uudelleenkäynnistyksen (ydin olettaa watchdog-taustaohjelman " "kaatuneen)." #. Type: string #. Description #: ../templates:4001 msgid "Watchdog module to preload:" msgstr "Ennakkoon ladattava watchdog-moduuli:" #. Type: string #. Description #: ../templates:4001 msgid "" "Please choose which watchdog module should be preloaded before starting " "watchdog. The 'softdog' module should be suited for all installations. Enter " "'none' if you don't want the script to load a module." msgstr "" "Valitse mikä watchdog-moduuli tulisi ladata ennen watchdogin käynnistämistä. " "Moduulin â€softdog†tulisi sopia kaikkiin asennuksiin. Valitse â€noneâ€, jos et " "haluat ladata mitään moduulia." watchdog-5.13/debian/po/fr.po0000644000175000017500000000531312102721740015635 0ustar michaelmichael# Copyright (C) 2006 Frédéric ZULIAN , Christian Perrier , 2007. # This file is distributed under the same license as the watchdog package. # Relecteurs :Jean-Baka Domelevo-Entfellner , # Christian Perrier , Olivier Trichet # Thomas Huriaux et Frédéric Bothamy msgid "" msgstr "" "Project-Id-Version:\n" "Report-Msgid-Bugs-To: meskes@debian.org\n" "POT-Creation-Date: 2007-07-16 08:48+0200\n" "PO-Revision-Date: 2007-07-11 19:54+0200\n" "Last-Translator: Christian Perrier \n" "Language-Team: French \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.11.4\n" #. Type: boolean #. Description #: ../templates:2001 msgid "Start watchdog at boot time?" msgstr "Faut-il lancer watchdog au démarrage ?" #. Type: boolean #. Description #: ../templates:2001 msgid "" "Please specify whether watchdog should be started as part of the boot " "process. This can be changed later by editing /etc/default/watchdog." msgstr "" "Veuillez indiquer si vous désirez démarrer watchdog à l'amorçage de " "l'ordinateur. Vous pourrez changer ce comportement plus tard en modifiant le " "fichier /etc/default/watchdog." #. Type: boolean #. Description #: ../templates:3001 msgid "Restart watchdog on upgrades?" msgstr "Faut-il redémarrer watchdog lors des mises à jour ?" #. Type: boolean #. Description #: ../templates:3001 msgid "" "If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which " "is not the default setting), restarting watchdog will cause a spurious " "reboot (the kernel will assume that the watchdog daemon crashed)." msgstr "" "Si le noyau est configuré avec l'option CONFIG_WATCHDOG_NOWAYOUT (ce qui " "n'est pas l'option par défaut), le redémarrage de watchdog causera un " "réamorçage indésirable (le noyau pensera que le démon s'est brutalement " "arrêté)." #. Type: string #. Description #: ../templates:4001 msgid "Watchdog module to preload:" msgstr "Module watchdog à précharger :" #. Type: string #. Description #: ../templates:4001 msgid "" "Please choose which watchdog module should be preloaded before starting " "watchdog. The 'softdog' module should be suited for all installations. Enter " "'none' if you don't want the script to load a module." msgstr "" "Veuillez choisir le module watchdog qui doit être préchargé avant de lancer " "watchdog. Le module « softdog » est adapté à toutes les situations. Vous " "pouvez indiquer « none » si vous ne souhaitez pas précharger de module." watchdog-5.13/debian/po/ja.po0000644000175000017500000000556512102721740015631 0ustar michaelmichael# Japanese debconf templates translation for watchdog. # Copyright (C) 2007-2009 Michael Meskes # This file is distributed under the same license as the watchdog package. # Noritada Kobayashi , 2007. # Hideki Yamane (Debian-JP) , 2009. # msgid "" msgstr "" "Project-Id-Version: watchdog 5.4-10\n" "Report-Msgid-Bugs-To: meskes@debian.org\n" "POT-Creation-Date: 2007-07-16 08:48+0200\n" "PO-Revision-Date: 2009-01-05 22:44+0900\n" "Last-Translator: Hideki Yamane (Debian-JP) \n" "Language-Team: Japanese \n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:2001 msgid "Start watchdog at boot time?" msgstr "システム起動時㫠watchdog ã‚’é–‹å§‹ã—ã¾ã™ã‹?" #. Type: boolean #. Description #: ../templates:2001 msgid "" "Please specify whether watchdog should be started as part of the boot " "process. This can be changed later by editing /etc/default/watchdog." msgstr "" "起動プロセスã®ä¸€éƒ¨ã¨ã—㦠watchdog ã‚’èµ·å‹•ã•ã›ã‚‹ã‹ã©ã†ã‹æŒ‡å®šã—ã¦ãã ã•ã„。ã“ã®" "指定ã¯ã€/etc/default/watchdog を編集ã—ã¦å¾Œã‹ã‚‰å¤‰æ›´ã™ã‚‹ã“ã¨ã‚‚å¯èƒ½ã§ã™ã€‚" #. Type: boolean #. Description #: ../templates:3001 msgid "Restart watchdog on upgrades?" msgstr "アップグレード時㫠watchdog ã‚’å†èµ·å‹•ã—ã¾ã™ã‹?" #. Type: boolean #. Description #: ../templates:3001 msgid "" "If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which " "is not the default setting), restarting watchdog will cause a spurious " "reboot (the kernel will assume that the watchdog daemon crashed)." msgstr "" "カーãƒãƒ«ãŒ CONFIG_WATCHDOG_NOWAYOUT オプションを有効ã«ã—ã¦è¨­å®šã•れã¦ã„ã‚‹å ´åˆ " "(デフォルトã§ã¯è¨­å®šã•れã¦ã„ã¾ã›ã‚“)ã€watchdog ã‚’å†èµ·å‹•ã™ã‚‹ã¨ã‚·ã‚¹ãƒ†ãƒ ãŒèª¤ã£ã¦å†" "èµ·å‹•ã—ã¦ã—ã¾ã„ã¾ã™ (watchdog デーモンãŒã‚¯ãƒ©ãƒƒã‚·ãƒ¥ã—ãŸã¨ã‚«ãƒ¼ãƒãƒ«ãŒè€ƒãˆã‚‹ãŸã‚ã§" "ã™)。" #. Type: string #. Description #: ../templates:4001 msgid "Watchdog module to preload:" msgstr "å…ˆã«ãƒ­ãƒ¼ãƒ‰ã—ã¦ãŠã watchdog モジュール:" #. Type: string #. Description #: ../templates:4001 msgid "" "Please choose which watchdog module should be preloaded before starting " "watchdog. The 'softdog' module should be suited for all installations. Enter " "'none' if you don't want the script to load a module." msgstr "" "ã©ã® watchdog モジュールを watchdog ã®èµ·å‹•å‰ã«å…ˆã«ãƒ­ãƒ¼ãƒ‰ã—ã¦ãŠãå¿…è¦ãŒã‚ã‚‹ã‹" "ã‚’é¸æŠžã—ã¦ãã ã•ã„。「softdogã€ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã¯ã©ã®ã‚ˆã†ãªã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«çжæ³ã§ã‚‚å•題" "ã¯ã‚りã¾ã›ã‚“。モジュールをロードã™ã‚‹ã‚¹ã‚¯ãƒªãƒ—トãŒå¿…è¦ã§ç„¡ã„å ´åˆã¯ã€Œnoneã€ã¨å…¥" "力ã—ã¦ãã ã•ã„。" watchdog-5.13/debian/po/da.po0000644000175000017500000000460412102721740015614 0ustar michaelmichael# Danish translation watchdog. # Copyright (C) 2011 watchdog & nedenstÃ¥ende oversættere. # This file is distributed under the same license as the watchdog package. # Joe Hansen , 2011. # msgid "" msgstr "" "Project-Id-Version: watchdog\n" "Report-Msgid-Bugs-To: meskes@debian.org\n" "POT-Creation-Date: 2007-07-16 08:48+0200\n" "PO-Revision-Date: 2011-12-04 22:21+0100\n" "Last-Translator: Joe Hansen \n" "Language-Team: Danish \n" "Language: da\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:2001 msgid "Start watchdog at boot time?" msgstr "Igangsæt watchdog ved opstart?" #. Type: boolean #. Description #: ../templates:2001 msgid "" "Please specify whether watchdog should be started as part of the boot " "process. This can be changed later by editing /etc/default/watchdog." msgstr "" "Angiv venligst hvorvidt watchdog skal igangsættes som en del af " "opstartsprocessen. Dette kan ændres senere ved at redigere " "/etc/default/watchdog." #. Type: boolean #. Description #: ../templates:3001 msgid "Restart watchdog on upgrades?" msgstr "Genstart watchdog ved opgraderinger?" #. Type: boolean #. Description #: ../templates:3001 msgid "" "If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which " "is not the default setting), restarting watchdog will cause a spurious " "reboot (the kernel will assume that the watchdog daemon crashed)." msgstr "" "Hvis kernen er konfigureret med tilvalget CONFIG_WATCHDOG_NOWAYOUT (som " "ikke er standardindstillingen) vil genstart af watchdog medføre en falsk " "genstart (kernen vil antage at watchdog-dæmonen brød ned)." #. Type: string #. Description #: ../templates:4001 msgid "Watchdog module to preload:" msgstr "Watchdog-modul at præindlæse:" #. Type: string #. Description #: ../templates:4001 msgid "" "Please choose which watchdog module should be preloaded before starting " "watchdog. The 'softdog' module should be suited for all installations. Enter " "'none' if you don't want the script to load a module." msgstr "" "Vælg venligst hvilket watchdog-modul der skal præindlæses før start af " "watchdog. Modulet »softdog« bør være egnet for alle installationer. Indtast " "»none« (ingen) hvis du ikke ønsker, at skriptet skal indlæse et modul." watchdog-5.13/debian/po/es.po0000644000175000017500000000651212102721740015637 0ustar michaelmichael# watchdog translation to spanish # Copyright (C) 2008 Software in the Public Interest, SPI Inc. # This file is distributed under the same license as the watchdog package. # # Changes # - Initial translation # Carlos Eduardo Sotelo Pinto , 2008 # # Traductores, si no estan familiarizados con el formato PO, merece la # pena leer la documentación de gettext, especialmente las secciones # dedicadas a este formato, por ejemplo ejecutando # # info -n '(gettext)PO Files' # info -n '(gettext)Header Entry' # # - El proyecto de traducción de Debian al español # http://www.debian.org/intl/spanish/ # especialmente las notas y normas de traducción en # http://www.debian.org/intl/spanish/notas # # - La guía de traducción de po's de debconof # /usr/share/doc/po-debconf/README-trans # o # http://www.debian.org/intl/l10n/po-debconf/README-trans # # Si tiene dudas o consultas sobre esta traducción consulte con el último # traductor (campo Last-Translator) y ponga en copia a la lista de # traducción de Debian al español () # msgid "" msgstr "" "Project-Id-Version: watchdog 5.4-5\n" "Report-Msgid-Bugs-To: meskes@debian.org\n" "POT-Creation-Date: 2007-07-16 08:48+0200\n" "PO-Revision-Date: 2008-08-09 20:18-0500\n" "Last-Translator: Carlos Eduardo Sotelo Pinto \n" "Language-Team: Spanish \n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:2001 msgid "Start watchdog at boot time?" msgstr "¿Desea cargar «watchdog» al inicio del sistema?" #. Type: boolean #. Description #: ../templates:2001 msgid "" "Please specify whether watchdog should be started as part of the boot " "process. This can be changed later by editing /etc/default/watchdog." msgstr "" "Especifique si se debe iniciar watchdog como parte del proceso de carga del " "sistema. Puuede cambiar más adelante esto luego editando el archivo /etc/" "default/watchdog." #. Type: boolean #. Description #: ../templates:3001 msgid "Restart watchdog on upgrades?" msgstr "¿Desea reiniciar «watchdog» en las actualizaciones?" #. Type: boolean #. Description #: ../templates:3001 msgid "" "If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which " "is not the default setting), restarting watchdog will cause a spurious " "reboot (the kernel will assume that the watchdog daemon crashed)." msgstr "" "Si el kernel esta configurado con la opción CONFIG_WATCHDOG_NOWAYOUT (que no " "es la opción por omisión), reiniciar watchdog causará un reinicio momentáneo " "(el kernel asumirá que el demonio de watchdog ha colisionado.)" #. Type: string #. Description #: ../templates:4001 msgid "Watchdog module to preload:" msgstr "Módulo de watchdog a precargar:" #. Type: string #. Description #: ../templates:4001 msgid "" "Please choose which watchdog module should be preloaded before starting " "watchdog. The 'softdog' module should be suited for all installations. Enter " "'none' if you don't want the script to load a module." msgstr "" "Seleccione que módulo de watchdog se cargará antes de iniciar watchdog. El " "módulo «softdog» se adaptará a todas las instalaciones. Ingrese «none» si no " "desea el guión para cargar un módulo." watchdog-5.13/debian/po/gl.po0000644000175000017500000000451112102721740015627 0ustar michaelmichael# Galician translation of watchdog's debconf templates # This file is distributed under the same license as the watchdog package. # Jacobo Tarrio , 2007. # msgid "" msgstr "" "Project-Id-Version: watchdog\n" "Report-Msgid-Bugs-To: meskes@debian.org\n" "POT-Creation-Date: 2007-07-16 08:48+0200\n" "PO-Revision-Date: 2007-07-02 17:48+0200\n" "Last-Translator: Jacobo Tarrio \n" "Language-Team: Galician \n" "Language: gl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:2001 msgid "Start watchdog at boot time?" msgstr "¿Iniciar watchdog co ordenador?" #. Type: boolean #. Description #: ../templates:2001 msgid "" "Please specify whether watchdog should be started as part of the boot " "process. This can be changed later by editing /etc/default/watchdog." msgstr "" "Indique se quere que watchdog se inicie coma unha parte do proceso de inicio " "do sistema. Isto pódese cambiar máis tarde editando /etc/default/watchdog." #. Type: boolean #. Description #: ../templates:3001 msgid "Restart watchdog on upgrades?" msgstr "¿Reiniciar watchdog ao actualizalo?" #. Type: boolean #. Description #: ../templates:3001 msgid "" "If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which " "is not the default setting), restarting watchdog will cause a spurious " "reboot (the kernel will assume that the watchdog daemon crashed)." msgstr "" "Se o núcleo está configurado coa opción CONFIG_WATCHDOG_NOWAYOUT (que non é " "a opción por defecto), reiniciar watchdog ha facer que se reinicie o sistema " "(o núcleo ha supoñer que o servizo watchdog fallou)." #. Type: string #. Description #: ../templates:4001 msgid "Watchdog module to preload:" msgstr "Módulo de watchdog a precargar:" #. Type: string #. Description #: ../templates:4001 msgid "" "Please choose which watchdog module should be preloaded before starting " "watchdog. The 'softdog' module should be suited for all installations. Enter " "'none' if you don't want the script to load a module." msgstr "" "Indique que modulo de watchdog se debe precargar antes de iniciar watchdig. " "O módulo \"softdog\" é válido para tódalas instalacións. Introduza \"none\" " "se non quere que o script cargue ningún módulo." watchdog-5.13/debian/po/nl.po0000644000175000017500000000500612102721740015636 0ustar michaelmichael# Dutch translation of watchdog debconf templates. # Copyright (C) 2006-2012 THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the watchdog package. # Kurt De Bree , 2006 # Jeroen Schot , 2012. # msgid "" msgstr "" "Project-Id-Version: watchdog 5.11-1\n" "Report-Msgid-Bugs-To: meskes@debian.org\n" "POT-Creation-Date: 2007-07-16 08:48+0200\n" "PO-Revision-Date: 2012-01-27 10:40+0100\n" "Last-Translator: Jeroen Schot \n" "Language-Team: debian-l10n-dutch \n" "Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:2001 msgid "Start watchdog at boot time?" msgstr "watchdog starten tijdens opstarten van het systeem?" #. Type: boolean #. Description #: ../templates:2001 msgid "" "Please specify whether watchdog should be started as part of the boot " "process. This can be changed later by editing /etc/default/watchdog." msgstr "" "Gelieve aan te geven of watchdog gestart dient te worden tijdens het " "opstarten van het systeem. Dit kan later aangepast worden door /etc/default/" "watchdog te wijzigen." #. Type: boolean #. Description #: ../templates:3001 msgid "Restart watchdog on upgrades?" msgstr "watchdog herstarten bij opwaarderingen?" #. Type: boolean #. Description #: ../templates:3001 msgid "" "If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which " "is not the default setting), restarting watchdog will cause a spurious " "reboot (the kernel will assume that the watchdog daemon crashed)." msgstr "" "Indien uw kernel is geconfigureerd met de optie 'CONFIG_WATCHDOG_NOWAYOUT', " "zal het herstarten van watchdog ten onrechte een herstart van uw computer " "veroorzaken (de kernel zal aannemen dat de watchdog-achtergronddienst is " "vastgelopen)." #. Type: string #. Description #: ../templates:4001 msgid "Watchdog module to preload:" msgstr "Voor te laden watchdog-module:" #. Type: string #. Description #: ../templates:4001 msgid "" "Please choose which watchdog module should be preloaded before starting " "watchdog. The 'softdog' module should be suited for all installations. Enter " "'none' if you don't want the script to load a module." msgstr "" "Welke watchdog-module moeten worden geladen voordat watchdog wordt " "opgestart? De 'softdog'-module is geschikt voor de meeste installaties. Kies " "'none' als u wilt dat het script geen module laadt." watchdog-5.13/debian/po/templates.pot0000644000175000017500000000322012102721740017403 0ustar michaelmichael# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: meskes@debian.org\n" "POT-Creation-Date: 2007-07-16 08:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:2001 msgid "Start watchdog at boot time?" msgstr "" #. Type: boolean #. Description #: ../templates:2001 msgid "" "Please specify whether watchdog should be started as part of the boot " "process. This can be changed later by editing /etc/default/watchdog." msgstr "" #. Type: boolean #. Description #: ../templates:3001 msgid "Restart watchdog on upgrades?" msgstr "" #. Type: boolean #. Description #: ../templates:3001 msgid "" "If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which " "is not the default setting), restarting watchdog will cause a spurious " "reboot (the kernel will assume that the watchdog daemon crashed)." msgstr "" #. Type: string #. Description #: ../templates:4001 msgid "Watchdog module to preload:" msgstr "" #. Type: string #. Description #: ../templates:4001 msgid "" "Please choose which watchdog module should be preloaded before starting " "watchdog. The 'softdog' module should be suited for all installations. Enter " "'none' if you don't want the script to load a module." msgstr "" watchdog-5.13/debian/po/pt.po0000644000175000017500000000476212102721740015660 0ustar michaelmichael# Portuguese translation of watchdog # Copyright (C) 2006 THE watchdog'S COPYRIGHT HOLDER # This file is distributed under the same license as the watchdog package. # Rui Branco , 2006. # Miguel Figueiredo , 2007. # # msgid "" msgstr "" "Project-Id-Version: watchdog 5.2.5-2\n" "Report-Msgid-Bugs-To: meskes@debian.org\n" "POT-Creation-Date: 2007-07-16 08:48+0200\n" "PO-Revision-Date: 2007-07-15 20:54+0100\n" "Last-Translator: Miguel Figueiredo \n" "Language-Team: Portuguese \n" "Language: pt\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:2001 msgid "Start watchdog at boot time?" msgstr "Iniciar o watchdog durante o arranque?" #. Type: boolean #. Description #: ../templates:2001 msgid "" "Please specify whether watchdog should be started as part of the boot " "process. This can be changed later by editing /etc/default/watchdog." msgstr "" "Especifique se quer que o watchdog arranque com parte do processo de " "arranque. Pode no entanto alterar esta opção editando o ficheiro /etc/" "default/watchdog." #. Type: boolean #. Description #: ../templates:3001 msgid "Restart watchdog on upgrades?" msgstr "Reiniciar o watchdog após actualizações?" #. Type: boolean #. Description #: ../templates:3001 msgid "" "If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which " "is not the default setting), restarting watchdog will cause a spurious " "reboot (the kernel will assume that the watchdog daemon crashed)." msgstr "" "Se o kernel está configurado com a opção CONFIG_WATCHDOG_NOWAYOUT (que não " "está escolhido por omissão), reiniciar o watchdog irá causar uma " "reinicialização estranha (o kernel irá assumir que o daemon do watchdog " "bloqueou)." #. Type: string #. Description #: ../templates:4001 msgid "Watchdog module to preload:" msgstr "Módulo watchdog para pré-carregar:" #. Type: string #. Description #: ../templates:4001 msgid "" "Please choose which watchdog module should be preloaded before starting " "watchdog. The 'softdog' module should be suited for all installations. Enter " "'none' if you don't want the script to load a module." msgstr "" "Por favor escolha qual o módulo watchdog que deve ser pré-carregado antes de " "iniciar o watchdog. O módulo 'softdog' deve ser adequado para todas as " "instalações. Introduza 'none' se não quiser que o script carregue um módulo." watchdog-5.13/debian/po/cs.po0000644000175000017500000000464212102721740015637 0ustar michaelmichael# Czech translation of watchdog debconf messages # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the watchdog package. # Miroslav Kure , 2006, 2007. # msgid "" msgstr "" "Project-Id-Version: watchdog\n" "Report-Msgid-Bugs-To: meskes@debian.org\n" "POT-Creation-Date: 2007-07-16 08:48+0200\n" "PO-Revision-Date: 2007-07-07 21:31+0200\n" "Last-Translator: Miroslav Kure \n" "Language-Team: Czech \n" "Language: cs\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:2001 msgid "Start watchdog at boot time?" msgstr "Spustit watchdog pÅ™i zavádÄ›ní systému?" #. Type: boolean #. Description #: ../templates:2001 msgid "" "Please specify whether watchdog should be started as part of the boot " "process. This can be changed later by editing /etc/default/watchdog." msgstr "" "Vyberte si, zda se má watchdog spouÅ¡tÄ›t bÄ›hem zavádÄ›ní systému. Své " "rozhodnutí můžete pozdÄ›ji zmÄ›nit úpravou souboru /etc/default/watchdog." #. Type: boolean #. Description #: ../templates:3001 msgid "Restart watchdog on upgrades?" msgstr "Restartovat watchdog pÅ™i aktualizaci?" #. Type: boolean #. Description #: ../templates:3001 msgid "" "If the kernel is configured with the CONFIG_WATCHDOG_NOWAYOUT option (which " "is not the default setting), restarting watchdog will cause a spurious " "reboot (the kernel will assume that the watchdog daemon crashed)." msgstr "" "Pokud je jádro sestaveno s parametrem CONFIG_WATCHDOG_NOWAYOUT (což není " "výchozí nastavení), restart watchdogu způsobí zbyteÄný restart poÄítaÄe, " "protože si jádro Bude myslet, že daemon watchdogu havaroval." #. Type: string #. Description #: ../templates:4001 msgid "Watchdog module to preload:" msgstr "Modul watchdogu, který se má nahrát:" #. Type: string #. Description #: ../templates:4001 msgid "" "Please choose which watchdog module should be preloaded before starting " "watchdog. The 'softdog' module should be suited for all installations. Enter " "'none' if you don't want the script to load a module." msgstr "" "Vyberte prosím, který modul watchdogu se má nahrát jeÅ¡tÄ› pÅ™ed spuÅ¡tÄ›ním " "watchdogu. Modul „softdog“ je vhodný pro vÅ¡echny instalace. Nechcete-li, aby " "skript nahrál modul, zadejte „none“." watchdog-5.13/debian/watch0000644000175000017500000000007012102721740015274 0ustar michaelmichaelversion=3 http://sf.net/watchdog watchdog-(.*)\.tar\.gz watchdog-5.13/debian/source/0002755000175000017500000000000012102721740015550 5ustar michaelmichaelwatchdog-5.13/debian/source/format0000644000175000017500000000000412102721740016753 0ustar michaelmichael1.0 watchdog-5.13/debian/postinst0000644000175000017500000000600712102721740016057 0ustar michaelmichael#!/bin/sh set -e if [ "$1" = configure ] then . /usr/share/debconf/confmodule if [ -x "`which MAKEDEV`" ]; then # do we have to create the device? if [ ! -c /dev/watchdog ] then (cd /dev; MAKEDEV misc || true) fi # do we have to create the temperature device? if [ ! -c /dev/temperature ] then (cd /dev; MAKEDEV misc || true) fi fi # one version set some incorrect permissions if [ -k /var/log/watchdog ] then chmod 750 /var/log/watchdog fi default_format="\ # Start watchdog at boot time? 0 or 1 run_watchdog=%s # Load module before starting watchdog watchdog_module=%s # Specify additional watchdog options here (see manpage). " # Determine whether to start watchdog at boot time. db_get watchdog/run case $RET in false) run_watchdog=0;; *) run_watchdog=1;; esac db_get watchdog/module module=$RET # Create an up-to-date copy of the default file. { # If it already exists, preserve everything except our comment # and $run_watchdog. if [ -f /etc/default/watchdog ] then printf "$default_format" '.*' '.*' \ | grep -vxf - /etc/default/watchdog \ | grep -v watchdog_options || true fi # Append our comment and the current value. printf "$default_format" "$run_watchdog" "\"$module\"" # And finally preserve the watchdog_options setting. if [ -f /etc/default/watchdog ] then grep watchdog_options /etc/default/watchdog || true fi } > /etc/default/watchdog.dpkg-new # Replace the original atomically. mv /etc/default/watchdog.dpkg-new /etc/default/watchdog # Restart if so configured. db_get watchdog/restart if [ "$RET" = true ] then if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then invoke-rc.d watchdog restart else /etc/init.d/watchdog stop > /dev/null 2>&1 /etc/init.d/watchdog start fi fi # # stop debconf # db_stop fi # # remove old links # if dpkg --compare-versions "$2" lt 5.2.4-3 then if [ -L /etc/rc2.d/S10watchdog -a \ -L /etc/rc3.d/S10watchdog -a \ -L /etc/rc4.d/S10watchdog -a \ -L /etc/rc5.d/S10watchdog -a \ -L /etc/rc0.d/K80watchdog -a \ -L /etc/rc1.d/K80watchdog -a \ -L /etc/rc6.d/K80watchdog ]; then update-rc.d -f watchdog remove fi fi if dpkg --compare-versions "$2" lt 5.4-11 then if [ -L /etc/rc2.d/S09wd_keepalive -a \ -L /etc/rc3.d/S09wd_keepalive -a \ -L /etc/rc4.d/S09wd_keepalive -a \ -L /etc/rc5.d/S09wd_keepalive -a \ -L /etc/rc0.d/K91wd_keepalive -a \ -L /etc/rc1.d/K91wd_keepalive -a \ -L /etc/rc6.d/K91wd_keepalive ]; then update-rc.d -f wd_keepalive remove fi fi if dpkg --compare-versions "$2" lt 5.6-5 then if [ -f /var/lib/insserv/using-insserv ]; then rm -f /etc/rc0.d/K*wd_keepalive rm -f /etc/rc1.d/K*wd_keepalive rm -f /etc/rc6.d/K*wd_keepalive fi fi # Not automatically added by dh_installinit (--noscripts) update-rc.d watchdog defaults 89 11 >/dev/null update-rc.d wd_keepalive start 09 2 3 4 5 . >/dev/null #DEBHELPER# watchdog-5.13/debian/rules0000755000175000017500000000331212102721740015325 0ustar michaelmichael#!/usr/bin/make -f SHELL = /bin/bash CFLAGS = $(shell dpkg-buildflags --get CFLAGS) CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) build: build-arch build-indep build-arch: build-stamp build-indep: build-stamp build-stamp: Makefile $(checkdir) $(MAKE) touch build Makefile: CFLAGS="${CFLAGS}" CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}" ./configure --prefix=/usr \ --with-configfile=/etc/watchdog.conf clean: Makefile $(checkdir) [ ! -f Makefile ] || $(MAKE) distclean debconf-updatepo dh_clean rm -f $(find . -name "*.P") rm -rf build-stamp *~ debian/*~ configure-stamp binary-indep: checkroot build $(checkdir) # There are no architecture-independent files to be uploaded # generated by this package. If there were any they would be # made here. binary-arch: checkroot build $(checkdir) dh_clean -k dh_installdirs dh_installdocs README* watchdog.lsm IAFA-PACKAGE \ include/watch_err.h dh_installexamples examples/* dh_installchangelogs ChangeLog dh_installdebconf $(MAKE) install prefix=$$(pwd)/debian/watchdog/usr \ CONFIG_FILENAME=$$(pwd)/debian/watchdog/etc/watchdog.conf cp -p watchdog.conf debian/watchdog/etc/watchdog.conf dh_installinit --noscripts dh_installinit --noscripts --name=wd_keepalive dh_strip dh_compress dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_fixperms dpkg --build debian/watchdog .. define checkdir test -f debian/rules endef # Below here is fairly generic really binary: binary-indep binary-arch source diff: @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false checkroot: $(checkdir) test root = "`whoami`" .PHONY: binary binary-arch binary-indep clean checkroot watchdog-5.13/ChangeLog0000644000175000017500000003375212102721740014610 0ustar michaelmichaelFri Feb 23 13:26:14 MET 1996 - Watchdog 1.0 released. Tue Mar 5 09:11:34 MET 1996 - Fixed two bugs in watchdog.c reported (and patched) by Johannes Kroeger : Watchdog now tries to open /dev/watchdog before tugging its process ID away. - Released version 1.1 Thu May 23 14:20:59 MET DST 1996 - Added process table watch routine. - Process filemode before sleeping. - Released version 1.2 Thu May 30 13:00:44 MET DST 1996 - Watchdog now correctly shuts down the system if the process table is full Mon Jul 29 13:51:42 MET DST 1996 - Finally watchdog is able to shut down the system even if the process table remains full after killing all processes. - Released version 2.0 (this was a major overhaul) Fri Jan 31 13:39:43 MET 1997 - Disconnect deamon from console. - Close file descriptors 0, 1, 2 when compiled with USE_SYSLOG. - Cleaned up source code. - Write the softdog device between each check, since the increasing number of checks might cause problems otherise. - Test the system load average and reboot if it is too high. Thu Apr 3 11:14:07 MET DST 1997 - Fixed that nasty bug that caused the root partion to stay mounted during a soft reboot. - Fixed another bug that caused watchdog to kill itself during reboot before all the work was done. Wed Jun 4 20:16:23 CEST 1997 - Finally soft reboot works as advertised. - Tested NFS access in filemode. Fri Jun 6 22:55:16 CEST 1997 - Added ping mode: soft reboot is initiated if a given network/host does not answer. Wen Jun 11 09:25:36 CEST 1997 - Added file table check: reboot if file table overflow occurs. Mon Jun 16 12:10:55 CEST 1997 - Upgraded to mount 2.6g. - Compile and link with glibc. - Implemented call to user provides test binary. Tue Jun 17 13:35:15 CEST 1997 - Added examples for test scripts. Wed Jun 18 15:51:10 CEST 1997 - Default sleep interval now configurable via Makefile. Fri Jun 20 10:51:56 CEST 1997 - Added call to repair script. Tue Jun 24 15:31:03 CEST 1997 - Repair script now calls logger to create a syslog entry. Thu Jun 26 21:40:37 CEST 1997 - Fixed call of repair script. - Let watchdog sleep five seconds before closelog() to make sure everything is written to the logs. Mon Jun 30 13:48:08 CEST 1997 - Make sure files are only opened once. - Work even if there is no /dev/watchdog. Mon Jun 30 21:07:39 CEST 1997 - Implemented temperature test. - Added double fork() to inherit rights from init. Now watchdog will unmount all partitions correctly regardless what your current working directory is when you start it. My thanks go to Peter Tobias for pointing me into the right direction. Wed Jul 2 11:00:49 CEST 1997 - Halt the system if temperature is too high, but send mail to the sysadmin prior doing that. Thu Jul 3 16:22:47 CEST 1997 - Include fully quantified hostname in Subject: line for mail. Fri Jul 11 10:38:39 CEST 1997 - Released version 3.0. Fri Jul 11 10:49:31 CEST 1997 - Fixed small typo in Makefile. Wed Sep 3 12:33:32 CEST 1997 - Corrected temperature reading code. - Include patch to mount.c for sparcs. - Write warning to log file when temperature start climbing to high. Sun Oct 19 11:22:26 CEST 1997 - No more warnings about unused variables if compiled without USE_SYSLOG. - Some more glibc adjustments for glibc 2.0.5. Fri Oct 24 11:40:07 CEST 1997 - Released version 3.1. Fri Nov 28 11:10:26 CET 1997 - Changed handling of return value of repair script to take care of negative return value. - Stop init before going down. Fri Nov 28 11:26:50 CET 1997 - Released version 3.2. Tue Dec 2 10:02:43 CET 1997 - Stupid me! Somehow I managed to release my test version without removing the call to halt the system regardless of the temperature that I used for my last test. I'm sorry. Hope it didn't cause too much problems. - Released version 3.3. Tue Dez 30 11:35:03 CET 1997 - Reorganized watchdog source files. - Implemented no-action option. Fri Jan 2 16:30:56 CET 1998 - Made watchdog a real-time application. - To enable this I had to change the process-table check code so no hang can occur there. Thu Sep 10 17:22:32 CEST 1998 - Updated mount code to version 2.8 something. Thanks to the one who send me the patches. Unfortunately I lost his email-address. Fri Sep 11 16:22:28 CEST 1998 - Updated test binary stuff to make sure it won't reboot the system if binary runs for too long. Tue Sep 15 13:28:35 CEST 1998 - Allow multiple filenames resp. ip-addresses. Fri Sep 18 16:10:56 CEST 1998 - Move all options with arguments to watchdog.conf and added long options for the remaining ones. - Added option -c to add config file name. Mon Sep 21 13:16:15 CEST 1998 - Output file modification time in verbose mode. - Added check for constant changing of a file. Mon Sep 21 15:23:54 CEST 1998 - Updated man pages. Thu Oct 15 18:21:57 CEST 1998 - Released version 4.0. Fri Oct 16 14:22:15 CEST 1998 - Received patches for RedHat. Argh, should have waited with releasing 4.0. - Some more modifications to repair.sh. Wed Okt 21 13:33:21 CEST 1998 - Moved configuration to config.h. Tue Okt 27 20:49:23 MEZ 1998 - Released 4.1. Mon Nov 23 09:33:20 MEZ 1998 - Changed union name in extern.h from options to wdog_options to be able to compile on libc5 systems. Tue Nov 24 14:32:41 MEZ 1998 - Added patches by Sascha Schumann for libc5 compatibility. Thu Jan 14 13:43:53 CET 1999 - Fixed the bug in read_config that caused the max-load-15 line to be read as max-load-1 = 5. Thu Jan 14 14:17:35 CET 1999 - And fixed another silly bug that caused ping mode to not work anymore. Wed Jan 20 21:03:30 CET 1999 - Switched to GNU autoconf, work done by Sascha Schumann . Fri Jan 22 17:30:41 CET 1999 - Restructured the configuration management. No need to specify compile time defaults for parameters changeable via /etc/watchdog.conf. Sat Jan 30 08:58:47 CET 1999 - Released 4.2. Mon Feb 1 18:16:04 CET 1999 - Fixed autoconf bug so CONFIG_FILENAME default is correct. - Added info about zombie process to docs. Fri Feb 5 07:33:47 CET 1999 - Removed remount call so the one reported hang cannot happen anymore. This call wasn't really needed anyway. - Released 4.3. Thu Feb 18 08:02:01 CET 1999 - Fixed typo in manpage. Fri Feb 19 07:49:51 CET 1999 - Send mail even in case of reboot. - Close log only after the last write. - Fixed getopt_long handling. Fri Feb 19 21:33:26 CET 1999 - Create directory before installing CONFIG_FILENAME. Sun Feb 28 13:05:11 CET 1999 - Released 4.4. Sat Apr 10 14:30:59 CEST 1999 - Added RedHat patches by Marc Merlin. - Made ret an int variable. - Include stdio.h in src/umount.c. - Released 4.5. Mon May 3 19:49:45 CEST 1999 - Corrected INSTALL file to explicitely state that the .spec file is not distributed together with watchdog. Fri Sep 3 11:21:11 CEST 1999 - Change compile time maxload defaults to 24/18/12. Fre Sep 3 14:23:58 CEST 1999 - Add test for free memory. Mon Sep 6 07:40:07 CEST 1999 - Added simple test script that tests whether /bin/sh can be started. - Made load average check disabled by default. Don Sep 9 19:56:06 CEST 1999 - Added passive network test and server pinging test. Sun Dec 19 13:18:35 CET 1999 - Fixed big in test_binary.c that caused not existing errors to be logged. - Add red label in watchdog.8 to not use broadcast ping without explicit permission. Mon Dec 20 14:54:58 CET 1999 - Released 5.0. Mon Dec 27 17:07:51 CET 1999 - Fixed silly calculation bug in memory check. - Disable memory check for default setup. - Released 5.1. Sat May 6 17:01:37 MEST 2000 - added /etc/sysconfig/watchdog to the rc.watchdog.redhat script - added some ifdefs to include/mount_constants.h for compilation on RedHat 6.2 without some warnings about redefined symbols - added "logtick" option to the watchdog binary (I wanted to do this for a very long time -- hps) Mon Jul 24 16:49:11 PDT 2000 - added patch by Hisaaki Shibata to add number of times a ping is tried to config file Son Mar 25 14:18:45 CEST 2001 - Made watchdog work with kernel 2.4. - Send a more verbose email. - Made watchdog compile with latest libc6. Thu May 10 14:19:57 CEST 2001 - Finally released 5.2. Thu May 10 15:11:45 CEST 2001 - Started to integrate stuff written by Marcel Jansen . - Decided to move to version 6.0. Fre Jan 3 14:47:46 CET 2003 - Added patch by Patrick Higgins to catch test programs running for too long and react to that fact. - Fixed pidfile check. A missing file usually means the server exited and thus watchdog needs to take action. - Finally really started adding Marcel's patches: * Redirection of stdout/stderr for test and repair binary. * Write timestamps to heartbeat file. * Add wd_keepalive program that uses the same config file, but only updates the watchdog device. - Fixed shutdown with missing sendmail program. - Added two bug fixes by Stephane List . - Added patch by Jos Vos for a "write-magic" config parameter. - Use unsigned ints for free memory check. Mo Apr 17 14:35:29 CEST 2006 - Fixed some bugs: * unsigned int is too small for free memory check * Man page still referencing options that are no longer available. - Logtick option is used for verbose output in all tests We Jun 21 15:42:28 CEST 2006 - Added patch by Thomas Glanzmann for correct parsing of ping-count option. - Added a patch by James Harper to fix that nasty ping problem. Thanks a lot. - Applied some bug fix patches by Christoph Probst . - Changed interface check to use unsigned long. - Some more small fixes. Mo Jul 31 11:13:04 CEST 2006 - Added patch by Richard Hansen to fix intervals being 50% too long. Mon Feb 12 10:45:21 CET 2007 - Hopefully fixed outstanding problems with wd_keepalive. - Added some documentation about return values of the test binary. - Released 5.3. Wed Feb 21 17:33:30 CET 2007 - Removed superfluous quotation from wd_keepalive.c. - Added sourceforge as new primary archive site. Thu Feb 22 11:48:57 CET 2007 - Released 5.3.1. Thu, 26 Apr 2007 15:08:07 +0200 - Added "another-chance" repair script written by Erik Rossen . Tue, 29 May 2007 16:34:34 +0200 - Applied some changes to RedHat init script. - Added sysconf script for RedHat. Fri, 17 Aug 2007 11:15:08 +0200 - Made wd_keepalive honor config file option. - Added wd_keealive manpage. - Made wd_keepalive not start without a watchdog device. - Fixed some typos in watchdog manpage. - Updated Debian files. - Released 5.4 Mon, 14 Jan 2008 13:57:34 +0100 - Check for existance before usage of sendmail. Wed, 11 Feb 2009 15:00:48 +0100 - Added patch by Jan RouÅ¡ to prevent rare segfault on shutdown. Wed, 25 Feb 2009 10:27:35 +0100 - Added patch by Enrique Zanardi to let repair binary know more about the failing test. - Expanded that patch to work for more tests. - Released version 5.5 Tue, 3 Mar 2009 14:59:55 +0100 - Added patch by Enrique Zanardi to check for the source of the ping reply packets. Thu, 12 Mar 2009 14:36:01 +0100 - Added patch by Lon Hohberger to allow configuration of timeouts. - Added another patch by Lon Hohberger to make sure signal handler does not call not-signal safe functions. - Made wd_keepalive accept all options watchdog accepts and not throw errors on those it does not use itself. Fri, 13 Mar 2009 12:26:40 +0100 - Made watchdog not close the watchdog device so early when trying a normal shutdown. This ensures a reset even if the system hangs while doing this. - Applied patch by Richard W.M. Jones to cleanup code base for gcc-4.4. Sun, 22 Mar 2009 14:33:21 +0100 - Some more bugfixes by me and Lon. - Released 5.6 Mon, 25 May 2009 02:46:32 +0200 - Allow config lines with arbitrary length. - Applied patch by Mike Frysinger to not use deprecated sys_siglist anymore. - Also removed configure test for sys_siglist. - Cleaned up includes, also courtesy of Mike Frysinger. Sun, 22 Nov 2009 14:05:29 +0100 - Applied patch by Russell Coker to sets the socket handle for raw socket access to close on exec. Wed, 06 Jan 2010 13:36:37 +0100 - Applied patch by Russell Coker to give a better error message if no config file is found. - Released version 5.7. Fri, 08 Jan 2010 11:02:23 +0100 - Applied patch by Min Zhang to make logdir a configurable option. Tue, 09 Feb 2010 16:26:21 +0100 - Disable OOM killer for watchdog and wd_keepalive. In the process also make sure that the daemons do not allocate memory once they are in daemon mode as a safeguard for systems running out of memory. Thu, 11 Feb 2010 14:50:39 +0100 - Decreased default interval from 10 seconds to just 1 because 10 is too much for some hardware especially embedded systems. Sat Mar 6 22:07:15 2010 +0100 - Applied two patches by Jon Ringle : - uclibc does not have index(), but strchr() is equivalent to index() according to the index man page - Fix compile with USE_SYSLOG disabled Patch by Jon Ringle Mon, 22 Mar 2010 15:24:02 +0100 - Released 5.8 Mon May 10 15:48:35 2010 +0200 - Applied patches by Martin Koegler : - Implementing a timeout for repair scripts - Fixing a few bugs. Thu, 17 Jun 2010 16:59:53 +0200 - Added the ability to query the watchdog type based on work by Corey Minyard ChangeLog ends here. Please refer to git log for later changes. watchdog-5.13/COPYING0000644000175000017500000000075512102721740014066 0ustar michaelmichaelCopyright (C) 1996-2012 Michael Meskes WATCHDOG is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. WATCHDOG is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. watchdog-5.13/depcomp0000755000175000017500000005064312102721745014416 0ustar michaelmichael#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2012-03-27.16; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. # 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 # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # A tabulation character. tab=' ' # A newline character. nl=' ' if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' "$nl" < "$tmpdepfile" | ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependent.h'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. # However on # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\': # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... # tcc 0.9.26 (FIXME still under development at the moment of writing) # will emit a similar output, but also prepend the continuation lines # with horizontal tabulation characters. "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form 'foo.o: dependent.h', # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ < "$tmpdepfile" > "$depfile" sed ' s/[ '"$tab"'][ '"$tab"']*/ /g s/^ *// s/ *\\*$// s/^[^:]*: *// /^$/d /:$/d s/$/ :/ ' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test "$stat" = 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' "$nl" < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: watchdog-5.13/include/0002755000175000017500000000000012102721744014455 5ustar michaelmichaelwatchdog-5.13/include/sundries.h0000644000175000017500000000434012102721740016455 0ustar michaelmichael/* * sundries.h * Support function prototypes. Functions are in sundries.c. */ #include #include #include #include #include #include #if !defined(bool_t) && !defined(__GLIBC__) #include #endif extern int mount_mount_quiet; extern int mount_verbose; extern int sloppy; #define streq(s, t) (strcmp ((s), (t)) == 0) /* String list data structure. */ typedef struct string_list { char *hd; struct string_list *tl; } *string_list; #define car(p) ((p) -> hd) #define cdr(p) ((p) -> tl) string_list cons (char *a, const string_list); /* Functions in sundries.c that are used in mount.c and umount.c */ void block_signals (int how); char *canonicalize (const char *path); char *realpath (const char *path, char *resolved_path); void error (const char *fmt, ...); int matching_type (const char *type, string_list types); string_list parse_list (char *strings); void *xmalloc (size_t size); char *xstrdup (const char *s); char *xstrndup (const char *s, int n); char *xstrconcat2 (const char *, const char *); char *xstrconcat3 (const char *, const char *, const char *); char *xstrconcat4 (const char *, const char *, const char *, const char *); /* Here is some serious cruft. */ #ifdef __GNUC__ #if defined(__GNUC_MINOR__) && __GNUC__ == 2 && __GNUC_MINOR__ >= 5 void die (int errcode, const char *fmt, ...) __attribute__ ((noreturn)); #else /* GNUC < 2.5 */ void die (int errcode, const char *fmt, ...); #endif /* GNUC < 2.5 */ #else /* !__GNUC__ */ void die (int errcode, const char *fmt, ...); #endif /* !__GNUC__ */ #ifdef HAVE_NFS int nfsmount (const char *spec, const char *node, int *flags, char **orig_opts, char **opt_args, int running_bg); #endif /* exit status - bits below are ORed */ #define EX_USAGE 1 /* incorrect invocation or permission */ #define EX_SYSERR 2 /* out of memory, cannot fork, ... */ #define EX_SOFTWARE 4 /* internal mount bug or wrong version */ #define EX_USER 8 /* user interrupt */ #define EX_FILEIO 16 /* problems writing, locking, ... mtab/fstab */ #define EX_FAIL 32 /* mount failure */ #define EX_SOMEOK 64 /* some mount succeeded */ #define EX_BG 256 /* retry in background (internal only) */ watchdog-5.13/include/stamp-h0000644000175000017500000000001212102721740015734 0ustar michaelmichaeltimestamp watchdog-5.13/include/loop.h0000644000175000017500000000015612102721740015573 0ustar michaelmichael#include #undef dev_t #define dev_t __kernel_dev_t #include #undef dev_t watchdog-5.13/include/nfsmount.h0000644000175000017500000002547312102721740016504 0ustar michaelmichael/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _NFSMOUNT_H_RPCGEN #define _NFSMOUNT_H_RPCGEN #include /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape * media and as a part of the software program in whole or part. Users * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user or with the express written consent of * Sun Microsystems, Inc. * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 */ /* * Copyright (c) 1985, 1990 by Sun Microsystems, Inc. */ /* from @(#)mount.x 1.3 91/03/11 TIRPC 1.0 */ #ifndef _rpcsvc_mount_h #define _rpcsvc_mount_h #define MNTPATHLEN 1024 #define MNTNAMLEN 255 #define FHSIZE 32 typedef char fhandle[FHSIZE]; #ifdef __cplusplus extern "C" bool_t xdr_fhandle(XDR *, fhandle); #elif __STDC__ extern bool_t xdr_fhandle(XDR *, fhandle); #else /* Old Style C */ bool_t xdr_fhandle(); #endif /* Old Style C */ struct fhstatus { u_int fhs_status; union { fhandle fhs_fhandle; } fhstatus_u; }; typedef struct fhstatus fhstatus; #ifdef __cplusplus extern "C" bool_t xdr_fhstatus(XDR *, fhstatus*); #elif __STDC__ extern bool_t xdr_fhstatus(XDR *, fhstatus*); #else /* Old Style C */ bool_t xdr_fhstatus(); #endif /* Old Style C */ typedef char *dirpath; #ifdef __cplusplus extern "C" bool_t xdr_dirpath(XDR *, dirpath*); #elif __STDC__ extern bool_t xdr_dirpath(XDR *, dirpath*); #else /* Old Style C */ bool_t xdr_dirpath(); #endif /* Old Style C */ typedef char *name; #ifdef __cplusplus extern "C" bool_t xdr_name(XDR *, name*); #elif __STDC__ extern bool_t xdr_name(XDR *, name*); #else /* Old Style C */ bool_t xdr_name(); #endif /* Old Style C */ typedef struct mountbody *mountlist; #ifdef __cplusplus extern "C" bool_t xdr_mountlist(XDR *, mountlist*); #elif __STDC__ extern bool_t xdr_mountlist(XDR *, mountlist*); #else /* Old Style C */ bool_t xdr_mountlist(); #endif /* Old Style C */ struct mountbody { name ml_hostname; dirpath ml_directory; mountlist ml_next; }; typedef struct mountbody mountbody; #ifdef __cplusplus extern "C" bool_t xdr_mountbody(XDR *, mountbody*); #elif __STDC__ extern bool_t xdr_mountbody(XDR *, mountbody*); #else /* Old Style C */ bool_t xdr_mountbody(); #endif /* Old Style C */ typedef struct groupnode *groups; #ifdef __cplusplus extern "C" bool_t xdr_groups(XDR *, groups*); #elif __STDC__ extern bool_t xdr_groups(XDR *, groups*); #else /* Old Style C */ bool_t xdr_groups(); #endif /* Old Style C */ struct groupnode { name gr_name; groups gr_next; }; typedef struct groupnode groupnode; #ifdef __cplusplus extern "C" bool_t xdr_groupnode(XDR *, groupnode*); #elif __STDC__ extern bool_t xdr_groupnode(XDR *, groupnode*); #else /* Old Style C */ bool_t xdr_groupnode(); #endif /* Old Style C */ typedef struct exportnode *exports; #ifdef __cplusplus extern "C" bool_t xdr_exports(XDR *, exports*); #elif __STDC__ extern bool_t xdr_exports(XDR *, exports*); #else /* Old Style C */ bool_t xdr_exports(); #endif /* Old Style C */ struct exportnode { dirpath ex_dir; groups ex_groups; exports ex_next; }; typedef struct exportnode exportnode; #ifdef __cplusplus extern "C" bool_t xdr_exportnode(XDR *, exportnode*); #elif __STDC__ extern bool_t xdr_exportnode(XDR *, exportnode*); #else /* Old Style C */ bool_t xdr_exportnode(); #endif /* Old Style C */ struct ppathcnf { int pc_link_max; short pc_max_canon; short pc_max_input; short pc_name_max; short pc_path_max; short pc_pipe_buf; u_char pc_vdisable; char pc_xxx; short pc_mask[2]; }; typedef struct ppathcnf ppathcnf; #ifdef __cplusplus extern "C" bool_t xdr_ppathcnf(XDR *, ppathcnf*); #elif __STDC__ extern bool_t xdr_ppathcnf(XDR *, ppathcnf*); #else /* Old Style C */ bool_t xdr_ppathcnf(); #endif /* Old Style C */ #endif /*!_rpcsvc_mount_h*/ #define MOUNTPROG ((u_long)100005) #define MOUNTVERS ((u_long)1) #ifdef __cplusplus #define MOUNTPROC_NULL ((u_long)0) extern "C" void * mountproc_null_1(void *, CLIENT *); extern "C" void * mountproc_null_1_svc(void *, struct svc_req *); #define MOUNTPROC_MNT ((u_long)1) extern "C" fhstatus * mountproc_mnt_1(dirpath *, CLIENT *); extern "C" fhstatus * mountproc_mnt_1_svc(dirpath *, struct svc_req *); #define MOUNTPROC_DUMP ((u_long)2) extern "C" mountlist * mountproc_dump_1(void *, CLIENT *); extern "C" mountlist * mountproc_dump_1_svc(void *, struct svc_req *); #define MOUNTPROC_UMNT ((u_long)3) extern "C" void * mountproc_umnt_1(dirpath *, CLIENT *); extern "C" void * mountproc_umnt_1_svc(dirpath *, struct svc_req *); #define MOUNTPROC_UMNTALL ((u_long)4) extern "C" void * mountproc_umntall_1(void *, CLIENT *); extern "C" void * mountproc_umntall_1_svc(void *, struct svc_req *); #define MOUNTPROC_EXPORT ((u_long)5) extern "C" exports * mountproc_export_1(void *, CLIENT *); extern "C" exports * mountproc_export_1_svc(void *, struct svc_req *); #define MOUNTPROC_EXPORTALL ((u_long)6) extern "C" exports * mountproc_exportall_1(void *, CLIENT *); extern "C" exports * mountproc_exportall_1_svc(void *, struct svc_req *); #elif __STDC__ #define MOUNTPROC_NULL ((u_long)0) extern void * mountproc_null_1(void *, CLIENT *); extern void * mountproc_null_1_svc(void *, struct svc_req *); #define MOUNTPROC_MNT ((u_long)1) extern fhstatus * mountproc_mnt_1(dirpath *, CLIENT *); extern fhstatus * mountproc_mnt_1_svc(dirpath *, struct svc_req *); #define MOUNTPROC_DUMP ((u_long)2) extern mountlist * mountproc_dump_1(void *, CLIENT *); extern mountlist * mountproc_dump_1_svc(void *, struct svc_req *); #define MOUNTPROC_UMNT ((u_long)3) extern void * mountproc_umnt_1(dirpath *, CLIENT *); extern void * mountproc_umnt_1_svc(dirpath *, struct svc_req *); #define MOUNTPROC_UMNTALL ((u_long)4) extern void * mountproc_umntall_1(void *, CLIENT *); extern void * mountproc_umntall_1_svc(void *, struct svc_req *); #define MOUNTPROC_EXPORT ((u_long)5) extern exports * mountproc_export_1(void *, CLIENT *); extern exports * mountproc_export_1_svc(void *, struct svc_req *); #define MOUNTPROC_EXPORTALL ((u_long)6) extern exports * mountproc_exportall_1(void *, CLIENT *); extern exports * mountproc_exportall_1_svc(void *, struct svc_req *); #else /* Old Style C */ #define MOUNTPROC_NULL ((u_long)0) extern void * mountproc_null_1(); extern void * mountproc_null_1_svc(); #define MOUNTPROC_MNT ((u_long)1) extern fhstatus * mountproc_mnt_1(); extern fhstatus * mountproc_mnt_1_svc(); #define MOUNTPROC_DUMP ((u_long)2) extern mountlist * mountproc_dump_1(); extern mountlist * mountproc_dump_1_svc(); #define MOUNTPROC_UMNT ((u_long)3) extern void * mountproc_umnt_1(); extern void * mountproc_umnt_1_svc(); #define MOUNTPROC_UMNTALL ((u_long)4) extern void * mountproc_umntall_1(); extern void * mountproc_umntall_1_svc(); #define MOUNTPROC_EXPORT ((u_long)5) extern exports * mountproc_export_1(); extern exports * mountproc_export_1_svc(); #define MOUNTPROC_EXPORTALL ((u_long)6) extern exports * mountproc_exportall_1(); extern exports * mountproc_exportall_1_svc(); #endif /* Old Style C */ #define MOUNTVERS_POSIX ((u_long)2) #ifdef __cplusplus extern "C" void * mountproc_null_2(void *, CLIENT *); extern "C" void * mountproc_null_2_svc(void *, struct svc_req *); extern "C" fhstatus * mountproc_mnt_2(dirpath *, CLIENT *); extern "C" fhstatus * mountproc_mnt_2_svc(dirpath *, struct svc_req *); extern "C" mountlist * mountproc_dump_2(void *, CLIENT *); extern "C" mountlist * mountproc_dump_2_svc(void *, struct svc_req *); extern "C" void * mountproc_umnt_2(dirpath *, CLIENT *); extern "C" void * mountproc_umnt_2_svc(dirpath *, struct svc_req *); extern "C" void * mountproc_umntall_2(void *, CLIENT *); extern "C" void * mountproc_umntall_2_svc(void *, struct svc_req *); extern "C" exports * mountproc_export_2(void *, CLIENT *); extern "C" exports * mountproc_export_2_svc(void *, struct svc_req *); extern "C" exports * mountproc_exportall_2(void *, CLIENT *); extern "C" exports * mountproc_exportall_2_svc(void *, struct svc_req *); #define MOUNTPROC_PATHCONF ((u_long)7) extern "C" ppathcnf * mountproc_pathconf_2(dirpath *, CLIENT *); extern "C" ppathcnf * mountproc_pathconf_2_svc(dirpath *, struct svc_req *); #elif __STDC__ extern void * mountproc_null_2(void *, CLIENT *); extern void * mountproc_null_2_svc(void *, struct svc_req *); extern fhstatus * mountproc_mnt_2(dirpath *, CLIENT *); extern fhstatus * mountproc_mnt_2_svc(dirpath *, struct svc_req *); extern mountlist * mountproc_dump_2(void *, CLIENT *); extern mountlist * mountproc_dump_2_svc(void *, struct svc_req *); extern void * mountproc_umnt_2(dirpath *, CLIENT *); extern void * mountproc_umnt_2_svc(dirpath *, struct svc_req *); extern void * mountproc_umntall_2(void *, CLIENT *); extern void * mountproc_umntall_2_svc(void *, struct svc_req *); extern exports * mountproc_export_2(void *, CLIENT *); extern exports * mountproc_export_2_svc(void *, struct svc_req *); extern exports * mountproc_exportall_2(void *, CLIENT *); extern exports * mountproc_exportall_2_svc(void *, struct svc_req *); #define MOUNTPROC_PATHCONF ((u_long)7) extern ppathcnf * mountproc_pathconf_2(dirpath *, CLIENT *); extern ppathcnf * mountproc_pathconf_2_svc(dirpath *, struct svc_req *); #else /* Old Style C */ extern void * mountproc_null_2(); extern void * mountproc_null_2_svc(); extern fhstatus * mountproc_mnt_2(); extern fhstatus * mountproc_mnt_2_svc(); extern mountlist * mountproc_dump_2(); extern mountlist * mountproc_dump_2_svc(); extern void * mountproc_umnt_2(); extern void * mountproc_umnt_2_svc(); extern void * mountproc_umntall_2(); extern void * mountproc_umntall_2_svc(); extern exports * mountproc_export_2(); extern exports * mountproc_export_2_svc(); extern exports * mountproc_exportall_2(); extern exports * mountproc_exportall_2_svc(); #define MOUNTPROC_PATHCONF ((u_long)7) extern ppathcnf * mountproc_pathconf_2(); extern ppathcnf * mountproc_pathconf_2_svc(); #endif /* Old Style C */ #endif /* !_NFSMOUNT_H_RPCGEN */ watchdog-5.13/include/fstab.h0000644000175000017500000000137212102721740015722 0ustar michaelmichael#define _PATH_FSTAB "/etc/fstab" #define MOUNTED_LOCK "/etc/mtab~" #define MOUNTED_TEMP "/etc/mtab.tmp" #define LOCK_TIMEOUT 10 int mtab_is_writable(void); int mtab_does_not_exist(void); int mtab_is_a_symlink(void); struct mntentchn { struct mntentchn *nxt, *prev; char *mnt_fsname; char *mnt_dir; char *mnt_type; char *mnt_opts; }; struct mntentchn *mtab_head (void); struct mntentchn *getmntfile (const char *name); struct mntentchn *getmntoptfile (const char *file); struct mntentchn *fstab_head (void); struct mntentchn *getfsfile (const char *file); struct mntentchn *getfsspec (const char *spec); #include void lock_mtab (void); void unlock_mtab (void); void update_mtab (const char *special, struct mntent *with); watchdog-5.13/include/watch_err.h0000644000175000017500000000115712102721740016602 0ustar michaelmichael/*********************************/ /* additional error return codes */ /*********************************/ #define ENOERR 0 /* no error */ #define EREBOOT -1 /* unconditional reboot */ #define ERESET -2 /* unconditional hard reset */ #define EMAXLOAD -3 /* load average too high */ #define ETOOHOT -4 /* too hot inside */ #define ENOLOAD -5 /* /proc/loadavg contains no data */ #define ENOCHANGE -6 /* file wasn't changed in the given interval */ #define EINVMEM -7 /* /proc/meminfo contains invalid data */ #define ECHKILL -8 /* child was killed by signal */ #define ETOOLONG -9 /* child didn't return in time */ watchdog-5.13/include/ext2_mnt.h0000644000175000017500000000071312102721740016361 0ustar michaelmichael/* * this file contains some information still missing from glibc header files */ /* * from mntent.h */ #define MNTTYPE_EXT2 "ext2" /* Second Extended file system */ #define MNTOPT_NOQUOTA "noquota" /* don't use any quota on this partition */ #define MNTOPT_USRQUOTA "usrquota" /* use userquota on this partition */ #define MNTOPT_GRPQUOTA "grpquota" /* use groupquota on this partition */ watchdog-5.13/include/wd_mntent.h0000644000175000017500000000067012102721740016622 0ustar michaelmichael#ifndef WD_MNTENT_H #define WD_MNTENT_H #include /* for struct mntent */ #define ERR_MAX 5 typedef struct mntFILEstruct { FILE *mntent_fp; char *mntent_file; int mntent_lineno; int mntent_errs; int mntent_softerrs; } mntFILE; mntFILE *my_setmntent (const char *file, char *mode); void my_endmntent (mntFILE *mfp); int my_addmntent (mntFILE *mfp, struct mntent *mnt); struct mntent *my_getmntent (mntFILE *mfp); #endif watchdog-5.13/include/config.h.in0000644000175000017500000001260712102721744016504 0ustar michaelmichael/* include/config.h.in. Generated from configure.in by autoheader. */ /* "name of config file" */ #undef CONFIG_FILENAME /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA /* Define to 1 if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `gethostname' function. */ #undef HAVE_GETHOSTNAME /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* "enable NFS" */ #undef HAVE_NFS /* Define to 1 if you have the header file. */ #undef HAVE_PATHS_H /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcspn' function. */ #undef HAVE_STRCSPN /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL /* Define to 1 if `st_rdev' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_RDEV /* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use `HAVE_STRUCT_STAT_ST_RDEV' instead. */ #undef HAVE_ST_RDEV /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the `uname' function. */ #undef HAVE_UNAME /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* "name of keepalive pid file" */ #undef KA_PIDFILE /* "major version number" */ #undef MAJOR_VERSION /* "minimum value accepted as reboot cause" */ #undef MINLOAD /* "minor version number" */ #undef MINOR_VERSION /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* "path to sendmail binary" */ #undef PATH_SENDMAIL /* "name of pid file" */ #undef PIDFILE /* "filename for storing random seed" */ #undef RANDOM_SEED /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* "path to test binaries" */ #undef TESTBIN_PATH /* "timer margin used by kernel" */ #undef TIMER_MARGIN /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* "enable syslog" */ #undef USE_SYSLOG /* Version number of package */ #undef VERSION /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t watchdog-5.13/include/mount_constants.h0000644000175000017500000000177412102721740020067 0ustar michaelmichael#ifndef MS_RDONLY #define MS_RDONLY 1 /* Mount read-only */ #endif #ifndef MS_NOSUID #define MS_NOSUID 2 /* Ignore suid and sgid bits */ #endif #ifndef MS_NODEV #define MS_NODEV 4 /* Disallow access to device special files */ #endif #ifndef MS_NOEXEC #define MS_NOEXEC 8 /* Disallow program execution */ #endif #ifndef MS_SYNCHRONOUS #define MS_SYNCHRONOUS 16 /* Writes are synced at once */ #endif #ifndef MS_REMOUNT #define MS_REMOUNT 32 /* Alter flags of a mounted FS */ #endif #ifndef MS_MANDLOCK #define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ #endif #ifndef MS_NOATIME #define MS_NOATIME 1024 /* Do not update access times. */ #endif #ifndef MS_NODIRATIME #define MS_NODIRATIME 2048 /* Do not update directory access times */ #endif /* * Magic mount flag number. Has to be or-ed to the flag values. */ #ifndef MS_MGC_VAL #define MS_MGC_VAL 0xC0ED0000 /* magic flag number to indicate "new" flags */ #endif #ifndef MS_MGC_MSK #define MS_MGC_MSK 0xffff0000 /* magic flag number mask */ #endif watchdog-5.13/include/stamp-h.in0000644000175000017500000000001212102721740016341 0ustar michaelmichaeltimestamp watchdog-5.13/include/lomount.h0000644000175000017500000000027012102721740016314 0ustar michaelmichaelextern int mount_verbose; extern int set_loop (const char *, const char *, int, const char *, int *); extern int del_loop (const char *); extern char * find_unused_loop_device (void); watchdog-5.13/include/linux_fs.h0000644000175000017500000000412512102721740016451 0ustar michaelmichael/* Including became more and more painful. Below a very abbreviated version of some declarations, only designed to be able to check a magic number in case no filesystem type was given. */ #ifndef BLKGETSIZE #define BLKGETSIZE 0x1260 /* return device size */ #endif #define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ #define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ struct minix_super_block { u_char s_dummy[16]; u_char s_magic[2]; }; #define minixmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8)) #define ISODCL(from, to) (to - from + 1) #define ISO_STANDARD_ID "CD001" struct iso_volume_descriptor { char type[ISODCL(1,1)]; /* 711 */ char id[ISODCL(2,6)]; char version[ISODCL(7,7)]; char data[ISODCL(8,2048)]; }; #define HS_STANDARD_ID "CDROM" struct hs_volume_descriptor { char foo[ISODCL ( 1, 8)]; /* 733 */ char type[ISODCL ( 9, 9)]; /* 711 */ char id[ISODCL ( 10, 14)]; char version[ISODCL ( 15, 15)]; /* 711 */ char data[ISODCL(16,2048)]; }; #define EXT_SUPER_MAGIC 0x137D struct ext_super_block { u_char s_dummy[56]; u_char s_magic[2]; }; #define extmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8)) #define EXT2_PRE_02B_MAGIC 0xEF51 #define EXT2_SUPER_MAGIC 0xEF53 struct ext2_super_block { u_char s_dummy[56]; u_char s_magic[2]; }; #define ext2magic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8)) #define _XIAFS_SUPER_MAGIC 0x012FD16D struct xiafs_super_block { u_char s_boot_segment[512]; /* 1st sector reserved for boot */ u_char s_dummy[60]; u_char s_magic[4]; }; #define xiafsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ (((uint) s.s_magic[2]) << 16) + \ (((uint) s.s_magic[3]) << 24)) /* From jj@sunsite.ms.mff.cuni.cz Mon Mar 23 15:19:05 1998 */ #define UFS_SUPER_MAGIC 0x00011954 struct ufs_super_block { u_char s_dummy[0x55c]; u_char s_magic[4]; }; #define ufsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ (((uint) s.s_magic[2]) << 16) + \ (((uint) s.s_magic[3]) << 24)) watchdog-5.13/include/extern.h0000644000175000017500000000326412102721740016132 0ustar michaelmichael#include #include /* external variables */ extern int softboot, watchdog, temp, maxtemp, tint, lastts, nrts; extern int maxload1, maxload5, maxload15, load, verbose, mem, minpages; extern int hbstamps, logtick, ticker; extern pid_t pid; extern char *tempname, *admin, *devname, *progname, *timestamps, *heartbeat; extern time_t timeout, rtimeout; extern FILE *hb; extern char* logdir, *filename_buf; /* variable types */ struct pingmode { struct sockaddr to; int sock_fp; unsigned char *packet; }; struct filemode { int mtime; }; struct ifmode { unsigned long bytes; }; union wdog_options { struct pingmode net; struct filemode file; struct ifmode iface; }; struct list { char *name; union wdog_options parameter; struct list *next; }; /* constants */ #define DATALEN (64 - 8) #define MAXIPLEN 60 #define MAXICMPLEN 76 #define MAXPACKET (65536 - 60 - 8) /* max packet size */ #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #define TS_SIZE 12 /* function prototypes */ int check_file_stat(struct list *); int check_file_table(void); int keep_alive(void); int check_load(void); int check_net(char *target, int sock_fp, struct sockaddr to, unsigned char *packet, int time, int count); int check_temp(void); int check_bin(char *, time_t, int); int check_pidfile(struct list *); int check_iface(struct list *); int check_memory(void); void do_shutdown(int errorcode); void sigterm_handler(int arg); #ifdef __GNUC__ #define GCC_NORETURN __attribute__((noreturn)) #else #define GCC_NORETURN #endif void terminate(void) GCC_NORETURN; watchdog-5.13/include/nfs_mountversion.h0000644000175000017500000000007012102721740020233 0ustar michaelmichael#define KERNEL_NFS_MOUNT_VERSION 1 /* mountd version */ watchdog-5.13/include/nfs_mount4.h0000644000175000017500000000274612102721740016725 0ustar michaelmichael/* * We want to be able to compile mount on old kernels in such a way * that the binary will work well on more recent kernels. * Thus, if necessary we teach nfsmount.c the structure of new fields * that will come later. * * Moreover, the new kernel includes conflict with glibc includes * so it is easiest to ignore the kernel altogether (at compile time). */ #define NFS_MOUNT_VERSION 4 struct nfs2_fh { char data[32]; }; struct nfs3_fh { unsigned short size; unsigned char data[64]; }; struct nfs_mount_data { int version; /* 1 */ int fd; /* 1 */ struct nfs2_fh old_root; /* 1 */ int flags; /* 1 */ int rsize; /* 1 */ int wsize; /* 1 */ int timeo; /* 1 */ int retrans; /* 1 */ int acregmin; /* 1 */ int acregmax; /* 1 */ int acdirmin; /* 1 */ int acdirmax; /* 1 */ struct sockaddr_in addr; /* 1 */ char hostname[256]; /* 1 */ int namlen; /* 2 */ unsigned int bsize; /* 3 */ struct nfs3_fh root; /* 4 */ }; /* bits in the flags field */ #define NFS_MOUNT_SOFT 0x0001 /* 1 */ #define NFS_MOUNT_INTR 0x0002 /* 1 */ #define NFS_MOUNT_SECURE 0x0004 /* 1 */ #define NFS_MOUNT_POSIX 0x0008 /* 1 */ #define NFS_MOUNT_NOCTO 0x0010 /* 1 */ #define NFS_MOUNT_NOAC 0x0020 /* 1 */ #define NFS_MOUNT_TCP 0x0040 /* 2 */ #define NFS_MOUNT_VER3 0x0080 /* 3 */ #define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ #define NFS_MOUNT_NONLM 0x0200 /* 3 */ #define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ watchdog-5.13/src/0002755000175000017500000000000012102721745013622 5ustar michaelmichaelwatchdog-5.13/src/file_stat.c0000644000175000017500000000262112102721740015732 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/file_stat.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "extern.h" #include "watch_err.h" #if USE_SYSLOG #include #endif int check_file_stat(struct list *file) { struct stat buf; /* in filemode stat file */ if (stat(file->name, &buf) == -1) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "cannot stat %s (errno = %d = '%m')", file->name, err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ /* on error ENETDOWN|ENETUNREACH we react as if we're in ping mode */ if (softboot || err == ENETDOWN || err == ENETUNREACH) return (err); } else if (file->parameter.file.mtime != 0) { #if USE_SYSLOG /* do verbose logging */ if (verbose && logtick && ticker == 1) syslog(LOG_INFO, "file %s was last changed at %s.", file->name, ctime(&buf.st_mtime)); #endif if (time(NULL) - buf.st_mtime > file->parameter.file.mtime) { /* file wasn't changed often enough */ #if USE_SYSLOG syslog(LOG_ERR, "file %s was not changed in %d seconds.", file->name, file->parameter.file.mtime); #else /* USE_SYSLOG */ fprintf(stderr, "file %s was not changed in %d seconds.", file->name, file->parameter.file.mtime); #endif /* USE_SYSLOG */ return (ENOCHANGE); } } return (ENOERR); } watchdog-5.13/src/wd_keepalive.c0000644000175000017500000002772612102721740016434 0ustar michaelmichael/********************************************************** * Copyright: Appliance Studio Ltd * License: GPL * * Filename: $Id: wd_keepalive.c,v 1.6 2007/08/17 09:24:54 meskes Exp $ * Author: Marcel Jansen, 22 February 2001 * Michael Meskes, since then * Purpose: This program can be run during critical periods * when the normal watcdog shouldn't be run. It will * read from the same configuration file, it will do * no checks but will keep writing to the device * ***********************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if USE_SYSLOG #include #endif #define TRUE 1 #define FALSE 0 #define DEVICE "watchdog-device" #define INTERVAL "interval" #define PRIORITY "priority" #define REALTIME "realtime" int watchdog = -1, tint = 10, schedprio = 1; char *devname = NULL, *progname = NULL; volatile sig_atomic_t _running = 1; #if defined(_POSIX_MEMLOCK) int mlocked = FALSE, realtime = FALSE; #endif static void usage(void) { fprintf(stderr, "%s version %d.%d, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION); fprintf(stderr, "%s \n", progname); exit(1); } /* write a log entry on exit */ static void log_end() { #if USE_SYSLOG /* Log the closing message */ syslog(LOG_INFO, "stopping watchdog keepalive daemon (%d.%d)", MAJOR_VERSION, MINOR_VERSION); closelog(); sleep(5); /* make sure log is written */ #endif /* USE_SYSLOG */ return; } /* close the device and check for error */ static void close_all() { if (watchdog != -1) { if (write(watchdog, "V", 1) < 0 ) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "write watchdog device gave error %d = '%m'!", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } if (close(watchdog) == -1) { #if USE_SYSLOG syslog(LOG_ALERT, "cannot close %s (errno = %d)", devname, errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } } } void sigterm_handler(int arg) { _running = 0; } /* on exit we close the device and log that we stop */ void terminate(void) { #if defined(_POSIX_MEMLOCK) if ( realtime == TRUE && mlocked == TRUE ) { /* unlock all locked pages */ if ( munlockall() != 0 ) { #if USE_SYSLOG syslog(LOG_ERR, "cannot unlock realtime memory (errno = %d)", errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } } #endif /* _POSIX_MEMLOCK */ close_all(); log_end(); exit(0); } static int spool(char *line, int *i, int offset) { for ( (*i) += offset; line[*i] == ' ' || line[*i] == '\t'; (*i)++ ); if ( line[*i] == '=' ) (*i)++; for ( ; line[*i] == ' ' || line[*i] == '\t'; (*i)++ ); if ( line[*i] == '\0' ) return(1); else return(0); } static void read_config(char *configfile, char *progname) { FILE *wc; if ( (wc = fopen(configfile, "r")) == NULL ) { perror(progname); exit(1); } while ( !feof(wc) ) { char *line = NULL; size_t n; if (getline(&line, &n, wc) == -1) { if ( !ferror(wc) ) break; else { perror(progname); exit(1); } } else { int i, j; /* scan the actual line for an option */ /* first remove the leading blanks */ for ( i = 0; line[i] == ' ' || line[i] == '\t'; i++ ); /* if the next sign is a '#' we have a comment */ if ( line[i] == '#' ) continue; /* also remove the trailing blanks and the \n */ for ( j = strlen(line) - 1; line[j] == ' ' || line[j] == '\t' || line[j] == '\n'; j-- ); line[j + 1] = '\0'; /* if the line is empty now, we don't have to parse it */ if ( strlen(line + i) == 0 ) continue; /* now check for an option */ if ( strncmp(line + i, INTERVAL, strlen(INTERVAL)) == 0 ) { if ( spool(line, &i, strlen(INTERVAL)) ) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else tint = atol(line + i); } else if ( strncmp(line + i, DEVICE, strlen(DEVICE)) == 0 ) { if ( spool(line, &i, strlen(DEVICE)) ) devname = NULL; else devname = strdup(line + i); } else if (strncmp(line + i, REALTIME, strlen(REALTIME)) == 0) { (void)spool(line, &i, strlen(REALTIME)); realtime = (strncmp(line + i, "yes", 3) == 0) ? TRUE : FALSE; } else if (strncmp(line + i, PRIORITY, strlen(PRIORITY)) == 0) { if (spool(line, &i, strlen(PRIORITY))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else schedprio = atol(line + i); } else { /* * do not print an error message here because we usually use * watchdog's config file which may contain far more valid * options than we understand */ /* fprintf(stderr, "Ignoring config line: %s\n", line); */ } } } if ( fclose(wc) != 0 ) { perror(progname); exit(1); } } int main(int argc, char *const argv[]) { FILE *fp; char *configfile = CONFIG_FILENAME; pid_t child_pid; int count = 0; int c; int oom_adjusted = 0; struct stat s; /* allow all options watchdog understands too */ #if USE_SYSLOG char *opts = "d:i:n:fsvbql:p:t:c:r:m:a:"; struct option long_options[] = { {"config-file", required_argument, NULL, 'c'}, {"force", no_argument, NULL, 'f'}, {"sync", no_argument, NULL, 's'}, {"no-action", no_argument, NULL, 'q'}, {"verbose", no_argument, NULL, 'v'}, {"softboot", no_argument, NULL, 'b'}, {NULL, 0, NULL, 0} }; struct watchdog_info ident; #else /* USE_SYSLOG */ char *opts = "d:i:n:fsbql:p:t:c:r:m:a:"; struct option long_options[] = { {"config-file", required_argument, NULL, 'c'}, {"force", no_argument, NULL, 'f'}, {"sync", no_argument, NULL, 's'}, {"no-action", no_argument, NULL, 'q'}, {"softboot", no_argument, NULL, 'b'}, {NULL, 0, NULL, 0} }; #endif /* USE_SYSLOG */ progname = basename(argv[0]); /* check for the one option we understand */ while ((c = getopt_long(argc, argv, opts, long_options, NULL)) != EOF) { if (c == -1) break; switch (c) { case 'c': configfile = optarg; break; case 'n': case 'p': case 'a': case 'r': case 'd': case 't': case 'l': case 'm': case 'i': case 'f': case 's': case 'b': case 'q': #if USE_SYSLOG case 'v': #endif /* USE_SYSLOG */ break; default: usage(); } } read_config(configfile, progname); /* make sure we're on the root partition */ if ( chdir("/") < 0 ) { perror(progname); exit(1); } #if !defined(DEBUG) /* fork to go into the background */ if ( (child_pid = fork()) < 0 ) { perror(progname); exit(1); } else if ( child_pid > 0 ) { /* fork was okay */ /* wait for child to exit */ if ( waitpid(child_pid, NULL, 0) != child_pid ) { perror(progname); exit(1); } /* and exit myself */ exit(0); } /* and fork again to make sure we inherit all rights from init */ if ( (child_pid = fork()) < 0 ) { perror(progname); exit(1); } else if ( child_pid > 0 ) exit(0); #endif /* !DEBUG */ /* now we're free */ #if USE_SYSLOG #if !defined(DEBUG) /* Okay, we're a daemon */ /* but we're still attached to the tty */ /* create our own session */ setsid(); /* with USE_SYSLOG we don't do any console IO */ close(0); close(1); close(2); #endif /* !DEBUG */ /* Log the starting message */ openlog(progname, LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "starting watchdog keepalive daemon (%d.%d):", MAJOR_VERSION, MINOR_VERSION); if (devname == NULL) syslog(LOG_INFO, " no watchdog device configured, aborting"); else syslog(LOG_INFO, " int=%d alive=%s realtime=%s", tint, devname, realtime ? "yes" : "no"); #endif /* USE_SYSLOG */ /* this daemon has no other function than writing to this device * i.e. if there is no device given we better punt */ if ( devname == NULL ) terminate(); /* open the device */ watchdog = open(devname, O_WRONLY); if ( watchdog == -1 ) { #if USE_SYSLOG syslog(LOG_ERR, "cannot open %s (errno = %d = '%m')", devname, errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ exit(1); } #if USE_SYSLOG /* Also log watchdog identity */ if (ioctl(watchdog, WDIOC_GETSUPPORT, &ident) < 0) { syslog(LOG_ERR, "cannot get watchdog identity (errno = %d = '%m')", errno); } else { ident.identity[sizeof(ident.identity) - 1] = '\0'; /* Be sure */ syslog(LOG_INFO, "hardware watchdog identity: %s", ident.identity); } #endif /* tuck my process id away */ fp = fopen(KA_PIDFILE, "w"); if ( fp != NULL ) { fprintf(fp, "%d\n", getpid()); (void) fclose(fp); } /* set signal term to call sigterm_handler() */ /* to make sure watchdog device is closed */ signal(SIGTERM, sigterm_handler); #if defined(_POSIX_MEMLOCK) if ( realtime == TRUE ) { /* lock all actual and future pages into memory */ if ( mlockall(MCL_CURRENT | MCL_FUTURE) != 0 ) { #if USE_SYSLOG syslog(LOG_ERR, "cannot lock realtime memory (errno = %d = '%m')", errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } else { struct sched_param sp; /* now set the scheduler */ sp.sched_priority = schedprio; if ( sched_setscheduler(0, SCHED_RR, &sp) != 0 ) { #if USE_SYSLOG syslog(LOG_ERR, "cannot set scheduler (errno = %d = '%m')", errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } else mlocked = TRUE; } } #endif /* tell oom killer to not kill this process */ #ifdef OOM_SCORE_ADJ_MIN if ( ! stat("/proc/self/oom_score_adj", &s) ) { fp = fopen("/proc/self/oom_score_adj", "w"); if (fp) { fprintf(fp, "%d\n", OOM_SCORE_ADJ_MIN); (void) fclose(fp); oom_adjusted = 1; } } #endif #ifdef OOM_DISABLE if ( ! oom_adjusted ) { if ( ! stat("/proc/self/oom_adj", &s) ) { fp = fopen("/proc/self/oom_adj", "w"); if (fp) { fprintf(fp, "%d\n", OOM_DISABLE); (void) fclose(fp); oom_adjusted = 1; } } } #endif #if USE_SYSLOG if ( ! oom_adjusted ) { syslog(LOG_WARNING, "unable to disable oom handling!"); } #endif /* USE_SYSLOG */ /* main loop: update after seconds */ while ( _running ) { if ( write(watchdog, "\0", 1) < 0 ) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "write watchdog device gave error %d = '%m'!", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } /* finally sleep some seconds */ sleep(tint); count++; } terminate(); /* not reached */ } watchdog-5.13/src/mount.c0000644000175000017500000010725412102721740015132 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/mount.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ /* * A mount(8) for Linux 0.99. * mount.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp * * Thu Jul 14 07:32:40 1994: faith@cs.unc.edu added changes from Adam * J. Richter (adam@adam.yggdrasil.com) so that /proc/filesystems is used * if no -t option is given. I modified his patches so that, if * /proc/filesystems is not available, the behavior of mount is the same as * it was previously. * * Wed Sep 14 22:43:00 1994: Mitchum DSouza * (mitch@mrc-applied-psychology.cambridge.ac.uk) added support for mounting * the "loop" device. * * Wed Sep 14 22:55:10 1994: Sander van Malssen (svm@kozmix.hacktic.nl) * added support for remounting readonly file systems readonly. * * Wed Feb 8 09:23:18 1995: Mike Grupenhoff added * a probe of the superblock for the type before /proc/filesystems is * checked. * * Wed Feb 8 12:27:00 1995: Andries.Brouwer@cwi.nl fixed up error messages. * Sat Jun 3 20:44:38 1995: Patches from Andries.Brouwer@cwi.nl applied. * Tue Sep 26 22:38:20 1995: aeb@cwi.nl, many changes * Fri Feb 23 13:47:00 1996: aeb@cwi.nl, loop device related changes * * Fri Apr 5 01:13:33 1996: quinlan@bucknell.edu, fixed up iso9660 autodetect * * Since then, many changes - aeb. * * Wed Oct 1 23:55:28 1997: Dick Streefland * Implemented the "bg", "fg" and "retry" mount options for NFS. * * Tue Aug 4 15:54:31 1998: aeb@cwi.nl: * Open fd 0,1,2 so that printf's do not clobber /etc/mtab or so. * Mangle filenames with embedded spaces. Add ufsmagic. Add locking. * Avoid unnecessary error messages about /proc. * Improve support for noncanonical names in /etc/fstab. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include "mount_constants.h" #include "sundries.h" #include "wd_mntent.h" #include "fstab.h" #include "lomount.h" #include "loop.h" #include "linux_fs.h" #define PROC_FILESYSTEMS "/proc/filesystems" #define SIZE(a) (sizeof(a)/sizeof(a[0])) #define DO_PS_FIDDLING #ifdef DO_PS_FIDDLING #define PROC_NAME "mount: " static int argc0; static char** argv0; static char** envp0; extern char** environ; #endif /* True for fake mount (-f). */ int fake = 0; /* Don't write a entry in /etc/mtab (-n). */ int mount_nomtab = 0; /* True for explicit readonly (-r). */ int readonly = 0; /* Nonzero for chatty (-v). */ int mount_verbose = 0; /* Nonzero for sloppy (-s). */ int sloppy = 0; /* True for explicit read/write (-w). */ int readwrite = 0; /* True for all mount (-a). */ int all = 0; /* True for fork() during all mount (-F). */ int optfork = 0; /* True if ruid != euid. */ int mount_suid = 0; /* Map from -o and fstab option strings to the flag argument to mount(2). */ struct opt_map { const char *opt; /* option name */ int skip; /* skip in mtab option string */ int inv; /* true if flag value should be inverted */ int mask; /* flag mask value */ }; /* Custom mount options for our own purposes. */ /* We can use the high-order 16 bits, since the mount call has MS_MGC_VAL there. */ #define MS_NOAUTO 0x80000000 #define MS_USER 0x40000000 #define MS_LOOP 0x00010000 /* Options that we keep the mount system call from seeing. */ #define MS_NOSYS (MS_NOAUTO|MS_USER|MS_LOOP) /* Options that we keep from appearing in the options field in the mtab. */ #define MS_NOMTAB (MS_REMOUNT|MS_NOAUTO|MS_USER) /* OPTIONS that we make ordinary users have by default. */ #define MS_SECURE (MS_NOEXEC|MS_NOSUID|MS_NODEV) const struct opt_map opt_map[] = { { "defaults", 0, 0, 0 }, /* default options */ { "ro", 1, 0, MS_RDONLY }, /* read-only */ { "rw", 1, 1, MS_RDONLY }, /* read-write */ { "exec", 0, 1, MS_NOEXEC }, /* permit execution of binaries */ { "noexec", 0, 0, MS_NOEXEC }, /* don't execute binaries */ { "mount_suid", 0, 1, MS_NOSUID }, /* honor mount_suid executables */ { "nomount_suid", 0, 0, MS_NOSUID }, /* don't honor mount_suid executables */ { "dev", 0, 1, MS_NODEV }, /* interpret device files */ { "nodev", 0, 0, MS_NODEV }, /* don't interpret devices */ { "sync", 0, 0, MS_SYNCHRONOUS}, /* synchronous I/O */ { "async", 0, 1, MS_SYNCHRONOUS}, /* asynchronous I/O */ { "remount", 0, 0, MS_REMOUNT}, /* Alter flags of mounted FS */ { "auto", 0, 1, MS_NOAUTO }, /* Can be mounted using -a */ { "noauto", 0, 0, MS_NOAUTO }, /* Can only be mounted explicitly */ { "user", 0, 0, MS_USER }, /* Allow ordinary user to mount */ { "nouser", 0, 1, MS_USER }, /* Forbid ordinary user to mount */ /* add new options here */ #ifdef MS_NOSUB { "sub", 0, 1, MS_NOSUB }, /* allow submounts */ { "nosub", 0, 0, MS_NOSUB }, /* don't allow submounts */ #endif #ifdef MS_SILENT { "quiet", 0, 0, MS_SILENT }, /* be quiet */ { "loud", 0, 1, MS_SILENT }, /* print out messages. */ #endif #ifdef MS_MANDLOCK { "mand", 0, 0, MS_MANDLOCK }, /* Allow mandatory locks on this FS */ { "nomand", 0, 1, MS_MANDLOCK }, /* Forbid mandatory locks on this FS */ #endif { "loop", 1, 0, MS_LOOP }, /* use a loop device */ #ifdef MS_NOATIME { "atime", 0, 1, MS_NOATIME }, /* Update access time */ { "noatime", 0, 0, MS_NOATIME }, /* Do not update access time */ #endif #ifdef MS_NODIRATIME { "diratime", 0, 1, MS_NODIRATIME }, /* Update dir access times */ { "nodiratime", 0, 0, MS_NODIRATIME },/* Do not update dir access times */ #endif { NULL, 0, 0, 0 } }; char *opt_loopdev, *opt_vfstype, *opt_offset, *opt_encryption; struct string_opt_map { char *tag; int skip; char **valptr; } string_opt_map[] = { { "loop=", 0, &opt_loopdev }, { "vfs=", 1, &opt_vfstype }, { "offset=", 0, &opt_offset }, { "encryption=", 0, &opt_encryption }, { NULL, 0, NULL } }; static void clear_string_opts(void) { struct string_opt_map *m; for (m = &string_opt_map[0]; m->tag; m++) *(m->valptr) = NULL; } static int parse_string_opt(char *s) { struct string_opt_map *m; int lth; for (m = &string_opt_map[0]; m->tag; m++) { lth = strlen(m->tag); if (!strncmp(s, m->tag, lth)) { *(m->valptr) = xstrdup(s + lth); return 1; } } return 0; } int mount_mount_quiet=0; /* Report on a single mount. */ static void print_one (const struct mntentchn *mc) { if (mount_mount_quiet) return; printf ("%s on %s", mc->mnt_fsname, mc->mnt_dir); if (mc->mnt_type != NULL && *(mc->mnt_type) != '\0') printf (" type %s", mc->mnt_type); if (mc->mnt_opts != NULL) printf (" (%s)", mc->mnt_opts); printf ("\n"); } /* Report on everything in mtab (of the specified types if any). */ static int print_all (string_list types) { struct mntentchn *mc; for (mc = mtab_head()->nxt; mc; mc = mc->nxt) { if (matching_type (mc->mnt_type, types)) print_one (mc); } exit (0); } /* Look for OPT in opt_map table and return mask value. If OPT isn't found, tack it onto extra_opts (which is non-NULL). */ static inline void parse_opt (const char *opt, int *mask, char *extra_opts) { const struct opt_map *om; for (om = opt_map; om->opt != NULL; om++) if (streq (opt, om->opt)) { if (om->inv) *mask &= ~om->mask; else *mask |= om->mask; if (om->mask == MS_USER) *mask |= MS_SECURE; #ifdef MS_SILENT if (om->mask == MS_SILENT && om->inv) { mount_mount_quiet = 1; mount_verbose = 0; } #endif return; } if (*extra_opts) strcat(extra_opts, ","); strcat(extra_opts, opt); } /* Take -o options list and compute 4th and 5th args to mount(2). flags gets the standard options and extra_opts anything we don't recognize. */ static void parse_opts (char *opts, int *flags, char **extra_opts) { char *opt; *flags = 0; *extra_opts = NULL; clear_string_opts(); if (opts != NULL) { *extra_opts = xmalloc (strlen (opts) + 1); **extra_opts = '\0'; for (opt = strtok (opts, ","); opt; opt = strtok (NULL, ",")) if (!parse_string_opt (opt)) parse_opt (opt, flags, *extra_opts); } if (readonly) *flags |= MS_RDONLY; if (readwrite) *flags &= ~MS_RDONLY; } /* Try to build a canonical options string. */ static char * fix_opts_string (int flags, char *extra_opts) { const struct opt_map *om; const struct string_opt_map *m; char *new_opts; new_opts = (flags & MS_RDONLY) ? "ro" : "rw"; for (om = opt_map; om->opt != NULL; om++) { if (om->skip) continue; if (om->inv || !om->mask || (flags & om->mask) != om->mask) continue; new_opts = xstrconcat3(new_opts, ",", om->opt); flags &= ~om->mask; } for (m = &string_opt_map[0]; m->tag; m++) { if (!m->skip && *(m->valptr)) new_opts = xstrconcat4(new_opts, ",", m->tag, *(m->valptr)); } if (extra_opts && *extra_opts) { new_opts = xstrconcat3(new_opts, ",", extra_opts); } return new_opts; } /* Most file system types can be recognized by a `magic' number in the superblock. Note that the order of the tests is significant: by coincidence a filesystem can have the magic numbers for several file system types simultaneously. For example, the romfs magic lives in the 1st sector; xiafs does not touch the 1st sector and has its magic in the 2nd sector; ext2 does not touch the first two sectors. */ static inline unsigned short swapped(unsigned short a) { return (a>>8) | (a<<8); } /* char *fstype(const char *device); Probes the device and attempts to determine the type of filesystem contained within. Original routine by ; made into a function for mount(8) by Mike Grupenhoff . Read the superblock only once - aeb Added a test for iso9660 - aeb Added a test for high sierra (iso9660) - quinlan@bucknell.edu Corrected the test for xiafs - aeb Added romfs - aeb Added ufs from a patch by jj. But maybe there are several types of ufs? Currently supports: minix, ext, ext2, xiafs, iso9660, romfs, ufs */ char *magic_known[] = { "minix", "ext", "ext2", "xiafs", "iso9660", "romfs", "ufs" }; static int tested(const char *device) { char **m; for (m = magic_known; m - magic_known < SIZE(magic_known); m++) if (!strcmp(*m, device)) return 1; return 0; } static char * fstype(const char *device) { int fd; char *type = NULL; union { struct minix_super_block ms; struct ext_super_block es; struct ext2_super_block e2s; } sb; union { struct xiafs_super_block xiasb; char romfs_magic[8]; } xsb; struct ufs_super_block ufssb; union { struct iso_volume_descriptor iso; struct hs_volume_descriptor hs; } isosb; struct stat statbuf; /* opening and reading an arbitrary unknown path can have undesired side effects - first check that `device' refers to a block device */ if (stat (device, &statbuf) || !S_ISBLK(statbuf.st_mode)) return 0; fd = open(device, O_RDONLY); if (fd < 0) return 0; if (lseek(fd, 1024, SEEK_SET) != 1024 || read(fd, (char *) &sb, sizeof(sb)) != sizeof(sb)) goto io_error; if (ext2magic(sb.e2s) == EXT2_SUPER_MAGIC || ext2magic(sb.e2s) == EXT2_PRE_02B_MAGIC || ext2magic(sb.e2s) == swapped(EXT2_SUPER_MAGIC)) type = "ext2"; else if (minixmagic(sb.ms) == MINIX_SUPER_MAGIC || minixmagic(sb.ms) == MINIX_SUPER_MAGIC2) type = "minix"; else if (extmagic(sb.es) == EXT_SUPER_MAGIC) type = "ext"; if (!type) { if (lseek(fd, 0, SEEK_SET) != 0 || read(fd, (char *) &xsb, sizeof(xsb)) != sizeof(xsb)) goto io_error; if (xiafsmagic(xsb.xiasb) == _XIAFS_SUPER_MAGIC) type = "xiafs"; else if(!strncmp(xsb.romfs_magic, "-rom1fs-", 8)) type = "romfs"; } if (!type) { if (lseek(fd, 8192, SEEK_SET) != 8192 || read(fd, (char *) &ufssb, sizeof(ufssb)) != sizeof(ufssb)) goto io_error; if (ufsmagic(ufssb) == UFS_SUPER_MAGIC) /* also test swapped version? */ type = "ufs"; } if (!type) { if (lseek(fd, 0x8000, SEEK_SET) != 0x8000 || read(fd, (char *) &isosb, sizeof(isosb)) != sizeof(isosb)) goto io_error; if(strncmp(isosb.iso.id, ISO_STANDARD_ID, sizeof(isosb.iso.id)) == 0 || strncmp(isosb.hs.id, HS_STANDARD_ID, sizeof(isosb.hs.id)) == 0) type = "iso9660"; } close (fd); return(type); io_error: perror(device); close(fd); return 0; } FILE *procfs; static void procclose(void) { if (procfs) fclose (procfs); procfs = 0; } static int procopen(void) { return ((procfs = fopen(PROC_FILESYSTEMS, "r")) != NULL); } static char * procnext(void) { char line[100]; static char fsname[50]; while (fgets(line, sizeof(line), procfs)) { if (sscanf (line, "nodev %[^\n]\n", fsname) == 1) continue; if (sscanf (line, " %[^ \n]\n", fsname) != 1) continue; return fsname; } return 0; } static int is_in_proc(char *type) { char *fsname; if (procopen()) { while ((fsname = procnext()) != NULL) if (!strcmp(fsname, type)) return 1; } return 0; } static int already (char *spec, char *node) { struct mntentchn *mc; int ret = 1; if ((mc = getmntfile(node)) != NULL) error ("mount: according to mtab, %s is already mounted on %s", mc->mnt_fsname, node); else if ((mc = getmntfile(spec)) != NULL) error ("mount: according to mtab, %s is mounted on %s", spec, mc->mnt_dir); else ret = 0; return ret; } /* Create mtab with a root entry. */ static void create_mtab (void) { struct mntentchn *fstab; struct mntent mnt; int flags; char *extra_opts; mntFILE *mfp; lock_mtab(); mfp = my_setmntent (MOUNTED, "a+"); if (mfp == NULL || mfp->mntent_fp == NULL) die (EX_FILEIO, "mount: can't open %s for writing: %s", MOUNTED, strerror (errno)); /* Find the root entry by looking it up in fstab */ if ((fstab = getfsfile ("/")) || (fstab = getfsfile ("root"))) { parse_opts (xstrdup (fstab->mnt_opts), &flags, &extra_opts); mnt.mnt_dir = "/"; mnt.mnt_fsname = canonicalize (fstab->mnt_fsname); mnt.mnt_type = fstab->mnt_type; mnt.mnt_opts = fix_opts_string (flags, extra_opts); mnt.mnt_freq = mnt.mnt_passno = 0; if (my_addmntent (mfp, &mnt) == 1) die (EX_FILEIO, "mount: error writing %s: %s", MOUNTED, strerror (errno)); } if (fchmod (fileno (mfp->mntent_fp), S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) if (errno != EROFS) die (EX_FILEIO, "mount: error changing mode of %s: %s", MOUNTED, strerror (errno)); my_endmntent (mfp); unlock_mtab(); } /* count successful mount system calls */ static int mountcount = 0; static int mount5 (char *special, char *dir, char *type, int flags, void *data) { int ret = mount (special, dir, type, 0xC0ED0000 | (flags), data); if (ret == 0) mountcount++; return ret; } /* Mount a single file system. Return status, so don't exit on non-fatal errors. */ static int try_mount5 (char *spec, char *node, char **type, int flags, char *mount_opts) { char *fsname; if (*type && strcasecmp (*type, "auto") == 0) *type = NULL; if (!*type && !(flags & MS_REMOUNT)) { *type = fstype(spec); if (mount_verbose) { printf ("mount: you didn't specify a filesystem type for %s\n", spec); if (*type) printf (" I will try type %s\n", *type); else printf (" I will try all types mentioned in %s\n", PROC_FILESYSTEMS); } } if (*type || (flags & MS_REMOUNT)) return mount5 (spec, node, *type, flags & ~MS_NOSYS, mount_opts); if (!procopen()) return -1; while ((fsname = procnext()) != NULL) { if (tested (fsname)) continue; if (mount5 (spec, node, fsname, flags & ~MS_NOSYS, mount_opts) == 0) { *type = xstrdup(fsname); procclose(); return 0; } else if (errno != EINVAL) { *type = "guess"; procclose(); return 1; } } procclose(); *type = NULL; return -1; } /* * try_mount_one() * Try to mount one file system. When "bg" is 1, this is a retry * in the background. One additional exit code EX_BG is used here. * It is used to instruct the caller to retry the mount in the * background. */ static int try_mount_one (char *spec0, char *node0, char *type0, char *opts0, int freq, int pass, int bg) { struct mntentchn mcn; struct mntent mnt; int mnt_err; int flags; char *extra_opts; /* written in mtab */ char *mount_opts; /* actually used on system call */ static int added_ro = 0; int loop, looptype, offset; char *spec, *node, *type, *opts, *loopdev, *loopfile; struct stat statbuf; spec = xstrdup(spec0); node = xstrdup(node0); type = xstrdup(type0); opts = xstrdup(opts0); parse_opts (xstrdup (opts), &flags, &extra_opts); /* root may allow certain types of mounts by ordinary users */ if (mount_suid && !(flags & MS_USER)) { if (already (spec, node)) die (EX_USAGE, "mount failed"); else die (EX_USAGE, "mount: only root can mount %s on %s", spec, node); } /* quietly succeed for fstab entries that don't get mounted automatically */ if (all && (flags & MS_NOAUTO)) return 0; mount_opts = extra_opts; /* * In the case of a loop mount, either type is of the form lo@/dev/loop5 * or the option "-o loop=/dev/loop5" or just "-o loop" is given, or * mount just has to figure things out for itself from the fact that * spec is not a block device. We do not test for a block device * immediately: maybe later other types of mountable objects will occur. */ loopdev = opt_loopdev; looptype = (type && strncmp("lo@", type, 3) == 0); if (looptype) { if (loopdev) error("mount: loop device specified twice"); loopdev = type+3; type = opt_vfstype; } else if (opt_vfstype) { if (type) error("mount: type specified twice"); else type = opt_vfstype; } loop = ((flags & MS_LOOP) || loopdev || opt_offset || opt_encryption); loopfile = spec; if (loop) { flags |= MS_LOOP; if (fake) { if (mount_verbose) printf("mount: skipping the setup of a loop device\n"); } else { int loopro = (flags & MS_RDONLY); if (!loopdev || !*loopdev) loopdev = find_unused_loop_device(); if (!loopdev) return EX_SYSERR; /* no more loop devices */ if (mount_verbose) printf("mount: going to use the loop device %s\n", loopdev); offset = opt_offset ? strtoul(opt_offset, NULL, 0) : 0; if (set_loop (loopdev, loopfile, offset, opt_encryption, &loopro)) return EX_FAIL; spec = loopdev; if (loopro) flags |= MS_RDONLY; } } if (!fake && type && streq (type, "nfs")) { #if HAVE_NFS mnt_err = nfsmount (spec, node, &flags, &extra_opts, &mount_opts, bg); if (mnt_err) return mnt_err; #else die (EX_SOFTWARE, "mount: this version was compiled " "without support for the type `nfs'"); #endif } /* * Call mount.TYPE for types that require a separate * mount program. For the moment these types are ncp and smb. */ if (type) #ifndef ALWAYS_STAT if (streq (type, "smb") || streq (type, "ncp")) #else if (strlen (type) < 100) #endif { char mountprog[120]; sprintf(mountprog, "/sbin/mount.%s", type); if (stat(mountprog, &statbuf) == 0) { if (fork() == 0) { char *oo, *mountargs[10]; int i = 0; setuid(getuid()); setgid(getgid()); oo = fix_opts_string (flags, extra_opts); mountargs[i++] = mountprog; mountargs[i++] = spec; mountargs[i++] = node; if (mount_nomtab) mountargs[i++] = "-n"; if (mount_verbose) mountargs[i++] = "-v"; if (oo && *oo) { mountargs[i++] = "-o"; mountargs[i++] = oo; } mountargs[i] = NULL; execv(mountprog, mountargs); exit(1); /* exec failed */ } else if (fork() != -1) { int status; wait(&status); return status; } else error("cannot fork: %s", strerror(errno)); } } block_signals (SIG_BLOCK); if (fake || (try_mount5 (spec, node, &type, flags & ~MS_NOSYS, mount_opts)) == 0) /* Mount succeeded, report this (if mount_verbose) and write mtab entry. */ { if (loop) opt_loopdev = loopdev; mcn.mnt_fsname = mnt.mnt_fsname = canonicalize (loop ? loopfile : spec); mcn.mnt_dir = mnt.mnt_dir = canonicalize (node); mcn.mnt_type = mnt.mnt_type = type ? type : "unknown"; mcn.mnt_opts = mnt.mnt_opts = fix_opts_string (flags & ~MS_NOMTAB, extra_opts); mcn.nxt = 0; mnt.mnt_freq = freq; mnt.mnt_passno = pass; /* We get chatty now rather than after the update to mtab since the mount succeeded, even if the write to /etc/mtab should fail. */ if (mount_verbose) print_one (&mcn); if (!mount_nomtab && mtab_is_writable()) { if (flags & MS_REMOUNT) update_mtab (mnt.mnt_dir, &mnt); else { mntFILE *mfp; lock_mtab(); mfp = my_setmntent(MOUNTED, "a+"); if (mfp == NULL || mfp->mntent_fp == NULL) { error("mount: can't open %s: %s", MOUNTED, strerror (errno)); } else { if ((my_addmntent (mfp, &mnt)) == 1) error("mount: error writing %s: %s", MOUNTED, strerror (errno)); my_endmntent(mfp); } unlock_mtab(); } } block_signals (SIG_UNBLOCK); return 0; } mnt_err = errno; if (loop) del_loop(spec); block_signals (SIG_UNBLOCK); /* Mount failed, complain, but don't die. */ if (type == 0) error ("mount: you must specify the filesystem type"); else switch (mnt_err) { case EPERM: if (geteuid() == 0) { if (stat (node, &statbuf) || !S_ISDIR(statbuf.st_mode)) error ("mount: mount point %s is not a directory", node); else error ("mount: permission denied"); } else error ("mount: must be superuser to use mount"); break; case EBUSY: if (flags & MS_REMOUNT) { error ("mount: %s is busy", node); } else if (!strcmp(type, "proc") && !strcmp(node, "/proc")) { /* heuristic: if /proc/version exists, then probably proc is mounted */ if (stat ("/proc/version", &statbuf)) /* proc mounted? */ error ("mount: %s is busy", node); /* no */ else if(!all || mount_verbose) /* yes, don't mention it */ error ("mount: proc already mounted"); } else { error ("mount: %s already mounted or %s busy", spec, node); already (spec, node); } break; case ENOENT: if (lstat (node, &statbuf)) error ("mount: mount point %s does not exist", node); else if (stat (node, &statbuf)) error ("mount: mount point %s is a symbolic link to nowhere", node); else if (stat (spec, &statbuf)) error ("mount: special device %s does not exist", spec); else { errno = mnt_err; perror("mount"); } break; case ENOTDIR: error ("mount: mount point %s is not a directory", node); break; case EINVAL: { int fd, size; if (flags & MS_REMOUNT) { error ("mount: %s not mounted already, or bad option", node); } else { error ("mount: wrong fs type, bad option, bad superblock on %s,\n" " or too many mounted file systems", spec); if (stat (spec, &statbuf) == 0 && S_ISBLK(statbuf.st_mode) && (fd = open(spec, O_RDONLY)) >= 0) { if(ioctl(fd, BLKGETSIZE, &size) == 0 && size <= 2) error (" (aren't you trying to mount an extended partition,\n" " instead of some logical partition inside?)"); close(fd); } } break; } case EMFILE: error ("mount table full"); break; case EIO: error ("mount: %s: can't read superblock", spec); break; case ENODEV: if (is_in_proc(type) || !strcmp(type, "guess")) error("mount: %s has wrong major or minor number", spec); else if (procfs) { char *lowtype, *p; int u; error ("mount: fs type %s not supported by kernel", type); /* maybe this loser asked for FAT or ISO9660 or isofs */ lowtype = xstrdup(type); u = 0; for(p=lowtype; *p; p++) { if(tolower(*p) != *p) { *p = tolower(*p); u++; } } if (u && is_in_proc(lowtype)) error ("mount: probably you meant %s", lowtype); else if (!strncmp(lowtype, "iso", 3) && is_in_proc("iso9660")) error ("mount: maybe you meant iso9660 ?"); free(lowtype); } else error ("mount: %s has wrong device number or fs type %s not supported", spec, type); break; case ENOTBLK: if (stat (spec, &statbuf)) /* strange ... */ error ("mount: %s is not a block device, and stat fails?", spec); else if (S_ISBLK(statbuf.st_mode)) error ("mount: the kernel does not recognize %s as a block device\n" " (maybe `insmod driver'?)", spec); else if (S_ISREG(statbuf.st_mode)) error ("mount: %s is not a block device (maybe try `-o loop'?)", spec); else error ("mount: %s is not a block device", spec); break; case ENXIO: error ("mount: %s is not a valid block device", spec); break; case EACCES: /* pre-linux 1.1.38, 1.1.41 and later */ case EROFS: /* linux 1.1.38 and later */ if (added_ro) { error ("mount: block device %s is not permitted on its filesystem", spec); break; } else { added_ro = 1; if (loop) { opts = opts0; type = type0; } if (opts) { opts = realloc(xstrdup(opts), strlen(opts)+4); strcat(opts, ",ro"); } else opts = "ro"; if (type && !strcmp(type, "guess")) type = 0; error ("mount: %s%s is write-protected, mounting read-only", loop ? "" : "block device ", spec0); return try_mount_one (spec0, node0, type, opts, freq, pass, bg); } break; default: error ("mount: %s", strerror (mnt_err)); break; } return EX_FAIL; } /* * set_proc_name() * Update the argument vector, so that this process may be easily * identified in a "ps" listing. */ static void set_proc_name (char *spec) { #ifdef DO_PS_FIDDLING int i, l; /* * Move the environment so we can reuse the memory. * (Code borrowed from sendmail.) * WARNING: ugly assumptions on memory layout here; if this ever causes * problems, #undef DO_PS_FIDDLING */ for (i = 0; envp0[i] != NULL; i++) continue; environ = (char **) xmalloc(sizeof(char *) * (i + 1)); for (i = 0; envp0[i] != NULL; i++) environ[i] = xstrdup(envp0[i]); environ[i] = NULL; if (i > 0) l = envp0[i-1] + strlen(envp0[i-1]) - argv0[0]; else l = argv0[argc0-1] + strlen(argv0[argc0-1]) - argv0[0]; if (l > sizeof(PROC_NAME)) { strcpy(argv0[0], PROC_NAME); strncpy(argv0[0] + sizeof(PROC_NAME) - 1, spec, l - sizeof(PROC_NAME) - 1); argv0[1] = NULL; } #endif } int mount_one (char *spec, char *node, char *type, char *opts, char *cmdlineopts, int freq, int pass) { int status; int status2; /* Merge the fstab and command line options. */ if (opts == NULL) opts = cmdlineopts; else if (cmdlineopts != NULL) opts = xstrconcat3(opts, ",", cmdlineopts); if (type == NULL) { if (strchr (spec, ':') != NULL) { type = "nfs"; if (mount_verbose) printf("mount: no type was given - " "I'll assume nfs because of the colon\n"); } } /* * Try to mount the file system. When the exit status is EX_BG, * we will retry in the background. Otherwise, we're done. */ status = try_mount_one (spec, node, type, opts, freq, pass, 0); if (status != EX_BG) return status; /* * Retry in the background. */ printf ("mount: backgrounding \"%s\"\n", spec); fflush( stdout ); /* prevent duplicate output */ if (fork() > 0) return 0; /* parent returns "success" */ spec = xstrdup(spec); /* arguments will be destroyed */ node = xstrdup(node); /* by set_proc_name() */ type = xstrdup(type); opts = xstrdup(opts); set_proc_name (spec); /* make a nice "ps" listing */ status2 = try_mount_one (spec, node, type, opts, freq, pass, 1); if (mount_verbose && status2) printf ("mount: giving up \"%s\"\n", spec); exit (0); /* child stops here */ } /* Check if an fsname/dir pair was already in the old mtab. */ static int mounted (char *spec, char *node) { struct mntentchn *mc; spec = canonicalize (spec); node = canonicalize (node); for (mc = mtab_head()->nxt; mc; mc = mc->nxt) if (streq (spec, mc->mnt_fsname) && streq (node, mc->mnt_dir)) return 1; return 0; } /* Mount all filesystems of the specified types except swap and root. */ /* With the --fork option: fork and let different incarnations of mount handle different filesystems. However, try to avoid several simultaneous mounts on the same physical disk, since that is very slow. */ #define DISKMAJOR(m) (((int) m) & ~0xf) static int mount_all (string_list types, char *options) { struct mntentchn *mc, *mtmp; int status = 0; struct stat statbuf; struct child { pid_t pid; char *group; struct mntentchn *mec; struct mntentchn *meclast; struct child *nxt; } childhead, *childtail, *cp; char major[22]; char *g, *colon; /* build a chain of what we have to do, or maybe several chains, one for each major or NFS host */ childhead.nxt = 0; childtail = &childhead; for (mc = fstab_head()->nxt; mc; mc = mc->nxt) { if (matching_type (mc->mnt_type, types) && !streq (mc->mnt_dir, "/") && !streq (mc->mnt_dir, "root")) { if (mounted (mc->mnt_fsname, mc->mnt_dir)) { if (mount_verbose) printf("mount: %s already mounted on %s\n", mc->mnt_fsname, mc->mnt_dir); } else { mtmp = (struct mntentchn *) xmalloc(sizeof(*mtmp)); *mtmp = *mc; mtmp->nxt = 0; g = NULL; if (optfork) { if (stat(mc->mnt_fsname, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) { sprintf(major, "#%x", DISKMAJOR(statbuf.st_rdev)); g = major; } #if HAVE_NFS if (strcmp(mc->mnt_type, "nfs") == 0) { g = xstrdup(mc->mnt_fsname); colon = strchr(g, ':'); if (colon) *colon = '\0'; } #endif } if (g) { for (cp = childhead.nxt; cp; cp = cp->nxt) if (cp->group && strcmp(cp->group, g) == 0) { cp->meclast->nxt = mtmp; cp->meclast = mtmp; goto fnd; } } cp = (struct child *) xmalloc(sizeof *cp); cp->nxt = 0; cp->mec = cp->meclast = mtmp; cp->group = xstrdup(g); cp->pid = 0; childtail->nxt = cp; childtail = cp; fnd:; } } } /* now do everything */ for (cp = childhead.nxt; cp; cp = cp->nxt) { pid_t p = -1; if (optfork) { p = fork(); if (p == -1) error("mount: cannot fork: %s", strerror (errno)); else if (p != 0) cp->pid = p; } /* if child, or not forked, do the mounting */ if (p == 0 || p == -1) { for (mc = cp->mec; mc; mc = mc->nxt) status |= mount_one (mc->mnt_fsname, mc->mnt_dir, mc->mnt_type, mc->mnt_opts, options, 0, 0); if (mountcount) status |= EX_SOMEOK; if (p == 0) exit(status); } } /* wait for children, if any */ while ((cp = childhead.nxt) != NULL) { childhead.nxt = cp->nxt; if (cp->pid) { int ret; keep_waiting: if(waitpid(cp->pid, &ret, 0) == -1) { if (errno == EINTR) goto keep_waiting; perror("waitpid"); } else if (WIFEXITED(ret)) status |= WEXITSTATUS(ret); else status |= EX_SYSERR; } } if (mountcount) status |= EX_SOMEOK; return status; } extern char version[]; static struct option longopts[] = { { "all", 0, 0, 'a' }, { "fake", 0, 0, 'f' }, { "fork", 0, 0, 'F' }, { "help", 0, 0, 'h' }, { "no-mtab", 0, 0, 'n' }, { "read-only", 0, 0, 'r' }, { "ro", 0, 0, 'r' }, { "mount_verbose", 0, 0, 'v' }, { "version", 0, 0, 'V' }, { "read-write", 0, 0, 'w' }, { "rw", 0, 0, 'w' }, { "options", 1, 0, 'o' }, { "types", 1, 0, 't' }, { NULL, 0, 0, 0 } }; const char *mount_usage_string = "\ usage: mount [-hV]\n\ mount -a [-nfFrsvw] [-t vfstypes]\n\ mount [-nfrsvw] [-o options] special | node\n\ mount [-nfrsvw] [-t vfstype] [-o options] special node\n\ "; static void usage (FILE *fp, int n) { fprintf (fp, "%s", mount_usage_string); unlock_mtab(); exit (n); } int main_but_defunct (int argc, char *argv[]) { int c, result = 0; char *options = NULL, *spec; string_list types = NULL; struct mntentchn *mc; int fd; /* People report that a mount called from init without console writes error messages to /etc/mtab Let us try to avoid getting fd's 0,1,2 */ while((fd = open("/dev/null", O_RDWR)) == 0 || fd == 1 || fd == 2) ; if (fd > 2) close(fd); #ifdef DO_PS_FIDDLING argc0 = argc; argv0 = argv; envp0 = environ; #endif while ((c = getopt_long (argc, argv, "afFhno:rsvVwt:", longopts, NULL)) != EOF) switch (c) { case 'a': /* mount everything in fstab */ ++all; break; case 'f': /* fake (don't actually do mount(2) call) */ ++fake; break; case 'F': ++optfork; break; case 'h': /* help */ usage (stdout, 0); break; case 'n': /* mount without writing in /etc/mtab */ ++mount_nomtab; break; case 'o': /* specify mount options */ if (options) options = xstrconcat3(options, ",", optarg); else options = xstrdup(optarg); break; case 'r': /* mount readonly */ readonly = 1; readwrite = 0; break; case 's': /* allow sloppy mount options */ sloppy = 1; break; case 't': /* specify file system types */ types = parse_list (optarg); break; case 'v': /* be chatty - very chatty if repeated */ ++mount_verbose; break; case 'V': /* version */ printf ("mount: %s\n", version); exit (0); case 'w': /* mount read/write */ readwrite = 1; readonly = 0; break; case 0: break; case '?': default: usage (stderr, EX_USAGE); } argc -= optind; argv += optind; if (argc == 0 && !all) { if (options) usage (stderr, EX_USAGE); return print_all (types); } if (getuid () != geteuid ()) { mount_suid = 1; if (types || options || readwrite || mount_nomtab || all || fake || argc != 1) die (EX_USAGE, "mount: only root can do that"); } if (!mount_nomtab && mtab_does_not_exist()) { if (mount_verbose > 1) printf("mount: no %s found - creating it..\n", MOUNTED); create_mtab (); } switch (argc) { case 0: /* mount -a */ result = mount_all (types, options); if (result == 0 && mount_verbose) error("not mounted anything"); break; case 1: /* mount [-nfrvw] [-o options] special | node */ if (types != NULL) usage (stderr, EX_USAGE); /* Try to find the other pathname in fstab. */ spec = canonicalize (*argv); if ((mc = getmntfile (spec)) == NULL && (mc = getfsspec (spec)) == NULL && (mc = getfsfile (spec)) == NULL && /* Try noncanonical name in fstab perhaps /dev/cdrom or /dos is a symlink */ (mc = getfsspec (*argv)) == NULL && (mc = getfsfile (*argv)) == NULL) die (EX_USAGE, "mount: can't find %s in %s or %s", spec, MOUNTED, _PATH_FSTAB); result = mount_one (xstrdup (mc->mnt_fsname), xstrdup (mc->mnt_dir), xstrdup (mc->mnt_type), mc->mnt_opts, options, 0, 0); break; case 2: /* mount [-nfrvw] [-t vfstype] [-o options] special node */ if (types == NULL) result = mount_one (argv[0], argv[1], NULL, NULL, options, 0, 0); else if (cdr (types) == NULL) result = mount_one (argv[0], argv[1], car (types), NULL, options, 0, 0); else usage (stderr, EX_USAGE); break; default: usage (stderr, EX_USAGE); } if (result == EX_SOMEOK) result = 0; exit (result); } watchdog-5.13/src/mntent.c0000644000175000017500000001050212102721740015262 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/mntent.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ /* Private version of the libc *mntent() routines. */ /* Note slightly different prototypes. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* for strchr */ #include /* for isdigit */ #include "wd_mntent.h" #include "sundries.h" /* for xmalloc */ /* Unfortunately the classical Unix /etc/mtab and /etc/fstab do not handle directory names containing spaces. Here we mangle them, replacing a space by \040. What do other Unices do? */ static char need_escaping[] = { ' ', '\t', '\n', '\\' }; static char * mangle(const char *s) { char *ss, *sp; int n; n = (int) strlen(s); ss = sp = xmalloc(4*n+1); while(1) { for (n = 0; n < sizeof(need_escaping); n++) { if (*s == need_escaping[n]) { *sp++ = '\\'; *sp++ = '0' + ((*s & 0300) >> 6); *sp++ = '0' + ((*s & 070) >> 3); *sp++ = '0' + (*s & 07); goto next; } } *sp++ = *s; if (*s == 0) break; next: s++; } return ss; } static int is_space_or_tab (char c) { return (c == ' ' || c == '\t'); } static char * skip_spaces(char *s) { while (is_space_or_tab(*s)) s++; return s; } static char * skip_nonspaces(char *s) { while (*s && !is_space_or_tab(*s)) s++; return s; } #define isoctal(a) (((a) & ~7) == '0') /* returns malloced pointer - no more strdup required */ static char * unmangle(char *s) { char *ret, *ss, *sp; ss = skip_nonspaces(s); ret = sp = xmalloc(ss-s+1); while(s != ss) { if (*s == '\\' && isoctal(s[1]) && isoctal(s[2]) && isoctal(s[3])) { *sp++ = 64*(s[1] & 7) + 8*(s[2] & 7) + (s[3] & 7); s += 4; } else *sp++ = *s++; } *sp = 0; return ret; } /* * fstat'ing the file and allocating a buffer holding all of it * may be a bad idea: if the file is /proc/mounttab, the stat * returns 0. * (On the other hand, mangling and unmangling is meaningless * for /proc/mounttab.) */ mntFILE * my_setmntent (const char *file, char *mode) { mntFILE *mfp = xmalloc(sizeof(*mfp)); mfp->mntent_fp = fopen (file, mode); mfp->mntent_file = xstrdup(file); mfp->mntent_errs = (mfp->mntent_fp == NULL); mfp->mntent_softerrs = 0; mfp->mntent_lineno = 0; return mfp; } void my_endmntent (mntFILE *mfp) { if (mfp) { if (mfp->mntent_fp) fclose(mfp->mntent_fp); if (mfp->mntent_file) free(mfp->mntent_file); free(mfp); } } int my_addmntent (mntFILE *mfp, struct mntent *mnt) { char *m1, *m2, *m3, *m4; int res; if (fseek (mfp->mntent_fp, 0, SEEK_END)) return 1; /* failure */ m1 = mangle(mnt->mnt_fsname); m2 = mangle(mnt->mnt_dir); m3 = mangle(mnt->mnt_type); m4 = mangle(mnt->mnt_opts); res = ((fprintf (mfp->mntent_fp, "%s %s %s %s %d %d\n", m1, m2, m3, m4, mnt->mnt_freq, mnt->mnt_passno) < 0) ? 1 : 0); free(m1); free(m2); free(m3); free(m4); return res; } /* Read the next entry from the file fp. Stop reading at an incorrect entry. */ struct mntent * my_getmntent (mntFILE *mfp) { static char buf[4096]; static struct mntent me; char *s; again: if (mfp->mntent_errs || mfp->mntent_softerrs >= ERR_MAX) return NULL; /* read the next non-blank non-comment line */ do { if (fgets (buf, sizeof(buf), mfp->mntent_fp) == NULL) return NULL; s = strchr (buf, '\n'); if (s == NULL) { /* extremely long line - assume file was corrupted */ mfp->mntent_errs = 1; goto err; } *s = 0; s = skip_spaces(buf); } while (*s == '\0' || *s == '#'); me.mnt_fsname = unmangle(s); s = skip_nonspaces(s); s = skip_spaces(s); me.mnt_dir = unmangle(s); s = skip_nonspaces(s); s = skip_spaces(s); me.mnt_type = unmangle(s); s = skip_nonspaces(s); s = skip_spaces(s); me.mnt_opts = unmangle(s); s = skip_nonspaces(s); s = skip_spaces(s); if(isdigit(*s)) { me.mnt_freq = atoi(s); while(isdigit(*s)) s++; } else me.mnt_freq = 0; if(*s && !is_space_or_tab(*s)) goto err; s = skip_spaces(s); if(isdigit(*s)) { me.mnt_passno = atoi(s); while(isdigit(*s)) s++; } else me.mnt_passno = 0; if(*s && !is_space_or_tab(*s)) goto err; /* allow more stuff, e.g. comments, on this line */ return &me; err: mfp->mntent_softerrs++; fprintf(stderr, "[mntent]: line %d in %s is bad%s\n", mfp->mntent_lineno, mfp->mntent_file, (mfp->mntent_errs || mfp->mntent_softerrs >= ERR_MAX) ? "; rest of file ignored" : ""); goto again; } watchdog-5.13/src/sundries.c0000644000175000017500000001165512102721740015623 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/sundries.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ /* * Support functions. Exported functions are prototyped in sundries.h. * sundries.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp * * added fcntl locking by Kjetil T. (kjetilho@math.uio.no) - aeb, 950927 */ #include #include #include #include /* for MNTTYPE_SWAP */ #include "fstab.h" #include "sundries.h" /* String list constructor. (car() and cdr() are defined in "sundries.h"). */ string_list cons (char *a, const string_list b) { string_list p; p = xmalloc (sizeof *p); car (p) = a; cdr (p) = b; return p; } void * xmalloc (size_t size) { void *t; if (size == 0) return NULL; t = malloc (size); if (t == NULL) die (EX_SYSERR, "not enough memory"); return t; } char * xstrdup (const char *s) { char *t; if (s == NULL) return NULL; t = strdup (s); if (t == NULL) die (EX_SYSERR, "not enough memory"); return t; } char * xstrndup (const char *s, int n) { char *t; if (s == NULL) die (EX_SOFTWARE, "bug in xstrndup call"); t = xmalloc(n+1); strncpy(t,s,n); t[n] = 0; return t; } char * xstrconcat2 (const char *s, const char *t) { char *res; if (!s) s = ""; if (!t) t = ""; res = xmalloc(strlen(s) + strlen(t) + 1); strcpy(res, s); strcat(res, t); return res; } char * xstrconcat3 (const char *s, const char *t, const char *u) { char *res; if (!s) s = ""; if (!t) t = ""; if (!u) u = ""; res = xmalloc(strlen(s) + strlen(t) + strlen(u) + 1); strcpy(res, s); strcat(res, t); strcat(res, u); return res; } char * xstrconcat4 (const char *s, const char *t, const char *u, const char *v) { char *res; if (!s) s = ""; if (!t) t = ""; if (!u) u = ""; if (!v) v = ""; res = xmalloc(strlen(s) + strlen(t) + strlen(u) + strlen(v) + 1); strcpy(res, s); strcat(res, t); strcat(res, u); strcat(res, v); return res; } /* Call this with SIG_BLOCK to block and SIG_UNBLOCK to unblock. */ void block_signals (int how) { sigset_t sigs; sigfillset (&sigs); sigdelset(&sigs, SIGTRAP); sigdelset(&sigs, SIGSEGV); sigprocmask (how, &sigs, (sigset_t *) 0); } /* Non-fatal error. Print message and return. */ /* (print the message in a single printf, in an attempt to avoid mixing output of several threads) */ void error (const char *fmt, ...) { va_list args; char *fmt2; if (mount_mount_quiet) return; fmt2 = xstrconcat2 (fmt, "\n"); va_start (args, fmt); vfprintf (stderr, fmt2, args); va_end (args); free (fmt2); } /* Fatal error. Print message and exit. */ void die (int err, const char *fmt, ...) { va_list args; va_start (args, fmt); vfprintf (stderr, fmt, args); fprintf (stderr, "\n"); va_end (args); unlock_mtab (); exit (err); } /* Parse a list of strings like str[,str]... into a string list. */ string_list parse_list (char *strings) { string_list list; char *t; if (strings == NULL) return NULL; list = cons (strtok (strings, ","), NULL); while ((t = strtok (NULL, ",")) != NULL) list = cons (t, list); return list; } /* True if fstypes match. Null *TYPES means match anything, except that swap types always return false. This routine has some ugliness to deal with ``no'' types. Fixed bug: the `no' part comes at the end - aeb, 970216 */ int matching_type (const char *type, string_list types) { char *notype; int foundyes, foundno; int no; /* true if a "no" type match, eg -t nominix */ if (streq (type, MNTTYPE_SWAP)) return 0; if (types == NULL) return 1; if ((notype = alloca (strlen (type) + 3)) == NULL) die (EX_SYSERR, "mount: out of memory"); sprintf (notype, "no%s", type); foundyes = foundno = no = 0; while (types != NULL) { if (cdr (types) == NULL) no = (car (types)[0] == 'n') && (car (types)[1] == 'o'); if (streq (type, car (types))) foundyes = 1; else if (streq (notype, car (types))) foundno = 1; types = cdr (types); } return (foundno ? 0 : (no ^ foundyes)); } /* Make a canonical pathname from PATH. Returns a freshly malloced string. It is up the *caller* to ensure that the PATH is sensible. i.e. canonicalize ("/dev/fd0/.") returns "/dev/fd0" even though ``/dev/fd0/.'' is not a legal pathname for ``/dev/fd0''. Anything we cannot parse we return unmodified. */ char * canonicalize (const char *path) { char *canonical; if (path == NULL) return NULL; if (streq(path, "none") || streq(path, "proc")) return xstrdup(path); canonical = xmalloc (PATH_MAX + 1); if (realpath (path, canonical)) return canonical; free(canonical); return xstrdup(path); } watchdog-5.13/src/load.c0000644000175000017500000000416412102721740014703 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/load.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "extern.h" #include "watch_err.h" #if USE_SYSLOG #include #endif int check_load(void) { int avg1, avg5, avg15; char buf[40], *ptr; /* is the load average file open? */ if (load == -1 || maxload1 == 0 || maxload5 == 0 || maxload15 == 0) return (ENOERR); /* position pointer at start of file */ if (lseek(load, 0, SEEK_SET) < 0) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "lseek /proc/loadavg gave errno = %d = '%m'", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); return (ENOERR); } /* read the line (there is only one) */ if (read(load, buf, sizeof(buf)) < 0) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "read /proc/loadavg gave errno = %d = '%m'", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); return (ENOERR); } /* we only care about integer values */ avg1 = atoi(buf); /* if we have incorrect data we might not be able to find */ /* the blanks we're looking for */ ptr = strchr(buf, ' '); if (ptr != NULL) { avg5 = atoi(ptr); ptr = strchr(ptr + 1, ' '); } if (ptr != NULL) avg15 = atoi(ptr); else { #if USE_SYSLOG syslog(LOG_ERR, "/proc/loadavg does not contain any data (read = %s)", buf); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (ENOLOAD); return (ENOERR); } #if USE_SYSLOG if (verbose && logtick && ticker == 1) syslog(LOG_INFO, "current load is %d %d %d", avg1, avg5, avg15); #endif /* USE_SYSLOG */ if (avg1 > maxload1 || avg5 > maxload5 || avg15 > maxload15) { #if USE_SYSLOG syslog(LOG_ERR, "loadavg %d %d %d is higher than the given threshold %d %d %d!", avg1, avg5, avg15, maxload1, maxload5, maxload15); #endif /* USE_SYSLOG */ return (EMAXLOAD); } return (ENOERR); } watchdog-5.13/src/pidfile.c0000644000175000017500000000536712102721740015406 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/pidfile.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include "extern.h" #include "watch_err.h" #if USE_SYSLOG #include #endif int check_pidfile(struct list *file) { int fd = open(file->name, O_RDONLY), pid; char buf[10]; if (fd == -1) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "cannot open %s (errno = %d = '%m')", file->name, err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ /* on error ENETDOWN|ENETUNREACH we react as if we're in ping mode * on ENOENT we assume that the server to be monitored has exited */ if (softboot || err == ENETDOWN || err == ENETUNREACH || err == ENOENT ) return (err); return(ENOERR); } /* position pointer at start of file */ if (lseek(fd, 0, SEEK_SET) < 0) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "lseek %s gave errno = %d = '%m'", file->name, err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ close(fd); if (softboot) return (err); return (ENOERR); } /* just to play it safe */ memset(buf, 0, sizeof(buf)); /* read the line (there is only one) */ if (read(fd, buf, sizeof(buf)) < 0) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "read %s gave errno = %d = '%m'", file->name, err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ close(fd); if (softboot) return (err); return (ENOERR); } /* we only care about integer values */ pid = atoi(buf); if (close(fd) == -1) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "could not close %s, errno = %d = '%m'", file->name, err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); return (ENOERR); } if (kill (pid, 0) == -1) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "pinging process %d (%s) gave errno = %d = '%m'", pid, file->name, err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot || err == ESRCH) return (err); return (ENOERR); } #if USE_SYSLOG /* do verbose logging */ if (verbose && logtick && ticker == 1) syslog(LOG_INFO, "was able to ping process %d (%s).", pid, file->name); #endif return (ENOERR); } watchdog-5.13/src/lomount.c0000644000175000017500000001561512102721740015464 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/lomount.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ /* Taken from Ted's losetup.c - Mitch */ /* Added vfs mount options - aeb - 960223 */ /* Removed lomount - aeb - 960224 */ #define PROC_DEVICES "/proc/devices" /* * losetup.c - setup and control loop devices */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include "loop.h" #include "lomount.h" char *xstrdup (const char *s); /* not: #include "sundries.h" */ void error (const char *fmt, ...); /* idem */ #ifdef LOOP_SET_FD struct crypt_type_struct { int id; char *name; } crypt_type_tbl[] = { { LO_CRYPT_NONE, "no" }, { LO_CRYPT_NONE, "none" }, { LO_CRYPT_XOR, "xor" }, { LO_CRYPT_DES, "DES" }, { -1, NULL } }; static int crypt_type (const char *name) { int i; if (name) for (i = 0; crypt_type_tbl[i].id != -1; i++) if (!strcasecmp (name, crypt_type_tbl[i].name)) return crypt_type_tbl[i].id; return -1; } #if 0 static char * crypt_name (int id) { int i; for (i = 0; crypt_type_tbl[i].id != -1; i++) if (id == crypt_type_tbl[i].id) return crypt_type_tbl[i].name; return "undefined"; } static void show_loop (char *device) { struct loop_info loopinfo; int fd; if ((fd = open (device, O_RDONLY)) < 0) { fprintf(stderr, "loop: can't open device %s: %s\n", device, strerror (errno)); return; } if (ioctl (fd, LOOP_GET_STATUS, &loopinfo) < 0) { fprintf(stderr, "loop: can't get info on device %s: %s\n", device, strerror (errno)); close (fd); return; } printf ("%s: [%04x]:%ld (%s) offset %d, %s encryption\n", device, loopinfo.lo_device, loopinfo.lo_inode, loopinfo.lo_name, loopinfo.lo_offset, crypt_name (loopinfo.lo_encrypt_type)); close (fd); } #endif char * find_unused_loop_device (void) { /* Just creating a device, say in /tmp, is probably a bad idea - people might have problems with backup or so. So, we just try /dev/loop[0-7]. */ char dev[20]; int i, fd, somedev = 0, someloop = 0, loop_known = 0; struct stat statbuf; struct loop_info loopinfo; FILE *procdev; for(i = 0; i < 256; i++) { sprintf(dev, "/dev/loop%d", i); if (stat (dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) { somedev++; fd = open (dev, O_RDONLY); if (fd >= 0) { if(ioctl (fd, LOOP_GET_STATUS, &loopinfo) == 0) someloop++; /* in use */ else if (errno == ENXIO) { close (fd); return xstrdup(dev); /* probably free */ } close (fd); } continue; /* continue trying as long as devices exist */ } if (i >= 7) break; } /* Nothing found. Why not? */ if ((procdev = fopen(PROC_DEVICES, "r")) != NULL) { char line[100]; while (fgets (line, sizeof(line), procdev)) if (strstr (line, " loop\n")) { loop_known = 1; break; } fclose(procdev); if (!loop_known) loop_known = -1; } if (!somedev) error("mount: could not find any device /dev/loop#"); else if(!someloop) { if (loop_known == 1) error( "mount: Could not find any loop device.\n" " Maybe /dev/loop# has a wrong major number?"); else if (loop_known == -1) error( "mount: Could not find any loop device, and, according to %s,\n" " this kernel does not know about the loop device.\n" " (If so, then recompile or `insmod loop.o'.)", PROC_DEVICES); else error( "mount: Could not find any loop device. Maybe this kernel does not know\n" " about the loop device (then recompile or `insmod loop.o'), or\n" " maybe /dev/loop# has the wrong major number?"); } else error("mount: could not find any free loop device"); return 0; } int set_loop (const char *device, const char *file, int offset, const char *encryption, int *loopro) { struct loop_info loopinfo; int fd, ffd, mode, i; char *pass; mode = (*loopro ? O_RDONLY : O_RDWR); if ((ffd = open (file, mode)) < 0) { if (!*loopro && errno == EROFS) ffd = open (file, mode = O_RDONLY); if (ffd < 0) { perror (file); return 1; } } if ((fd = open (device, mode)) < 0) { perror (device); return 1; } *loopro = (mode == O_RDONLY); memset (&loopinfo, 0, sizeof (loopinfo)); strncpy (loopinfo.lo_name, file, LO_NAME_SIZE); loopinfo.lo_name[LO_NAME_SIZE - 1] = 0; if (encryption && (loopinfo.lo_encrypt_type = crypt_type (encryption)) < 0) { fprintf (stderr, "Unsupported encryption type %s\n", encryption); return 1; } loopinfo.lo_offset = offset; switch (loopinfo.lo_encrypt_type) { case LO_CRYPT_NONE: loopinfo.lo_encrypt_key_size = 0; break; case LO_CRYPT_XOR: pass = getpass ("Password: "); strncpy ((char *) loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE); loopinfo.lo_encrypt_key[LO_KEY_SIZE - 1] = 0; loopinfo.lo_encrypt_key_size = (int) strlen ((char *) loopinfo.lo_encrypt_key); break; case LO_CRYPT_DES: pass = getpass ("Password: "); strncpy ((char *) loopinfo.lo_encrypt_key, pass, 8); loopinfo.lo_encrypt_key[8] = 0; loopinfo.lo_encrypt_key_size = 8; pass = getpass ("Init (up to 16 hex digits): "); for (i = 0; i < 16 && pass[i]; i++) if (isxdigit (pass[i])) loopinfo.lo_init[i >> 3] |= (pass[i] > '9' ? (islower (pass[i]) ? toupper (pass[i]) : pass[i]) - 'A' + 10 : pass[i] - '0') << (i & 7) * 4; else { fprintf (stderr, "Non-hex digit '%c'.\n", pass[i]); return 1; } break; default: fprintf (stderr, "Don't know how to get key for encryption system %d\n", loopinfo.lo_encrypt_type); return 1; } if (ioctl (fd, LOOP_SET_FD, ffd) < 0) { perror ("ioctl: LOOP_SET_FD"); return 1; } if (ioctl (fd, LOOP_SET_STATUS, &loopinfo) < 0) { (void) ioctl (fd, LOOP_CLR_FD, 0); perror ("ioctl: LOOP_SET_STATUS"); return 1; } close (fd); close (ffd); if (mount_verbose > 1) printf("set_loop(%s,%s,%d): success\n", device, file, offset); return 0; } int del_loop (const char *device) { int fd; if ((fd = open (device, O_RDONLY)) < 0) { fprintf(stderr, "loop: can't delete device %s: %s\n", device, strerror (errno)); return 1; } if (ioctl (fd, LOOP_CLR_FD, 0) < 0) { perror ("ioctl: LOOP_CLR_FD"); return 1; } close (fd); if (mount_verbose > 1) printf("del_loop(%s): success\n", device); return 0; } #else /* no LOOP_SET_FD defined */ static void mutter(void) { fprintf(stderr, "This mount was compiled without loop support. Please recompile.\n"); } int set_loop (const char *device, const char *file, int offset, const char *encryption, int *loopro) { mutter(); return 1; } int del_loop (const char *device) { mutter(); return 1; } char * find_unused_loop_device (void) { mutter(); return 0; } #endif watchdog-5.13/src/test_binary.c0000644000175000017500000001136312102721740016306 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/test_binary.c,v 1.3 2006/09/12 09:17:01 meskes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include "extern.h" #include "watch_err.h" #if USE_SYSLOG #include #endif struct process { char proc_name[PATH_MAX]; pid_t pid; time_t time; struct process *next; }; static struct process *process_head = NULL; static void add_process (const char *name, pid_t pid) { struct process *node = (struct process *) malloc (sizeof (struct process)); snprintf(node->proc_name, sizeof(node->proc_name), "%s", name); node->pid = pid; node->time = time (NULL); node->next = process_head; process_head = node; } static void remove_process (pid_t pid) { struct process *last, *current; last = NULL; current = process_head; while (current != NULL && current->pid != pid) { last = current; current = current->next; } if (current != NULL) { if (last == NULL) process_head = current->next; else last->next = current->next; free (current); } } /* See if any test processes have exceeded the timeout */ static int check_processes (const char *name, time_t timeout) { struct process *current; time_t now = time (NULL); current = process_head; while (current != NULL) { if (!strcmp(current->proc_name, name) && now - current->time > timeout) { remove_process (current->pid); return (ETOOLONG); } current = current->next; } return (ENOERR); } /* execute test binary */ int check_bin(char *tbinary, time_t timeout, int version) { pid_t child_pid; int result, res = 0; if (tbinary == NULL) return ENOERR; if (timeout > 0) res = check_processes(tbinary, timeout); if (res == ETOOLONG) { #if USE_SYSLOG syslog(LOG_ERR, "test-binary %s exceeded time limit %ld", tbinary, timeout); #endif /* USE_SYSLOG */ return res; } child_pid = fork(); if (!child_pid) { /* Don't want the stdout and stderr of our test program * to cause trouble, so make them go to their respective files */ strcpy(filename_buf, logdir); strcat(filename_buf, "/test-bin.stdout"); if (!freopen(filename_buf, "a+", stdout)) exit (errno); strcpy(filename_buf, logdir); strcat(filename_buf, "/test-bin.stderr"); if (!freopen(filename_buf, "a+", stderr)) exit (errno); /* now start binary */ if (version == 0) { execl(tbinary, tbinary, NULL); } else { execl(tbinary, tbinary, "test", NULL); } /* execl should only return in case of an error */ /* so we return that error */ exit(errno); } else if (child_pid < 0) { /* fork failed */ int err = errno; if (errno == EAGAIN) { /* process table full */ #if USE_SYSLOG syslog(LOG_ERR, "process table is full!"); #endif /* USE_SYSLOG */ return (EREBOOT); } else if (softboot) return (err); else return (ENOERR); } else { int ret, err; /* fork was okay, add child to process list */ add_process(tbinary, child_pid); /* wait for child(s) to stop */ /* but only after a short sleep */ usleep(tint * 500000); do { ret = waitpid(-1, &result, WNOHANG); err = errno; if (ret > 0) remove_process(ret); } while (ret > 0 && WIFEXITED(result) != 0 && WEXITSTATUS(result) == 0); /* check result: */ /* ret < 0 => error */ /* ret == 0 => no more child returned, however we may already have caught the actual child */ /* WIFEXITED(result) == 0 => child did not exit normally but was killed by signal which was not caught */ /* WEXITSTATUS(result) != 0 => child returned an error code */ if (ret > 0) { if (WIFEXITED(result) != 0) { /* if one of the scripts returns an error code just return that code */ #if USE_SYSLOG syslog(LOG_ERR, "test binary %s returned %d", tbinary, WEXITSTATUS(result)); #endif /* USE_SYSLOG */ return (WEXITSTATUS(result)); } else if (WIFSIGNALED(result) != 0) { /* if one of the scripts was killed return ECHKILL */ #if USE_SYSLOG syslog(LOG_ERR, "test binary %s was killed by uncaught signal %d", tbinary, WTERMSIG(result)); #endif /* USE_SYSLOG */ return (ECHKILL); } } else { /* in case there are still old childs running due to an error */ /* log that error */ if (ret != 0 && err != 0 && err != ECHILD) { #if USE_SYSLOG errno = err; syslog(LOG_ERR, "child %d did not exit immediately (error = %d = '%m')", child_pid, err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); } } } return (ENOERR); } watchdog-5.13/src/temp.c0000644000175000017500000000404412102721740014726 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/temp.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "extern.h" #include "watch_err.h" #if USE_SYSLOG #include #endif int check_temp(void) { unsigned char temperature; #if USE_SYSLOG int templevel1 = maxtemp * 9 / 10, have1 = FALSE; int templevel2 = maxtemp * 95 / 100, have2 = FALSE; int templevel3 = maxtemp * 98 / 100, have3 = FALSE; #endif /* USE_SYSLOG */ /* is the temperature device open? */ if (temp == -1) return (ENOERR); /* read the line (there is only one) */ if (read(temp, &temperature, sizeof(temperature)) < 0) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "read %s gave errno = %d = '%m'", tempname, err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); return (ENOERR); } #if USE_SYSLOG if (verbose && logtick && ticker == 1) syslog(LOG_INFO, "current temperature is %d", temperature); if (temperature > templevel3) { if (!have3) { /* once we reach level3, issue a warning */ syslog(LOG_WARNING, "temperature increases %d", templevel3); have1 = have2 = have3 = TRUE; } } else { have3 = FALSE; if (temperature > templevel2) { if (!have2) { /* once we reach level2, issue a warning */ syslog(LOG_WARNING, "temperature increases %d", templevel2); have1 = have2 = TRUE; } } else { have2 = have3 = FALSE; if (temperature > templevel1) { if (!have1) { /* once we reach level1, issue a warning */ syslog(LOG_WARNING, "temperature increases %d", templevel1); have1 = TRUE; } } } } #endif /* USE_SYSLOG */ if (temperature >= maxtemp) { #if USE_SYSLOG syslog(LOG_ERR, "it is too hot inside (temperature = %d)", temperature); #else /* USE_SYSLOG */ fprintf(stderr, "%s: it is too hot inside (temperature = %d\n", progname, temperature); #endif /* USE_SYSLOG */ return (ETOOHOT); } return (ENOERR); } watchdog-5.13/src/Makefile.in0000644000175000017500000004372612102721745015701 0ustar michaelmichael# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : sbin_PROGRAMS = watchdog$(EXEEXT) wd_keepalive$(EXEEXT) \ wd_identify$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" PROGRAMS = $(sbin_PROGRAMS) am_watchdog_OBJECTS = file_stat.$(OBJEXT) file_table.$(OBJEXT) \ fstab.$(OBJEXT) iface.$(OBJEXT) ifdown.$(OBJEXT) \ keep_alive.$(OBJEXT) load.$(OBJEXT) lomount.$(OBJEXT) \ memory.$(OBJEXT) mntent.$(OBJEXT) mount.$(OBJEXT) \ net.$(OBJEXT) nfsmount.$(OBJEXT) nfsmount_clnt.$(OBJEXT) \ nfsmount_xdr.$(OBJEXT) pidfile.$(OBJEXT) shutdown.$(OBJEXT) \ sundries.$(OBJEXT) temp.$(OBJEXT) test_binary.$(OBJEXT) \ umount.$(OBJEXT) version.$(OBJEXT) watchdog.$(OBJEXT) watchdog_OBJECTS = $(am_watchdog_OBJECTS) watchdog_LDADD = $(LDADD) am_wd_identify_OBJECTS = wd_identify.$(OBJEXT) wd_identify_OBJECTS = $(am_wd_identify_OBJECTS) wd_identify_LDADD = $(LDADD) am_wd_keepalive_OBJECTS = wd_keepalive.$(OBJEXT) wd_keepalive_OBJECTS = $(am_wd_keepalive_OBJECTS) wd_keepalive_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(watchdog_SOURCES) $(wd_identify_SOURCES) \ $(wd_keepalive_SOURCES) DIST_SOURCES = $(watchdog_SOURCES) $(wd_identify_SOURCES) \ $(wd_keepalive_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFIG_FILENAME = @CONFIG_FILENAME@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SENDMAIL = @PATH_SENDMAIL@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TESTBIN_PATH = @TESTBIN_PATH@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ watchdog_SOURCES = file_stat.c file_table.c fstab.c iface.c ifdown.c keep_alive.c \ load.c lomount.c memory.c mntent.c mount.c net.c nfsmount.c \ nfsmount_clnt.c nfsmount_xdr.c pidfile.c shutdown.c sundries.c \ temp.c test_binary.c umount.c version.c watchdog.c wd_keepalive_SOURCES = wd_keepalive.c wd_identify_SOURCES = wd_identify.c INCLUDES = -I@top_srcdir@/include all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files clean-sbinPROGRAMS: -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) watchdog$(EXEEXT): $(watchdog_OBJECTS) $(watchdog_DEPENDENCIES) $(EXTRA_watchdog_DEPENDENCIES) @rm -f watchdog$(EXEEXT) $(LINK) $(watchdog_OBJECTS) $(watchdog_LDADD) $(LIBS) wd_identify$(EXEEXT): $(wd_identify_OBJECTS) $(wd_identify_DEPENDENCIES) $(EXTRA_wd_identify_DEPENDENCIES) @rm -f wd_identify$(EXEEXT) $(LINK) $(wd_identify_OBJECTS) $(wd_identify_LDADD) $(LIBS) wd_keepalive$(EXEEXT): $(wd_keepalive_OBJECTS) $(wd_keepalive_DEPENDENCIES) $(EXTRA_wd_keepalive_DEPENDENCIES) @rm -f wd_keepalive$(EXEEXT) $(LINK) $(wd_keepalive_OBJECTS) $(wd_keepalive_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_stat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_table.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstab.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifdown.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keep_alive.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lomount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mntent.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/net.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nfsmount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nfsmount_clnt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nfsmount_xdr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pidfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shutdown.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sundries.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/temp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_binary.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/watchdog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wd_identify.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wd_keepalive.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(sbindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-sbinPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sbinPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-sbinPROGRAMS ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-sbinPROGRAMS install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-sbinPROGRAMS distclean-depend: rm -rf .deps # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: watchdog-5.13/src/file_table.c0000644000175000017500000000220412102721740016043 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/file_table.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "extern.h" #include "watch_err.h" int check_file_table(void) { int fd; /* open a file */ fd = open("/proc/uptime", O_RDONLY); if (fd == -1) { int err = errno; if (err == ENFILE) { /* we need a reboot if ENFILE is returned (file table overflow) */ #if USE_SYSLOG syslog(LOG_ERR, "file table overflow detected!\n"); #endif /* USE_SYSLOG */ return (ENFILE); } else { #if USE_SYSLOG errno = err; syslog(LOG_ERR, "cannot open /proc/uptime (errno = %d = '%m')", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); } } else { if (close(fd) < 0) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "close /proc/uptime gave errno = %d = '%m'", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); } } return (ENOERR); } watchdog-5.13/src/nfsmount.h0000644000175000017500000002427312102721740015645 0ustar michaelmichael/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _NFSMOUNT_H_RPCGEN #define _NFSMOUNT_H_RPCGEN #include #ifdef __cplusplus extern "C" { #endif /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape * media and as a part of the software program in whole or part. Users * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user or with the express written consent of * Sun Microsystems, Inc. * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 */ /* * Copyright (c) 1985, 1990 by Sun Microsystems, Inc. */ /* from @(#)mount.x 1.3 91/03/11 TIRPC 1.0 */ #ifndef _rpcsvc_mount_h #define _rpcsvc_mount_h #include #define MOUNTPORT 635 #define MNTPATHLEN 1024 #define MNTNAMLEN 255 #define FHSIZE 32 #define FHSIZE3 64 typedef char fhandle[FHSIZE]; typedef struct { u_int fhandle3_len; char *fhandle3_val; } fhandle3; enum mountstat3 { MNT_OK = 0, MNT3ERR_PERM = 1, MNT3ERR_NOENT = 2, MNT3ERR_IO = 5, MNT3ERR_ACCES = 13, MNT3ERR_NOTDIR = 20, MNT3ERR_INVAL = 22, MNT3ERR_NAMETOOLONG = 63, MNT3ERR_NOTSUPP = 10004, MNT3ERR_SERVERFAULT = 10006, }; typedef enum mountstat3 mountstat3; struct fhstatus { u_int fhs_status; union { fhandle fhs_fhandle; } fhstatus_u; }; typedef struct fhstatus fhstatus; struct mountres3_ok { fhandle3 fhandle; struct { u_int auth_flavours_len; int *auth_flavours_val; } auth_flavours; }; typedef struct mountres3_ok mountres3_ok; struct mountres3 { mountstat3 fhs_status; union { mountres3_ok mountinfo; } mountres3_u; }; typedef struct mountres3 mountres3; typedef char *dirpath; typedef char *name; typedef struct mountbody *mountlist; struct mountbody { name ml_hostname; dirpath ml_directory; mountlist ml_next; }; typedef struct mountbody mountbody; typedef struct groupnode *groups; struct groupnode { name gr_name; groups gr_next; }; typedef struct groupnode groupnode; typedef struct exportnode *exports; struct exportnode { dirpath ex_dir; groups ex_groups; exports ex_next; }; typedef struct exportnode exportnode; struct ppathcnf { int pc_link_max; short pc_max_canon; short pc_max_input; short pc_name_max; short pc_path_max; short pc_pipe_buf; u_char pc_vdisable; char pc_xxx; short pc_mask[2]; }; typedef struct ppathcnf ppathcnf; #endif /*!_rpcsvc_mount_h*/ #define MOUNTPROG 100005 #define MOUNTVERS 1 #if defined(__STDC__) || defined(__cplusplus) #define MOUNTPROC_NULL 0 extern void * mountproc_null_1(void *, CLIENT *); extern void * mountproc_null_1_svc(void *, struct svc_req *); #define MOUNTPROC_MNT 1 extern fhstatus * mountproc_mnt_1(dirpath *, CLIENT *); extern fhstatus * mountproc_mnt_1_svc(dirpath *, struct svc_req *); #define MOUNTPROC_DUMP 2 extern mountlist * mountproc_dump_1(void *, CLIENT *); extern mountlist * mountproc_dump_1_svc(void *, struct svc_req *); #define MOUNTPROC_UMNT 3 extern void * mountproc_umnt_1(dirpath *, CLIENT *); extern void * mountproc_umnt_1_svc(dirpath *, struct svc_req *); #define MOUNTPROC_UMNTALL 4 extern void * mountproc_umntall_1(void *, CLIENT *); extern void * mountproc_umntall_1_svc(void *, struct svc_req *); #define MOUNTPROC_EXPORT 5 extern exports * mountproc_export_1(void *, CLIENT *); extern exports * mountproc_export_1_svc(void *, struct svc_req *); #define MOUNTPROC_EXPORTALL 6 extern exports * mountproc_exportall_1(void *, CLIENT *); extern exports * mountproc_exportall_1_svc(void *, struct svc_req *); extern int mountprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define MOUNTPROC_NULL 0 extern void * mountproc_null_1(); extern void * mountproc_null_1_svc(); #define MOUNTPROC_MNT 1 extern fhstatus * mountproc_mnt_1(); extern fhstatus * mountproc_mnt_1_svc(); #define MOUNTPROC_DUMP 2 extern mountlist * mountproc_dump_1(); extern mountlist * mountproc_dump_1_svc(); #define MOUNTPROC_UMNT 3 extern void * mountproc_umnt_1(); extern void * mountproc_umnt_1_svc(); #define MOUNTPROC_UMNTALL 4 extern void * mountproc_umntall_1(); extern void * mountproc_umntall_1_svc(); #define MOUNTPROC_EXPORT 5 extern exports * mountproc_export_1(); extern exports * mountproc_export_1_svc(); #define MOUNTPROC_EXPORTALL 6 extern exports * mountproc_exportall_1(); extern exports * mountproc_exportall_1_svc(); extern int mountprog_1_freeresult (); #endif /* K&R C */ #define MOUNTVERS_POSIX 2 #if defined(__STDC__) || defined(__cplusplus) extern void * mountproc_null_2(void *, CLIENT *); extern void * mountproc_null_2_svc(void *, struct svc_req *); extern fhstatus * mountproc_mnt_2(dirpath *, CLIENT *); extern fhstatus * mountproc_mnt_2_svc(dirpath *, struct svc_req *); extern mountlist * mountproc_dump_2(void *, CLIENT *); extern mountlist * mountproc_dump_2_svc(void *, struct svc_req *); extern void * mountproc_umnt_2(dirpath *, CLIENT *); extern void * mountproc_umnt_2_svc(dirpath *, struct svc_req *); extern void * mountproc_umntall_2(void *, CLIENT *); extern void * mountproc_umntall_2_svc(void *, struct svc_req *); extern exports * mountproc_export_2(void *, CLIENT *); extern exports * mountproc_export_2_svc(void *, struct svc_req *); extern exports * mountproc_exportall_2(void *, CLIENT *); extern exports * mountproc_exportall_2_svc(void *, struct svc_req *); #define MOUNTPROC_PATHCONF 7 extern ppathcnf * mountproc_pathconf_2(dirpath *, CLIENT *); extern ppathcnf * mountproc_pathconf_2_svc(dirpath *, struct svc_req *); extern int mountprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ extern void * mountproc_null_2(); extern void * mountproc_null_2_svc(); extern fhstatus * mountproc_mnt_2(); extern fhstatus * mountproc_mnt_2_svc(); extern mountlist * mountproc_dump_2(); extern mountlist * mountproc_dump_2_svc(); extern void * mountproc_umnt_2(); extern void * mountproc_umnt_2_svc(); extern void * mountproc_umntall_2(); extern void * mountproc_umntall_2_svc(); extern exports * mountproc_export_2(); extern exports * mountproc_export_2_svc(); extern exports * mountproc_exportall_2(); extern exports * mountproc_exportall_2_svc(); #define MOUNTPROC_PATHCONF 7 extern ppathcnf * mountproc_pathconf_2(); extern ppathcnf * mountproc_pathconf_2_svc(); extern int mountprog_2_freeresult (); #endif /* K&R C */ #define MOUNT_V3 3 #if defined(__STDC__) || defined(__cplusplus) #define MOUNTPROC3_NULL 0 extern void * mountproc3_null_3(void *, CLIENT *); extern void * mountproc3_null_3_svc(void *, struct svc_req *); #define MOUNTPROC3_MNT 1 extern mountres3 * mountproc3_mnt_3(dirpath *, CLIENT *); extern mountres3 * mountproc3_mnt_3_svc(dirpath *, struct svc_req *); #define MOUNTPROC3_DUMP 2 extern mountlist * mountproc3_dump_3(void *, CLIENT *); extern mountlist * mountproc3_dump_3_svc(void *, struct svc_req *); #define MOUNTPROC3_UMNT 3 extern void * mountproc3_umnt_3(dirpath *, CLIENT *); extern void * mountproc3_umnt_3_svc(dirpath *, struct svc_req *); #define MOUNTPROC3_UMNTALL 4 extern void * mountproc3_umntall_3(void *, CLIENT *); extern void * mountproc3_umntall_3_svc(void *, struct svc_req *); #define MOUNTPROC3_EXPORT 5 extern exports * mountproc3_export_3(void *, CLIENT *); extern exports * mountproc3_export_3_svc(void *, struct svc_req *); extern int mountprog_3_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define MOUNTPROC3_NULL 0 extern void * mountproc3_null_3(); extern void * mountproc3_null_3_svc(); #define MOUNTPROC3_MNT 1 extern mountres3 * mountproc3_mnt_3(); extern mountres3 * mountproc3_mnt_3_svc(); #define MOUNTPROC3_DUMP 2 extern mountlist * mountproc3_dump_3(); extern mountlist * mountproc3_dump_3_svc(); #define MOUNTPROC3_UMNT 3 extern void * mountproc3_umnt_3(); extern void * mountproc3_umnt_3_svc(); #define MOUNTPROC3_UMNTALL 4 extern void * mountproc3_umntall_3(); extern void * mountproc3_umntall_3_svc(); #define MOUNTPROC3_EXPORT 5 extern exports * mountproc3_export_3(); extern exports * mountproc3_export_3_svc(); extern int mountprog_3_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_fhandle (XDR *, fhandle); extern bool_t xdr_fhandle3 (XDR *, fhandle3*); extern bool_t xdr_mountstat3 (XDR *, mountstat3*); extern bool_t xdr_fhstatus (XDR *, fhstatus*); extern bool_t xdr_mountres3_ok (XDR *, mountres3_ok*); extern bool_t xdr_mountres3 (XDR *, mountres3*); extern bool_t xdr_dirpath (XDR *, dirpath*); extern bool_t xdr_name (XDR *, name*); extern bool_t xdr_mountlist (XDR *, mountlist*); extern bool_t xdr_mountbody (XDR *, mountbody*); extern bool_t xdr_groups (XDR *, groups*); extern bool_t xdr_groupnode (XDR *, groupnode*); extern bool_t xdr_exports (XDR *, exports*); extern bool_t xdr_exportnode (XDR *, exportnode*); extern bool_t xdr_ppathcnf (XDR *, ppathcnf*); #else /* K&R C */ extern bool_t xdr_fhandle (); extern bool_t xdr_fhandle3 (); extern bool_t xdr_mountstat3 (); extern bool_t xdr_fhstatus (); extern bool_t xdr_mountres3_ok (); extern bool_t xdr_mountres3 (); extern bool_t xdr_dirpath (); extern bool_t xdr_name (); extern bool_t xdr_mountlist (); extern bool_t xdr_mountbody (); extern bool_t xdr_groups (); extern bool_t xdr_groupnode (); extern bool_t xdr_exports (); extern bool_t xdr_exportnode (); extern bool_t xdr_ppathcnf (); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_NFSMOUNT_H_RPCGEN */ watchdog-5.13/src/umount.c0000644000175000017500000003005012102721740015304 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/umount.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ /* * A umount(8) for Linux 0.99. * umount.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp * * Wed Sep 14 22:43:54 1994: Sebastian Lederer * (lederer@next-pc.informatik.uni-bonn.de) added support for sending an * unmount RPC call to the server when an NFS-filesystem is unmounted. * * Tue Sep 26 16:33:09 1995: Added patches from Greg Page (greg@caldera.com) * so that NetWare filesystems can be unmounted. * * 951213: Marek Michalkiewicz : * Ignore any RPC errors, so that you can umount an nfs mounted filesystem * if the server is down. * * 960223: aeb - several minor changes * 960324: aeb - added some changes from Rob Leslie * 960823: aeb - also try umount(spec) when umount(node) fails * 970307: aeb - canonise names from fstab * 970726: aeb - remount read-only in cases where umount fails */ #include #include #include #include #include #include #include #include "mount_constants.h" #include "sundries.h" #include "lomount.h" #include "loop.h" #include "fstab.h" #if HAVE_NFS #include #include #include #include #include #include #include "nfsmount.h" #include #endif #ifdef notyet /* Nonzero for force umount (-f). This needs kernel support we don't have. */ int force = 0; #endif /* When umount fails, attempt a read-only remount (-r). */ int remount = 0; /* Don't write a entry in /etc/mtab (-n). */ int umount_nomtab = 0; /* Nonzero for chatty (-v). This is a nonstandard flag (not in BSD). */ int umount_verbose = 0; /* True if ruid != euid. */ int umount_suid = 0; #if HAVE_NFS static int xdr_dir(XDR *xdrsp, char *dirp) { return (xdr_string(xdrsp, &dirp, MNTPATHLEN)); } static int nfs_umount_rpc_call(const char *spec, const char *opts) { register CLIENT *clp; struct sockaddr_in saddr; struct timeval pertry, try; enum clnt_stat clnt_stat; int so = RPC_ANYSOCK; struct hostent *hostp; char *hostname; char *dirname; char *p; if (spec == NULL || (p = strchr(spec,':')) == NULL) return 0; hostname = xstrndup(spec, p-spec); dirname = xstrdup(p+1); #ifdef DEBUG printf("host: %s, directory: %s\n", hostname, dirname); #endif if (opts && (p = strstr(opts, "addr="))) { char *q; free(hostname); p += 5; q = p; while (*q && *q != ',') q++; hostname = xstrndup(p,q-p); } if (hostname[0] >= '0' && hostname[0] <= '9') saddr.sin_addr.s_addr = inet_addr(hostname); else { if ((hostp = gethostbyname(hostname)) == NULL) { fprintf(stderr, "umount: can't get address for %s\n", hostname); return 1; } if (hostp->h_length > sizeof(struct in_addr)) { fprintf(stderr, "umount: got bad hostp->h_length\n"); hostp->h_length = sizeof(struct in_addr); } memcpy(&saddr.sin_addr, hostp->h_addr, hostp->h_length); } saddr.sin_family = AF_INET; saddr.sin_port = 0; pertry.tv_sec = 3; pertry.tv_usec = 0; if ((clp = clntudp_create(&saddr, MOUNTPROG, MOUNTVERS, pertry, &so)) == NULL) { clnt_pcreateerror("Cannot MOUNTPROG RPC"); return (1); } clp->cl_auth = authunix_create_default(); try.tv_sec = 20; try.tv_usec = 0; clnt_stat = clnt_call(clp, MOUNTPROC_UMNT, (xdrproc_t) xdr_dir, dirname, (xdrproc_t) xdr_void, (caddr_t) 0, try); if (clnt_stat != RPC_SUCCESS) { clnt_perror(clp, "Bad UMNT RPC"); return (1); } auth_destroy(clp->cl_auth); clnt_destroy(clp); return (0); } #endif /* HAVE_NFS */ /* complain about a failed umount */ static void complain(int err, const char *dev) { switch (err) { case ENXIO: error ("umount: %s: invalid block device", dev); break; case EINVAL: error ("umount: %s: not mounted", dev); break; case EIO: error ("umount: %s: can't write superblock", dev); break; case EBUSY: /* Let us hope fstab has a line "proc /proc ..." and not "none /proc ..."*/ error ("umount: %s: device is busy", dev); break; case ENOENT: error ("umount: %s: not found", dev); break; case EPERM: error ("umount: %s: must be superuser to umount", dev); break; case EACCES: error ("umount: %s: block devices not permitted on fs", dev); break; default: error ("umount: %s: %s", dev, strerror (err)); break; } } /* Umount a single device. Return a status code, so don't exit on a non-fatal error. We lock/unlock around each umount. */ static int umount_one (const char *spec, const char *node, const char *type, const char *opts) { int umnt_err, umnt_err2; int isroot; int res; /* Special case for root. As of 0.99pl10 we can (almost) unmount root; the kernel will remount it readonly so that we can carry on running afterwards. The readonly remount is illegal if any files are opened for writing at the time, so we can't update mtab for an unmount of root. As it is only really a remount, this doesn't matter too much. [sct May 29, 1993] */ isroot = (streq (node, "/") || streq (node, "root") || streq (node, "rootfs")); if (isroot) umount_nomtab++; #if HAVE_NFS /* Ignore any RPC errors, so that you can umount the filesystem if the server is down. */ if (strcasecmp(type, "nfs") == 0) nfs_umount_rpc_call(spec, opts); #endif umnt_err = umnt_err2 = 0; res = umount (node); if (res < 0) { umnt_err = errno; /* A device might have been mounted on a node that has since been deleted or renamed, so if node fails, also try spec. */ /* if (umnt_err == ENOENT || umnt_err == EINVAL) */ if (umnt_err != EBUSY && strcmp(node, spec)) { if (umount_verbose) printf ("could not umount %s - trying %s instead\n", node, spec); res = umount (spec); if (res < 0) umnt_err2 = errno; /* Do not complain about remote NFS mount points */ if (errno == ENOENT && strchr(spec, ':')) umnt_err2 = 0; } } if (res < 0 && remount && (umnt_err == EBUSY || umnt_err2 == EBUSY)) { /* Umount failed - let us try a remount */ res=mount(spec, node, NULL, MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); if (res == 0) { struct mntent remnt; fprintf(stderr, "umount: %s busy - remounted read-only\n", spec); remnt.mnt_type = remnt.mnt_fsname = NULL; remnt.mnt_dir = xstrdup(node); remnt.mnt_opts = "ro"; update_mtab(node, &remnt); return 0; } else if (errno != EBUSY) { /* hmm ... */ perror("remount"); fprintf(stderr, "umount: could not remount %s read-only\n", spec); } } if (res >= 0) { /* Umount succeeded, update mtab. */ if (umount_verbose) printf ("%s umounted\n", spec); if (!umount_nomtab && mtab_is_writable()) { struct mntentchn *mc; /* Special stuff for loop devices */ if ((mc = getmntfile (spec)) || (mc = getmntfile (node))) { char *opts; /* old style mtab line? */ if (streq(mc->mnt_type, "loop")) if (del_loop(spec)) goto fail; /* new style mtab line? */ opts = mc->mnt_opts ? xstrdup(mc->mnt_opts) : ""; for (opts = strtok (opts, ","); opts; opts = strtok (NULL, ",")) { if (!strncmp(opts, "loop=", 5)) { if (del_loop(opts+5)) goto fail; break; } } } else { /* maybe spec is a loop device? */ /* no del_loop() - just delete it from mtab */ if ((mc = getmntoptfile (spec)) != NULL) node = mc->mnt_dir; } /* Non-loop stuff */ update_mtab (node, NULL); } return 0; } fail: /* Umount or del_loop failed, complain, but don't die. */ if (!umount_nomtab) { /* remove obsolete entry */ if (umnt_err == EINVAL || umnt_err == ENOENT) update_mtab (node, NULL); } if (umnt_err2) complain(umnt_err2, spec); if (umnt_err && umnt_err != umnt_err2) complain(umnt_err, node); return 1; } /* Unmount all filesystems of type VFSTYPES found in mtab. Since we are concurrently updating mtab after every succesful umount, we have to slurp in the entire file before we start. This isn't too bad, because in any case it's important to umount mtab entries in reverse order to mount, e.g. /usr/spool before /usr. */ int umount_all (string_list types) { struct mntentchn *mc, *hd; int errors = 0; hd = mtab_head(); if (!hd->prev) die (2, "umount: cannot find list of filesystems to unmount"); for (mc = hd->prev; mc != hd; mc = mc->prev) { if (matching_type (mc->mnt_type, types)) { errors |= umount_one (mc->mnt_fsname, mc->mnt_dir, mc->mnt_type, mc->mnt_opts); } } sync (); return errors; } extern char version[]; static struct option longopts[] = { { "all", 0, 0, 'a' }, { "force", 0, 0, 'f' }, { "help", 0, 0, 'h' }, { "no-mtab", 0, 0, 'n' }, { "umount_verbose", 0, 0, 'v' }, { "version", 0, 0, 'V' }, { "read-only", 0, 0, 'r' }, { "types", 1, 0, 't' }, { NULL, 0, 0, 0 } }; char *umount_usage_string = "\ usage: umount [-hV]\n\ umount -a [-r] [-n] [-v] [-t vfstypes]\n\ umount [-r] [-n] [-v] special | node...\n\ "; static void usage (FILE *fp, int n) { fprintf (fp, "%s", umount_usage_string); exit (n); } int umount_mount_quiet = 0; int this_was_main_int_mount_c (int argc, char *argv[]) { int c; int all = 0; string_list types = NULL; string_list options; struct mntentchn *mc, *fs; char *file; int result = 0; while ((c = getopt_long (argc, argv, "afhnrvVt:", longopts, NULL)) != EOF) switch (c) { case 'a': /* umount everything */ ++all; break; case 'f': /* force umount (needs kernel support) */ #if 0 ++force; #else die (2, "umount: forced umount not supported yet"); #endif break; case 'h': /* help */ usage (stdout, 0); break; case 'n': ++umount_nomtab; break; case 'r': /* remount read-only if umount fails */ ++remount; break; case 'v': /* make noise */ ++umount_verbose; break; case 'V': /* version */ printf ("umount: %s\n", version); exit (0); case 't': /* specify file system type */ types = parse_list (optarg); break; case 0: break; case '?': default: usage (stderr, 1); } if (getuid () != geteuid ()) { umount_suid = 1; if (all || types || umount_nomtab) die (2, "umount: only root can do that"); } argc -= optind; argv += optind; if (all) { if (types == NULL) types = parse_list(xstrdup("noproc")); result = umount_all (types); } else if (argc < 1) { usage (stderr, 2); } else while (argc--) { file = canonicalize (*argv); /* mtab paths are canonicalized */ if (umount_verbose > 1) printf("Trying to umount %s\n", file); mc = getmntfile (file); if (!mc && umount_verbose) printf("Could not find %s in mtab\n", file); if (umount_suid) { if (!mc) die (2, "umount: %s is not mounted (according to mtab)", file); if (!(fs = getfsspec (file)) && !(fs = getfsfile (file))) die (2, "umount: %s is not in the fstab (and you are not root)", file); if ((!streq (mc->mnt_fsname, fs->mnt_fsname) && !streq (mc->mnt_fsname, canonicalize (fs->mnt_fsname))) || (!streq (mc->mnt_dir, fs->mnt_dir) && !streq (mc->mnt_dir, canonicalize (fs->mnt_dir)))) { die (2, "umount: %s mount disagrees with the fstab", file); } options = parse_list (fs->mnt_opts); while (options) { if (streq (car (options), "user")) break; options = cdr (options); } if (!options) die (2, "umount: only root can unmount %s from %s", fs->mnt_fsname, fs->mnt_dir); } if (mc) result = umount_one (xstrdup(mc->mnt_fsname), xstrdup(mc->mnt_dir), xstrdup(mc->mnt_type), xstrdup(mc->mnt_opts)); else result = umount_one (*argv, *argv, *argv, *argv); argv++; } exit (result); } watchdog-5.13/src/net.c0000644000175000017500000001061612102721740014551 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/net.c,v 1.3 2007/01/08 12:01:58 meskes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "extern.h" #include "watch_err.h" #if USE_SYSLOG #include #endif /* * in_cksum -- * Checksum routine for Internet Protocol family headers (C Version) */ static int in_cksum(unsigned short *addr, int len) { int nleft = len, sum = 0; unsigned short *w = addr, answer = 0; /* * Our algorithm is simple, using a 32 bit accumulator (sum), we add * sequential 16 bit words to it, and at the end, fold back all the * carry bits from the top 16 bits into the lower 16 bits. */ while (nleft > 1) { sum += *w++; nleft -= 2; } /* mop up an odd byte, if necessary */ if (nleft == 1) { sum += htons(*(u_char *) w << 8); } /* add back carry outs from top 16 bits to low 16 bits */ sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */ sum += (sum >> 16); /* add carry */ answer = ~sum; /* truncate to 16 bits */ return (answer); } int check_net(char *target, int sock_fp, struct sockaddr to, unsigned char *packet, int time, int count) { int i; unsigned char outpack[MAXPACKET]; if (target == NULL) return (ENOERR); /* try "ping-count" times */ for (i = 0; i < count; i++) { struct sockaddr_in from; int fdmask, j; socklen_t fromlen; struct timeval timeout, dtimeout; struct icmphdr *icp = (struct icmphdr *) outpack; /* setup a ping message */ icp->type = ICMP_ECHO; icp->code = icp->checksum = 0; icp->un.echo.sequence = htons(i + 1); icp->un.echo.id = pid; /* ID */ /* compute ICMP checksum here */ icp->checksum = in_cksum((unsigned short *) icp, DATALEN + 8); /* and send it out */ j = sendto(sock_fp, (char *) outpack, DATALEN + 8, 0, &to, sizeof(struct sockaddr)); if (j < 0) { int err = errno; /* if our kernel tells us the network is unreachable we are done */ if (err == ENETUNREACH) { #if USE_SYSLOG syslog(LOG_ERR, "network is unreachable (target: %s)", target); #endif /* USE_SYSLOG */ return (ENETUNREACH); } else { #if USE_SYSLOG syslog(LOG_ERR, "sendto gave errno = %d = '%m'\n", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); } } else { gettimeofday(&timeout, NULL); /* set the timeout value */ j = time / count; /* we have to wait at least one second */ if (j == 0) j = 1; timeout.tv_sec += j; /* wait for reply */ fdmask = 1 << sock_fp; while (1) { gettimeofday(&dtimeout, NULL); dtimeout.tv_sec = timeout.tv_sec - dtimeout.tv_sec; dtimeout.tv_usec = timeout.tv_usec - dtimeout.tv_usec; if (dtimeout.tv_usec < 0) { dtimeout.tv_usec += 1000000; dtimeout.tv_sec--; } /* Is this loop really needed? I have yet to see a usec value >= 1000000. */ while (dtimeout.tv_usec >= 1000000) { dtimeout.tv_usec -= 1000000; dtimeout.tv_sec++; } if (dtimeout.tv_sec < 0) break; #if USE_SYSLOG if (verbose && logtick && ticker == 1) syslog(LOG_ERR, "ping select timeout = %ld seconds and %ld useconds\n", dtimeout.tv_sec, dtimeout.tv_usec); #endif /* USE_SYSLOG */ if (select(sock_fp + 1, (fd_set *) & fdmask, (fd_set *) NULL, (fd_set *) NULL, &dtimeout) >= 1) { /* read reply */ fromlen = sizeof(from); if (recvfrom(sock_fp, (char *) packet, DATALEN + MAXIPLEN + MAXICMPLEN, 0, (struct sockaddr *) &from, &fromlen) < 0) { int err = errno; if (err != EINTR) #if USE_SYSLOG syslog(LOG_ERR, "recvfrom gave errno = %d = '%m'\n", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); continue; } /* check if packet is our ECHO */ icp = (struct icmphdr *) (packet + (((struct ip *) packet)->ip_hl << 2)); if (icp->type == ICMP_ECHOREPLY && icp->un.echo.id == pid) { if (from.sin_addr.s_addr == ((struct sockaddr_in *) &to)->sin_addr.s_addr) { #if USE_SYSLOG if (verbose && logtick && ticker == 1) syslog(LOG_INFO, "got answer from target %s", target); #endif return (ENOERR); } } } } } } #if USE_SYSLOG syslog(LOG_ERR, "no response from ping (target: %s)", target); #endif /* USE_SYSLOG */ return (ENETUNREACH); } watchdog-5.13/src/nfsmount_xdr.c0000644000175000017500000001702312102721740016510 0ustar michaelmichael/* * Please do not edit this file. * It was generated using rpcgen. */ #include "config.h" #if HAVE_NFS #include "nfsmount.h" /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape * media and as a part of the software program in whole or part. Users * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user or with the express written consent of * Sun Microsystems, Inc. * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 */ /* * Copyright (c) 1985, 1990 by Sun Microsystems, Inc. */ /* from @(#)mount.x 1.3 91/03/11 TIRPC 1.0 */ #include bool_t xdr_fhandle (XDR *xdrs, fhandle objp) { if (!xdr_opaque (xdrs, objp, FHSIZE)) return FALSE; return TRUE; } bool_t xdr_fhandle3 (XDR *xdrs, fhandle3 *objp) { if (!xdr_bytes (xdrs, (char **)&objp->fhandle3_val, (u_int *) &objp->fhandle3_len, FHSIZE3)) return FALSE; return TRUE; } bool_t xdr_mountstat3 (XDR *xdrs, mountstat3 *objp) { if (!xdr_enum (xdrs, (enum_t *) objp)) return FALSE; return TRUE; } bool_t xdr_fhstatus (XDR *xdrs, fhstatus *objp) { if (!xdr_u_int (xdrs, &objp->fhs_status)) return FALSE; switch (objp->fhs_status) { case 0: if (!xdr_fhandle (xdrs, objp->fhstatus_u.fhs_fhandle)) return FALSE; break; default: break; } return TRUE; } bool_t xdr_mountres3_ok (XDR *xdrs, mountres3_ok *objp) { if (!xdr_fhandle3 (xdrs, &objp->fhandle)) return FALSE; if (!xdr_array (xdrs, (char **)&objp->auth_flavours.auth_flavours_val, (u_int *) &objp->auth_flavours.auth_flavours_len, ~0, sizeof (int), (xdrproc_t) xdr_int)) return FALSE; return TRUE; } bool_t xdr_mountres3 (XDR *xdrs, mountres3 *objp) { if (!xdr_mountstat3 (xdrs, &objp->fhs_status)) return FALSE; switch (objp->fhs_status) { case MNT_OK: if (!xdr_mountres3_ok (xdrs, &objp->mountres3_u.mountinfo)) return FALSE; break; default: break; } return TRUE; } bool_t xdr_dirpath (XDR *xdrs, dirpath *objp) { if (!xdr_string (xdrs, objp, MNTPATHLEN)) return FALSE; return TRUE; } bool_t xdr_name (XDR *xdrs, name *objp) { if (!xdr_string (xdrs, objp, MNTNAMLEN)) return FALSE; return TRUE; } bool_t xdr_mountlist (XDR *xdrs, mountlist *objp) { if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct mountbody), (xdrproc_t) xdr_mountbody)) return FALSE; return TRUE; } bool_t xdr_mountbody (XDR *xdrs, mountbody *objp) { if (!xdr_name (xdrs, &objp->ml_hostname)) return FALSE; if (!xdr_dirpath (xdrs, &objp->ml_directory)) return FALSE; if (!xdr_mountlist (xdrs, &objp->ml_next)) return FALSE; return TRUE; } bool_t xdr_groups (XDR *xdrs, groups *objp) { if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct groupnode), (xdrproc_t) xdr_groupnode)) return FALSE; return TRUE; } bool_t xdr_groupnode (XDR *xdrs, groupnode *objp) { if (!xdr_name (xdrs, &objp->gr_name)) return FALSE; if (!xdr_groups (xdrs, &objp->gr_next)) return FALSE; return TRUE; } bool_t xdr_exports (XDR *xdrs, exports *objp) { if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct exportnode), (xdrproc_t) xdr_exportnode)) return FALSE; return TRUE; } bool_t xdr_exportnode (XDR *xdrs, exportnode *objp) { if (!xdr_dirpath (xdrs, &objp->ex_dir)) return FALSE; if (!xdr_groups (xdrs, &objp->ex_groups)) return FALSE; if (!xdr_exports (xdrs, &objp->ex_next)) return FALSE; return TRUE; } bool_t xdr_ppathcnf (XDR *xdrs, ppathcnf *objp) { register int32_t *buf; int i; if (xdrs->x_op == XDR_ENCODE) { /* On many machines XDR_INLINE returns a (long *) */ buf = (int32_t *) XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_int (xdrs, &objp->pc_link_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_max_canon)) return FALSE; if (!xdr_short (xdrs, &objp->pc_max_input)) return FALSE; if (!xdr_short (xdrs, &objp->pc_name_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_path_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_pipe_buf)) return FALSE; } else { IXDR_PUT_LONG(buf, objp->pc_link_max); IXDR_PUT_SHORT(buf, objp->pc_max_canon); IXDR_PUT_SHORT(buf, objp->pc_max_input); IXDR_PUT_SHORT(buf, objp->pc_name_max); IXDR_PUT_SHORT(buf, objp->pc_path_max); IXDR_PUT_SHORT(buf, objp->pc_pipe_buf); } if (!xdr_u_char (xdrs, &objp->pc_vdisable)) return FALSE; if (!xdr_char (xdrs, &objp->pc_xxx)) return FALSE; buf = (int32_t *) XDR_INLINE(xdrs, 2 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_vector (xdrs, (char *)objp->pc_mask, 2, sizeof (short), (xdrproc_t) xdr_short)) return FALSE; } else { { register short *genp; for (i = 0, genp = objp->pc_mask; i < 2; ++i) { IXDR_PUT_SHORT(buf, *genp++); } } } return TRUE; } else if (xdrs->x_op == XDR_DECODE) { buf = (int32_t *) XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_int (xdrs, &objp->pc_link_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_max_canon)) return FALSE; if (!xdr_short (xdrs, &objp->pc_max_input)) return FALSE; if (!xdr_short (xdrs, &objp->pc_name_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_path_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_pipe_buf)) return FALSE; } else { objp->pc_link_max = IXDR_GET_LONG(buf); objp->pc_max_canon = IXDR_GET_SHORT(buf); objp->pc_max_input = IXDR_GET_SHORT(buf); objp->pc_name_max = IXDR_GET_SHORT(buf); objp->pc_path_max = IXDR_GET_SHORT(buf); objp->pc_pipe_buf = IXDR_GET_SHORT(buf); } if (!xdr_u_char (xdrs, &objp->pc_vdisable)) return FALSE; if (!xdr_char (xdrs, &objp->pc_xxx)) return FALSE; buf = (int32_t *) XDR_INLINE(xdrs, 2 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_vector (xdrs, (char *)objp->pc_mask, 2, sizeof (short), (xdrproc_t) xdr_short)) return FALSE; } else { { register short *genp; for (i = 0, genp = objp->pc_mask; i < 2; ++i) { *genp++ = IXDR_GET_SHORT(buf); } } } return TRUE; } if (!xdr_int (xdrs, &objp->pc_link_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_max_canon)) return FALSE; if (!xdr_short (xdrs, &objp->pc_max_input)) return FALSE; if (!xdr_short (xdrs, &objp->pc_name_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_path_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_pipe_buf)) return FALSE; if (!xdr_u_char (xdrs, &objp->pc_vdisable)) return FALSE; if (!xdr_char (xdrs, &objp->pc_xxx)) return FALSE; if (!xdr_vector (xdrs, (char *)objp->pc_mask, 2, sizeof (short), (xdrproc_t) xdr_short)) return FALSE; return TRUE; } #endif watchdog-5.13/src/keep_alive.c0000644000175000017500000000570412102721740016071 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/keep_alive.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "extern.h" #include "watch_err.h" /* write a heartbeat file */ int write_heartbeat(void) { time_t timenow; struct tm *tm; char tbuf[TS_SIZE + 1]; char tbufw[TS_SIZE + 1]; if (hb == NULL) return (ENOERR); /* MJ 16/2/2001 keep a rolling buffer in a file of writes to the watchdog device, any gaps in this will indicate a reboot */ timenow = time(NULL); if (timenow != -1) { tm = gmtime(&timenow); /* Get the seconds since seconds since 00:00:00, Jan 1, 1970 */ strftime(tbuf, TS_SIZE - 1, "%s", tm); /* Make it the right width */ sprintf(tbufw, "%*s\n", TS_SIZE - 1, tbuf); /* copy it to the buffer */ memcpy(timestamps + (lastts * TS_SIZE), tbufw, TS_SIZE); // success if (nrts < hbstamps) nrts++; ++lastts; lastts = lastts % hbstamps; // write the buffer to the file rewind(hb); if (nrts == hbstamps) { // write from the logical start of the buffer to the physical end if (fwrite(timestamps + (lastts * TS_SIZE), TS_SIZE, hbstamps - lastts, hb) == 0) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "write heartbeat file gave error %d = '%m'!", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } // write from the physical start of the buffer to the logical end if (fwrite(timestamps, TS_SIZE, lastts, hb) == 0) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "write heartbeat file gave error %d = '%m'!", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } } else { // write from the physical start of the buffer to the logical end if (fwrite(timestamps, TS_SIZE, nrts, hb) == 0) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "write heartbeat file gave error %d = '%m'!", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } } fflush(hb); } return(ENOERR); } /* write to the watchdog device */ int keep_alive(void) { if (watchdog == -1) return (ENOERR); if (write(watchdog, "\0", 1) < 0) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "write watchdog device gave error %d = '%m'!", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); } /* MJ 20/2/2001 write a heartbeat to a file outside the syslog, because: - there is no guarantee the system logger is up and running - easier and quicker to parse checkpoint information */ write_heartbeat(); return(ENOERR); } watchdog-5.13/src/nfsmount_clnt.c0000644000175000017500000001554312102721740016660 0ustar michaelmichael/* * Please do not edit this file. * It was generated using rpcgen. */ #include "config.h" #if HAVE_NFS #include "nfsmount.h" /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape * media and as a part of the software program in whole or part. Users * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user or with the express written consent of * Sun Microsystems, Inc. * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 */ /* * Copyright (c) 1985, 1990 by Sun Microsystems, Inc. */ /* from @(#)mount.x 1.3 91/03/11 TIRPC 1.0 */ #include /* for memset() */ /* Default timeout can be changed using clnt_control() */ static struct timeval TIMEOUT = { 25, 0 }; void * mountproc_null_1(argp, clnt) void *argp; CLIENT *clnt; { static char clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_NULL, (xdrproc_t) xdr_void, argp, (xdrproc_t) xdr_void, &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return ((void *)&clnt_res); } fhstatus * mountproc_mnt_1(argp, clnt) dirpath *argp; CLIENT *clnt; { static fhstatus clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_MNT, (xdrproc_t) xdr_dirpath, (caddr_t) argp, (xdrproc_t) xdr_fhstatus, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (&clnt_res); } mountlist * mountproc_dump_1(argp, clnt) void *argp; CLIENT *clnt; { static mountlist clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_DUMP, (xdrproc_t) xdr_void, (caddr_t) argp, (xdrproc_t) xdr_mountlist, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (&clnt_res); } void * mountproc_umnt_1(argp, clnt) dirpath *argp; CLIENT *clnt; { static char clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_UMNT, (xdrproc_t) xdr_dirpath, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return ((void *)&clnt_res); } void * mountproc_umntall_1(argp, clnt) void *argp; CLIENT *clnt; { static char clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_UMNTALL, (xdrproc_t) xdr_void, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return ((void *)&clnt_res); } exports * mountproc_export_1(argp, clnt) void *argp; CLIENT *clnt; { static exports clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_EXPORT, (xdrproc_t) xdr_void, (caddr_t) argp, (xdrproc_t) xdr_exports, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (&clnt_res); } exports * mountproc_exportall_1(argp, clnt) void *argp; CLIENT *clnt; { static exports clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_EXPORTALL, (xdrproc_t) xdr_void, (caddr_t) argp, (xdrproc_t) xdr_exports, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (&clnt_res); } void * mountproc_null_2(argp, clnt) void *argp; CLIENT *clnt; { static char clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_NULL, (xdrproc_t) xdr_void, argp, (xdrproc_t) xdr_void, &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return ((void *)&clnt_res); } fhstatus * mountproc_mnt_2(argp, clnt) dirpath *argp; CLIENT *clnt; { static fhstatus clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_MNT, (xdrproc_t) xdr_dirpath, (caddr_t) argp, (xdrproc_t) xdr_fhstatus, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (&clnt_res); } mountlist * mountproc_dump_2(argp, clnt) void *argp; CLIENT *clnt; { static mountlist clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_DUMP, (xdrproc_t) xdr_void, argp, (xdrproc_t) xdr_mountlist, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (&clnt_res); } void * mountproc_umnt_2(argp, clnt) dirpath *argp; CLIENT *clnt; { static char clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_UMNT, (xdrproc_t) xdr_dirpath, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return ((void *)&clnt_res); } void * mountproc_umntall_2(argp, clnt) void *argp; CLIENT *clnt; { static char clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_UMNTALL, (xdrproc_t) xdr_void, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return ((void *)&clnt_res); } exports * mountproc_export_2(argp, clnt) void *argp; CLIENT *clnt; { static exports clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_EXPORT, (xdrproc_t) xdr_void, argp, (xdrproc_t) xdr_exports, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (&clnt_res); } exports * mountproc_exportall_2(argp, clnt) void *argp; CLIENT *clnt; { static exports clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_EXPORTALL, (xdrproc_t) xdr_void, argp, (xdrproc_t) xdr_exports, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (&clnt_res); } ppathcnf * mountproc_pathconf_2(argp, clnt) dirpath *argp; CLIENT *clnt; { static ppathcnf clnt_res; memset((char *)&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MOUNTPROC_PATHCONF, (xdrproc_t) xdr_dirpath, (caddr_t) argp, (xdrproc_t) xdr_ppathcnf, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (&clnt_res); } #endif watchdog-5.13/src/wd_identify.c0000644000175000017500000001076712102721740016277 0ustar michaelmichael/*************************************************************/ /* Small utility to identify hardware watchdog */ /* */ /* Idea and most of the implementation by */ /* Corey Minyard */ /* */ /* The rest was written by me, Michael Meskes */ /* meskes@debian.org */ /* */ /*************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #define DEVICE "watchdog-device" int watchdog = -1; char *devname = NULL, *progname = NULL; static void usage(void) { fprintf(stderr, "%s version %d.%d, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION); fprintf(stderr, "%s \n", progname); exit(1); } void terminate(void) { if (watchdog != -1) { if (write(watchdog, "V", 1) < 0 ) perror(progname); if (close(watchdog) == -1) perror(progname); } exit(0); } static int spool(char *line, int *i, int offset) { for ( (*i) += offset; line[*i] == ' ' || line[*i] == '\t'; (*i)++ ); if ( line[*i] == '=' ) (*i)++; for ( ; line[*i] == ' ' || line[*i] == '\t'; (*i)++ ); if ( line[*i] == '\0' ) return(1); else return(0); } static void read_config(char *configfile, char *progname) { FILE *wc; if ( (wc = fopen(configfile, "r")) == NULL ) { perror(progname); exit(1); } while ( !feof(wc) ) { char *line = NULL; size_t n; if (getline(&line, &n, wc) == -1) { if ( !ferror(wc) ) break; else { perror(progname); exit(1); } } else { int i, j; /* scan the actual line for an option */ /* first remove the leading blanks */ for ( i = 0; line[i] == ' ' || line[i] == '\t'; i++ ); /* if the next sign is a '#' we have a comment */ if ( line[i] == '#' ) continue; /* also remove the trailing blanks and the \n */ for ( j = strlen(line) - 1; line[j] == ' ' || line[j] == '\t' || line[j] == '\n'; j-- ); line[j + 1] = '\0'; /* if the line is empty now, we don't have to parse it */ if ( strlen(line + i) == 0 ) continue; /* now check for an option */ if ( strncmp(line + i, DEVICE, strlen(DEVICE)) == 0 ) { if ( spool(line, &i, strlen(DEVICE)) ) devname = NULL; else devname = strdup(line + i); } else { /* * do not print an error message here because we usually use * watchdog's config file which may contain far more valid * options than we understand */ /* fprintf(stderr, "Ignoring config line: %s\n", line); */ } } } if ( fclose(wc) != 0 ) { perror(progname); exit(1); } } int main(int argc, char *const argv[]) { char *configfile = CONFIG_FILENAME; int c; struct watchdog_info ident; char *opts = "c:"; struct option long_options[] = { {"config-file", required_argument, NULL, 'c'}, {NULL, 0, NULL, 0} }; progname = basename(argv[0]); /* check for the one option we understand */ while ((c = getopt_long(argc, argv, opts, long_options, NULL)) != EOF) { if (c == -1) break; switch (c) { case 'c': configfile = optarg; break; default: usage(); } } read_config(configfile, progname); /* this program has no other function than iidentifying the hardware behind * this device i.e. if there is no device given we better punt */ if ( devname == NULL ) exit(0); /* open the device */ watchdog = open(devname, O_WRONLY); if ( watchdog == -1 ) { perror(progname); exit(1); } /* Print watchdog identity */ if (ioctl(watchdog, WDIOC_GETSUPPORT, &ident) < 0) { perror(progname); } else { ident.identity[sizeof(ident.identity) - 1] = '\0'; /* Be sure */ printf("%s\n", ident.identity); } if (write(watchdog, "V", 1) < 0 ) perror(progname); if (close(watchdog) == -1) perror(progname); exit(0); } watchdog-5.13/src/ifdown.c0000644000175000017500000000244312102721740015250 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/ifdown.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ /* * ifdown.c Find all network interfaces on the system and * shut them down. * */ char *v_ifdown = "@(#)ifdown.c 1.10 21-Apr-1997 miquels@cistron.nl"; #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #define MAX_IFS 64 int ifdown(void) { struct ifreq ifr[MAX_IFS]; struct ifconf ifc; int i, fd; int numif; if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { fprintf(stderr, "ifdown: "); perror("socket"); return -1; } ifc.ifc_len = sizeof(ifr); ifc.ifc_req = ifr; if (ioctl(fd, SIOCGIFCONF, &ifc) < 0) { fprintf(stderr, "ifdown: "); perror("SIOCGIFCONF"); close(fd); return -1; } numif = ifc.ifc_len / sizeof(struct ifreq); for(i = 0; i < numif; i++) { if (strcmp(ifr[i].ifr_name, "lo") == 0) continue; if (strchr(ifr[i].ifr_name, ':') != NULL) continue; ifr[i].ifr_flags &= ~(IFF_UP); if (ioctl(fd, SIOCSIFFLAGS, &ifr[i]) < 0) { fprintf(stderr, "ifdown: shutdown "); perror(ifr[i].ifr_name); } } close(fd); return 0; } watchdog-5.13/src/nfsmount.c0000644000175000017500000005322512102721740015637 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/nfsmount.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ /* * nfsmount.c -- Linux NFS mount * Copyright (C) 1993 Rick Sladkey * * 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 * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Wed Feb 8 12:51:48 1995, biro@yggdrasil.com (Ross Biro): allow all port * numbers to be specified on the command line. * * Fri, 8 Mar 1996 18:01:39, Swen Thuemmler : * Omit the call to connect() for Linux version 1.3.11 or later. * * Wed Oct 1 23:55:28 1997: Dick Streefland * Implemented the "bg", "fg" and "retry" mount options for NFS. * * 1999-02-22 Arkadiusz Mi¶kiewicz * - added Native Language Support * * Modified by Olaf Kirch and Trond Myklebust for new NFS code, * plus NFSv3 stuff. */ /* * nfsmount.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp */ #include "config.h" #if HAVE_NFS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "sundries.h" #include "nfsmount.h" #include #include "mount_constants.h" #include "nfs_mount4.h" #define HAVE_inet_aton #ifndef NFS_PORT #define NFS_PORT 2049 #endif #ifndef NFS_FHSIZE #define NFS_FHSIZE 32 #endif static char *nfs_strerror(int stat); #define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) #define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) static int linux_version_code(void) { struct utsname my_utsname; int p, q, r; if (uname(&my_utsname) == 0) { p = atoi(strtok(my_utsname.release, ".")); q = atoi(strtok(NULL, ".")); r = atoi(strtok(NULL, ".")); return MAKE_VERSION(p,q,r); } return 0; } /* * nfs_mount_version according to the sources seen at compile time. */ int nfs_mount_version = NFS_MOUNT_VERSION; /* * Unfortunately, the kernel prints annoying console messages * in case of an unexpected nfs mount version (instead of * just returning some error). Therefore we'll have to try * and figure out what version the kernel expects. * * Variables: * NFS_MOUNT_VERSION: these nfsmount sources at compile time * nfs_mount_version: version this source and running kernel can handle */ static void find_kernel_nfs_mount_version(void) { static int kernel_version = 0; if (kernel_version) return; kernel_version = linux_version_code(); if (kernel_version) { if (kernel_version < MAKE_VERSION(2,1,32)) nfs_mount_version = 1; else if (kernel_version < MAKE_VERSION(2,2,18)) nfs_mount_version = 3; else if (kernel_version < MAKE_VERSION(2,3,0)) nfs_mount_version = 4; /* since 2.2.18pre9 */ else if (kernel_version < MAKE_VERSION(2,3,99)) nfs_mount_version = 3; else nfs_mount_version = 4; /* since 2.3.99pre4 */ } if (nfs_mount_version > NFS_MOUNT_VERSION) nfs_mount_version = NFS_MOUNT_VERSION; } static struct pmap * get_mountport(struct sockaddr_in *server_addr, long unsigned prog, long unsigned version, long unsigned proto, long unsigned port) { struct pmaplist *pmap; static struct pmap p = {0, 0, 0, 0}; server_addr->sin_port = PMAPPORT; pmap = pmap_getmaps(server_addr); if (version > MAX_NFSPROT) version = MAX_NFSPROT; if (!prog) prog = MOUNTPROG; p.pm_prog = prog; p.pm_vers = version; p.pm_prot = proto; p.pm_port = port; while (pmap) { if (pmap->pml_map.pm_prog != prog) goto next; if (!version && p.pm_vers > pmap->pml_map.pm_vers) goto next; if (version > 2 && pmap->pml_map.pm_vers != version) goto next; if (version && version <= 2 && pmap->pml_map.pm_vers > 2) goto next; if (pmap->pml_map.pm_vers > MAX_NFSPROT || (proto && p.pm_prot && pmap->pml_map.pm_prot != proto) || (port && pmap->pml_map.pm_port != port)) goto next; memcpy(&p, &pmap->pml_map, sizeof(p)); next: pmap = pmap->pml_next; } if (!p.pm_vers) p.pm_vers = MOUNTVERS; if (!p.pm_port) p.pm_port = MOUNTPORT; if (!p.pm_prot) p.pm_prot = IPPROTO_TCP; return &p; } int nfsmount(const char *spec, const char *node, int *flags, char **extra_opts, char **mount_opts, int running_bg) { static char *prev_bg_host; char hostdir[1024]; CLIENT *mclient; char *hostname; char *dirname; char *old_opts; char *mounthost=NULL; char new_opts[1024]; struct timeval total_timeout; enum clnt_stat clnt_stat; static struct nfs_mount_data data; char *opt, *opteq; int val; struct hostent *hp; struct sockaddr_in server_addr; struct sockaddr_in mount_server_addr; struct pmap* pm_mnt; int msock, fsock; struct timeval retry_timeout; union { struct fhstatus nfsv2; struct mountres3 nfsv3; } status; struct stat statbuf; char *s; int port; int mountport; int proto; int bg; int soft; int intr; int posix; int nocto; int noac; int nolock; int broken_suid; int retry; int tcp; int mountprog; int mountvers; int nfsprog; int nfsvers; int retval; time_t t; time_t prevt; time_t timeout; find_kernel_nfs_mount_version(); retval = EX_FAIL; msock = fsock = -1; mclient = NULL; if (strlen(spec) >= sizeof(hostdir)) { fprintf(stderr, "mount: " "excessively long host:dir argument\n"); goto fail; } strcpy(hostdir, spec); if ((s = strchr(hostdir, ':'))) { hostname = hostdir; dirname = s + 1; *s = '\0'; /* Ignore all but first hostname in replicated mounts until they can be fully supported. (mack@sgi.com) */ if ((s = strchr(hostdir, ','))) { *s = '\0'; fprintf(stderr, "mount: warning: " "multiple hostnames not supported\n"); } } else { fprintf(stderr, "mount: " "directory to mount not in host:dir format\n"); goto fail; } server_addr.sin_family = AF_INET; #ifdef HAVE_inet_aton if (!inet_aton(hostname, &server_addr.sin_addr)) #endif { if ((hp = gethostbyname(hostname)) == NULL) { fprintf(stderr, "mount: can't get address for %s\n", hostname); goto fail; } else { if (hp->h_length > sizeof(struct in_addr)) { fprintf(stderr, "mount: got bad hp->h_length\n"); hp->h_length = sizeof(struct in_addr); } memcpy(&server_addr.sin_addr, hp->h_addr, hp->h_length); } } memcpy (&mount_server_addr, &server_addr, sizeof (mount_server_addr)); /* add IP address to mtab options for use when unmounting */ s = inet_ntoa(server_addr.sin_addr); old_opts = *extra_opts; if (!old_opts) old_opts = ""; if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { fprintf(stderr, "mount: " "excessively long option argument\n"); goto fail; } sprintf(new_opts, "%s%saddr=%s", old_opts, *old_opts ? "," : "", s); *extra_opts = xstrdup(new_opts); /* Set default options. * rsize/wsize (and bsize, for ver >= 3) are left 0 in order to * let the kernel decide. * timeo is filled in after we know whether it'll be TCP or UDP. */ memset(&data, 0, sizeof(data)); data.retrans = 3; data.acregmin = 3; data.acregmax = 60; data.acdirmin = 30; data.acdirmax = 60; #if NFS_MOUNT_VERSION >= 2 data.namlen = NAME_MAX; #endif bg = 0; soft = 0; intr = 0; posix = 0; nocto = 0; nolock = 0; broken_suid = 0; noac = 0; retry = 10000; /* 10000 minutes ~ 1 week */ tcp = 0; mountprog = MOUNTPROG; mountvers = 0; port = 0; mountport = 0; nfsprog = NFS_PROGRAM; nfsvers = 0; /* parse options */ for (opt = strtok(old_opts, ","); opt; opt = strtok(NULL, ",")) { if ((opteq = strchr(opt, '='))) { val = atoi(opteq + 1); *opteq = '\0'; if (!strcmp(opt, "rsize")) data.rsize = val; else if (!strcmp(opt, "wsize")) data.wsize = val; else if (!strcmp(opt, "timeo")) data.timeo = val; else if (!strcmp(opt, "retrans")) data.retrans = val; else if (!strcmp(opt, "acregmin")) data.acregmin = val; else if (!strcmp(opt, "acregmax")) data.acregmax = val; else if (!strcmp(opt, "acdirmin")) data.acdirmin = val; else if (!strcmp(opt, "acdirmax")) data.acdirmax = val; else if (!strcmp(opt, "actimeo")) { data.acregmin = val; data.acregmax = val; data.acdirmin = val; data.acdirmax = val; } else if (!strcmp(opt, "retry")) retry = val; else if (!strcmp(opt, "port")) port = val; else if (!strcmp(opt, "mountport")) mountport = val; else if (!strcmp(opt, "mounthost")) mounthost=xstrndup(opteq+1, strcspn(opteq+1," \t\n\r,")); else if (!strcmp(opt, "mountprog")) mountprog = val; else if (!strcmp(opt, "mountvers")) mountvers = val; else if (!strcmp(opt, "nfsprog")) nfsprog = val; else if (!strcmp(opt, "nfsvers") || !strcmp(opt, "vers")) nfsvers = val; else if (!strcmp(opt, "proto")) { if (!strncmp(opteq+1, "tcp", 3)) tcp = 1; else if (!strncmp(opteq+1, "udp", 3)) tcp = 0; else printf("Warning: Unrecognized proto= option.\n"); } else if (!strcmp(opt, "namlen")) { #if NFS_MOUNT_VERSION >= 2 if (nfs_mount_version >= 2) data.namlen = val; else #endif printf("Warning: Option namlen is not supported.\n"); } else if (!strcmp(opt, "addr")) /* ignore */; else { printf("unknown nfs mount parameter: " "%s=%d\n", opt, val); goto fail; } } else { val = 1; if (!strncmp(opt, "no", 2)) { val = 0; opt += 2; } if (!strcmp(opt, "bg")) bg = val; else if (!strcmp(opt, "fg")) bg = !val; else if (!strcmp(opt, "soft")) soft = val; else if (!strcmp(opt, "hard")) soft = !val; else if (!strcmp(opt, "intr")) intr = val; else if (!strcmp(opt, "posix")) posix = val; else if (!strcmp(opt, "cto")) nocto = !val; else if (!strcmp(opt, "ac")) noac = !val; else if (!strcmp(opt, "tcp")) tcp = val; else if (!strcmp(opt, "udp")) tcp = !val; else if (!strcmp(opt, "lock")) { if (nfs_mount_version >= 3) nolock = !val; else printf("Warning: option nolock is not supported.\n"); } else if (!strcmp(opt, "broken_suid")) { broken_suid = val; } else { if (!sloppy) { printf("unknown nfs mount option: " "%s%s\n", val ? "" : "no", opt); goto fail; } } } } proto = (tcp) ? IPPROTO_TCP : IPPROTO_UDP; data.flags = (soft ? NFS_MOUNT_SOFT : 0) | (intr ? NFS_MOUNT_INTR : 0) | (posix ? NFS_MOUNT_POSIX : 0) | (nocto ? NFS_MOUNT_NOCTO : 0) | (noac ? NFS_MOUNT_NOAC : 0); #if NFS_MOUNT_VERSION >= 2 if (nfs_mount_version >= 2) data.flags |= (tcp ? NFS_MOUNT_TCP : 0); #endif #if NFS_MOUNT_VERSION >= 3 if (nfs_mount_version >= 3) data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); #endif #if NFS_MOUNT_VERSION >= 4 if (nfs_mount_version >= 4) data.flags |= (broken_suid ? NFS_MOUNT_BROKEN_SUID : 0); #endif if (nfsvers > MAX_NFSPROT) { fprintf(stderr, "NFSv%d not supported!\n", nfsvers); return 0; } if (mountvers > MAX_NFSPROT) { fprintf(stderr, "NFSv%d not supported!\n", nfsvers); return 0; } if (nfsvers && !mountvers) mountvers = (nfsvers < 3) ? 1 : nfsvers; if (nfsvers && nfsvers < mountvers) { mountvers = nfsvers; } /* Adjust options if none specified */ if (!data.timeo) data.timeo = tcp ? 70 : 7; #ifdef NFS_MOUNT_DEBUG printf("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n", data.rsize, data.wsize, data.timeo, data.retrans); printf("acreg (min, max) = (%d, %d), acdir (min, max) = (%d, %d)\n", data.acregmin, data.acregmax, data.acdirmin, data.acdirmax); printf("port = %d, bg = %d, retry = %d, flags = %.8x\n", port, bg, retry, data.flags); printf("mountprog = %d, mountvers = %d, nfsprog = %d, nfsvers = %d\n", mountprog, mountvers, nfsprog, nfsvers); printf("soft = %d, intr = %d, posix = %d, nocto = %d, noac = %d\n", (data.flags & NFS_MOUNT_SOFT) != 0, (data.flags & NFS_MOUNT_INTR) != 0, (data.flags & NFS_MOUNT_POSIX) != 0, (data.flags & NFS_MOUNT_NOCTO) != 0, (data.flags & NFS_MOUNT_NOAC) != 0); #if NFS_MOUNT_VERSION >= 2 printf("tcp = %d\n", (data.flags & NFS_MOUNT_TCP) != 0); #endif #endif data.version = nfs_mount_version; *mount_opts = (char *) &data; if (*flags & MS_REMOUNT) return 0; /* * If the previous mount operation on the same host was * backgrounded, and the "bg" for this mount is also set, * give up immediately, to avoid the initial timeout. */ if (bg && !running_bg && prev_bg_host && strcmp(hostname, prev_bg_host) == 0) { if (retry > 0) retval = EX_BG; return retval; } /* create mount deamon client */ /* See if the nfs host = mount host. */ if (mounthost) { if (mounthost[0] >= '0' && mounthost[0] <= '9') { mount_server_addr.sin_family = AF_INET; mount_server_addr.sin_addr.s_addr = inet_addr(hostname); } else { if ((hp = gethostbyname(mounthost)) == NULL) { fprintf(stderr, "mount: can't get address for %s\n", hostname); goto fail; } else { if (hp->h_length > sizeof(struct in_addr)) { fprintf(stderr, "mount: got bad hp->h_length?\n"); hp->h_length = sizeof(struct in_addr); } mount_server_addr.sin_family = AF_INET; memcpy(&mount_server_addr.sin_addr, hp->h_addr, hp->h_length); } } } /* * The following loop implements the mount retries. On the first * call, "running_bg" is 0. When the mount times out, and the * "bg" option is set, the exit status EX_BG will be returned. * For a backgrounded mount, there will be a second call by the * child process with "running_bg" set to 1. * * The case where the mount point is not present and the "bg" * option is set, is treated as a timeout. This is done to * support nested mounts. * * The "retry" count specified by the user is the number of * minutes to retry before giving up. * * Only the first error message will be displayed. */ retry_timeout.tv_sec = 3; retry_timeout.tv_usec = 0; total_timeout.tv_sec = 20; total_timeout.tv_usec = 0; timeout = time(NULL) + 60 * retry; prevt = 0; t = 30; val = 1; for (;;) { if (bg && stat(node, &statbuf) == -1) { /* no mount point yet - sleep */ if (running_bg) { sleep(val); /* 1, 2, 4, 8, 16, 30, ... */ val *= 2; if (val > 30) val = 30; } } else { /* be careful not to use too many CPU cycles */ if (t - prevt < 30) sleep(30); pm_mnt = get_mountport(&mount_server_addr, mountprog, mountvers, proto, mountport); /* contact the mount daemon via TCP */ mount_server_addr.sin_port = htons(pm_mnt->pm_port); msock = RPC_ANYSOCK; switch (pm_mnt->pm_prot) { case IPPROTO_UDP: mclient = clntudp_create(&mount_server_addr, pm_mnt->pm_prog, pm_mnt->pm_vers, retry_timeout, &msock); if (mclient) break; mount_server_addr.sin_port = htons(pm_mnt->pm_port); msock = RPC_ANYSOCK; case IPPROTO_TCP: mclient = clnttcp_create(&mount_server_addr, pm_mnt->pm_prog, pm_mnt->pm_vers, &msock, 0, 0); break; default: mclient = 0; } if (mclient) { /* try to mount hostname:dirname */ mclient->cl_auth = authunix_create_default(); /* make pointers in xdr_mountres3 NULL so * that xdr_array allocates memory for us */ memset(&status, 0, sizeof(status)); if (pm_mnt->pm_vers == 3) clnt_stat = clnt_call(mclient, MOUNTPROC3_MNT, (xdrproc_t) xdr_dirpath, (caddr_t) &dirname, (xdrproc_t) xdr_mountres3, (caddr_t) &status, total_timeout); else clnt_stat = clnt_call(mclient, MOUNTPROC_MNT, (xdrproc_t) xdr_dirpath, (caddr_t) &dirname, (xdrproc_t) xdr_fhstatus, (caddr_t) &status, total_timeout); if (clnt_stat == RPC_SUCCESS) break; /* we're done */ #if 0 /* errno? who sets errno? */ /* this fragment breaks bg mounting */ if (errno != ECONNREFUSED) { clnt_perror(mclient, "mount"); goto fail; /* don't retry */ } #endif if (!running_bg && prevt == 0) clnt_perror(mclient, "mount"); auth_destroy(mclient->cl_auth); clnt_destroy(mclient); mclient = 0; close(msock); } else { if (!running_bg && prevt == 0) clnt_pcreateerror("mount"); } prevt = t; } if (!bg) goto fail; if (!running_bg) { prev_bg_host = xstrdup(hostname); if (retry > 0) retval = EX_BG; goto fail; } t = time(NULL); if (t >= timeout) goto fail; } nfsvers = (pm_mnt->pm_vers < 2) ? 2 : pm_mnt->pm_vers; if (nfsvers == 2) { if (status.nfsv2.fhs_status != 0) { fprintf(stderr, "mount: %s:%s failed, reason given by server: %s\n", hostname, dirname, nfs_strerror(status.nfsv2.fhs_status)); goto fail; } memcpy(data.root.data, (char *) status.nfsv2.fhstatus_u.fhs_fhandle, NFS_FHSIZE); #if NFS_MOUNT_VERSION >= 4 data.root.size = NFS_FHSIZE; memcpy(data.old_root.data, (char *) status.nfsv2.fhstatus_u.fhs_fhandle, NFS_FHSIZE); #endif } else { #if NFS_MOUNT_VERSION >= 4 fhandle3 *fhandle; if (status.nfsv3.fhs_status != 0) { fprintf(stderr, "mount: %s:%s failed, reason given by server: %s\n", hostname, dirname, nfs_strerror(status.nfsv3.fhs_status)); goto fail; } fhandle = &status.nfsv3.mountres3_u.mountinfo.fhandle; memset(data.old_root.data, 0, NFS_FHSIZE); memset(&data.root, 0, sizeof(data.root)); data.root.size = fhandle->fhandle3_len; memcpy(data.root.data, (char *) fhandle->fhandle3_val, fhandle->fhandle3_len); data.flags |= NFS_MOUNT_VER3; #endif } /* create nfs socket for kernel */ if (tcp) { if (nfs_mount_version < 3) { printf("NFS over TCP is not supported.\n"); goto fail; } fsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); } else fsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (fsock < 0) { perror("nfs socket"); goto fail; } if (bindresvport(fsock, 0) < 0) { perror("nfs bindresvport"); goto fail; } if (port == 0) { server_addr.sin_port = PMAPPORT; port = pmap_getport(&server_addr, nfsprog, nfsvers, tcp ? IPPROTO_TCP : IPPROTO_UDP); if (port == 0) port = NFS_PORT; #ifdef NFS_MOUNT_DEBUG else printf("used portmapper to find NFS port\n"); #endif } #ifdef NFS_MOUNT_DEBUG printf("using port %d for nfs deamon\n", port); #endif server_addr.sin_port = htons(port); /* * connect() the socket for kernels 1.3.10 and below only, * to avoid problems with multihomed hosts. * --Swen */ if (linux_version_code() <= 66314 && connect(fsock, (struct sockaddr *) &server_addr, sizeof (server_addr)) < 0) { perror("nfs connect"); goto fail; } /* prepare data structure for kernel */ data.fd = fsock; memcpy((char *) &data.addr, (char *) &server_addr, sizeof(data.addr)); strncpy(data.hostname, hostname, sizeof(data.hostname)); /* clean up */ auth_destroy(mclient->cl_auth); clnt_destroy(mclient); close(msock); return 0; /* abort */ fail: if (msock != -1) { if (mclient) { auth_destroy(mclient->cl_auth); clnt_destroy(mclient); } close(msock); } if (fsock != -1) close(fsock); return retval; } /* * We need to translate between nfs status return values and * the local errno values which may not be the same. * * Andreas Schwab : change errno: * "after #include the symbol errno is reserved for any use, * it cannot even be used as a struct tag or field name". */ #ifndef EDQUOT #define EDQUOT ENOSPC #endif static struct { enum nfs_stat stat; int errnum; } nfs_errtbl[] = { { NFS_OK, 0 }, { NFSERR_PERM, EPERM }, { NFSERR_NOENT, ENOENT }, { NFSERR_IO, EIO }, { NFSERR_NXIO, ENXIO }, { NFSERR_ACCES, EACCES }, { NFSERR_EXIST, EEXIST }, { NFSERR_NODEV, ENODEV }, { NFSERR_NOTDIR, ENOTDIR }, { NFSERR_ISDIR, EISDIR }, #ifdef NFSERR_INVAL { NFSERR_INVAL, EINVAL }, /* that Sun forgot */ #endif { NFSERR_FBIG, EFBIG }, { NFSERR_NOSPC, ENOSPC }, { NFSERR_ROFS, EROFS }, { NFSERR_NAMETOOLONG, ENAMETOOLONG }, { NFSERR_NOTEMPTY, ENOTEMPTY }, { NFSERR_DQUOT, EDQUOT }, { NFSERR_STALE, ESTALE }, #ifdef EWFLUSH { NFSERR_WFLUSH, EWFLUSH }, #endif /* Throw in some NFSv3 values for even more fun (HP returns these) */ { 71, EREMOTE }, { -1, EIO } }; static char *nfs_strerror(int stat) { int i; static char buf[256]; for (i = 0; nfs_errtbl[i].stat != -1; i++) { if (nfs_errtbl[i].stat == stat) return strerror(nfs_errtbl[i].errnum); } sprintf(buf, "unknown nfs status return value: %d", stat); return buf; } #if 0 int my_getport(struct in_addr server, struct timeval *timeo, ...) { struct sockaddr_in sin; struct pmap pmap; CLIENT *clnt; int sock = RPC_ANYSOCK, port; pmap.pm_prog = prog; pmap.pm_vers = vers; pmap.pm_prot = prot; pmap.pm_port = 0; sin.sin_family = AF_INET; sin.sin_addr = server; sin.sin_port = htons(111); clnt = clntudp_create(&sin, 100000, 2, *timeo, &sock); status = clnt_call(clnt, PMAP_GETPORT, &pmap, (xdrproc_t) xdr_pmap, &port, (xdrproc_t) xdr_uint); if (status != SUCCESS) { /* natter */ port = 0; } clnt_destroy(clnt); close(sock); return port; } #endif #endif watchdog-5.13/src/watchdog.c0000644000175000017500000007362212102721740015571 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/watchdog.c,v 1.5 2009/02/25 09:38:18 meskes Exp $ */ /*************************************************************/ /* Original version was an example in the kernel source tree */ /* */ /* Most of the rest was written by me, Michael Meskes */ /* meskes@debian.org */ /* */ /*************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "extern.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "watch_err.h" #if USE_SYSLOG #include #endif /* USE_SYSLOG */ static int no_act = FALSE; #if USE_SYSLOG int verbose = FALSE; #endif /* USE_SYSLOG */ volatile sig_atomic_t _running = 1; #define ADMIN "admin" #define CHANGE "change" #define DEVICE "watchdog-device" #define DEVICE_TIMEOUT "watchdog-timeout" #define FILENAME "file" #define INTERFACE "interface" #define INTERVAL "interval" #define LOGTICK "logtick" #define MAXLOAD1 "max-load-1" #define MAXLOAD5 "max-load-5" #define MAXLOAD15 "max-load-15" #define MAXTEMP "max-temperature" #define MINMEM "min-memory" #define SERVERPIDFILE "pidfile" #define PING "ping" #define PINGCOUNT "ping-count" #define PRIORITY "priority" #define REALTIME "realtime" #define REPAIRBIN "repair-binary" #define REPAIRTIMEOUT "repair-timeout" #define TEMP "temperature-device" #define TESTBIN "test-binary" #define TESTTIMEOUT "test-timeout" #define HEARTBEAT "heartbeat-file" #define HBSTAMPS "heartbeat-stamps" #define LOGDIR "log-dir" #define TESTDIR "test-directory" #ifndef TESTBIN_PATH #define TESTBIN_PATH NULL #endif pid_t pid; int tint = 1, softboot = FALSE, watchdog = -1, load = -1, mem = -1, temp = -1; int logtick = 1, ticker = 1, schedprio = 1; int maxload1 = 0, maxload5 = 0, maxload15 = 0, minpages = 0; int maxtemp = 120, hbstamps = 300, lastts, nrts; int pingcount = 3; int devtimeout = TIMER_MARGIN; char *tempname = NULL, *devname = NULL, *admin = "root", *progname; char *timestamps, *heartbeat; time_t timeout = 0, rtimeout = 0; FILE *hb; char* logdir = "/var/log/watchdog"; char *filename_buf; #if defined(_POSIX_MEMLOCK) int mlocked = FALSE, realtime = FALSE; #endif static void usage(void) { fprintf(stderr, "%s version %d.%d, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION); #if USE_SYSLOG fprintf(stderr, "%s [-F] [-f] [-c ] [-v] [-s] [-b] [-q]\n", progname); #else /* USE_SYSLOG */ fprintf(stderr, "%s [-F] [-f] [-c ] [-s] [-b] [-q]\n", progname); #endif /* USE_SYSLOG */ exit(1); } /* Try to sync */ static int sync_system(int sync_it) { if (sync_it) { sync(); sync(); } return (0); } /* execute repair binary */ static int repair(char *rbinary, int result, char *name, int version) { pid_t child_pid; pid_t r_pid; char parm[5]; int ret; /* no binary given, we have to reboot */ if (rbinary == NULL) return (result); sprintf(parm, "%d", result); child_pid = fork(); if (!child_pid) { /* Don't want the stdin and stdout of our repair program * to cause trouble. * So make stdout and stderr go to their respective files */ strcpy(filename_buf, logdir); strcat(filename_buf, "/repair-bin.stdout"); if (!freopen(filename_buf, "a+", stdout)) exit (errno); strcpy(filename_buf, logdir); strcat(filename_buf, "/repair-bin.stderr"); if (!freopen(filename_buf, "a+", stderr)) exit (errno); /* now start binary */ if (version == 0) { if (name == NULL) execl(rbinary, rbinary, parm, NULL); else execl(rbinary, rbinary, parm, name, NULL); } else /* if (version == 1) */ { if (name == NULL) execl(rbinary, rbinary, "repair", parm, NULL); else execl(rbinary, rbinary, "repair", parm, name, NULL); } /* execl should only return in case of an error */ /* so we return the reboot code */ return (errno); } else if (child_pid < 0) { /* fork failed */ int err = errno; if (errno == EAGAIN) { /* process table full */ #if USE_SYSLOG syslog(LOG_ERR, "process table is full!"); #endif /* USE_SYSLOG */ return (EREBOOT); } else if (softboot) return (err); else return (ENOERR); } if (rtimeout > 0) { time_t left = rtimeout; do { sleep (1); r_pid = waitpid(child_pid, &result, WNOHANG); if (r_pid) break; left--; } while (left > 0); } else r_pid = waitpid(child_pid, &result, 0); if (r_pid == 0) { #if USE_SYSLOG syslog(LOG_ERR, "repair child %d timed out", child_pid); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ return (EREBOOT); } else if (r_pid != child_pid) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "child %d does not exist (errno = %d = '%m')", child_pid, err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); } /* check result */ ret = WEXITSTATUS(result); if (ret != 0) { #if USE_SYSLOG syslog(LOG_ERR, "repair binary %s returned %d", rbinary, ret); #endif /* USE_SYSLOG */ if (ret == ERESET) /* repair script says force hard reset, we give it a try */ sleep(devtimeout * 4); /* for all other errors or if we still live, we let shutdown handle it */ return (ret); } return (ENOERR); } static void wd_action(int result, char *rbinary, char *name, int version) { /* if no-action flag set, do nothing */ /* no error, keep on working */ if (result == ENOERR || no_act == TRUE) return; /* error that might be repairable */ if (result != EREBOOT) result = repair(rbinary, result, name, version); /* if still error, reboot */ if (result != ENOERR) do_shutdown(result); } static void do_check(int res, char *rbinary, char *name) { wd_action(res, rbinary, name, 0); wd_action(keep_alive(), rbinary, NULL, 0); } static void do_check2(int res, char *r_specific, char *r_global, char *name) { wd_action(res, r_specific, name, 1); wd_action(keep_alive(), r_global, NULL, 0); } /* Self-repairing binaries list */ struct list *tr_bin = NULL; char *test_dir = TESTBIN_PATH; struct list *file = NULL, *target = NULL, *pidfile = NULL, *iface = NULL; char *tbinary, *rbinary, *admin; static void add_list(struct list **list, char *name) { struct list *new, *act; if ((new = (struct list *) calloc(1, sizeof(struct list))) == NULL) { fprintf(stderr, "%s: out of memory\n", progname); exit(1); } new->name = name; memset((char *) (&(new->parameter)), '\0', sizeof(union wdog_options)); if (*list == NULL) *list = new; else { for (act = *list; act->next != NULL; act = act->next); act->next = new; } } static int spool(char *line, int *i, int offset) { for ((*i) += offset; line[*i] == ' ' || line[*i] == '\t'; (*i)++); if (line[*i] == '=') (*i)++; for (; line[*i] == ' ' || line[*i] == '\t'; (*i)++); if (line[*i] == '\0') return(1); else return(0); } static void read_config(char *configfile, char *progname) { FILE *wc; int gotload5 = FALSE, gotload15 = FALSE; if ((wc = fopen(configfile, "r")) == NULL) { fprintf(stderr, "%s: Can't open config file \"%s\": %s ", progname, configfile, strerror(errno)); exit(1); } while (!feof(wc)) { char *line = NULL; size_t n; if (getline(&line, &n, wc) == -1) { if (!ferror(wc)) break; else { perror(progname); exit(1); } } else { int i, j; /* scan the actual line for an option */ /* first remove the leading blanks */ for (i = 0; line[i] == ' ' || line[i] == '\t'; i++); /* if the next sign is a '#' we have a comment */ if (line[i] == '#') continue; /* also remove the trailing blanks and the \n */ for (j = strlen(line) - 1; line[j] == ' ' || line[j] == '\t' || line[j] == '\n'; j--); line[j + 1] = '\0'; /* if the line is empty now, we don't have to parse it */ if (strlen(line + i) == 0) continue; /* now check for an option */ if (strncmp(line + i, FILENAME, strlen(FILENAME)) == 0) { if (spool(line, &i, strlen(FILENAME))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else add_list(&file, strdup(line + i)); } else if (strncmp(line + i, CHANGE, strlen(CHANGE)) == 0) { struct list *ptr; if (spool(line, &i, strlen(CHANGE))) continue; if (!file) { /* no file entered yet */ fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); continue; } for (ptr = file; ptr->next != NULL; ptr = ptr->next); if (ptr->parameter.file.mtime != 0) fprintf(stderr, "Duplicate change interval option in config file. Ignoring first entry.\n"); ptr->parameter.file.mtime = atoi(line + i); } else if (strncmp(line + i, SERVERPIDFILE, strlen(SERVERPIDFILE)) == 0) { if (spool(line, &i, strlen(SERVERPIDFILE))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else add_list(&pidfile, strdup(line + i)); } else if (strncmp(line + i, PINGCOUNT, strlen(PINGCOUNT)) == 0) { if (spool(line, &i, strlen(PINGCOUNT))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else pingcount = atol(line + i); } else if (strncmp(line + i, PING, strlen(PING)) == 0) { if (spool(line, &i, strlen(PING))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else add_list(&target, strdup(line + i)); } else if (strncmp(line + i, INTERFACE, strlen(INTERFACE)) == 0) { if (spool(line, &i, strlen(INTERFACE))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else add_list(&iface, strdup(line + i)); } else if (strncmp(line + i, REALTIME, strlen(REALTIME)) == 0) { (void)spool(line, &i, strlen(REALTIME)); realtime = (strncmp(line + i, "yes", 3) == 0) ? TRUE : FALSE; } else if (strncmp(line + i, PRIORITY, strlen(PRIORITY)) == 0) { if (spool(line, &i, strlen(PRIORITY))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else schedprio = atol(line + i); } else if (strncmp(line + i, REPAIRBIN, strlen(REPAIRBIN)) == 0) { if (spool(line, &i, strlen(REPAIRBIN))) rbinary = NULL; else rbinary = strdup(line + i); } else if (strncmp(line + i, REPAIRTIMEOUT, strlen(REPAIRTIMEOUT)) == 0) { if (spool(line, &i, strlen(REPAIRTIMEOUT))) rtimeout = 0; else rtimeout = atol(line + i); } else if (strncmp(line + i, TESTBIN, strlen(TESTBIN)) == 0) { if (spool(line, &i, strlen(TESTBIN))) tbinary = NULL; else tbinary = strdup(line + i); } else if (strncmp(line + i, TESTTIMEOUT, strlen(TESTTIMEOUT)) == 0) { if (spool(line, &i, strlen(TESTTIMEOUT))) timeout = 0; else timeout = atol(line + i); } else if (strncmp(line + i, HEARTBEAT, strlen(HEARTBEAT)) == 0) { if (spool(line, &i, strlen(HEARTBEAT))) heartbeat = NULL; else heartbeat = strdup(line + i); } else if (strncmp(line + i, HBSTAMPS, strlen(HBSTAMPS)) == 0) { if (spool(line, &i, strlen(HBSTAMPS))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else hbstamps = atol(line + i); } else if (strncmp(line + i, ADMIN, strlen(ADMIN)) == 0) { if (spool(line, &i, strlen(ADMIN))) admin = NULL; else admin = strdup(line + i); } else if (strncmp(line + i, INTERVAL, strlen(INTERVAL)) == 0) { if (spool(line, &i, strlen(INTERVAL))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else tint = atol(line + i); } else if (strncmp(line + i, LOGTICK, strlen(LOGTICK)) == 0) { if (spool(line, &i, strlen(LOGTICK))) logtick = ticker = 1; else logtick = ticker = atol(line + i); } else if (strncmp(line + i, DEVICE, strlen(DEVICE)) == 0) { if (spool(line, &i, strlen(DEVICE))) devname = NULL; else devname = strdup(line + i); } else if (strncmp(line + i, DEVICE_TIMEOUT, strlen(DEVICE_TIMEOUT)) == 0) { if (spool(line, &i, strlen(DEVICE_TIMEOUT))) fprintf(stderr, "Ignoring invalid line in config file: %s ", line); else devtimeout = atol(line + i); } else if (strncmp(line + i, TEMP, strlen(TEMP)) == 0) { if (spool(line, &i, strlen(TEMP))) tempname = NULL; else tempname = strdup(line + i); } else if (strncmp(line + i, MAXTEMP, strlen(MAXTEMP)) == 0) { if (spool(line, &i, strlen(MAXTEMP))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else maxtemp = atol(line + i); } else if (strncmp(line + i, MAXLOAD15, strlen(MAXLOAD15)) == 0) { if (spool(line, &i, strlen(MAXLOAD15))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else { maxload15 = atol(line + i); gotload15 = TRUE; } } else if (strncmp(line + i, MAXLOAD1, strlen(MAXLOAD1)) == 0) { if (spool(line, &i, strlen(MAXLOAD1))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else { maxload1 = atol(line + i); if (!gotload5) maxload5 = maxload1 * 3 / 4; if (!gotload15) maxload15 = maxload1 / 2; } } else if (strncmp(line + i, MAXLOAD5, strlen(MAXLOAD5)) == 0) { if (spool(line, &i, strlen(MAXLOAD5))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else { maxload5 = atol(line + i); gotload5 = TRUE; } } else if (strncmp(line + i, MINMEM, strlen(MINMEM)) == 0) { if (spool(line, &i, strlen(MINMEM))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else minpages = atol(line + i); } else if (strncmp(line + i, LOGDIR, strlen(LOGDIR)) == 0) { if (spool(line, &i, strlen(LOGDIR))) fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); else logdir = strdup(line + i); } else if (strncmp(line + i, TESTDIR, strlen(TESTDIR)) == 0) { if (spool(line, &i, strlen(TESTDIR))) fprintf(stderr, "Ignoring invalid line in config file: %s ", line); else test_dir = strdup(line + i); } else { fprintf(stderr, "Ignoring invalid line in config file:\n%s\n", line); } } } if (fclose(wc) != 0) { perror(progname); exit(1); } } static void add_test_binaries(const char *path) { DIR *d; struct dirent dentry; struct dirent *rdret; struct stat sb; int ret; char fname[PATH_MAX]; char *fdup; if (!path) return; ret = stat(path, &sb); if (ret < 0) return; if (!S_ISDIR(sb.st_mode)) return; d = opendir(path); if (!d) return; do { ret = readdir_r(d, &dentry, &rdret); if (ret) break; if (rdret == NULL) break; ret = snprintf(fname, sizeof(fname), "%s/%s", path, dentry.d_name); if (ret >= sizeof(fname)) continue; ret = stat(fname, &sb); if (ret < 0) continue; if (!S_ISREG(sb.st_mode)) continue; if (!(sb.st_mode & S_IXUSR)) continue; if (!(sb.st_mode & S_IRUSR)) continue; fdup = strdup(fname); if (!fdup) continue; syslog(LOG_DEBUG, "adding %s to list of auto-repair binaries", fdup); add_list(&tr_bin, fdup); } while (1); } static void old_option(int c, char *configfile) { fprintf(stderr, "Option -%c is no longer valid, please specify it in %s.\n", c, configfile); usage(); } int main(int argc, char *const argv[]) { FILE *fp; int c, foreground = FALSE, force = FALSE, sync_it = FALSE; int hold; char *configfile = CONFIG_FILENAME; struct list *act; pid_t child_pid; int oom_adjusted = 0; struct stat s; #if USE_SYSLOG char *opts = "d:i:n:Ffsvbql:p:t:c:r:m:a:"; struct option long_options[] = { {"config-file", required_argument, NULL, 'c'}, {"foreground", no_argument, NULL, 'F'}, {"force", no_argument, NULL, 'f'}, {"sync", no_argument, NULL, 's'}, {"no-action", no_argument, NULL, 'q'}, {"verbose", no_argument, NULL, 'v'}, {"softboot", no_argument, NULL, 'b'}, {NULL, 0, NULL, 0} }; long count = 0L; struct watchdog_info ident; #else /* USE_SYSLOG */ char *opts = "d:i:n:Ffsbql:p:t:c:r:m:a:"; struct option long_options[] = { {"config-file", required_argument, NULL, 'c'}, {"foreground", no_argument, NULL, 'F'}, {"force", no_argument, NULL, 'f'}, {"sync", no_argument, NULL, 's'}, {"no-action", no_argument, NULL, 'q'}, {"softboot", no_argument, NULL, 'b'}, {NULL, 0, NULL, 0} }; #endif /* USE_SYSLOG */ progname = basename(argv[0]); /* check the options */ /* there aren't that many any more */ while ((c = getopt_long(argc, argv, opts, long_options, NULL)) != EOF) { if (c == -1) break; switch (c) { case 'n': case 'p': case 'a': case 'r': case 'd': case 't': case 'l': case 'm': case 'i': old_option(c, configfile); break; case 'c': configfile = optarg; break; case 'F': foreground = TRUE; break; case 'f': force = TRUE; break; case 's': sync_it = TRUE; break; case 'b': softboot = TRUE; break; case 'q': no_act = TRUE; break; #if USE_SYSLOG case 'v': verbose = TRUE; break; #endif /* USE_SYSLOG */ default: usage(); } } read_config(configfile, progname); add_test_binaries(test_dir); if (tint < 0) usage(); if (tint >= devtimeout && !force) { fprintf(stderr, "%s error:\n", progname); fprintf(stderr, "This interval length might reboot the system while the process sleeps!\n"); fprintf(stderr, "To force this interval length use the -f option.\n"); exit(1); } if (maxload1 > 0 && maxload1 < MINLOAD && !force) { fprintf(stderr, "%s error:\n", progname); fprintf(stderr, "Using this maximal load average might reboot the system too often!\n"); fprintf(stderr, "To force this load average use the -f option.\n"); exit(1); } /* make sure we get our own log directory */ if (mkdir (logdir, 0750) && errno != EEXIST) { fprintf(stderr, "%s error:\n", progname); fprintf(stderr, "Cannot create directory %s\n", logdir); exit (1); } /* set up pinging if in ping mode */ if (target != NULL) { for (act = target; act != NULL; act = act->next) { struct protoent *proto; struct pingmode *net = (struct pingmode *) calloc(1, sizeof(struct pingmode)); if (net == NULL) { fprintf(stderr, "%s: out of memory\n", progname); exit(1); } /* setup the socket */ memset(&(net->to), 0, sizeof(struct sockaddr)); ((struct sockaddr_in *) &(net->to))->sin_family = AF_INET; if ((((struct sockaddr_in *) &(net->to))->sin_addr.s_addr = inet_addr(act->name)) == (unsigned int) -1) { (void) fprintf(stderr, "%s: unknown host %s\n", progname, act->name); exit(1); } if (!(net->packet = (unsigned char *) malloc((unsigned int) (DATALEN + MAXIPLEN + MAXICMPLEN)))) { fprintf(stderr, "%s: out of memory\n", progname); exit(1); } if (!(proto = getprotobyname("icmp"))) { (void) fprintf(stderr, "%s: unknown protocol icmp.\n", progname); exit(1); } if ((net->sock_fp = socket(AF_INET, SOCK_RAW, proto->p_proto)) < 0 || fcntl(net->sock_fp, F_SETFD, 1)) { perror(progname); exit(1); } /* this is necessary for broadcast pings to work */ (void) setsockopt(net->sock_fp, SOL_SOCKET, SO_BROADCAST, (char *)&hold, sizeof(hold)); hold = 48 * 1024; (void) setsockopt(net->sock_fp, SOL_SOCKET, SO_RCVBUF, (char *) &hold, sizeof(hold)); act->parameter.net = *net; } } /* make sure we're on the root partition */ if (chdir("/") < 0) { perror(progname); exit(1); } /* allocate some memory to store a filename, this is needed later on even * if the system runs out of memory */ filename_buf = (char*)malloc(strlen(logdir) + sizeof("/repair-bin.stdout") + 1); if (!filename_buf) { perror(progname); exit(1); } #if !defined(DEBUG) if ( ! foreground ) { /* fork to go into the background */ if ((child_pid = fork()) < 0) { perror(progname); exit(1); } else if (child_pid > 0) { /* fork was okay */ /* wait for child to exit */ if (waitpid(child_pid, NULL, 0) != child_pid) { perror(progname); exit(1); } /* and exit myself */ exit(0); } /* and fork again to make sure we inherit all rights from init */ if ((child_pid = fork()) < 0) { perror(progname); exit(1); } else if (child_pid > 0) exit(0); /* now we're free */ #if USE_SYSLOG /* Okay, we're a daemon */ /* but we're still attached to the tty */ /* create our own session */ setsid(); /* with USE_SYSLOG we don't do any console IO */ close(0); close(1); close(2); #endif /* USE_SYSLOG */ } #endif /* !DEBUG */ #if USE_SYSLOG /* Log the starting message */ openlog(progname, LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "starting daemon (%d.%d):", MAJOR_VERSION, MINOR_VERSION); syslog(LOG_INFO, "int=%ds realtime=%s sync=%s soft=%s mla=%d mem=%d", tint, realtime ? "yes" : "no", sync_it ? "yes" : "no", softboot ? "yes" : "no", maxload1, minpages); if (target == NULL) syslog(LOG_INFO, "ping: no machine to check"); else for (act = target; act != NULL; act = act->next) syslog(LOG_INFO, "ping: %s", act->name); if (file == NULL) syslog(LOG_INFO, "file: no file to check"); else for (act = file; act != NULL; act = act->next) syslog(LOG_INFO, "file: %s:%d", act->name, act->parameter.file.mtime); if (pidfile == NULL) syslog(LOG_INFO, "pidfile: no server process to check"); else for (act = pidfile; act != NULL; act = act->next) syslog(LOG_INFO, "pidfile: %s", act->name); if (iface == NULL) syslog(LOG_INFO, "interface: no interface to check"); else for (act = iface; act != NULL; act = act->next) syslog(LOG_INFO, "interface: %s", act->name); syslog(LOG_INFO, "test=%s(%ld) repair=%s(%ld) alive=%s heartbeat=%s temp=%s to=%s no_act=%s", (tbinary == NULL) ? "none" : tbinary, timeout, (rbinary == NULL) ? "none" : rbinary, rtimeout, (devname == NULL) ? "none" : devname, (heartbeat == NULL) ? "none" : heartbeat, (tempname == NULL) ? "none" : tempname, (admin == NULL) ? "noone" : admin, (no_act == TRUE) ? "yes" : "no"); #endif /* USE_SYSLOG */ /* open the device */ if (devname != NULL && no_act == FALSE) { watchdog = open(devname, O_WRONLY); if (watchdog == -1) { #if USE_SYSLOG syslog(LOG_ERR, "cannot open %s (errno = %d = '%m')", devname, errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ /* do not exit here per default */ /* we can use watchdog even if there is no watchdog device */ } if (watchdog >= 0) { if (devtimeout > 0) { /* Set the watchdog hard-stop timeout; default = unset (use driver default) */ if (ioctl(watchdog, WDIOC_SETTIMEOUT, &devtimeout) < 0) { #if USE_SYSLOG syslog(LOG_ERR, "cannot set timeout %d (errno = %d = '%m')", devtimeout, errno); #else perror(progname); #endif } } #if USE_SYSLOG /* Also log watchdog identity */ if (ioctl(watchdog, WDIOC_GETSUPPORT, &ident) < 0) { syslog(LOG_ERR, "cannot get watchdog identity (errno = %d = '%m')", errno); } else { ident.identity[sizeof(ident.identity) - 1] = '\0'; /* Be sure */ syslog(LOG_INFO, "hardware watchdog identity: %s", ident.identity); } #endif } } /* MJ 16/2/2000, need to keep track of the watchdog writes so that I can have a potted history of recent reboots */ if ( heartbeat != NULL ) { hb = ((hb = fopen(heartbeat, "r+")) == NULL) ? fopen(heartbeat, "w+") : hb; if ( hb == NULL ) { #if USE_SYSLOG syslog(LOG_ERR, "cannot open %s (errno = %d = '%m')", heartbeat, errno); #else perror(progname); #endif } else { char rbuf[TS_SIZE + 1]; /* Allocate memory for keeping the timestamps in */ nrts = 0; lastts = 0; timestamps = (char *) calloc(hbstamps, TS_SIZE); if ( timestamps == NULL ) { #if USE_SYSLOG syslog(LOG_ERR, "cannot allocate memory for timestamps (errno = %d = '%m')", errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } else { /* read any previous timestamps */ rewind(hb); while ( fgets(rbuf, TS_SIZE + 1, hb) != NULL ) { memcpy(timestamps + (TS_SIZE * lastts), rbuf, TS_SIZE); if (nrts < hbstamps) nrts++; ++lastts; lastts = lastts % hbstamps; } /* Write an indication that the watchdog has started to the heartbeat file */ /* copy it to the buffer */ sprintf(rbuf, "%*s\n", TS_SIZE - 1, "--restart--"); memcpy(timestamps + (lastts * TS_SIZE), rbuf, TS_SIZE); // success if (nrts < hbstamps) nrts++; ++lastts; lastts = lastts % hbstamps; } } } if (maxload1 > 0) { /* open the load average file */ load = open("/proc/loadavg", O_RDONLY); if (load == -1) { #if USE_SYSLOG syslog(LOG_ERR, "cannot open /proc/loadavg (errno = %d = '%m')", errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } } if (minpages > 0) { /* open the memory info file */ mem = open("/proc/meminfo", O_RDONLY); if (mem == -1) { #if USE_SYSLOG syslog(LOG_ERR, "cannot open /proc/meminfo (errno = %d = '%m')", errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } } if (tempname != NULL && no_act == FALSE) { /* open the temperature file */ temp = open(tempname, O_RDONLY); if (temp == -1) { #if USE_SYSLOG syslog(LOG_ERR, "cannot open %s (errno = %d = '%m')", tempname, errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } } /* tuck my process id away */ pid = getpid(); fp = fopen(PIDFILE, "w"); if (fp != NULL) { fprintf(fp, "%d\n", pid); (void) fclose(fp); } /* set signal term to set our run flag to 0 so that */ /* we make sure watchdog device is closed when receiving SIGTERM */ signal(SIGTERM, sigterm_handler); #if defined(_POSIX_MEMLOCK) if (realtime == TRUE) { /* lock all actual and future pages into memory */ if (mlockall(MCL_CURRENT | MCL_FUTURE) != 0) { #if USE_SYSLOG syslog(LOG_ERR, "cannot lock realtime memory (errno = %d = '%m')", errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } else { struct sched_param sp; /* now set the scheduler */ sp.sched_priority = schedprio; if (sched_setscheduler(0, SCHED_RR, &sp) != 0) { #if USE_SYSLOG syslog(LOG_ERR, "cannot set scheduler (errno = %d = '%m')", errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } else mlocked = TRUE; } } #endif /* tell oom killer to not kill this process */ #ifdef OOM_SCORE_ADJ_MIN if ( ! stat("/proc/self/oom_score_adj", &s) ) { fp = fopen("/proc/self/oom_score_adj", "w"); if (fp) { fprintf(fp, "%d\n", OOM_SCORE_ADJ_MIN); (void) fclose(fp); oom_adjusted = 1; } } #endif #ifdef OOM_DISABLE if ( ! oom_adjusted ) { if ( ! stat("/proc/self/oom_adj", &s) ) { fp = fopen("/proc/self/oom_adj", "w"); if (fp) { fprintf(fp, "%d\n", OOM_DISABLE); (void) fclose(fp); oom_adjusted = 1; } } } #endif #if USE_SYSLOG if ( ! oom_adjusted ) { syslog(LOG_WARNING, "unable to disable oom handling!"); } #endif /* USE_SYSLOG */ /* main loop: update after seconds */ while (_running) { wd_action(keep_alive(), rbinary, NULL, 0); /* sync system if we have to */ do_check(sync_system(sync_it), rbinary, NULL); /* check file table */ do_check(check_file_table(), rbinary, NULL); /* check load average */ do_check(check_load(), rbinary, NULL); /* check free memory */ do_check(check_memory(), rbinary, NULL); /* check temperature */ do_check(check_temp(), rbinary, NULL); /* in filemode stat file */ for (act = file; act != NULL; act = act->next) do_check(check_file_stat(act), rbinary, act->name); /* in pidmode kill -0 processes */ for (act = pidfile; act != NULL; act = act->next) do_check(check_pidfile(act), rbinary, act->name); /* in network mode check the given devices for input */ for (act = iface; act != NULL; act = act->next) do_check(check_iface(act), rbinary, act->name); /* in ping mode ping the ip address */ for (act = target; act != NULL; act = act->next) do_check(check_net(act->name, act->parameter.net.sock_fp, act->parameter.net.to, act->parameter.net.packet, tint , pingcount), rbinary, act->name); /* in user mode execute the given binary or just test fork() call */ do_check(check_bin(tbinary, timeout, 0), rbinary, NULL); #ifdef TESTBIN_PATH /* test/repair binaries in the watchdog.d directory */ for (act = tr_bin; act != NULL; act = act->next) /* Use version 1 for testbin-path */ do_check2(check_bin(act->name, timeout, 1), act->name, rbinary, NULL); #endif /* finally sleep some seconds */ usleep(tint * 500000); /* this should make watchdog sleep tint seconds alltogther */ /* sleep(tint); */ #if USE_SYSLOG /* do verbose logging */ if (verbose && logtick && (--ticker == 0)) { ticker = logtick; count += logtick; syslog(LOG_INFO, "still alive after %ld interval(s)", count); } #endif /* USE_SYSLOG */ } terminate(); /* not reached */ exit (EXIT_SUCCESS); } watchdog-5.13/src/iface.c0000644000175000017500000000446312102721740015035 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/iface.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "extern.h" #include "watch_err.h" #if USE_SYSLOG #include #endif #define NETDEV_LINE_LEN 128 int check_iface(struct list *dev) { FILE *file = fopen ("/proc/net/dev", "r"); if (file == NULL) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "cannot open /proc/net/dev (errno = %d = '%m')", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); return(ENOERR); } /* read the file line by line */ while (!feof(file)) { char line[NETDEV_LINE_LEN]; if (fgets(line, NETDEV_LINE_LEN, file) == NULL) { if (!ferror(file)) break; else { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "cannot read /proc/net/dev (errno = %d = '%m')", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ fclose(file); if (softboot) return (err); return(ENOERR); } } else { int i = 0; for (; line[i] == ' ' || line[i] == '\t'; i++); if (strncmp(line + i, dev->name, strlen(dev->name)) == 0) { unsigned long bytes = strtoul(line + i + strlen(dev->name) + 1, NULL, 10); #if USE_SYSLOG /* do verbose logging */ if (verbose && logtick && ticker == 1) syslog(LOG_INFO, "device %s received %lu bytes", dev->name, bytes); #endif if (dev->parameter.iface.bytes == bytes) { fclose(file); #if USE_SYSLOG syslog(LOG_ERR, "device %s did not receive anything since last check", dev->name); #endif return (ENETUNREACH); } else dev->parameter.iface.bytes = bytes; } } } if (fclose(file) != 0) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "cannot close /proc/net/dev (errno = %d = '%m')", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); return(ENOERR); } return (ENOERR); } watchdog-5.13/src/Makefile.am0000644000175000017500000000072212102721740015650 0ustar michaelmichaelsbin_PROGRAMS = watchdog wd_keepalive wd_identify watchdog_SOURCES = file_stat.c file_table.c fstab.c iface.c ifdown.c keep_alive.c \ load.c lomount.c memory.c mntent.c mount.c net.c nfsmount.c \ nfsmount_clnt.c nfsmount_xdr.c pidfile.c shutdown.c sundries.c \ temp.c test_binary.c umount.c version.c watchdog.c wd_keepalive_SOURCES = wd_keepalive.c wd_identify_SOURCES = wd_identify.c INCLUDES = -I@top_srcdir@/include distclean-depend: rm -rf .deps watchdog-5.13/src/memory.c0000644000175000017500000000371212102721740015272 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/memory.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "extern.h" #include "watch_err.h" #if USE_SYSLOG #include #endif #define FREEMEM "MemFree:" #define FREESWAP "SwapFree:" int check_memory(void) { char buf[1024], *ptr1, *ptr2; unsigned int free; /* is the memory file open? */ if (mem == -1) return (ENOERR); /* position pointer at start of file */ if (lseek(mem, 0, SEEK_SET) < 0) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "lseek /proc/meminfo gave errno = %d = '%m'", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); return (ENOERR); } /* read the file */ if (read(mem, buf, sizeof(buf)) < 0) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "read /proc/meminfo gave errno = %d = '%m'", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (err); return (ENOERR); } ptr1 = strstr(buf, FREEMEM); ptr2 = strstr(buf, FREESWAP); if (!ptr1 || !ptr2) { #if USE_SYSLOG syslog(LOG_ERR, "/proc/meminfo contains invalid data (read = %s)", buf); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ if (softboot) return (EINVMEM); return (ENOERR); } /* we only care about integer values */ free = atoi(ptr1+strlen(FREEMEM)) + atoi(ptr2+strlen(FREESWAP)); #if USE_SYSLOG if (verbose && logtick && ticker == 1) syslog(LOG_INFO, "currently there are %d kB of free memory available", free); #endif /* USE_SYSLOG */ if (free < minpages * (EXEC_PAGESIZE / 1024)) { #if USE_SYSLOG syslog(LOG_ERR, "memory %d kB is less than %d pages", free, minpages); #endif /* USE_SYSLOG */ return (ENOMEM); } return (ENOERR); } watchdog-5.13/src/shutdown.c0000644000175000017500000003265112102721740015641 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/shutdown.c,v 1.5 2009/02/11 14:01:05 meskes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #define _XOPEN_SOURCE 500 /* for getsid(2) */ #define _BSD_SOURCE /* for acct(2) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "watch_err.h" #include "extern.h" #if defined __GLIBC__ #include "ext2_mnt.h" #include #include #include #else /* __GLIBC__ */ #include #endif /* __GLIBC__ */ #include #if USE_SYSLOG #include #endif /* USE_SYSLOG */ #ifndef NSIG #define NSIG _NSIG #endif extern void umount_all(void *); extern int ifdown(void); #if 0 extern int mount_one(char *, char *, char *, char *, int, int); static struct mntent rootfs; #endif #if defined(_POSIX_MEMLOCK) extern int mlocked, realtime; #endif /* _POSIX_MEMLOCK */ extern volatile sig_atomic_t _running; extern int devtimeout; /* From watchdog.c */ jmp_buf ret2dog; /* Info about a process. */ typedef struct _proc_ { pid_t pid; /* Process ID. */ int sid; /* Session ID. */ struct _proc_ *next; /* Pointer to next struct. */ } PROC; /* write a log entry on exit */ static void log_end() { #if USE_SYSLOG /* Log the closing message */ syslog(LOG_INFO, "stopping daemon (%d.%d)", MAJOR_VERSION, MINOR_VERSION); closelog(); sleep(5); /* make sure log is written */ #endif /* USE_SYSLOG */ return; } /* close the device and check for error */ static void close_all() { if (watchdog != -1) { if (write(watchdog, "V", 1) < 0 ) { int err = errno; #if USE_SYSLOG syslog(LOG_ERR, "write watchdog device gave error %d = '%m'!", err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } if (close(watchdog) == -1) { #if USE_SYSLOG syslog(LOG_ALERT, "cannot close %s (errno = %d)", devname, errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } } if (load != -1 && close(load) == -1) { #if USE_SYSLOG syslog(LOG_ALERT, "cannot close /proc/loadavg (errno = %d)", errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } if (mem != -1 && close(mem) == -1) { #if USE_SYSLOG syslog(LOG_ALERT, "cannot close /proc/meminfo (errno = %d)", errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } if (temp != -1 && close(temp) == -1) { #if USE_SYSLOG syslog(LOG_ALERT, "cannot close /dev/temperature (errno = %d)", errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } if (hb != NULL && fclose(hb) == -1) { #if USE_SYSLOG syslog(LOG_ALERT, "cannot close %s (errno = %d)", heartbeat, errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } } void sigterm_handler(int arg) { _running = 0; } /* on exit we close the device and log that we stop */ void terminate(void) { #if defined(_POSIX_MEMLOCK) if (realtime == TRUE && mlocked == TRUE) { /* unlock all locked pages */ if (munlockall() != 0) { #if USE_SYSLOG syslog(LOG_ERR, "cannot unlock realtime memory (errno = %d)", errno); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ } } #endif /* _POSIX_MEMLOCK */ close_all(); log_end(); if (timestamps != NULL) free(timestamps); exit(0); } /* panic: we're still alive but shouldn't */ static void panic(void) { /* if we are still alive, we just exit */ close_all(); fprintf(stderr, "WATCHDOG PANIC: Still alive after sleeping %d seconds!\n", 4 * devtimeout); #if USE_SYSLOG openlog(progname, LOG_PID, LOG_DAEMON); syslog(LOG_ALERT, "still alive after sleeping %d seconds", 4 * devtimeout); closelog(); #endif exit(1); } static void mnt_off() { FILE *fp; struct mntent *mnt; fp = setmntent(MNTTAB, "r"); /* in some rare cases fp might be NULL so be careful */ while (fp != NULL && ((mnt = getmntent(fp)) != (struct mntent *) 0)) { /* First check if swap */ if (!strcmp(mnt->mnt_type, MNTTYPE_SWAP)) if (swapoff(mnt->mnt_fsname) < 0) perror(mnt->mnt_fsname); /* quota only if mounted at boot time && filesytem=ext2 */ if (hasmntopt(mnt, MNTOPT_NOAUTO) || strcmp(mnt->mnt_type, MNTTYPE_EXT2)) continue; /* group quota? */ if (hasmntopt(mnt, MNTOPT_GRPQUOTA)) if (quotactl(QCMD(Q_QUOTAOFF, GRPQUOTA), mnt->mnt_fsname, 0, (caddr_t) 0) < 0) perror(mnt->mnt_fsname); /* user quota */ if (hasmntopt(mnt, MNTOPT_USRQUOTA)) if (quotactl(QCMD(Q_QUOTAOFF, USRQUOTA), mnt->mnt_fsname, 0, (caddr_t) 0) < 0) perror(mnt->mnt_fsname); #if 0 /* not needed anymore */ /* while we're at it we add the remount option */ if (strcmp(mnt->mnt_dir, "/") == 0) { /* save entry if root partition */ rootfs.mnt_freq = mnt->mnt_freq; rootfs.mnt_passno = mnt->mnt_passno; rootfs.mnt_fsname = strdup(mnt->mnt_fsname); rootfs.mnt_dir = strdup(mnt->mnt_dir); rootfs.mnt_type = strdup(mnt->mnt_type); /* did we get enough memory? */ if (rootfs.mnt_fsname == NULL || rootfs.mnt_dir == NULL || rootfs.mnt_type == NULL) { #if USE_SYSLOG syslog(LOG_ERR, "out of memory"); #else /* USE_SYSLOG */ fprintf(stderr, "%s: out of memory\n", progname); #endif } if ((rootfs.mnt_opts = malloc(strlen(mnt->mnt_opts) + strlen("remount,ro") + 2)) == NULL) { #if USE_SYSLOG syslog(LOG_ERR, "out of memory"); #else /* USE_SYSLOG */ fprintf(stderr, "%s: out of memory\n", progname); #endif } else sprintf(rootfs.mnt_opts, "%s,remount,ro", mnt->mnt_opts); } #endif } endmntent(fp); } /* Parts of the following two functions are taken from Miquel van */ /* Smoorenburg's killall5 program. */ static PROC *plist; /* get a list of all processes */ static int readproc() { DIR *dir; struct dirent *d; pid_t act_pid; PROC *p; /* Open the /proc directory. */ if ((dir = opendir("/proc")) == NULL) { #if USE_SYSLOG syslog(LOG_ERR, "cannot opendir /proc"); #else /* USE_SYSLOG */ perror(progname); #endif return (-1); } plist = NULL; /* Walk through the directory. */ while ((d = readdir(dir)) != NULL) { /* See if this is a process */ if ((act_pid = atoi(d->d_name)) == 0) continue; /* Get a PROC struct . */ if ((p = (PROC *) calloc(1, sizeof(PROC))) == NULL) { #if USE_SYSLOG syslog(LOG_ERR, "out of memory"); #else /* USE_SYSLOG */ fprintf(stderr, "%s: out of memory\n", progname); #endif return (-1); } p->sid = getsid(act_pid); p->pid = act_pid; /* Link it into the list. */ p->next = plist; plist = p; } closedir(dir); /* Done. */ return (0); } static void killall5(int sig) { PROC *p; int sid = -1; /* * Ignoring SIGKILL and SIGSTOP do not make sense, but * someday kill(-1, sig) might kill ourself if we don't * do this. This certainly is a valid concern for SIGTERM- * Linux 2.1 might send the calling process the signal too. */ /* Since we ignore all signals, we don't have to worry here. MM */ /* Now stop all processes. */ kill(-1, SIGSTOP); /* Find out our own 'sid'. */ if (readproc() < 0) { kill(-1, SIGCONT); return; } for (p = plist; p; p = p->next) if (p->pid == pid) { sid = p->sid; break; } /* Now kill all processes except our session. */ for (p = plist; p; p = p->next) if (p->pid != pid && p->sid != sid) kill(p->pid, sig); /* And let them continue. */ kill(-1, SIGCONT); } /* shut down the system */ void do_shutdown(int errorcode) { int i = 0, fd; char *seedbck = RANDOM_SEED; /* soft-boot the system */ /* do not close open files here, they will be closed later anyway */ /* close_all(); */ /* if we will halt the system we should try to tell a sysadmin */ if (admin != NULL) { /* send mail to the system admin */ FILE *ph; char exe[128]; struct stat buf; /* Only can send an email if sendmail binary exists so check * that first, or else we will get a broken pipe in pclose. * We cannot let the shell check, because a non-existant or * non-executable sendmail binary means that the pipe is closed faster * than we can write to it. */ if ((stat(PATH_SENDMAIL, &buf) != 0) || ((buf.st_mode&S_IXUSR) == 0)) { #if USE_SYSLOG syslog(LOG_ERR, "%s does not exist or is not executable (errno = %d)", PATH_SENDMAIL, errno); #endif /* USE_SYSLOG */ } else { sprintf(exe, "%s -i %s", PATH_SENDMAIL, admin); ph = popen(exe, "w"); if (ph == NULL) { #if USE_SYSLOG syslog(LOG_ERR, "cannot start %s (errno = %d)", PATH_SENDMAIL, errno); #endif /* USE_SYSLOG */ } else { char myname[MAXHOSTNAMELEN + 1]; struct hostent *hp; /* get my name */ gethostname(myname, sizeof(myname)); fprintf(ph, "To: %s\n", admin); if (ferror(ph) != 0) { #if USE_SYSLOG syslog(LOG_ERR, "cannot send mail (errno = %d)", errno); #endif /* USE_SYSLOG */ } /* if possible use the full name including domain */ if ((hp = gethostbyname(myname)) != NULL) fprintf(ph, "Subject: %s is going down!\n\n", hp->h_name); else fprintf(ph, "Subject: %s is going down!\n\n", myname); if (ferror(ph) != 0) { #if USE_SYSLOG syslog(LOG_ERR, "cannot send mail (errno = %d)", errno); #endif /* USE_SYSLOG */ } if (errorcode == ETOOHOT) fprintf(ph, "Message from watchdog:\nIt is too hot to keep on working. The system will be halted!\n"); else fprintf(ph, "Message from watchdog:\nThe system will be rebooted because of error %d!\n", errorcode); if (ferror(ph) != 0) { #if USE_SYSLOG syslog(LOG_ERR, "cannot send mail (errno = %d)", errno); #endif /* USE_SYSLOG */ } if (pclose(ph) == -1) { #if USE_SYSLOG syslog(LOG_ERR, "cannot finish mail (errno = %d)", errno); #endif /* USE_SYSLOG */ } /* finally give the system a little bit of time to deliver */ } } } #if USE_SYSLOG /* now tell syslog what's happening */ syslog(LOG_ALERT, "shutting down the system because of error %d", errorcode); closelog(); #endif /* USE_SYSLOG */ keep_alive(); sleep(10); /* make sure log is written and mail is send */ keep_alive(); /* We cannot start shutdown, since init might not be able to fork. */ /* That would stop the reboot process. So we try rebooting the system */ /* ourselves. Note, that it is very likely we cannot start any rc */ /* script either, so we do it all here. */ /* Close all files except the watchdog device. */ for (i = 0; i < 3; i++) if (!isatty(i)) close(i); for (i = 3; i < 20; i++) if (i != watchdog) close(i); close(255); /* Ignore all signals. */ for (i = 1; i < NSIG; i++) signal(i, SIG_IGN); /* Stop init; it is insensitive to the signals sent by the kernel. */ kill(1, SIGTSTP); /* Kill all processes. */ (void) killall5(SIGTERM); sleep(5); (void) killall5(SIGKILL); keep_alive(); /* Record the fact that we're going down */ if ((fd = open(_PATH_WTMP, O_WRONLY | O_APPEND)) >= 0) { time_t t; struct utmp wtmp; time(&t); strcpy(wtmp.ut_user, "shutdown"); strcpy(wtmp.ut_line, "~"); strcpy(wtmp.ut_id, "~~"); wtmp.ut_pid = 0; wtmp.ut_type = RUN_LVL; wtmp.ut_time = t; if (write(fd, (char *) &wtmp, sizeof(wtmp)) < 0) perror(progname); close(fd); } /* save the random seed if a save location exists */ /* don't worry about error messages, we react here anyway */ if (strlen(seedbck) != 0) { int fd_seed; if ((fd_seed = open("/dev/urandom", O_RDONLY)) >= 0) { int fd_bck; if ((fd_bck = creat(seedbck, S_IRUSR | S_IWUSR)) >= 0) { char buf[512]; if (read(fd_seed, buf, 512) == 512) { if (write(fd_bck, buf, 512) < 0) perror(progname); } close(fd_bck); } close(fd_seed); } } /* Turn off accounting */ if (acct(NULL) < 0) perror(progname); keep_alive(); /* Turn off quota and swap */ mnt_off(); /* umount all partitions */ if (setjmp(ret2dog) == 0) umount_all(NULL); #if 0 /* with the more recent version of mount code, this is not needed anymore */ /* remount / read-only */ if (setjmp(ret2dog) == 0) mount_one(rootfs.mnt_fsname, rootfs.mnt_dir, rootfs.mnt_type, rootfs.mnt_opts, rootfs.mnt_freq, rootfs.mnt_passno); #endif /* shut down interfaces (also taken from sysvinit source */ ifdown(); /* finally reboot */ if (errorcode != ETOOHOT) { #ifdef __GLIBC__ reboot(RB_AUTOBOOT); #else /* __GLIBC__ */ reboot(0xfee1dead, 672274793, 0x01234567); #endif /* __GLIBC__ */ } else { /* rebooting makes no sense if it's too hot */ /* Turn on hard reboot, CTRL-ALT-DEL will reboot now */ #ifdef __GLIBC__ reboot(RB_ENABLE_CAD); #else /* __GLIBC__ */ reboot(0xfee1dead, 672274793, 0x89abcdef); #endif /* __GLIBC__ */ /* And perform the `halt' system call. */ #ifdef __GLIBC__ reboot(RB_HALT_SYSTEM); #else /* __GLIBC__ */ reboot(0xfee1dead, 672274793, 0xcdef0123); #endif } /* okay we should never reach this point, */ /* but if we do we will cause the hard reset */ sleep(devtimeout * 4); /* unbelievable: we're still alive */ panic(); } watchdog-5.13/src/version.c0000644000175000017500000000003712102721740015444 0ustar michaelmichaelchar version[] = "mount-2.8a"; watchdog-5.13/src/fstab.c0000644000175000017500000002316212102721740015062 0ustar michaelmichael/* $Header: /cvsroot/watchdog/watchdog/src/fstab.c,v 1.2 2006/07/31 09:39:23 meskes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #define _GNU_SOURCE /* for strsignal() */ #include #include #include #include #include #include "wd_mntent.h" #include "fstab.h" #include "sundries.h" /* for xmalloc() etc */ #define streq(s, t) (strcmp ((s), (t)) == 0) #define PROC_MOUNTS "/proc/mounts" /* Information about mtab. ------------------------------------*/ static int have_mtab_info = 0; static int var_mtab_does_not_exist = 0; static int var_mtab_is_a_symlink = 0; static void get_mtab_info(void) { struct stat mtab_stat; if (!have_mtab_info) { if (lstat(MOUNTED, &mtab_stat)) var_mtab_does_not_exist = 1; else if (S_ISLNK(mtab_stat.st_mode)) var_mtab_is_a_symlink = 1; have_mtab_info = 1; } } int mtab_does_not_exist(void) { get_mtab_info(); return var_mtab_does_not_exist; } int mtab_is_a_symlink(void) { get_mtab_info(); return var_mtab_is_a_symlink; } int mtab_is_writable() { static int ret = -1; /* Should we write to /etc/mtab upon an update? Probably not if it is a symlink to /proc/mounts, since that would create a file /proc/mounts in case the proc filesystem is not mounted. */ if (mtab_is_a_symlink()) return 0; if (ret == -1) { int fd = open(MOUNTED, O_RDWR | O_CREAT, 0644); if (fd >= 0) { close(fd); ret = 1; } else ret = 0; } return ret; } /* Contents of mtab and fstab ---------------------------------*/ struct mntentchn mounttable, fstab; static int got_mtab = 0; static int got_fstab = 0; static void read_mounttable(void), read_fstab(void); struct mntentchn * mtab_head() { if (!got_mtab) read_mounttable(); return &mounttable; } struct mntentchn * fstab_head() { if (!got_fstab) read_fstab(); return &fstab; } static void read_mntentchn(mntFILE *mfp, const char *fnam, struct mntentchn *mc0) { struct mntentchn *mc = mc0; struct mntent *mnt; while ((mnt = my_getmntent (mfp)) != NULL && !streq (mnt->mnt_type, MNTTYPE_IGNORE)) { mc->nxt = (struct mntentchn *) xmalloc(sizeof(*mc)); mc->nxt->prev = mc; mc = mc->nxt; mc->mnt_fsname = mnt->mnt_fsname; mc->mnt_dir = mnt->mnt_dir; mc->mnt_type = mnt->mnt_type; mc->mnt_opts = mnt->mnt_opts; mc->nxt = NULL; } mc0->prev = mc; if (ferror (mfp->mntent_fp)) { error("warning: error reading %s: %s", fnam, strerror (errno)); mc0->nxt = mc0->prev = NULL; } my_endmntent(mfp); } /* * Read /etc/mtab. If that fails, try /proc/mounts. * This produces a linked list. The list head mounttable is a dummy. * Return 0 on success. */ static void read_mounttable() { mntFILE *mfp; const char *fnam; struct mntentchn *mc = &mounttable; got_mtab = 1; mc->nxt = mc->prev = NULL; fnam = MOUNTED; mfp = my_setmntent (fnam, "r"); if (mfp == NULL || mfp->mntent_fp == NULL) { int errsv = errno; fnam = PROC_MOUNTS; mfp = my_setmntent (fnam, "r"); if (mfp == NULL || mfp->mntent_fp == NULL) { error("warning: can't open %s: %s", MOUNTED, strerror (errsv)); return; } if (mount_verbose) printf ("mount: could not open %s - using %s instead\n", MOUNTED, PROC_MOUNTS); } read_mntentchn(mfp, fnam, mc); } static void read_fstab() { mntFILE *mfp = NULL; const char *fnam; struct mntentchn *mc = &fstab; got_fstab = 1; mc->nxt = mc->prev = NULL; fnam = _PATH_FSTAB; mfp = my_setmntent (fnam, "r"); if (mfp == NULL || mfp->mntent_fp == NULL) { error("warning: can't open %s: %s", _PATH_FSTAB, strerror (errno)); return; } read_mntentchn(mfp, fnam, mc); } /* Given the name NAME, try to find it in mtab. */ struct mntentchn * getmntfile (const char *name) { struct mntentchn *mc; for (mc = mtab_head()->nxt; mc; mc = mc->nxt) if (streq (mc->mnt_dir, name) || (streq (mc->mnt_fsname, name))) break; return mc; } /* Given the name FILE, try to find the option "loop=FILE" in mtab. */ struct mntentchn * getmntoptfile (const char *file) { struct mntentchn *mc; char *opts, *s; int l; if (!file) return NULL; l = strlen(file); for (mc = mtab_head()->nxt; mc; mc = mc->nxt) if ((opts = mc->mnt_opts) != NULL && (s = strstr(opts, "loop=")) && !strncmp(s+5, file, l) && (s == opts || s[-1] == ',') && (s[l+5] == 0 || s[l+5] == ',')) return mc; return NULL; } /* Find the dir FILE in fstab. */ struct mntentchn * getfsfile (const char *file) { struct mntentchn *mc; for (mc = fstab_head()->nxt; mc; mc = mc->nxt) if (streq (mc->mnt_dir, file)) break; return mc; } /* Find the device SPEC in fstab. */ struct mntentchn * getfsspec (const char *spec) { struct mntentchn *mc; for (mc = fstab_head()->nxt; mc; mc = mc->nxt) if (streq (mc->mnt_fsname, spec)) break; return mc; } /* Updating mtab ----------------------------------------------*/ /* File descriptor for lock. Value tested in unlock_mtab() to remove race. */ static int lock = -1; /* Flag for already existing lock file. */ static int old_lockfile = 1; /* Ensure that the lock is released if we are interrupted. */ static void handler (int sig) { die (EX_USER, "%s", strsignal(sig)); } static void setlkw_timeout (int sig) { /* nothing, fcntl will fail anyway */ } /* Create the lock file. The lock file will be removed if we catch a signal or when we exit. The value of lock is tested to remove the race. */ void lock_mtab (void) { int sig = 0; struct sigaction sa; struct flock flock; /* If this is the first time, ensure that the lock will be removed. */ if (lock < 0) { struct stat st; sa.sa_handler = handler; sa.sa_flags = 0; sigfillset (&sa.sa_mask); while (sigismember (&sa.sa_mask, ++sig) != -1 && sig != SIGCHLD) { if (sig == SIGALRM) sa.sa_handler = setlkw_timeout; else sa.sa_handler = handler; sigaction (sig, &sa, (struct sigaction *) 0); } /* This stat is performed so we know when not to be overly eager when cleaning up after signals. The window between stat and open is not significant. */ if (lstat (MOUNTED_LOCK, &st) < 0 && errno == ENOENT) old_lockfile = 0; lock = open (MOUNTED_LOCK, O_WRONLY|O_CREAT, 0); if (lock < 0) { die (EX_FILEIO, "can't create lock file %s: %s " "(use -n flag to override)", MOUNTED_LOCK, strerror (errno)); } flock.l_type = F_WRLCK; flock.l_whence = SEEK_SET; flock.l_start = 0; flock.l_len = 0; alarm(LOCK_TIMEOUT); if (fcntl (lock, F_SETLKW, &flock) == -1) { int errnosv = errno; close (lock); lock = -1; /* The file should not be removed */ die (EX_FILEIO, "can't lock lock file %s: %s", MOUNTED_LOCK, errnosv == EINTR ? "timed out" : strerror (errno)); } /* We have now access to the lock, and it can always be removed */ old_lockfile = 0; } } /* Remove lock file. */ void unlock_mtab (void) { if (lock != -1) { close (lock); if (!old_lockfile) unlink (MOUNTED_LOCK); } } /* * Update the mtab. * Used by umount with null INSTEAD: remove any DIR entries. * Used by mount upon a remount: update option part, * and complain if a wrong device or type was given. * [Note that often a remount will be a rw remount of / * where there was no entry before, and we'll have to believe * the values given in INSTEAD.] */ void update_mtab (const char *dir, struct mntent *instead) { struct mntent *mnt; struct mntent *next; struct mntent remnt; int added = 0; mntFILE *mfp, *mftmp; if (mtab_does_not_exist() || mtab_is_a_symlink()) return; lock_mtab(); mfp = my_setmntent(MOUNTED, "r"); if (mfp == NULL || mfp->mntent_fp == NULL) { error ("cannot open %s (%s) - mtab not updated", MOUNTED, strerror (errno)); goto leave; } mftmp = my_setmntent (MOUNTED_TEMP, "w"); if (mftmp == NULL || mfp->mntent_fp == NULL) { error ("can't open %s (%s) - mtab not updated", MOUNTED_TEMP, strerror (errno)); goto leave; } while ((mnt = my_getmntent (mfp))) { if (streq (mnt->mnt_dir, dir)) { added++; if (instead) { /* a remount */ remnt = *instead; next = &remnt; remnt.mnt_fsname = mnt->mnt_fsname; remnt.mnt_type = mnt->mnt_type; if (instead->mnt_fsname && !streq(mnt->mnt_fsname, instead->mnt_fsname)) printf("mount: warning: cannot change " "mounted device with a remount\n"); else if (instead->mnt_type && !streq(instead->mnt_type, "unknown") && !streq(mnt->mnt_type, instead->mnt_type)) printf("mount: warning: cannot change " "filesystem type with a remount\n"); } else next = NULL; } else next = mnt; if (next && my_addmntent(mftmp, next) == 1) die (EX_FILEIO, "error writing %s: %s", MOUNTED_TEMP, strerror (errno)); } if (instead && !added && my_addmntent(mftmp, instead) == 1) die (EX_FILEIO, "error writing %s: %s", MOUNTED_TEMP, strerror (errno)); my_endmntent (mfp); if (fchmod (fileno (mftmp->mntent_fp), S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) fprintf(stderr, "error changing mode of %s: %s\n", MOUNTED_TEMP, strerror (errno)); my_endmntent (mftmp); if (rename (MOUNTED_TEMP, MOUNTED) < 0) fprintf(stderr, "can't rename %s to %s: %s\n", MOUNTED_TEMP, MOUNTED, strerror(errno)); leave: unlock_mtab(); } watchdog-5.13/missing0000755000175000017500000002415212102721745014434 0ustar michaelmichael#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2012-01-06.13; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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 # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: watchdog-5.13/Makefile.am0000644000175000017500000000130312102721740015055 0ustar michaelmichael man_MANS = watchdog.8 wd_keepalive.8 watchdog.conf.5 wd_identify.8 # This does not work. subdirs are not copied correctly # for make dist... :( EXTRA_DIST = $(man_MANS) include examples ChangeLog watchdog.lsm \ watchdog.conf rc.watchdog.debian rc.watchdog.redhat SUBDIRS = src CONFIG_FILENAME = @CONFIG_FILENAME@ install-etc-local: watchdog.conf @if test -e $(DESTDIR)$(CONFIG_FILENAME) ; then \ echo "NOT installing $(CONFIG_FILENAME) - exists already"; \ else \ echo "installing $(CONFIG_FILENAME)"; \ $(mkinstalldirs) `dirname $(DESTDIR)$(CONFIG_FILENAME)`; \ $(INSTALL_DATA) watchdog.conf $(DESTDIR)$(CONFIG_FILENAME); \ fi install-data-local: install-etc-local watchdog-5.13/install-sh0000755000175000017500000003325612102721745015046 0ustar michaelmichael#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for `test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: