watchdog-5.16/0000755000175000017500000000000013650524722013041 5ustar michaelmichaelwatchdog-5.16/TODO0000644000175000017500000000016313650524716013534 0ustar michaelmichaelTest which applications are running. Support "ping =" for IPv6 (currently only IPv4 numeric address recognised). watchdog-5.16/COPYING0000644000175000017500000000077413650524716014107 0ustar michaelmichaelCopyright (C) 1996-2020 Michael Meskes, Paul Crawford 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.16/NEWS0000644000175000017500000000007313650524716013543 0ustar michaelmichaelSee ChangeLog for infos about the latest changes. Michael watchdog-5.16/compile0000755000175000017500000001635013650524721014423 0ustar michaelmichael#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN* | MSYS*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: watchdog-5.16/IAFA-PACKAGE0000644000175000017500000000050713650524716014522 0ustar michaelmichaelTitle: watchdog Version: 5.16 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.16/src/0000755000175000017500000000000013650524721013627 5ustar michaelmichaelwatchdog-5.16/src/pidfile.c0000644000175000017500000000277513650524716015426 0ustar michaelmichael#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include "extern.h" #include "watch_err.h" int check_pidfile(struct list *file) { int fd = open(file->name, O_RDONLY), pid; char buf[20]; int n; if (fd == -1) { int err = errno; log_message(LOG_ERR, "cannot open %s (errno = %d = '%s')", file->name, err, strerror(err)); return (err); } /* position pointer at start of file */ if (lseek(fd, 0, SEEK_SET) < 0) { int err = errno; log_message(LOG_ERR, "lseek %s gave errno = %d = '%s'", file->name, err, strerror(err)); close(fd); return (err); } /* read the line (there is only one) */ if ((n = read(fd, buf, sizeof(buf)-1)) < 0) { int err = errno; log_message(LOG_ERR, "read %s gave errno = %d = '%s'", file->name, err, strerror(err)); close(fd); return (err); } /* Force string to be nul-terminated. */ buf[n] = 0; /* we only care about integer values */ pid = atoi(buf); if (close(fd) == -1) { int err = errno; log_message(LOG_ERR, "could not close %s, errno = %d = '%s'", file->name, err, strerror(err)); return (err); } if (kill(pid, 0) == -1) { int err = errno; log_message(LOG_ERR, "pinging process %d (%s) gave errno = %d = '%s'", pid, file->name, err, strerror(err)); return (err); } /* do verbose logging */ if (verbose && logtick && ticker == 1) log_message(LOG_DEBUG, "was able to ping process %d (%s)", pid, file->name); return (ENOERR); } watchdog-5.16/src/send-email.c0000644000175000017500000000523313650524716016020 0ustar michaelmichael/* > send-email.c * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* for gethostname() etc */ #include /* for gethostbyname() */ #include /* for MAXHOSTNAMELEN */ #include #include #include "extern.h" #include "watch_err.h" /* * Attempt to send an email to admin about our exit condition. If successful it returns 0 * otherwise it returns an error code. Once sent, remember and allow a few seconds for the email to * go before killing processes! * * Argument 'ptr' is not really used and must be NULL. Just for run_func_as_child() compatibility. */ int send_email(int errorcode, void *ptr) { FILE *ph; char exe[512]; struct stat buf; int rv = EACCES; /* Report 'no access' if we can't run sendmail for any reason. */ const char *sendmail_bin = PATH_SENDMAIL; if (admin == NULL || sendmail_bin == NULL) { return 0; /* Report OK if not configured for email. */ } /* 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-existent or * non-executable sendmail binary means that the pipe is closed faster * than we can write to it. */ if ((stat(sendmail_bin, &buf) != 0) || ((buf.st_mode & S_IXUSR) == 0)) { log_message(LOG_ERR, "%s does not exist or is not executable (errno = %d)", sendmail_bin, errno); } else { snprintf(exe, sizeof(exe), "%s -i %s", sendmail_bin, admin); ph = popen(exe, "w"); if (ph == NULL) { rv = errno; log_message(LOG_ERR, "cannot start %s (errno = %d)", sendmail_bin, errno); } else { char myname[MAXHOSTNAMELEN + 1]; struct hostent *hp; rv = 0; /* get my name */ gethostname(myname, sizeof(myname)); fprintf(ph, "To: %s\n", admin); rv |= ferror(ph); /* 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); rv |= ferror(ph); 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); rv |= ferror(ph); if (rv) { rv = errno; log_message(LOG_ERR, "cannot send mail (errno = %d)", errno); } if (pclose(ph) == -1) { rv = errno; log_message(LOG_ERR, "cannot finish mail (errno = %d)", errno); } if (rv == 0) { sleep(10); /* make sure email is sent if all OK. */ } } } return rv; } watchdog-5.16/src/wd_keepalive.c0000644000175000017500000001104513650524716016437 0ustar michaelmichael/********************************************************** * Copyright: Appliance Studio Ltd * Michael Meskes * 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 watchdog 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 #include "extern.h" #define TRUE 1 #define FALSE 0 static void usage(char *progname) { fprintf(stderr, "%s version %d.%d, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION); fprintf(stderr, "%s [options]\n", progname); fprintf(stderr, "options:\n"); fprintf(stderr, " -c | --config-file specify location of config file\n"); fprintf(stderr, " -X | --loop-exit run a fixed number of loops then exit\n"); exit(1); } /* Dummy function for keep_alive.c use */ int write_heartbeat(void) { return 0; } /* close the device and check for error */ static void close_all(void) { close_watchdog(); } /* on exit we close the device and log that we stop */ void terminate(int ecode) { log_message(LOG_NOTICE, "stopping watchdog keepalive daemon (%d.%d)", MAJOR_VERSION, MINOR_VERSION); unlock_our_memory(); close_all(); remove_pid_file(); close_logging(); xusleep(100000); /* 0.1s to make sure log is written */ exit(ecode); } int main(int argc, char *const argv[]) { char *configfile = CONFIG_FILENAME; long count = 0L; long count_max = 0L; int c; char *progname; unsigned long twait; /* allow all options watchdog understands too */ char *opts = "d:i:n:fsvbql:p:t:c:r:m:a:X:"; 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'}, {"loop-exit", required_argument, NULL, 'X'}, {NULL, 0, NULL, 0} }; progname = basename(argv[0]); open_logging(progname, MSG_TO_STDERR | MSG_TO_SYSLOG); /* check for the one option we understand */ while ((c = getopt_long(argc, argv, opts, long_options, NULL)) != EOF) { 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': case 'v': break; case 'X': count_max = atol(optarg); log_message(LOG_WARNING, "NOTE: Using --loop-exit so daemon will exit after %ld time intervals", count_max); break; default: usage(progname); } } read_config(configfile); /* 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) { log_message(LOG_INFO, " no watchdog device configured, aborting"); exit(0); } if (wd_daemon(0, 0)) { fatal_error(EX_SYSERR, "failed to daemonize (%s)", strerror(errno)); } /* tuck my process id away */ if (write_pid_file(KA_PIDFILE)) { fatal_error(EX_USAGE, "unable to gain lock via PID file"); } /* Log the starting message */ open_logging(NULL, MSG_TO_SYSLOG); log_message(LOG_NOTICE, "starting watchdog keepalive daemon (%d.%d):", MAJOR_VERSION, MINOR_VERSION); log_message(LOG_INFO, " int=%d alive=%s realtime=%s", tint, devname, realtime ? "yes" : "no"); /* open the device */ if (open_watchdog(devname, dev_timeout) < 0) { terminate(1); } /* set signal term to call sigterm_handler() */ /* to make sure watchdog device is closed */ signal(SIGTERM, sigterm_handler); lock_our_memory(realtime, schedprio, daemon_pid); twait = (tint * 1000000); /* main loop: update after seconds */ while (_running) { keep_alive(); /* finally sleep some seconds */ xusleep(twait); count++; if (count_max > 0 && count >= count_max) { log_message(LOG_WARNING, "loop exit on interval counter reached"); _running = 0; } } terminate(0); /* not reached */ return 0; } watchdog-5.16/src/wd_identify.c0000644000175000017500000000632013650524716016305 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 #include "extern.h" static void usage(char *progname) { fprintf(stderr, "%s version %d.%d, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION); fprintf(stderr, "%s [options]\n", progname); fprintf(stderr, "options:\n"); fprintf(stderr, " -c | --config-file specify location of config file\n"); fprintf(stderr, " -v | --verbose verbose messages\n"); exit(1); } int main(int argc, char *const argv[]) { char *configfile = CONFIG_FILENAME; int c, rv = 0; struct watchdog_info ident; char *opts = "c:v"; struct option long_options[] = { {"config-file", required_argument, NULL, 'c'}, {"verbose", no_argument, NULL, 'v'}, {NULL, 0, NULL, 0} }; int watchdog = -1; char *progname = basename(argv[0]); open_logging(progname, MSG_TO_STDERR); /* check for the one option we understand */ while ((c = getopt_long(argc, argv, opts, long_options, NULL)) != EOF) { switch (c) { case 'c': configfile = optarg; break; case 'v': verbose++; break; default: usage(progname); } } read_config(configfile); /* this program has no other function than identifying the hardware behind * this device i.e. if there is no device given we better punt */ if (devname == NULL) { printf("No watchdog hardware configured in \"%s\"\n", configfile); exit(1); } /* open the device */ watchdog = open(devname, O_WRONLY); if (watchdog == -1) { log_message(LOG_ERR, "cannot open %s (errno = %d = '%s')", devname, errno, strerror(errno)); exit(1); } /* Print watchdog identity */ if (ioctl(watchdog, WDIOC_GETSUPPORT, &ident) < 0) { log_message(LOG_ERR, "cannot get watchdog identity (errno = %d = '%s')", errno, strerror(errno)); rv = 1; } else { ident.identity[sizeof(ident.identity) - 1] = '\0'; /* Be sure */ printf("%s\n", ident.identity); } if (verbose) { /* If called with timeout <= 0 then query device. */ int timeout = 0; if (ioctl(watchdog, WDIOC_GETTIMEOUT, &timeout) < 0) { int err = errno; log_message(LOG_ERR, "cannot get timeout (errno = %d = '%s')", err, strerror(err)); } else { printf("watchdog was set to %d seconds\n", timeout); } } if (write(watchdog, "V", 1) < 0) { log_message(LOG_ERR, "write watchdog device gave error %d = '%s'!", errno, strerror(errno)); rv = 1; } if (close(watchdog) == -1) { log_message(LOG_ALERT, "cannot close watchdog (errno = %d = '%s')", errno, strerror(errno)); rv = 1; } close_logging(); exit(rv); } watchdog-5.16/src/iface.c0000644000175000017500000000315013650524716015045 0ustar michaelmichael#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "extern.h" #include "watch_err.h" #define NETDEV_LINE_LEN 128 int check_iface(struct list *dev) { const char fname[] = "/proc/net/dev"; FILE *file = fopen(fname, "r"); if (file == NULL) { int err = errno; log_message(LOG_ERR, "cannot open %s (errno = %d = '%s')", fname, err, strerror(err)); return (err); } /* read the file line by line */ while (!feof(file)) { char line[NETDEV_LINE_LEN]; memset(line, 0, sizeof(line)); /* Just in case. */ if (fgets(line, NETDEV_LINE_LEN, file) == NULL) { if (!ferror(file)) { break; } else { int err = errno; log_message(LOG_ERR, "cannot read %s (errno = %d = '%s')", fname, err, strerror(err)); fclose(file); return (err); } } 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); /* do verbose logging */ if (verbose && logtick && ticker == 1) log_message(LOG_DEBUG, "device %s received %lu bytes", dev->name, bytes); if (dev->parameter.iface.bytes == bytes) { fclose(file); log_message(LOG_ERR, "device %s did not receive anything since last check", dev->name); return (ENETUNREACH); } else { dev->parameter.iface.bytes = bytes; } } } } if (fclose(file) != 0) { int err = errno; log_message(LOG_ERR, "cannot close %s (errno = %d = '%s')", fname, err, strerror(err)); return (err); } return (ENOERR); } watchdog-5.16/src/configfile.c0000644000175000017500000002570013650524716016110 0ustar michaelmichael/* > configfile.c * * Code based on old watchdog.c function to read settings and to get the * test binary(s) (if any). Reads the configuration file on a line-by-line * basis and parses it for "parameter = value" sort of entries. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include "extern.h" #include "watch_err.h" #include "read-conf.h" static void add_test_binaries(const char *path); static void set_file_list_change(int change, int linecount); static void parse_arg_val(char *arg, char *val, int linecount); #define ADMIN "admin" #define CHANGE "change" #define DEVICE "watchdog-device" #define DEVICE_USE_SETTIMEOUT "watchdog-refresh-use-settimeout" #define DEVICE_IGNORE_ERRORS "watchdog-refresh-ignore-errors" #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 ALLOCMEM "allocatable-memory" #define MAXSWAP "max-swap" #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 SOFTBOOT "softboot-option" #define TEMP "temperature-sensor" #define TEMPPOWEROFF "temp-power-off" #define TESTBIN "test-binary" #define TESTTIMEOUT "test-timeout" #define HEARTBEAT "heartbeat-file" #define HBSTAMPS "heartbeat-stamps" #define LOGDIR "log-dir" #define TESTDIR "test-directory" #define SIGTERM_DELAY "sigterm-delay" #define RETRYTIMEOUT "retry-timeout" #define REPAIRMAX "repair-maximum" #define VERBOSE "verbose" #define LOG_KILLED_PIDS "log-killed-pids" #ifndef TESTBIN_PATH #define TESTBIN_PATH NULL #endif static char *test_dir = TESTBIN_PATH; /* Global configuration variables */ int tint = 1; int logtick = 1; int ticker = 1; int schedprio = 1; int maxload1 = 0; int maxload5 = 0; int maxload15 = 0; int minpages = 0; int minalloc = 0; int maxswap = 0; int maxtemp = 90; int pingcount = 3; int temp_poweroff = TRUE; int sigterm_delay = 5; /* Seconds from first SIGTERM to sending SIGKILL during shutdown. */ int repair_max = 1; /* Number of repair attempts without success. */ char *devname = NULL; char *admin = "root"; int test_timeout = TIMER_MARGIN; /* test-binary time out value. */ int repair_timeout = TIMER_MARGIN; /* repair-binary time out value. */ int dev_timeout = TIMER_MARGIN; /* Watchdog hardware time-out. */ int retry_timeout = TIMER_MARGIN; /* Retry on non-critical errors. */ char *logdir = "/var/log/watchdog"; char *heartbeat = NULL; int hbstamps = 300; int refresh_use_settimeout = ENUM_AUTO; int refresh_ignore_errors = FALSE; int realtime = FALSE; /* Self-repairing binaries list */ struct list *tr_bin_list = NULL; struct list *file_list = NULL; struct list *target_list = NULL; struct list *pidfile_list = NULL; struct list *iface_list = NULL; struct list *temp_list = NULL; /* Dummy lists for the load averages & memory checking. */ struct list *memtimer = NULL; struct list *alloctimer = NULL; struct list *loadtimer = NULL; char *repair_bin = NULL; /* Command line options also used globally. */ int softboot = FALSE; int verbose = 0; /* Just for killall5.c */ int log_killed_PIDs = 0; /* Simple table for yes/no enumerated options. */ static const read_list_t Yes_No_list[] = { READ_LIST_ADD("no", 0) READ_LIST_ADD("yes", 1) READ_LIST_END() }; static const read_list_t YN_Auto_list[] = { READ_LIST_ADD("no", ENUM_NO) READ_LIST_ADD("yes", ENUM_YES) READ_LIST_ADD("auto", ENUM_AUTO) READ_LIST_END() }; /* Use the macros below to simplify the parsing function. For now we don't use the * integer range checking (0=0 so not checked), and assume all strings can be blank and * enumerated choices are Yes/No, but in future we could add such settings to the #define'd * list of names above. * * NOTE: We assume these are used with local variables 'arg' 'val' and 'found' present! */ #define READ_INT(name, iv) read_int_func( arg, val, name, &found, 0, 0, iv) #define READ_STRING(name, str) read_string_func( arg, val, name, &found, Read_allow_blank, str) #define READ_YESNO(name, iv) read_enumerated_func(arg, val, name, &found, Yes_No_list, iv) #define READ_YN_AUTO(name, iv) read_enumerated_func(arg, val, name, &found, YN_Auto_list, iv) #define READ_LIST(name, list) read_list_func( arg, val, name, &found, 0, list) /* * Open the configuration file, read & parse it, and set the global configuration variables to those values. */ void read_config(char *configfile) { FILE *wc; char *line = NULL, *arg=NULL, *val=NULL; size_t n = 0; int linecount = 0; add_list(&memtimer, "", 0); add_list(&alloctimer, "", 0); add_list(&loadtimer, "", 0); if ((wc = fopen(configfile, "r")) == NULL) { fatal_error(EX_SYSERR, "Can't open config file \"%s\" (%s)", configfile, strerror(errno)); } while (getline(&line, &n, wc) != -1) { linecount++; /* find first non-white space character and check for blank/commented lines. */ arg = str_start(line); if (arg[0] == 0 || arg[0] == '#') { continue; } /* find the '=' for the "arg = val" parsing. */ val = strchr(arg, '='); if (val == NULL) { log_message(LOG_WARNING, "Warning: no '=' assignment at line %d of config file", linecount); continue; } /* split at found '=' and move to next non-white-space character. */ *val = '\0'; val = str_start(val+1); /* remove trailing white-space characters for easier parsing. */ trim_white(val); trim_white(arg); /* do the 'arg'=something search to set variable='val'. */ parse_arg_val(arg, val, linecount); } if (line) free(line); if (fclose(wc) != 0) { fatal_error(EX_SYSERR, "Error closing file \"%s\" (%s)", configfile, strerror(errno)); } add_test_binaries(test_dir); if (tint <= 0) { fatal_error(EX_SYSERR, "Parameters %s = %d in file \"%s\" must be > 0", INTERVAL, tint, configfile); } /* compute 5 & 15 minute averages if not given. */ if (maxload1 && !maxload5) maxload5 = maxload1 * 3 / 4; if (maxload1 && !maxload15) maxload15 = maxload1 / 2; } /* * Perform the task of looking for 'arg' to be a known term and then setting * the related parameter to be 'val'. If no match is found then report the * discrepancy. */ static void parse_arg_val(char *arg, char *val, int linecount) { int itmp = 0; int found = 0; /* * Search for a match. * * Note #1: The read_*_func() calls deal with a zero-length 'val' as needed. * * Note #2: The READ_INT() and similar macros assume the variables 'arg', * 'val' and 'found' are present - hence the apparent minimal * reference to them in the code below! * * Note #3: There should only be one match - but we report any code errors * that result in 2 or more 'arg' matches in the functions below. */ if (READ_INT(CHANGE, &itmp) == 0) { set_file_list_change(itmp, linecount); } if (READ_INT(LOGTICK, &logtick) == 0) { ticker = logtick; } READ_LIST(FILENAME, &file_list); READ_LIST(SERVERPIDFILE, &pidfile_list); READ_INT(PINGCOUNT, &pingcount); READ_LIST(PING, &target_list); READ_LIST(INTERFACE, &iface_list); READ_YESNO(REALTIME, &realtime); READ_INT(PRIORITY, &schedprio); READ_STRING(REPAIRBIN, &repair_bin); READ_INT(REPAIRTIMEOUT, &repair_timeout); READ_LIST(TESTBIN, &tr_bin_list); READ_INT(TESTTIMEOUT, &test_timeout); READ_STRING(HEARTBEAT, &heartbeat); READ_INT(HBSTAMPS, &hbstamps); READ_STRING(ADMIN, &admin); READ_INT(INTERVAL, &tint); READ_STRING(DEVICE, &devname); READ_YN_AUTO(DEVICE_USE_SETTIMEOUT, &refresh_use_settimeout); READ_YESNO(DEVICE_IGNORE_ERRORS, &refresh_ignore_errors); READ_INT(DEVICE_TIMEOUT, &dev_timeout); READ_LIST(TEMP, &temp_list); READ_INT(MAXTEMP, &maxtemp); READ_INT(MAXLOAD1, &maxload1); READ_INT(MAXLOAD5, &maxload5); READ_INT(MAXLOAD15, &maxload15); READ_INT(MINMEM, &minpages); READ_INT(ALLOCMEM, &minalloc); READ_INT(MAXSWAP, &maxswap); READ_STRING(LOGDIR, &logdir); READ_STRING(TESTDIR, &test_dir); READ_YESNO(SOFTBOOT, &softboot); READ_YESNO(TEMPPOWEROFF, &temp_poweroff); READ_INT(SIGTERM_DELAY, &sigterm_delay); READ_INT(RETRYTIMEOUT, &retry_timeout); READ_INT(REPAIRMAX, &repair_max); READ_INT(VERBOSE, &verbose); READ_YESNO(LOG_KILLED_PIDS, &log_killed_PIDs); if (found == 0) { log_message(LOG_WARNING, "Ignoring invalid option at line %d of config file: %s=%s", linecount, arg, val); } else if (found > 1) { log_message(LOG_ERR, "Multiple matches at line %d of config file: %s=%s", linecount, arg, val); } } /* * Find the most recent file test and set the 'mtime' value for change in * modification time testing. */ static void set_file_list_change(int change, int linecount) { struct list *ptr; if (!file_list) { /* no file entered yet, report this anomaly */ log_message(LOG_WARNING, "Warning: file change interval, but no file (yet) at line %d of config file", linecount); } else { /* we have a file list */ for (ptr = file_list; ptr->next != NULL; ptr = ptr->next) { /* loop to find end of list. */ } if (ptr->parameter.file.mtime != 0) { log_message(LOG_WARNING, "Warning: duplicate change interval at line %d of config file (ignoring previous)", linecount); } ptr->parameter.file.mtime = change; } } /* * Look at the directory specified by 'path' and add any executable * files in there to the test list. */ 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]; 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 { rdret = readdir(d); if (rdret == NULL) break; /* * While readdir() should be thread safe, make a copy as soon * as practical just in case (see 'man readdir' page). */ dentry = (*rdret); 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; /* Skip any hidden files - a bit suspicious. */ if(dentry.d_name[0] == '.') { log_message(LOG_WARNING, "skipping hidden file %s", fname); continue; } if (!(sb.st_mode & S_IXUSR)) continue; if (!(sb.st_mode & S_IRUSR)) continue; if (verbose) log_message(LOG_DEBUG, "adding %s to list of auto-repair binaries", fname); add_list(&tr_bin_list, fname, 1); } while (1); closedir(d); } /* * Free all of the lists allocated by read_config() */ void free_all_lists(void) { free_list(&tr_bin_list); free_list(&file_list); free_list(&target_list); free_list(&pidfile_list); free_list(&iface_list); free_list(&temp_list); free_list(&loadtimer); free_list(&memtimer); } watchdog-5.16/src/keep_alive.c0000644000175000017500000002012413650524716016102 0ustar michaelmichael/* > keep_alive.c * * Code here from old keep_alive.c and taken from watchdog.c & shutdown.c to group * it together. This has the code to open, refresh, and safely close the watchdog device. * * While the watchdog daemon can still function without such hardware support, it is * MUCH less effective as a result, as it can't deal with kernel faults or very difficult * reboot conditions. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #define _GNU_SOURCE /* For O_CLOEXEC on older systems. */ #include #include #include #include #include #include #include /* for ioctl() */ #include /* for 'struct watchdog_info' */ #include "extern.h" #include "watch_err.h" #include "gettime.h" static int watchdog_fd = -1; static int timeout_used = TIMER_MARGIN; static int Refresh_using_ioctl = FALSE; static struct timespec tlast = {0, 0}; /* * Open the watchdog timer (if name non-NULL) and set the time-out value (if non-zero). */ int open_watchdog(char *name, int timeout) { struct watchdog_info ident; int rv = 0; memset(&ident, 0, sizeof(ident)); close_watchdog(); if (name != NULL) { watchdog_fd = open(name, O_WRONLY | O_CLOEXEC); if (watchdog_fd == -1) { int err = errno; log_message(LOG_ERR, "cannot open %s (errno = %d = '%s')", name, err, strerror(err)); rv = -1; /* do not exit here per default */ /* we can use watchdog even if there is no watchdog device */ } else { set_watchdog_timeout(timeout); /* Also log watchdog identity */ if (ioctl(watchdog_fd, WDIOC_GETSUPPORT, &ident) < 0) { int err = errno; log_message(LOG_ERR, "cannot get watchdog identity (errno = %d = '%s')", err, strerror(err)); } else { ident.identity[sizeof(ident.identity) - 1] = '\0'; /* Be sure */ log_message(LOG_INFO, "hardware watchdog identity: %s", ident.identity); } } } /* Start timer for minimum 'ping' on device open. */ clock_gettime(CLOCK_MONOTONIC, &tlast); /* The IT8728 on Gigabyte motherboard (and similar) would trip due to the normal * refresh in the device driver failing to reset the timer for no obvious reason * (though the normal operation used the Consumer IR sender to refresh via an * interrupt - also a non-obvious method!) so this work-around simply sets the * time-out every refresh operation. * * See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/932381 * Also https://bugzilla.kernel.org/show_bug.cgi?id=42801 * */ Refresh_using_ioctl = FALSE; switch (refresh_use_settimeout) { case ENUM_NO: /* Set to "no" so never use ioctl mode. */ break; case ENUM_YES: /* Set to "yes" so always use ioctl mode. */ Refresh_using_ioctl = TRUE; log_message(LOG_INFO, "Running ioctl-based refresh"); break; case ENUM_AUTO: /* Set to "auto" to decide based on driver identity. */ Refresh_using_ioctl = FALSE; if (strcmp("IT87 WDT", (char *)ident.identity) == 0) { Refresh_using_ioctl = TRUE; log_message(LOG_INFO, "Running IT87 module fix-up"); } break; default: log_message(LOG_ERR, "Unknown ioctl selection mode (%d)", refresh_use_settimeout); break; } return rv; } /* * In particular the iTCO_wdt driver has a lower limit of about 3 or 5 seconds * (and depending on version, upper of 31, 76 or 614). Since we also use this * to speed the reboot process in fault case, we might want to do something * about the lower limit failure. */ static int try_other_times(const int timeout) { static const int try_values[] = {3, 5, 10}; static const int num_try = ARRAY_SIZE(try_values); int ii; for (ii = 0; ii < num_try; ii++) { int tmp = try_values[ii]; if (tmp > timeout) { if (ioctl(watchdog_fd, WDIOC_SETTIMEOUT, &tmp) >= 0) { log_message(LOG_ERR, "trying watchdog time-out success for %d", tmp); return 0; } } } return -1; } /* * Once opened, call this to query or change the watchdog timer value. */ int set_watchdog_timeout(int timeout) { int rv = -1; if (watchdog_fd != -1) { if (timeout > 0) { timeout_used = timeout; /* Set the watchdog hard-stop timeout; default = unset (use driver default) */ if (ioctl(watchdog_fd, WDIOC_SETTIMEOUT, &timeout) < 0) { int err = errno; log_message(LOG_ERR, "cannot set timeout %d (errno = %d = '%s')", timeout, err, strerror(err)); /* * We can get here for several reasons: driver in error, time-out too big * or time-out too small. Try other values just in case. */ try_other_times(timeout); } else { if(timeout <= tint * 2) { log_message(LOG_WARNING, "Warning: watchdog now set to %d seconds, should be more than double interval = %d", timeout, tint); } else { log_message(LOG_INFO, "watchdog now set to %d seconds", timeout); } rv = 0; } } else { timeout = 0; /* If called with timeout <= 0 then query device. */ if (ioctl(watchdog_fd, WDIOC_GETTIMEOUT, &timeout) < 0) { int err = errno; log_message(LOG_ERR, "cannot get timeout (errno = %d = '%s')", err, strerror(err)); } else { log_message(LOG_INFO, "watchdog was set to %d seconds", timeout); rv = 0; } } } return rv; } /* * Test to see if "a - b > td" for a time-out indication. * * Return zero if a-b is between 0 and td. * * Return non-zero if a-b is negative (clock stepped?) or greater than td */ static int timespecpast(const struct timespec *a, const struct timespec *b, const struct timespec *td) { struct timespec tdiff; int ret = 0; /* Compute "a - b" */ timespecsub(a, b, &tdiff); if (tdiff.tv_sec < 0 || timespeccmp(&tdiff, td, >)) { ret = 1; } if (verbose > 1) { log_message(LOG_DEBUG, "Time from last refresh = %ld.%09ld => %d", tdiff.tv_sec, tdiff.tv_nsec, ret); } return ret; } /* write to the watchdog device */ int keep_alive(void) { int err = ENOERR; struct timespec tnow; const struct timespec tminimum = {0, NSEC/5}; /* Set to 0.2 seconds minimum 'ping' time. */ if (watchdog_fd == -1) return (ENOERR); /* Check if we have passed minimum period. */ clock_gettime(CLOCK_MONOTONIC, &tnow); if (timespecpast(&tnow, &tlast, &tminimum) == 0) { return (ENOERR); } /* Once we are going to feed the dog, save this time for next check. */ tlast = tnow; if (Refresh_using_ioctl) { int timeout = timeout_used; if (ioctl(watchdog_fd, WDIOC_SETTIMEOUT, &timeout) < 0) { err = errno; log_message(LOG_ERR, "set watchdog timeout gave error %d = '%s'!", err, strerror(err)); } } else { if (write(watchdog_fd, "\0", 1) < 0) { /* Normal use of the watchdog driver - any write refreshes it */ err = errno; log_message(LOG_ERR, "write watchdog device gave error %d = '%s'!", err, strerror(err)); } } /* * If we set this option then we simply ignore any errors reported by writing to * the watchdog device. Typically for broken IPMI implementations such as: * https://support.gfi.com/hc/en-us/articles/360012894154-IPMI-Watchdog-Response-Error */ if (refresh_ignore_errors) { err = ENOERR; } /* 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 (err); } /* * Provide read-only access to the watchdog file handle. */ int get_watchdog_fd(void) { return watchdog_fd; } /* * Close the watchdog device, this normally stops the hardware timer to prevent a * spontaneous reboot, but not if the kernel is compiled with the * CONFIG_WATCHDOG_NOWAYOUT option enabled! */ int close_watchdog(void) { int rv = 0; if (watchdog_fd != -1) { if (write(watchdog_fd, "V", 1) < 0) { int err = errno; log_message(LOG_ERR, "write watchdog device gave error %d = '%s'!", err, strerror(err)); rv = -1; } if (close(watchdog_fd) == -1) { int err = errno; log_message(LOG_ALERT, "cannot close watchdog (errno = %d = '%s')", err, strerror(err)); rv = -1; } } watchdog_fd = -1; return rv; } /* A version of sleep() that keeps the watchdog timer alive. */ void safe_sleep(int sec) { int i; keep_alive(); for (i=0; i heartbeat.c * * Groups together the code for the special heart-beat timestamps file * used for debug. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include "watch_err.h" #include "extern.h" static FILE *hb = NULL; static int lastts, nrts; static char *timestamps = NULL; static void next_value(void) { if (nrts < hbstamps) nrts++; ++lastts; lastts = lastts % hbstamps; } /* * Open the heartbeat file based on the global variable 'heartbeat' and allocate enough * memory for a buffer based on the global variable 'hbstamps'. */ int open_heartbeat(void) { int rv = 0; close_heartbeat(); if (heartbeat != NULL) { hb = ((hb = fopen(heartbeat, "r+")) == NULL) ? fopen(heartbeat, "w+") : hb; if (hb == NULL) { log_message(LOG_ERR, "cannot open %s (errno = %d = '%s')", heartbeat, errno, strerror(errno)); rv = -1; } else { char rbuf[TS_SIZE + 1]; /* Allocate memory for keeping the timestamps in */ nrts = 0; lastts = 0; timestamps = (char *)xcalloc(hbstamps, TS_SIZE); /* read any previous timestamps */ rewind(hb); while (fgets(rbuf, TS_SIZE + 1, hb) != NULL) { memcpy(timestamps + (TS_SIZE * lastts), rbuf, TS_SIZE); next_value(); } /* 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 */ next_value(); } } return rv; } /* write a heartbeat file */ int write_heartbeat(void) { time_t timenow; struct tm *tm; char tbuf[TS_SIZE + 1]; char tbufw[TS_SIZE + 2]; 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 */ next_value(); /* 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) != (hbstamps - lastts)) { int err = errno; log_message(LOG_ERR, "write heartbeat file gave error %d = '%s'!", err, strerror(err)); } /* write from the physical start of the buffer to the logical end */ if (fwrite(timestamps, TS_SIZE, lastts, hb) != lastts) { int err = errno; log_message(LOG_ERR, "write heartbeat file gave error %d = '%s'!", err, strerror(err)); } } else { /* write from the physical start of the buffer to the logical end */ if (fwrite(timestamps, TS_SIZE, nrts, hb) != nrts) { int err = errno; log_message(LOG_ERR, "write heartbeat file gave error %d = '%s'!", err, strerror(err)); } } fflush(hb); } return (ENOERR); } int close_heartbeat(void) { int rv = 0; if (hb != NULL && fclose(hb) == -1) { log_message(LOG_ALERT, "cannot close %s (errno = %d)", heartbeat, errno); rv = -1; } hb = NULL; if (timestamps != NULL) { free(timestamps); timestamps = NULL; } return rv; } watchdog-5.16/src/shutdown.c0000644000175000017500000002576213650524716015666 0ustar michaelmichael#ifdef HAVE_CONFIG_H #include "config.h" #endif #define _XOPEN_SOURCE 500 /* for getsid(2) */ #define _BSD_SOURCE /* for acct(2) */ #define _DEFAULT_SOURCE /* To stop complaints with gcc >= 2.19 */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* For MNT_FORCE */ #include /* for swapoff() */ #include #include #include "watch_err.h" #include "extern.h" #include "ext2_mnt.h" #if defined __GLIBC__ #include #include #include #else /* __GLIBC__ */ #include #endif /* __GLIBC__ */ #include #ifndef NSIG #define NSIG _NSIG #endif #ifndef __GLIBC__ #ifndef RB_AUTOBOOT #define RB_AUTOBOOT 0xfee1dead,672274793,0x01234567 /* Perform a hard reset now. */ #define RB_ENABLE_CAD 0xfee1dead,672274793,0x89abcdef /* Enable reboot using Ctrl-Alt-Delete keystroke. */ #define RB_HALT_SYSTEM 0xfee1dead,672274793,0xcdef0123 /* Halt the system. */ #define RB_POWER_OFF 0xfee1dead,672274793,0x4321fedc /* Stop system and switch power off if possible. */ #endif /*RB_AUTOBOOT*/ #endif /* !__GLIBC__ */ /* * Close all the device except for the watchdog. */ static void close_all_but_watchdog(void) { close_loadcheck(); close_memcheck(); close_tempcheck(); close_heartbeat(); close_netcheck(target_list); free_process(); /* What check_bin() was waiting to report. */ free_all_lists(); /* Memory used by read_config() */ } /* on exit we close the device and log that we stop */ void terminate(int ecode) { log_message(LOG_NOTICE, "stopping daemon (%d.%d)", MAJOR_VERSION, MINOR_VERSION); unlock_our_memory(); close_all_but_watchdog(); close_watchdog(); remove_pid_file(); close_logging(); xusleep(100000); /* 0.1s to make sure log is written */ exit(ecode); } /* panic: we're still alive but shouldn't */ static void panic(void) { /* * Okay we should never reach this point, * but if we do we will cause the hard reset */ open_logging(NULL, MSG_TO_STDERR | MSG_TO_SYSLOG); log_message(LOG_ALERT, "WATCHDOG PANIC: failed to reboot, trying hard-reset"); sleep(dev_timeout * 4); /* if we are still alive, we just exit */ log_message(LOG_ALERT, "WATCHDOG PANIC: still alive after sleeping %d seconds", 4 * dev_timeout); close_all_but_watchdog(); close_logging(); exit(1); } /* * Test for virtual file systems that we need not unmount. */ static int ignore_fs(const struct mntent *mnt) { int ii; const char *temp[] = { "devfs", "proc", "sysfs", "ramfs", "tmpfs", "devpts", "devtmpfs", "tracefs", "squashfs" }; const int num_temp = ARRAY_SIZE(temp); const char *ignore[] = { "/run/", "/sys/", "/proc/", "/dev/" }; const int num_ignore = ARRAY_SIZE(ignore); /* * Check for known temporary file systems */ for(ii = 0; ii < num_temp; ii++) { const char *str = temp[ii]; if(!strcmp(mnt->mnt_type, str)) { return -1; } } /* * Check for known virtual file systems, these * often also feature sub-directories hence the * length-limited test for a path start. */ for(ii = 0; ii < num_ignore; ii++) { const char *str = ignore[ii]; if(!strncmp(mnt->mnt_dir, str, strlen(str))) { return -1; } } return 0; } /* * Unmount file ourselves, this code adapted from util-linux-2.17.2/login-utils/shutdown.c * However, they also try running the 'umount' binary first, as it might be smarter. */ #define NUM_MNTLIST 128 static void mnt_off(void) { FILE *fp; struct mntent *mnt; char *mntlist[NUM_MNTLIST]; const char *fname = _PATH_MOUNTED; int n = 0; int i; keep_alive(); /* Could this hang the system? Hardware watchdog will kick in, but might be * better to try fork() and idle for a while before forcing unmounts? */ sync(); keep_alive(); if (!(fp = setmntent(fname, "r"))) { log_message(LOG_ERR, "could not open %s (%s)", fname, strerror(errno)); return; } /* in some rare cases fp might be NULL so be careful */ while (n < NUM_MNTLIST && (mnt = getmntent(fp)) != NULL) { /* First check if swap */ if (!strcmp(mnt->mnt_type, MNTTYPE_SWAP)) { if (swapoff(mnt->mnt_fsname) < 0) log_message(LOG_ERR, "could not swap-off %s (%s)", mnt->mnt_fsname, strerror(errno)); } else { /* quota only if mounted at boot time && filesytem=ext2 */ if (!hasmntopt(mnt, MNTOPT_NOAUTO) && !strcmp(mnt->mnt_type, MNTTYPE_EXT2)) { /* group quota? */ if (hasmntopt(mnt, MNTOPT_GRPQUOTA)) { if (quotactl(QCMD(Q_QUOTAOFF, GRPQUOTA), mnt->mnt_fsname, 0, (caddr_t) 0) < 0) { log_message(LOG_ERR, "could not stop group quota %s (%s)", mnt->mnt_fsname, strerror(errno)); } } /* user quota */ if (hasmntopt(mnt, MNTOPT_USRQUOTA)) { if (quotactl(QCMD(Q_QUOTAOFF, USRQUOTA), mnt->mnt_fsname, 0, (caddr_t) 0) < 0) { log_message(LOG_ERR, "could not stop user quota %s (%s)", mnt->mnt_fsname, strerror(errno)); } } } /* * Neil Phillips: trying to unmount temporary / kernel * filesystems is pointless and may cause error messages; * /dev can be a ramfs managed by udev. */ if (ignore_fs(mnt)) { log_message(LOG_DEBUG, "skip %s %s type %s", mnt->mnt_fsname, mnt->mnt_dir, mnt->mnt_type); } else { log_message(LOG_DEBUG, "listing %s %s type %s", mnt->mnt_fsname, mnt->mnt_dir, mnt->mnt_type); mntlist[n++] = strdup(mnt->mnt_dir); } } } /* Close our file pointer. */ endmntent(fp); /* * We are careful to do this in reverse order of the mtab file. * * NOTE: We do not update the mount point list, so this is really * only good for a final shutdown! * */ for (i = n - 1; i >= 0; i--) { char *filesys = mntlist[i]; /* Treat root file system as unmountable - make readonly instead. */ if(!strcmp(filesys, "/")) { log_message(LOG_DEBUG, "remounting read-only %s", filesys); keep_alive(); if(mount(filesys, filesys, "", MS_REMOUNT | MS_RDONLY, "") < 0) { log_message(LOG_ERR, "could not remount %s (%s)", filesys, strerror(errno)); } } else { log_message(LOG_DEBUG, "unmounting %s", filesys); keep_alive(); #if defined( MNT_FORCE ) if (umount2(filesys, MNT_FORCE) < 0) { #else if (umount(filesys) < 0) { #endif /*!MNT_FORCE*/ log_message(LOG_ERR, "could not unmount %s (%s)", filesys, strerror(errno)); } } } } /* * Kill everything, but depending on 'aflag' spare kernel/privileged * processes. Do this twice in case we have out-of-memory problems. * * The value of 'stime' is the delay from 2nd SIGTERM to SIGKILL but * the SIGKILL is only used when 'aflag' is true as things really bad then! */ static void kill_everything_else(int aflag, int stime) { int ii; /* Ignore all signals (except children, so run_func_as_child() works as expected). */ for (ii = 1; ii < NSIG; ii++) { if (ii != SIGCHLD) { signal(ii, SIG_IGN); } } /* Stop init; it is insensitive to the signals sent by the kernel. */ kill(1, SIGTSTP); /* Try to terminate processes the 'nice' way. */ killall5(SIGTERM, aflag); safe_sleep(1); /* Do this twice in case we have out-of-memory problems. */ killall5(SIGTERM, aflag); /* Now wait for most processes to exit as intended. */ safe_sleep(stime); if (aflag) { /* In case that fails, send them the non-ignorable kill signal. */ killall5(SIGKILL, aflag); keep_alive(); /* Out-of-memory safeguard again. */ killall5(SIGKILL, aflag); keep_alive(); } } /* * Record the system shut-down. */ static void write_wtmp(void) { time_t t; struct utmp wtmp; const char *fname = _PATH_WTMP; int fd; if ((fd = open(fname, O_WRONLY | O_APPEND)) >= 0) { memset(&wtmp, 0, sizeof(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) log_message(LOG_ERR, "failed writing wtmp (%s)", strerror(errno)); close(fd); } } /* * Save the random seed if a save location exists. * Don't worry about error messages, we react here anyway */ static void save_urandom(void) { const char *seedbck = RANDOM_SEED; int fd_seed, fd_bck; char buf[512]; if (strlen(seedbck) != 0) { if ((fd_seed = open("/dev/urandom", O_RDONLY)) >= 0) { if ((fd_bck = creat(seedbck, S_IRUSR | S_IWUSR)) >= 0) { if (read(fd_seed, buf, sizeof(buf)) == sizeof(buf)) { if (write(fd_bck, buf, sizeof(buf)) < 0) { log_message(LOG_ERR, "failed writing urandom (%s)", strerror(errno)); } } close(fd_bck); } close(fd_seed); } } } /* part that tries to shut down the system cleanly */ static void try_clean_shutdown(int errorcode) { /* soft-boot the system */ /* do not close open files here, they will be closed later anyway */ /* if we will halt the system we should try to tell a sysadmin */ if (admin != NULL) { run_func_as_child(60, send_email, errorcode, NULL); } open_logging(NULL, MSG_TO_STDERR); /* Without 'MSG_TO_SYSLOG' this closes syslog. */ safe_sleep(1); /* make sure log is written (send_email now has its own wait). */ /* 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. */ close_all_but_watchdog(); kill_everything_else(TRUE, sigterm_delay-1); /* Remove our PID file, as nothing should be capable of starting a 2nd daemon now. */ remove_pid_file(); /* Record the fact that we're going down */ write_wtmp(); /* save the random seed if a save location exists */ save_urandom(); /* Turn off accounting */ if (acct(NULL) < 0) log_message(LOG_ERR, "failed stopping acct() (%s)", strerror(errno)); keep_alive(); /* Turn off quota and swap */ mnt_off(); } /* shut down the system */ void do_shutdown(int errorcode) { /* tell syslog what's happening */ log_message(LOG_ALERT, "shutting down the system because of error %d = '%s'", errorcode, wd_strerror(errorcode)); if(errorcode != ERESET) { try_clean_shutdown(errorcode); } else { /* We have been asked to hard-reset, make basic attempt at clean filesystem * but don't try stopping anything, etc, then used device (below) to do reset * action. */ sync(); sleep(1); } /* finally reboot */ if (errorcode != ETOOHOT) { if (get_watchdog_fd() != -1) { /* We have a hardware timer, try using that for a quick reboot first. */ set_watchdog_timeout(1); sleep(dev_timeout * 4); } /* That failed, or was not possible, ask kernel to do it for us. */ reboot(RB_AUTOBOOT); } else { if (temp_poweroff) { /* Tell system to power off if possible. */ reboot(RB_POWER_OFF); } else { /* Turn on hard reboot, CTRL-ALT-DEL will reboot now. */ reboot(RB_ENABLE_CAD); /* And perform the `halt' system call. */ reboot(RB_HALT_SYSTEM); } } /* unbelievable: we're still alive */ panic(); } watchdog-5.16/src/temp.c0000644000175000017500000001275613650524716014757 0ustar michaelmichael#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include "extern.h" #include "watch_err.h" static int temp_fd = -1; static int templevel1; static int templevel2; static int templevel3; static int read_temp_sensor(const char *name, int *val); /* ================================================================= */ int open_tempcheck(struct list *tlist) { int rv = -1; struct list *act; close_tempcheck(); if (tlist != NULL) { /* Use temp_fd as in-use flag. */ temp_fd = 0; /* * Clear flags and set/compute warning and max thresholds. Make * sure that each level is distinct and properly ordered so that * we have templevel1 < templevel2 < templevel3 < maxtemp */ for (act = tlist; act != NULL; act = act->next) { int itmp = 0; act->parameter.temp.have1 = FALSE; act->parameter.temp.have2 = FALSE; act->parameter.temp.have3 = FALSE; /* Check the sensors is usable when initialising. */ if (read_temp_sensor(act->name, &itmp) == ENOERR) { act->parameter.temp.in_use = TRUE; } else { act->parameter.temp.in_use = FALSE; log_message(LOG_WARNING, "Disabling temperature check for %s", act->name); } } templevel3 = (maxtemp * 98) / 100; if (templevel3 >= maxtemp) { templevel3 = maxtemp - 1; } templevel2 = (maxtemp * 95) / 100; if (templevel2 >= templevel3) { templevel2 = templevel3 - 1; } templevel1 = (maxtemp * 90) / 100; if (templevel1 >= templevel2) { templevel1 = templevel2 - 1; } } return rv; } /* * Code to read the ASCII "files" presented by the lm-sensors package with paths such as: * * -r--r--r-- 1 root root 4096 2013-03-09 09:27 /sys/class/hwmon/hwmon0/device/temp1_input * -r--r--r-- 1 root root 4096 2013-03-09 09:01 /sys/class/hwmon/hwmon0/device/temp2_input * -r--r--r-- 1 root root 4096 2013-03-09 09:27 /sys/class/hwmon/hwmon0/device/temp3_input * * Location varies with hardware devices, and you may find two sensors as hwmon0 & hwmon1, etcv * but in my case the above paths are really sym-links to the hardware driver, such as: * * -r--r--r-- 1 root root 4096 2013-03-09 09:27 /sys/devices/platform/w83627ehf.656/temp1_input * -r--r--r-- 1 root root 4096 2013-03-09 09:01 /sys/devices/platform/w83627ehf.656/temp2_input * -r--r--r-- 1 root root 4096 2013-03-09 09:27 /sys/devices/platform/w83627ehf.656/temp3_input * * They have the temperature in C x 1000 but resolution may only be 0.5C or 1C. Typical result is: * * > cat /sys/class/hwmon/hwmon0/device/temp1_input * 36000 * * For 36.0C so we read and print as fraction, but truncate so only the whole deg C is used * for the watchdog tests below. */ static int read_temp_sensor(const char *name, int *val) { float temp; char buf[128]; char *p; int err; FILE *fp; fp = fopen(name, "r"); if (fp == NULL) { err = errno; log_message(LOG_ERR, "failed to open %s (%s)", name, strerror(err)); return err; } buf[0] = 0; /* to be safe... */ p = fgets(buf, sizeof(buf)-1, fp); err = errno; fclose(fp); if (p == NULL) { log_message(LOG_ERR, "failed to read %s (%s)", name, strerror(err)); return err; } /* New style sensors read in milli-Celsius, convert to deg C as float. */ temp = 1.0e-3F * atof(buf); if (verbose && logtick && ticker == 1) log_message(LOG_DEBUG, "current temperature is %.3f for %s", temp, name); /* convert to integer of whole deg C, small addition to make sure matches integer version. */ *val = (int)(1.0e-5F + temp); return ENOERR; } /* ================================================================= */ int check_temp(struct list *act) { int temperature = 0; int err; /* is the temperature device open? */ if (temp_fd == -1 || act == NULL || act->parameter.temp.in_use == FALSE) return (ENOERR); err = read_temp_sensor(act->name, &temperature); if (err != ENOERR) { return (err); } /* Print out warnings as we cross the 90/95/98 percent thresholds. */ if (temperature > templevel3) { if (!act->parameter.temp.have3) { /* once we reach level3, issue a warning once. */ log_message(LOG_WARNING, "temperature increases above %d (%s)", templevel3, act->name); act->parameter.temp.have1 = act->parameter.temp.have2 = act->parameter.temp.have3 = TRUE; } } else if (temperature > templevel2) { if (!act->parameter.temp.have2) { log_message(LOG_WARNING, "temperature increases above %d (%s)", templevel2, act->name); act->parameter.temp.have1 = act->parameter.temp.have2 = TRUE; } act->parameter.temp.have3 = FALSE; } else if (temperature > templevel1) { if (!act->parameter.temp.have1) { log_message(LOG_WARNING, "temperature increases above %d (%s)", templevel1, act->name); act->parameter.temp.have1 = TRUE; } act->parameter.temp.have2 = act->parameter.temp.have3 = FALSE; } else { /* Below all thresholds, report clear only if previously set. */ if (act->parameter.temp.have1 || act->parameter.temp.have2 || act->parameter.temp.have3) { log_message(LOG_INFO, "temperature now OK again for %s", act->name); } act->parameter.temp.have1 = act->parameter.temp.have2 = act->parameter.temp.have3 = FALSE; } if (temperature >= maxtemp) { log_message(LOG_ERR, "it is too hot inside (temperature = %d >= %d for %s)", temperature, maxtemp, act->name); return (ETOOHOT); } return (ENOERR); } /* ================================================================= */ int close_tempcheck(void) { int rv = -1; if (temp_fd != -1) { rv = 0; } temp_fd = -1; return rv; } watchdog-5.16/src/file_stat.c0000644000175000017500000000430713650524716015755 0ustar michaelmichael#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "extern.h" #include "watch_err.h" #include "gettime.h" int check_file_stat(struct list *file) { struct stat buf; if (file == NULL) { return (ENOERR); } /* in filemode stat file */ if (stat(file->name, &buf) == -1) { int err = errno; log_message(LOG_ERR, "cannot stat %s (errno = %d = '%s')", file->name, err, strerror(err)); return (err); } else if (file->parameter.file.mtime != 0) { time_t now = gettime(); if (buf.st_mtime != file->parameter.file.stat_mtime) { file->parameter.file.stat_mtime = buf.st_mtime; file->parameter.file.stat_changed = now; } int twait = (int)(now - file->parameter.file.stat_changed); if (twait > file->parameter.file.mtime) { /* file wasn't changed often enough */ log_message(LOG_ERR, "file %s was not changed in %d seconds (more than %d)", file->name, twait, file->parameter.file.mtime); return (ENOCHANGE); } /* do verbose logging */ if (verbose && logtick && ticker == 1) { char text[25]; /* Remove the trailing '\n' of the ctime() formatted string. */ strncpy(text, ctime(&buf.st_mtime), sizeof(text)-1); text[sizeof(text)-1] = 0; log_message(LOG_DEBUG, "file %s was last changed at %s (%ds ago)", file->name, text, twait); } } else { /* do verbose logging */ if (verbose && logtick && ticker == 1) { log_message(LOG_DEBUG, "file %s status OK", file->name); } } return (ENOERR); } /* * Present check_file_stat() in manner for run_func_as_child() to call. * In this case 'code' is not used. */ static int run_func(int code, void *ptr) { return check_file_stat((struct list *)ptr); } /* * An alternative to check_file_stat() that forks the process to run * it as a child, so a time-out on NFS access, etc, won't trigger a hardware * reset, so the main daemon has a chance to reboot cleanly. */ int check_file_stat_safe(struct list *file) { const int CHECK_TIMEOUT = 5; int ret; if (file == NULL) { return (ENOERR); } ret = run_func_as_child(CHECK_TIMEOUT, run_func, 0, file); if (ret == ETOOLONG) { log_message(LOG_ERR, "timeout getting file status for %s", file->name); } return (ret); } watchdog-5.16/src/gettime.c0000644000175000017500000000047613650524716015444 0ustar michaelmichael#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "gettime.h" /* * Return current MONOTONIC time. * (like time(NULL), but monotonic) */ time_t gettime(void) { struct timespec now = {}; int rc = clock_gettime(CLOCK_MONOTONIC, &now); if (rc < 0) { return -1; } return now.tv_sec; } watchdog-5.16/src/load.c0000644000175000017500000000516113650524716014721 0ustar michaelmichael/* > load.c * * Code for checking the system load averages. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include "extern.h" #include "watch_err.h" static int load_fd = -1; static const char load_name[] = "/proc/loadavg"; /* ============================================================================ */ int open_loadcheck(void) { int rv = -1; close_loadcheck(); if (maxload1 || maxload5 || maxload15) { /* open the load average file */ load_fd = open(load_name, O_RDONLY); if (load_fd == -1) { log_message(LOG_ERR, "cannot open %s (errno = %d = '%s')", load_name, errno, strerror(errno)); } else { rv = 0; } } return rv; } /* ============================================================================ */ int check_load(void) { int avg1, avg5, avg15; char buf[40], *ptr; int n; /* is the load average file open? */ if (load_fd == -1) return (ENOERR); /* position pointer at start of file */ if (lseek(load_fd, 0, SEEK_SET) < 0) { int err = errno; log_message(LOG_ERR, "lseek %s gave errno = %d = '%s'", load_name, err, strerror(err)); return (err); } /* read the line (there is only one) */ if ((n = read(load_fd, buf, sizeof(buf)-1)) < 0) { int err = errno; log_message(LOG_ERR, "read %s gave errno = %d = '%s'", load_name, err, strerror(err)); return (err); } /* Force string to be nul-terminated. */ buf[n] = 0; /* 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 { log_message(LOG_ERR, "%s does not contain any data (read = %s)", load_name, buf); return (ENOLOAD); } if (verbose && logtick && ticker == 1) log_message(LOG_DEBUG, "current load is %d %d %d", avg1, avg5, avg15); if ((maxload1 > 0 && avg1 > maxload1) || (maxload5 > 0 && avg5 > maxload5) || (maxload15 > 0 && avg15 > maxload15)) { log_message(LOG_ERR, "loadavg %d %d %d is higher than the given threshold %d %d %d!", avg1, avg5, avg15, maxload1, maxload5, maxload15); return (EMAXLOAD); } return (ENOERR); } /* ============================================================================ */ int close_loadcheck(void) { int rv = -1; if (load_fd != -1 && close(load_fd) == -1) { log_message(LOG_ALERT, "cannot close %s (errno = %d)", load_name, errno); } else { rv = 0; } load_fd = -1; return rv; } watchdog-5.16/src/file_table.c0000644000175000017500000000145013650524716016065 0ustar michaelmichael#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "extern.h" #include "watch_err.h" int check_file_table(void) { int fd; const char fname[] = "/proc/uptime"; /* Any file will do, so long as it ALWAYS exists. */ int err = ENOERR; /* open a file */ fd = open(fname, O_RDONLY); if (fd == -1) { err = errno; log_message(LOG_ERR, "cannot open %s (errno = %d = '%s')", fname, err, strerror(err)); if (err == ENFILE) { /* we need a reboot if ENFILE is returned (file table overflow) */ log_message(LOG_ERR, "file table overflow detected!"); return (EREBOOT); } } else { if (close(fd) < 0) { err = errno; log_message(LOG_ERR, "close %s gave errno = %d = '%s'", fname, err, strerror(err)); } } return (err); } watchdog-5.16/src/watchdog.c0000644000175000017500000003470713650524716015612 0ustar michaelmichael/*************************************************************/ /* 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* For EXEC_PAGESIZE */ #include #include #ifdef __linux__ #include #endif #include #include #include #include #include "watch_err.h" #include "extern.h" #include "gettime.h" #include "read-conf.h" static int no_act = FALSE; static void usage(char *progname) { fprintf(stderr, "%s version %d.%d, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION); fprintf(stderr, "%s [options]\n", progname); fprintf(stderr, "options:\n"); fprintf(stderr, " -c | --config-file specify location of config file\n"); fprintf(stderr, " -f | --force don't sanity-check config or use PID file\n"); fprintf(stderr, " -F | --foreground run in foreground\n"); fprintf(stderr, " -X | --loop-exit run a fixed number of loops then exit\n"); fprintf(stderr, " -q | --no-action do not reboot or halt\n"); fprintf(stderr, " -b | --softboot soft-boot on error\n"); fprintf(stderr, " -s | --sync sync filesystem\n"); fprintf(stderr, " -v | --verbose verbose messages\n"); 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) { char *arg[6]; char parm[22]; int ret; sprintf(parm, "%d", result); if (version == 0) { arg[0] = rbinary; /* Use common repair binary with V0 test scripts, etc. */ arg[1] = rbinary; arg[2] = parm; arg[3] = name; /* May be null, not a problem here. */ arg[4] = NULL; arg[5] = NULL; } else { arg[0] = name; /* With V1 the test binary is also the repair binary. */ arg[1] = name; arg[2] = "repair"; arg[3] = parm; arg[4] = name; arg[5] = NULL; } /* no binary given, we have to reboot */ if (arg[0] == NULL) return (result); ret = run_func_as_child(repair_timeout, exec_as_func, FLAG_REOPEN_STD_REPAIR, arg); /* check result */ if (ret != 0) { log_message(LOG_ERR, "repair binary %s returned %d = '%s'", rbinary, ret, wd_strerror(ret)); } return (ret); } static int attempt_repair(int result, char *rbinary, struct list *act) { int version = 0; char *name = NULL; int timeout = TRUE; /* If we have info about the version, use this to decide what to call * in order to repair the problem. Default is we use the global repair * call, but for V1 we use the same program with a different argument. */ if (act != NULL) { name = act->name; version = act->version; } if (version == 1) { rbinary = name; } /* Check for re-try options. */ if (act != NULL && retry_timeout > 0) { /* timer possible and used to allow re-try */ time_t now = gettime(); timeout = FALSE; if (act->last_time == 0) { /* First offence, record time. */ act->last_time = now; } else { /* timer running */ int tused = (int)(now - act->last_time); if (tused > retry_timeout) { log_message(LOG_WARNING, "Retry timed-out at %d seconds for %s", tused, act->name); timeout = TRUE; } else { if (verbose) log_message(LOG_DEBUG, "Retry at %d seconds for %s", tused, act->name); } } } /* Timed out, or not re-try in use? */ if (timeout) { int try_repair = TRUE; /* check for too many failed repair attempts */ if (act != NULL && repair_max > 0) { if (++act->repair_count > repair_max) { try_repair = FALSE; log_message(LOG_WARNING, "Repair count exceeded (%d for %s)", act->repair_count, act->name); } else { /* going to repair, reset re-try timer so same period for next try */ act->last_time = 0; if (verbose) { log_message(LOG_DEBUG, "Repair attempt %d for %s", act->repair_count, act->name); } } } if (try_repair) { result = repair(rbinary, result, name, version); } } else { /* Not yet timed out, so treat as "no error" for now. */ result = ENOERR; } return result; } static void wd_action(int result, char *rbinary, struct list *act) { /* Decide on repair or return based on error code. */ switch (result) { case ENOERR: /* No error, reset any time-out. */ if (act != NULL) { act->last_time = 0; act->repair_count = 0; } return; case EDONTKNOW: /* Don't know, keep on working */ return; case EREBOOT: case ERESET: case ETOOHOT: case ENOMEM: /* These are not repairable. */ break; default: /* Error that might be repairable */ result = attempt_repair(result, rbinary, act); break; } /* if still error, consider reboot */ if (result != ENOERR) { /* if no-action flag set, do nothing */ if (no_act) { if (verbose) { log_message(LOG_DEBUG, "Shutdown blocked by --no-action (error %d = '%s')", result, wd_strerror(result)); } } else { do_shutdown(result); } } } static void do_check(int res, char *rbinary, struct list *act) { wd_action(res, rbinary, act); wd_action(keep_alive(), rbinary, NULL); } static void old_option(int c, char *configfile) { fprintf(stderr, "Option -%c is no longer valid, please specify it in %s.\n", c, configfile); } static void print_info(int sync_it, int force) { struct list *act; log_message(LOG_INFO, " int=%ds realtime=%s sync=%s load=%d,%d,%d soft=%s", tint, realtime ? "yes" : "no", sync_it ? "yes" : "no", maxload1, maxload5, maxload15, softboot ? "yes" : "no"); if (minpages == 0 && minalloc == 0 && maxswap == 0) log_message(LOG_INFO, " memory not checked"); else log_message(LOG_INFO, " memory: minimum pages = %d free, %d allocatable, max swap %d (%d byte pages)", minpages, minalloc, maxswap, EXEC_PAGESIZE); if (target_list == NULL) log_message(LOG_INFO, " ping: no machine to check"); else for (act = target_list; act != NULL; act = act->next) log_message(LOG_INFO, "ping: %s", act->name); if (file_list == NULL) log_message(LOG_INFO, " file: no file to check"); else for (act = file_list; act != NULL; act = act->next) log_message(LOG_INFO, " file: %s:%d", act->name, act->parameter.file.mtime); if (pidfile_list == NULL) log_message(LOG_INFO, " pidfile: no server process to check"); else for (act = pidfile_list; act != NULL; act = act->next) log_message(LOG_INFO, " pidfile: %s", act->name); if (iface_list == NULL) log_message(LOG_INFO, " interface: no interface to check"); else for (act = iface_list; act != NULL; act = act->next) log_message(LOG_INFO, " interface: %s", act->name); if (temp_list == NULL) log_message(LOG_INFO, " temperature: no sensors to check"); else { log_message(LOG_INFO, " temperature: maximum = %d", maxtemp); for (act = temp_list; act != NULL; act = act->next) log_message(LOG_INFO, " temperature: %s", act->name); } if (tr_bin_list == NULL) log_message(LOG_INFO, " no test binary files"); else { log_message(LOG_INFO, " test binary time-out = %d", test_timeout); for (act = tr_bin_list; act != NULL; act = act->next) log_message(LOG_INFO, " %s: %s", act->version == 0 ? "test binary V0" : "test/repair V1", act->name); } if (repair_bin == NULL) log_message(LOG_INFO, " no repair binary files"); else { log_message(LOG_INFO, " repair binary: time-out = %d", repair_timeout); log_message(LOG_INFO, " repair binary: program = %s", repair_bin); } log_message(LOG_INFO, " error retry time-out = %d seconds", retry_timeout); if (repair_max > 0) { log_message(LOG_INFO, " repair attempts = %d", repair_max); } else { log_message(LOG_INFO, " repair attempts = unlimited"); } log_message(LOG_INFO, " alive=%s heartbeat=%s to=%s no_act=%s force=%s", (devname == NULL) ? "[none]" : devname, (heartbeat == NULL) ? "[none]" : heartbeat, (admin == NULL) ? "[none]" : admin, (no_act == TRUE) ? "yes" : "no", (force == TRUE) ? "yes" : "no"); } static void check_parameters(void) { int err = 0; if (tint >= dev_timeout - 1) { log_message(LOG_ERR, "This interval length (%d) might reboot the system while the process sleeps! Try %d or less", tint, dev_timeout - 1); err = 1; } if (maxload1 > 0 && maxload1 < MINLOAD) { log_message(LOG_ERR, "Using this maximal load average (%d) might reboot the system too often!", maxload1); err = 1; } if (err) { fatal_error(EX_USAGE, "To force parameter(s) use the --force command line option."); } } int main(int argc, char *const argv[]) { int c, foreground = FALSE, force = FALSE, sync_it = FALSE; char *configfile = CONFIG_FILENAME; struct list *act; char *progname; char *opts = "d:i:n:Ffsvbql:p:t:c:r:m:a:X:"; 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'}, {"loop-exit", required_argument, NULL, 'X'}, {NULL, 0, NULL, 0} }; long count = 0L; long count_max = 0L; unsigned long swait, twait; progname = basename(argv[0]); open_logging(progname, MSG_TO_STDERR | MSG_TO_SYSLOG); /* check the options */ /* there aren't that many any more */ while ((c = getopt_long(argc, argv, opts, long_options, NULL)) != EOF) { switch (c) { case 'n': case 'p': case 'a': case 'r': case 'd': case 't': case 'l': case 'm': case 'i': old_option(c, configfile); usage(progname); 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; case 'v': verbose++; break; case 'X': count_max = atol(optarg); log_message(LOG_WARNING, "NOTE: Using --loop-exit so daemon will exit after %ld time intervals", count_max); break; default: usage(progname); } } read_config(configfile); if (softboot) { /* Result of zeroing time-out is immediate action to shut down on errors, rather like old softboot behaviour. */ retry_timeout = 0; } if (!force) { check_parameters(); } /* make sure we get our own log directory */ if (mkdir(logdir, 0750) && errno != EEXIST) { fatal_error(EX_SYSERR, "Cannot create directory %s (%s)", logdir, strerror(errno)); } /* set up pinging if in ping mode */ if (target_list != NULL) { open_netcheck(target_list); } if (!foreground) { /* * Allocate some memory to store a filename, this is needed later on even * if the system runs out of memory */ set_reopen_dir(logdir); if (wd_daemon(0, 0)) { fatal_error(EX_SYSERR, "failed to daemonize (%s)", strerror(errno)); } open_logging(NULL, MSG_TO_SYSLOG); /* Close terminal output, keep syslog open. */ } /* tuck my process id away */ if (!force && write_pid_file(PIDFILE)) { fatal_error(EX_USAGE, "unable to gain lock via PID file"); } /* Log the starting message */ log_message(LOG_NOTICE, "starting daemon (%d.%d):", MAJOR_VERSION, MINOR_VERSION); print_info(sync_it, force); /* open the device */ if (no_act == FALSE) { open_watchdog(devname, dev_timeout); } open_tempcheck(temp_list); open_heartbeat(); open_loadcheck(); open_memcheck(); /* 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); lock_our_memory(realtime, schedprio, daemon_pid); /* Short wait (50ms OK?) in case test binaries return quickly, then * remaining 'twait' should make watchdog sleep 'tint' seconds total. */ swait = 50000; twait = (tint * 1000000) - swait; /* main loop: update after seconds */ while (_running) { wd_action(keep_alive(), repair_bin, NULL); /* sync system if we have to */ do_check(sync_system(sync_it), repair_bin, NULL); /* check file table */ do_check(check_file_table(), repair_bin, NULL); /* check load average */ do_check(check_load(), repair_bin, loadtimer); /* check free memory */ do_check(check_memory(), repair_bin, memtimer); /* check allocatable memory */ do_check(check_allocatable(), repair_bin, alloctimer); /* check temperature */ for (act = temp_list; act != NULL; act = act->next) do_check(check_temp(act), repair_bin, act); /* in filemode stat file */ for (act = file_list; act != NULL; act = act->next) do_check(check_file_stat_safe(act), repair_bin, act); /* in pidmode use "kill -0" to ping processes ID */ for (act = pidfile_list; act != NULL; act = act->next) do_check(check_pidfile(act), repair_bin, act); /* in network mode check the given devices for input */ for (act = iface_list; act != NULL; act = act->next) do_check(check_iface(act), repair_bin, act); /* in ping mode ping the ip address */ for (act = target_list; 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), repair_bin, act); /* test, or test/repair binaries in the watchdog.d directory */ for (act = tr_bin_list; act != NULL; act = act->next) do_check(check_bin(act->name, test_timeout, act->version), repair_bin, act); /* in case test binaries return quickly */ xusleep(swait); check_bin(NULL, test_timeout, 0); /* finally sleep for a full cycle */ /* we have just triggered the device with the last check */ xusleep(twait); count++; /* do verbose logging */ if (verbose && logtick && (--ticker == 0)) { ticker = logtick; log_message(LOG_DEBUG, "still alive after %ld interval(s)", count); } if (count_max > 0 && count >= count_max) { log_message(LOG_WARNING, "loop exit on interval counter reached"); _running = 0; } } /* The terminate() function closes all lists. */ terminate(EXIT_SUCCESS); /* not reached */ return (EXIT_SUCCESS); } watchdog-5.16/src/lock_mem.c0000644000175000017500000000567213650524716015577 0ustar michaelmichael/* > lock_mem.c * * Common taken from watchdog.c & wd_keepalive.c that locks the process memory, and * from shutdown.c etc that unlocks it again for a tidy exit. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include /* For OOM_SCORE_ADJ_MIN and OOM_DISABLE */ #include #include #include "extern.h" #if defined(_POSIX_MEMLOCK) static int mlocked = FALSE; #endif /* _POSIX_MEMLOCK */ /* * Function to lock the process and attempt to disable the Out-Of-Memory killer * that Linux uses so the daemon is not kicked out unexpectedly. Calling arguments * are: * do_lock : Set to TRUE if you want to process locked. * priority: Set to the real-time priority level you want. * pid: This should be the current process' PID. Either from a call * to getpid() just for this, or the value already found. */ void lock_our_memory(int do_lock, int priority, pid_t pid) { int oom_adjusted = 0; #if defined( OOM_SCORE_ADJ_MIN) || defined( OOM_DISABLE ) FILE *fp = NULL; struct stat s; char buf[256]; #endif #if defined(_POSIX_MEMLOCK) if (do_lock == TRUE) { unlock_our_memory(); /* lock all actual and future pages into memory */ if (mlockall(MCL_CURRENT | MCL_FUTURE) != 0) { log_message(LOG_ERR, "cannot lock realtime memory (errno = %d = '%s')", errno, strerror(errno)); } else { struct sched_param sp; memset(&sp, 0, sizeof(sp)); /* now set the scheduler */ sp.sched_priority = priority; if (sched_setscheduler(0, SCHED_RR, &sp) != 0) { log_message(LOG_ERR, "cannot set scheduler (errno = %d = '%s')", errno, strerror(errno)); } else mlocked = TRUE; } } #endif /* _POSIX_MEMLOCK */ /* tell oom killer to not kill this process */ if (pid > 0) { #ifdef OOM_SCORE_ADJ_MIN snprintf(buf, sizeof(buf), "/proc/%d/oom_score_adj", (int)pid); if (!oom_adjusted) { /* Or do both ? */ if (!stat(buf, &s)) { fp = fopen(buf, "w"); if (fp) { fprintf(fp, "%d\n", OOM_SCORE_ADJ_MIN); fclose(fp); oom_adjusted = 1; } } } #endif /* OOM_SCORE_ADJ_MIN */ #ifdef OOM_DISABLE snprintf(buf, sizeof(buf), "/proc/%d/oom_adj", (int)pid); if (!oom_adjusted) { /* Or do both ? */ if (!stat(buf, &s)) { fp = fopen(buf, "w"); if (fp) { fprintf(fp, "%d\n", OOM_DISABLE); fclose(fp); oom_adjusted = 1; } } } #endif /* OOM_DISABLE */ if (!oom_adjusted) { log_message(LOG_WARNING, "unable to disable oom handling!"); } } } /* * Release the lock on our memory (if used). */ void unlock_our_memory(void) { #if defined(_POSIX_MEMLOCK) if (mlocked == TRUE) { /* unlock all locked pages */ if (munlockall() != 0) { log_message(LOG_ERR, "cannot unlock realtime memory (errno = %d = '%s')", errno, strerror(errno)); } mlocked = FALSE; } #endif /* _POSIX_MEMLOCK */ } watchdog-5.16/src/errorcodes.c0000644000175000017500000000224413650524716016150 0ustar michaelmichael/* > errorcodes.c * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "watch_err.h" #include "extern.h" /* * Extend the operation of the system's strerror() error-to-text mapping function to * include errors that are specific to the watchdog code. */ const char *wd_strerror(int err) { char *str = ""; switch (err) { case ENOERR: str = "no error"; break; case EREBOOT: str = "unconditional reboot requested"; break; case ERESET: str = "unconditional hard reset requested"; break; case EMAXLOAD: str = "load average too high"; break; case ETOOHOT: str = "too hot"; break; case ENOLOAD: str = "loadavg contains no data"; break; case ENOCHANGE: str = "file was not changed in the given interval"; break; case EINVMEM: str = "meminfo contains invalid data"; break; case ECHKILL: str = "child process was killed by signal"; break; case ETOOLONG: str = "child process did not return in time"; break; case EUSERVALUE: str = "user-reserved code"; break; case EDONTKNOW: str = "unknown (neither good nor bad)"; break; default: str = strerror(err); break; } return str; } watchdog-5.16/src/net.c0000644000175000017500000002162113650524716014567 0ustar michaelmichael/* > net.c * * Code for checking network access. The open_netcheck() function is from set-up * code originally in watchdog.c * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include /* for gethostname() etc */ #include /* for getprotobyname() */ #include /* for MAXHOSTNAMELEN */ #include #include #include #include /* for ldiv() */ #ifndef FD_CLOEXEC #define FD_CLOEXEC 1 #endif /*FD_CLOEXEC*/ #define PKBUF_SIZE (DATALEN + MAXIPLEN + MAXICMPLEN) #include "extern.h" #include "watch_err.h" #include "gettime.h" /* * 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(*(unsigned 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); } /* * Send out a ping packet of sequence count 'i' and ID from 'daemon_pid' value. * * Return value is the same as 'ecode' and non-zero on error case. */ static int send_ping(char *target, int sock_fp, struct sockaddr to, int i, int *ecode) { unsigned char outpack[MAXPACKET]; memset(outpack, 0, sizeof(outpack)); struct icmphdr *icp = (struct icmphdr *)outpack; int err = ENOERR; /* setup a ping message */ icp->type = ICMP_ECHO; icp->code = icp->checksum = 0; icp->un.echo.sequence = htons(i + 1); icp->un.echo.id = htons(daemon_pid); /* ID */ /* compute ICMP checksum here */ icp->checksum = in_cksum((unsigned short *)icp, DATALEN + 8); /* and send it out */ if (sendto(sock_fp, (char *)outpack, DATALEN + 8, 0, &to, sizeof(struct sockaddr)) < 0) { err = errno; /* if our kernel tells us the network is unreachable we are done */ if (err == ENETUNREACH) { log_message(LOG_ERR, "network is unreachable (target: %s)", target); } else { log_message(LOG_ERR, "sendto gave error for target %s = %d = '%s'", target, err, strerror(err)); } } *ecode = err; return err; } /* * Look for a ping reply. We check it is our ping by comparing the ID and sequence * count to see if they match. * * Return value is non-zero on something significant: either an error or finding * one of our ping's response. The 'ecode' value shows which it was (0 if good). * */ static int found_ping(unsigned char *packet, int sock_fp, struct sockaddr to, int i, int *ecode, fd_set *fdmask, struct timespec *dtimeout) { struct sockaddr_in *to_in = (struct sockaddr_in *)&to; struct sockaddr_in from; socklen_t fromlen; if (pselect(sock_fp + 1, fdmask, NULL, NULL, dtimeout, NULL) >= 1) { /* read reply */ fromlen = sizeof(from); if (recvfrom(sock_fp, packet, PKBUF_SIZE, 0, (struct sockaddr *)&from, &fromlen) < 0) { int err = errno; if (err != EINTR) { log_message(LOG_ERR, "recvfrom gave errno = %d = '%s'", err, strerror(err)); *ecode = err; return 1; } } else { /* check if packet is our ECHO */ struct icmphdr *icp = (struct icmphdr *)(packet + (((struct ip *)packet)->ip_hl << 2)); if (icp->type == ICMP_ECHOREPLY) { int rcv_id = ntohs(icp->un.echo.id); int rcv_seq = ntohs(icp->un.echo.sequence); /* Have ping reply, but is it the one we just sent? */ if (rcv_id == daemon_pid && rcv_seq == (i + 1) && from.sin_addr.s_addr == to_in->sin_addr.s_addr) { *ecode = ENOERR; return 1; } } } } return 0; } /* * Check network / machine is accessible via 'ping' packet. */ int check_net(char *target, int sock_fp, struct sockaddr to, unsigned char *packet, int time, int count) { int i; int err = 0; struct timespec tmax; ldiv_t d; if (target == NULL) return (ENOERR); if (count < 1) return (EINVAL); /* set the timeout value */ d = ldiv(time, count); tmax.tv_sec = d.quot; /* Compute nanoseconds, including the above remainder. */ tmax.tv_nsec = (d.rem * NSEC) / count; /* try "ping-count" times */ for (i = 0; i < count; i++) { fd_set fdmask; struct timespec tstart, timeout, dtimeout; if (send_ping(target, sock_fp, to, i, &err)) { return err; } clock_gettime(CLOCK_MONOTONIC, &tstart); /* set the timeout value */ timespecadd(&tstart, &tmax, &timeout); /* wait for reply */ FD_ZERO(&fdmask); FD_SET(sock_fp, &fdmask); while (1) { clock_gettime(CLOCK_MONOTONIC, &dtimeout); timespecsub(&timeout, &dtimeout, &dtimeout); /* Check if we have timed out waiting for a reply. */ if ((long)dtimeout.tv_sec < 0) break; if (found_ping(packet, sock_fp, to, i, &err, &fdmask, &dtimeout)) { /* If successful and verbose, report this. */ if (err == 0 && verbose && logtick && ticker == 1) { /* Report time since tstart in milliseconds (like 'ping' program). */ double msec; clock_gettime(CLOCK_MONOTONIC, &dtimeout); timespecsub(&dtimeout, &tstart, &dtimeout); msec = 1.0e3 * (dtimeout.tv_sec + 1.0e-9 * dtimeout.tv_nsec); log_message(LOG_DEBUG, "got answer on ping=%d from target %-15s time=%.3fms", i+1, target, msec); } return err; } } } log_message(LOG_ERR, "no response from ping (target: %s)", target); return (ENETUNREACH); } /* * Close socket and free the packet buffer. As we zero this memory when originally * allocating it, a non-NULL packet buffer is an indicator it was opened. */ static int close_net(struct pingmode *net) { int err = ENOERR; if (net->packet != NULL) { free(net->packet); net->packet = NULL; if (close(net->sock_fp) < 0) { err = errno; log_message(LOG_ERR, "error closing socket (err = %d = '%s')", err, strerror(err)); } net->sock_fp = -1; } return err; } /* * Set up pinging if in ping mode */ int open_netcheck(struct list *tlist) { struct list *act; int hold; struct icmp_filter filt; memset(&filt, 0, sizeof(filt)); filt.data = ~(1<next) { struct pingmode *net = &act->parameter.net; /* 'net' is alias of act->parameter.net */ struct sockaddr_in *to_in; close_net(net); /* setup the socket */ memset(&(net->to), 0, sizeof(struct sockaddr)); /* * This pointer is an alias to same memory, an ugly but common * method, for example http://www.retran.com/beej/sockaddr_inman.html * Also we don't (yet) support IPv6 which needs a bigger structure * anyway (e.g. the 'struct sockaddr_storage' type for all) and other * changes around here. */ to_in = (struct sockaddr_in *)&(net->to); to_in->sin_family = AF_INET; to_in->sin_addr.s_addr = inet_addr(act->name); if (to_in->sin_addr.s_addr == INADDR_NONE) { fatal_error(EX_USAGE, "unknown host %s", act->name); } net->packet = (unsigned char *)xcalloc(PKBUF_SIZE, sizeof(char)); if ((net->sock_fp = socket(AF_INET, SOCK_RAW, proto->p_proto)) < 0 || fcntl(net->sock_fp, F_SETFD, FD_CLOEXEC)) { fatal_error(EX_SYSERR, "error opening socket (%s)", strerror(errno)); } /* set filter for only ECOREPLY packet (configured in the filt.dat value above) */ if (setsockopt(net->sock_fp, SOL_RAW, ICMP_FILTER, (char*)&filt, sizeof(filt)) < 0) { int err = errno; log_message(LOG_ERR, "set ICMP filter error for target %s err = %d = '%s'", act->name, err, strerror(err)); } /* this is necessary for broadcast pings to work */ hold = 0; /* value should not matter, but zero to be safe. */ if (setsockopt(net->sock_fp, SOL_SOCKET, SO_BROADCAST, (char *)&hold, sizeof(hold)) < 0) { int err = errno; log_message(LOG_ERR, "set broadcast error for target %s err = %d = '%s'", act->name, err, strerror(err)); } hold = 48 * 1024; if (setsockopt(net->sock_fp, SOL_SOCKET, SO_RCVBUF, (char *)&hold, sizeof(hold)) < 0) { int err = errno; log_message(LOG_ERR, "set revbuf error for target %s err = %d = '%s'", act->name, err, strerror(err)); } } } return 0; } /* * Shut sockets and free memory as allocated by open_netcheck(). */ int close_netcheck(struct list *tlist) { int err = 0; struct list *act; if (tlist != NULL) { for (act = tlist; act != NULL; act = act->next) { err |= close_net(&act->parameter.net); } } return err; } watchdog-5.16/src/run-as-child.c0000644000175000017500000001444613650524716016276 0ustar michaelmichael/* > run-as-child.c * * Run a C-function as a child process, and provides a C function to execute a * pathname/argv[] list in the same manner. * * (c) 2013 Paul S. Crawford (psc@sat.dundee.ac.uk) licensed under GPL v2 * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include "watch_err.h" #include "extern.h" #define WAIT_MS(x) ((x)*1000) const unsigned long wait_val[] = { WAIT_MS(1), WAIT_MS(2), /* 3ms total from 1+2 */ WAIT_MS(3), /* 6ms total from 1+2+3 */ WAIT_MS(4), /* 10ms */ WAIT_MS(20), /* 30ms */ WAIT_MS(30), /* 60ms */ WAIT_MS(40), /* 100ms */ WAIT_MS(200), /* 300ms */ WAIT_MS(300), /* 600ms */ WAIT_MS(400) /* 1000ms = 1 second */ }; const int num_wait = ARRAY_SIZE(wait_val); /* * Code to (optionally) sync the file system, then execv() the supplied process. * * This is intended for use with run_func_as_child() below, with typical * usage is something like: * * char *harg[] = { * "/sbin/hwclock", // The full path. * "hwclock", // The argv[0] the program expects. * "-w", // The 1st command line argument argv[1] (and others, as required) * NULL // Don't forget the NULL terminator! * }; * * run_func_as_child(60, exec_as_func, 0, harg); * * This should run "/sbin/hwclock -w" with a time-out of 60 seconds, but not * syncing the file system first. */ int exec_as_func(int flags, void *ptr) { char **arg; char *path; int err = ECHILD; /* Assume no child process until know otherwise. */ struct stat buf; if (ptr == NULL) return err; arg = (char **)ptr; path = arg[0]; if (path == NULL) return err; /* First check the supplied program is executable. */ if (stat(path, &buf) != 0) { err = errno; log_message(LOG_ERR, "can't get status of %s (errno = %d = '%s')", path, err, strerror(err)); } else if ((buf.st_mode & S_IXUSR) == 0) { err = EACCES; /* Treat as 'access denied' */ log_message(LOG_ERR, "program %s is not executable", path); } else { /* If desired, sync file system first. */ if (flags & FLAG_CHILD_SYNC) { if (verbose) { log_message(LOG_DEBUG, "syncing file system..."); } sync(); } /* We can also use the flags to re-direct stdout/stderr for "test" and "repair" */ reopen_std_files(flags); if (verbose) { /* Create single string with all command line options. */ int ii = 1; char *opt = strdup(":"); while (opt != NULL && arg[ii] != NULL) { opt = realloc(opt, strlen(opt) + strlen(arg[ii]) + 2); opt = strcat(opt, " "); opt = strcat(opt, arg[ii]); ii++; } if (opt) { log_message(LOG_DEBUG, "running %s%s", path, opt); free(opt); } } /* * Finally run the child process. The execv() call will not return if * successful, otherwise we return the failure code. */ execv(path, arg + 1); err = errno; } return err; } /* * Function to run a supplied function as a child process and passing the two arguments to it. * Intended for doing stuff that might fail or block so we can recover in some way and not have * the hardware watchdog reset unexpectedly. * * Calling arguments are: * timeout = Time to wait until sending SIGTERM then SIGSTOP to child. * funcptr = Function to be run by the child process. * code = Integer 1st argument to funcptr() * ptr = General pointer as 2nd argument to funcptr() * * Return value indicates the success, or otherwise, of running the child. Return value of zero * requires the child to run funcptr() successfully AND for funcptr() to return 0 for success. * * NOTE: The waitpid() function will not work as expected (gives error of child not present on * termination) if the SIGCHLD signal is set to SIG_IGN. */ int run_func_as_child(int timeout, int (*funcptr) (int, void *), int code, void *ptr) { pid_t child_pid; int err; if (funcptr == NULL) { return ECHILD; /* No child process! */ } if (--timeout < 0) { timeout = 0; /* Correct for the short delays, and stop -ve errors. */ } child_pid = fork(); if (child_pid < 0) { /* If fork() failed, things are bad so reboot now. */ err = errno; log_message(LOG_ERR, "process fork failed with error = %d = '%s'", err, strerror(err)); return EREBOOT; } else if (child_pid == 0) { /* We are the 'child' so run passed generic function. */ err = (*funcptr) (code, ptr); exit(err); } else { /* We are the parent, so wait for child to stop. */ int ret, ii; int result = 0; if (verbose > 1) { log_message(LOG_DEBUG, "waiting on PID=%d...", child_pid); } for (ii = 0; ii < timeout + num_wait; ii++) { /* Keep waiting while watchdog kept alive. */ keep_alive(); if (ii < num_wait) { xusleep(wait_val[ii]); /* sequence of short delays for < 1s. */ } else { xusleep(1000000); /* then 1.0s waits for "timeout" total seconds. */ } ret = waitpid(child_pid, &result, WNOHANG); err = errno; if (ret < 0) { /* Error case. */ log_message(LOG_ERR, "failed to get child status (PID=%d, error = %d = '%s')", child_pid, err, strerror(err)); return err; } if (ret > 0) { /* Something has changed, see if it is termination of process. */ if (WIFEXITED(result)) { int ecode = WEXITSTATUS(result); if (verbose > 1) { log_message(LOG_DEBUG, "child PID=%d has exited with value %d (count=%d)", child_pid, ecode, ii); } return ecode; } else if (WIFSIGNALED(result)) { log_message(LOG_WARNING, "child PID=%d was terminated by signal %d", child_pid, WTERMSIG(result)); return ECHKILL; } } } /* * Completed for() waiting loop without the process exiting so try to kill it, and report this * as a time-out rather than as "child process killed" (which implies an external signal did it). */ kill_process_tree(child_pid, SIGTERM); safe_sleep(2); ret = waitpid(child_pid, &result, WNOHANG); if (ret == 0 || (ret > 0 && !(WIFEXITED(result) || WIFSIGNALED(result)))) { /* Seems that SIGTERM did not work, try non-ignorable signal. */ kill_process_tree(child_pid, SIGKILL); /* Get the result to stop appearance of this as a zombie process. */ xusleep(1000); waitpid(child_pid, &result, WNOHANG); } log_message(LOG_ERR, "child timed out (PID=%d)", child_pid); } return ETOOLONG; } watchdog-5.16/src/read-conf.c0000644000175000017500000002044413650524716015641 0ustar michaelmichael/* > read-conf.c * * Functions to help with line-by-line reading of a text file, for example, by fgets() * * Typically what we have is a line like " something = somevalue\n" and we want firstly * to separate/split this in to "something" and "somevalue" as two clean strings, then * we parse them by looking for a match for "something" and then to read/convert the * "somevalue" string accordingly. * * (c) 2013 Paul S. Crawford (psc@sat.dundee.ac.uk) released under GPL v2 licence. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include /* for isdigit() */ #define USE_MMAP 1 /* Set to 1 to memory-map the lists so forked process share variables. */ #if USE_MMAP #include #endif /*USE_MMAP*/ #include "extern.h" #include "read-conf.h" /* * Return 1 if a character is "white space", so space, tab, CR, LF, etc. * Return 0 for anything else. */ static int is_white(char c) { switch (c) { case ' ': case '\t': case '\r': case '\n': case '\b': return 1; } return 0; } /* * Return 1 if looks like part of a number (e.g. "+-012...9") */ static int is_number(char c) { if(isdigit(c) || c == '-' || c == '+') return 1; return 0; } /* * Remove trailing "white space" characters from a string. */ void trim_white(char *buf) { int ii; if (buf == NULL) return; for (ii = strlen(buf) - 1; ii >= 0; ii--) { if (is_white(buf[ii])) { buf[ii] = 0; /* Replace white space with 'nul'. */ } else { break; } } } /* * Return pointer to first non-white space character, or to * the 'nul' end-of-string position. */ char *str_start(char *p) { if (p != NULL) { while (*p && is_white(*p)) p++; } return p; } /* * Function to read an integer from "arg=val" string as split above. This has * the basic check that the 'val' looks as if it is a number, otherwise it will * not change the supplied variable. * * Calling arguments are: * * arg : String of what variable has been found. * val : String of the corresponding value. * name : The searched-for case for 'arg' (if matched, then parse). * found : Counter for found values (incremented by one if match found). * imin : Lower limit of numeric range (if imin!=imax). * imax : Upper limit of numeric range (if imin!=imax). * iv : Pointer to an integer that is set on suitable match. * * The return value is 0 if arg=name */ int read_int_func(char *arg, char *val, const char *name, int *found, int imin, int imax, int *iv) { int rv = -1; /* Assume wrong/error case. */ if (strcmp(arg, name) == 0) { rv = 0; if (val != NULL && is_number(*val)) { int ii = atoi(val); if (imax > imin) { /* have limits, check and enforce them. */ if (ii > imax) { log_message(LOG_WARNING, "Warning: number for '%s' too big (%d > imax=%d)", arg, ii, imax); ii = imax; } else if (ii < imin) { log_message(LOG_WARNING, "Warning: number for '%s' too small (%d < imin=%d)", arg, ii, imin); ii = imin; } } *iv = ii; if (verbose) log_message(LOG_DEBUG, "Integer '%s' found = %d", arg, *iv); } else { log_message(LOG_WARNING, "Warning: number expected for '%s'", arg); } } if (rv == 0) *found += 1; return rv; } /* * Similar to read_int_func() above, here we search for a string. However, in this * case we may allow a blank case to set the string to NULL. So we use it like: * * char str = "before"; * * read_string_func(arg, val, "looking", Read_allow_blank, &str); * * If we had split "looking = after" then str would contain "after", however, if * we had split "looking = " then val is NULL or "", hence str would be NULL. * * NOTE: This function duplicates 'val' on success so remember to free it later, also * check what it was before the call as this is not freeing any pointer, just assigning * a new block of memory (as example has 'str' set to static memory, not from a call * to malloc() or similar). */ int read_string_func(char *arg, char *val, const char *name, int *found, string_read_e mode, char **str) { int rv = -1; if (strcmp(arg, name) == 0) { rv = 0; if (val != NULL && *val) { *str = xstrdup(val); if (verbose) log_message(LOG_DEBUG, "String '%s' found as '%s'", arg, val); } else { /* no string in file, what are we supposed to do? */ switch (mode) { case Read_allow_blank: *str = NULL; if (verbose) log_message(LOG_DEBUG, "String '%s' found as blank (NULL)", arg); break; case Read_string_only: log_message(LOG_WARNING, "Warning: blank string not allowed for '%s = %s'", arg, *str); break; default: fatal_error(EX_SOFTWARE, "Invalid mode for read_string_func() (mode=%d)", mode); break; } } } if (rv == 0) *found += 1; return rv; } /* * Function to read an integer based on matching an enumerated list. This is used for cases * such as yes/no or multiple-valued examples. The table list[] can be created using the macros * in read-conf.h */ int read_enumerated_func(char *arg, char *val, const char *name, int *found, const read_list_t list[], int *iv) { int rv = -1; if (strcmp(arg, name) == 0) { rv = 0; if (val != NULL && *val) { int ii = 0; /* We have some string, search the list[] table and if matched (case independent) use the list[] value. */ while(list[ii].name != NULL) { if(strcasecmp(val, list[ii].name) == 0) { *iv = list[ii].value; if (verbose) log_message(LOG_DEBUG, "Variable '%s' found as '%s' = %d", arg, val, *iv); *found += 1; return 0; } ii++; } /* We did not match & return, so log this. */ if (verbose) log_message(LOG_DEBUG, "Variable '%s' not matched for '%s'", arg, val); } else { if (verbose) log_message(LOG_DEBUG, "Variable '%s' found as blank", arg); } } if (rv == 0) *found += 1; return rv; } /* * Similar to the read_string_func() of read-conf.c, this function reads a string and * adds it to the linked-list. */ int read_list_func(char *arg, char *val, const char *name, int *found, int version, struct list **list) { int rv = -1; if (strcmp(arg, name) == 0) { rv = 0; if (val != NULL && *val) { add_list(list, val, version); if (verbose) log_message(LOG_DEBUG, "List '%s' added as '%s'", arg, val); } else { log_message(LOG_WARNING, "Warning: string expected for '%s'", arg); } } if (rv == 0) *found += 1; return rv; } /* * Add a new configuration list entry. Calling arguments are: * * list : Address of a pointer to be updated. Should be pointing to NULL to start * with, for example: * * struct list *list = NULL; * add_list(&list, name, version); * * name : Name of the object, this is duplicated so 'name' can change afterwards. * version : Version number for test & repair binary. * */ void add_list(struct list **list, const char *name, int version) { struct list *new, *act; if (list == NULL || name == NULL) return; #if USE_MMAP /* Use of mapped memory allows child (fork) to share changes with parent. */ new = (struct list *)mmap(NULL, sizeof(struct list), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); if(new == NULL) { int err = errno; log_message(LOG_ERR, "mmap() failed (%d = %s)", err, strerror(err)); return; } /* Zero memory just in case. */ memset(new, 0, sizeof(struct list)); #else /* Use xcalloc() to allocate and *zero* a block of memory. */ new = (struct list *)xcalloc(1, sizeof(struct list)); #endif /*USE_MMAP*/ /* Make a copy of 'name' in case it changes elsewhere. */ new->name = xstrdup(name); new->version = version; if (*list == NULL) { *list = new; } else { for (act = *list; act->next != NULL; act = act->next) { } /* The for() loop will seek to end of list, add new link to there. */ act->next = new; } } /* * Free a list created by add_list() (or read_list_func() that in turn uses it). */ void free_list(struct list **list) { struct list *new, *act; if (list != NULL) { act = (*list); while(act != NULL) { new = act->next; if (act->name != NULL) { free(act->name); } #if USE_MMAP /* If we mapped it, we should un-map it for exit. */ if(munmap(act, sizeof(struct list)) < 0) { int err = errno; log_message(LOG_ERR, "munmap() failed (%d = %s)", err, strerror(err)); } #else free(act); #endif /*USE_MMAP*/ act = new; } *list = NULL; /* Mark as done. */ } } watchdog-5.16/src/killall5.c0000644000175000017500000003337213650524716015520 0ustar michaelmichael/* > kill_all.c * * Parts of the following two functions are taken from Miquel van * Smoorenburg's killall5 program. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #define _XOPEN_SOURCE 500 /* for getsid(2) */ #include #include #include #include #include #include #include #include #include #include #include #include "xmalloc.h" #include "logmessage.h" #include "extern.h" static int read_proc_line(pid_t pid, const char *opt, size_t bsize, char *buf); #define MORTAL_GID (110) /* A value of GID typically above rsyslog's GID. */ #define DEBUG_DUMP 1 /* Set to 1 for verbose mode dumping of process lists. */ #if DEBUG_DUMP #include #include "read-conf.h" /* For trim_white() */ static FILE *dmp_fp = NULL; /* * Open the file for dumping all of the running process information * that readproc() gathers. */ static void open_dmp(int sig, int aflag) { char fname[1024]; static int done = 0; if (verbose || log_killed_PIDs) { snprintf(fname, sizeof(fname), "%s/killall5.log", logdir); if (done == FALSE) { done = TRUE; dmp_fp = fopen(fname, "w"); /* First time open and truncate file */ } else { dmp_fp = fopen(fname, "a+"); /* Then append for writing. */ } if (dmp_fp != NULL) { log_message(LOG_DEBUG, "Opened dump file %s", fname); time_t tnow = time(NULL); fprintf(dmp_fp, "sig = %d aflag = %d on %s", sig, aflag, ctime(&tnow)); } else { log_message(LOG_ERR, "Failed opening dump file %s (%s)", fname, strerror(errno)); } } } static void write_dmp(pid_t pid, char *buf) { if (dmp_fp != NULL) { char cmd[1024]; read_proc_line(pid, "cmdline", sizeof(cmd), cmd); trim_white(cmd); trim_white(buf); fprintf(dmp_fp, "%s\n%s\n\n", cmd, buf); } } static void close_dmp(void) { if (dmp_fp != NULL) { time_t tnow = time(NULL); fprintf(dmp_fp, "Done at %s", ctime(&tnow)); if (fclose(dmp_fp) < 0) { log_message(LOG_ERR, "Error closing dump file (%s)", strerror(errno)); } else { log_message(LOG_DEBUG, "Closed dump file"); /* * Sync file system so record is safe. * OK, this changes the shutdown behaviour/timing * a bit compared to non-verbose operations, but if * the timer kicks in before any other sync() is run * you simply have no record at all! */ sync(); } dmp_fp = NULL; } } #endif /*DEBUG_DUMP*/ /* Info about a process. */ typedef struct _proc_ { pid_t pid; /* Process ID. */ int sid; /* Session ID. */ pid_t ppid; /* Parent's PID. */ struct _proc_ *next; /* Pointer to next struct. */ } PROC; static PROC *plist = NULL; /* Free (global here) process list when allocated. */ static void free_plist(void) { PROC *p, *n; n = plist; for (p = plist; n != NULL; p = n) { n = p->next; free(p); } plist = NULL; } #ifndef BUFFER_SIZE #define BUFFER_SIZE (256+1) /* read BUFFER_SIZE-1 so make it multiple of machine word size. */ #endif /* * Read the text line for a given PID's entry of /proc/$PID/$opt * * This also converts any 'nul' in the string so it can be handled for * debug messages more easily. Calling arguments are: * * pid : Process to open file. * opt : The file-like option /proc/$PID/$opt to read. * bsize : Buffer size to read into (i.e. buf[] below). * buf[] : The buffer to fill. * * Return value is zero if successful read, or -1 otherwise. */ static int read_proc_line(pid_t pid, const char *opt, size_t bsize, char *buf) { int fd; int nread = 0; char fname[BUFFER_SIZE]; int rv = -1; fname[BUFFER_SIZE-1] = 0; buf[0] = 0; snprintf(fname, sizeof(fname)-1, "/proc/%d/%s", (int)pid, opt); fd = open(fname, O_RDONLY); if (fd < 0) { log_message(LOG_ERR, "failed to open %s (%s)", fname, strerror(errno)); } else { nread = read(fd, buf, bsize-1); close(fd); } if (nread > 0 && nread < bsize) { int ii; /* Convert any 'nul' separators (e.g. the command line arguments) * in to spaces for string handling & readability in text file. */ for (ii=0; iipid = pid; /* Safe starting points. */ p->sid = 0; p->ppid = 0; if (read_proc_line(pid, "stat", sizeof(buf), buf) == 0) { char *s = strrchr(buf, ')'); if (s != NULL) { char state=0; int parent=0, pgroup=0, session=0; s++; /* Skip past the ')' character to read the state/ppid/pgrp/session data. */ if (sscanf(s, " %c %d %d %d", &state, &parent, &pgroup, &session) == 4) { p->sid = session; p->ppid = (pid_t)parent; rv = 0; } } } #if DEBUG_DUMP /* Dump only non-kernel entries (i.e. non-zero SID). */ if (p->sid > 0) { write_dmp(pid, buf); } #endif /*DEBUG_DUMP*/ return rv; } /* * Get a list of all processes. * * Return value is the number found, or -1 if error. This may be short * if we run out of memory, so when killing processes try twice. * */ static int readproc(void) { DIR *dir; struct dirent *d; pid_t act_pid; PROC *p; int pcount = 0; const char dname[] = "/proc"; /* Open the /proc directory. */ if ((dir = opendir(dname)) == NULL) { log_message(LOG_ERR, "cannot opendir %s (%s)", dname, strerror(errno)); return (-1); } free_plist(); /* 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 this fails, which is likely if we have an * out-of-memory error, we return gracefully with what we have managed * so hopefully a 2nd call after killing some processes will give us more. */ if ((p = (PROC *) calloc(1, sizeof(PROC))) == NULL) { log_message(LOG_ERR, "readproc: out of memory at %d", pcount); break; } get_ID(act_pid, p); /* Link it into the list. */ p->next = plist; plist = p; pcount++; } /* Done. */ closedir(dir); return pcount; } /* * Check the UID of each process to decide if it should be killed in * the "first round" of shutting down a sick system. In the shutdown * program the test was uid < 100 but that also killed syslog on Ubuntu * so raised that a bit as it may be useful to see what happened afterwards. */ static int is_mortal(pid_t pid) { char path[128]; struct stat statbuf; int rv = -1; snprintf (path, sizeof(path), "/proc/%d", pid); if (stat (path, &statbuf) == 0) { if (statbuf.st_uid < MORTAL_GID) { rv = 0; } } return rv; } /* * Send 'sig' to "all" processes, typically to kill them. * * This sends SIGSTOP to all, then builds a list of processes to then uses * the kill() function to signal to "all" of them, before using SIGCONT to * allow them to resume execution. * * The 'aflag' is used to control how aggressive the signalling is, with aflag=TRUE * then everything other than our PID is signalled, with aflag=FALSE we skip our * own session (e.g. child processes still not exited), and all which are (or at * least appear to be) kernel processes. */ void killall5(int sig, int aflag) { PROC *p; int sid = -1; int pcount, kcount; /* * 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. */ suspend_logging(); kill(-1, SIGSTOP); #if DEBUG_DUMP open_dmp(sig, aflag); #endif /*DEBUG_DUMP*/ kcount = 0; pcount = readproc(); #if DEBUG_DUMP close_dmp(); #endif /*DEBUG_DUMP*/ if (pcount > 0) { /* Find out our own 'sid'. */ for (p = plist; p; p = p->next) { if (p->pid == daemon_pid) { sid = p->sid; break; } } /* Now kill all processes except our own PID and kernel processes (SID=0). * It turns out (at least on upstart-based systems like Ubuntu 12.04) you * need to 'kill' the init process, not because you can succeed, but if you * don't try then various things like syslog get re-spawned and you can't * then cleanly unmount some file systems, etc. */ for (p = plist; p; p = p->next) { if (p->pid != daemon_pid && p->sid != 0) { /* * We either kill everyone else (if aflag != 0) or we also * spare our session, and those that appear privileged processes. */ if (aflag || (p->sid != sid && is_mortal(p->pid))) { kill(p->pid, sig); kcount++; } else { if (verbose > 1) { log_message(LOG_DEBUG, "skipping PID=%d SID=%d", p->pid, p->sid); } } } } } else { /* An error in getting the process list. Could be we are totally out of memory or file * handles so our last resort is to signal everything. According to the man page for * the kill() function: * * POSIX.1-2001 requires that kill(-1,sig) send sig to all processes that the calling * process may send signals to, except possibly for some implementation-defined system * processes. Linux allows a process to signal itself, but on Linux the call kill(-1,sig) * does not signal the calling process. * * Thus we should still be able to shut down cleanly, though we might have lost the ability * to log or send emails, etc. */ kill(-1, sig); } /* And let them continue. */ kill(-1, SIGCONT); free_plist(); resume_logging(); if (verbose > 1) { log_message(LOG_DEBUG, "sent signal %2d to %d of %d processes", sig, kcount, pcount); } } /* * Function to use kill() recursively on a tree of processes. We start with the parent and * then go on to all children of that. For each child, we call ourselves to handle the * grandchild case and so on. To avoid stack overflow we start with the 'depth' counter * at some modest value, and when it gets to zero we go no further down the tree. * * For each process we find, we stop it with SIGSTOP, and if that returns zero (implying it was * still running) we then try any children. Only after doing the children do we signal & resume * the parent. Otherwise, on killing a parent, all the children's PIDs becomes 1 as 'init' takes * them over. * * We can't handle the case where the parent exited before a child, or where a child has used * setsid to become independent. But then just what the hell was that doing as a test/repair * program for the watchdog daemon! BAD DESIGN! * * NOTE: We don't have any lock on processes other than those we just stopped! * * So this may not be a completely safe thing to do, though I think by stopping the parents as we * traverse along the tree they won't clean-up any just-exited children, so those PIDs should not * be re-used (and thus risk being killed by our now out-of-date listing of /proc). * * Also some processes (e.g. bash) treat SIGSTOP as a kill, not just as a temporary hold, so you * can't do the same as killall5() where we are generally stopping the whole machine anyway. * * HOWEVER: If the watchdog is having to kill a test or repair programs, something is going badly * wrong anyway, and the very small chance of killing a new process that is not really our intended * target is probably not _that_ important. * */ static int kill_recursively(pid_t pid, int sig, int depth) { PROC *p; int kcount = 0; if (--depth < 0) { log_message(LOG_WARNING, "recursion limit reached for PID=%d", pid); return 0; } if (kill(pid, SIGSTOP) == 0) { /* This process exists so signal all with it as a parent, then itself (i.e. that parent). */ for (p = plist; p; p = p->next) { if (p->ppid == pid) { /* * Do this to all children's PID where its parent PID matched our PID and, * by the recursive nature of this function, to any grandchildren as well. */ kcount += kill_recursively(p->pid, sig, depth); } } if (verbose) { log_message(LOG_DEBUG, "sending signal %2d to PID %d (depth %d)", sig, pid, depth); } kill(pid, sig); kill(pid, SIGCONT); kcount++; } return kcount; } /* * Function to signal with kill() to a parent process and any child processes of it. * * Used to deal with cases such as a bash script running another program that is the * actual block to timely exiting. * * Return value is the number of processes signalled. */ int kill_process_tree(pid_t pid, int sig) { int pcount=0, kcount=0; const int MAX_DEPTH = 5; /* The limit on recursion. */ /* * Try to stop the parent and, if successful, get the current /proc list * and try to signal any children (and grandchildren, etc). */ if (kill(pid, SIGSTOP) == 0) { pcount = readproc(); if (pcount > 0) { kcount = kill_recursively(pid, sig, MAX_DEPTH); } else { /* Something has gone very wrong with readproc() */ kill(pid, sig); kill(pid, SIGCONT); } } free_plist(); if (verbose > 1) { log_message(LOG_DEBUG, "sent signal %2d to %d of %d processes", sig, kcount, pcount); } return kcount; } watchdog-5.16/src/Makefile.am0000644000175000017500000000144713650524716015675 0ustar michaelmichaelsbin_PROGRAMS = watchdog wd_keepalive wd_identify watchdog_SOURCES = file_stat.c file_table.c iface.c gettime.c keep_alive.c \ load.c memory.c net.c \ pidfile.c shutdown.c \ temp.c test_binary.c watchdog.c \ logmessage.c xmalloc.c heartbeat.c lock_mem.c daemon-pid.c configfile.c \ errorcodes.c read-conf.c sigterm.c reopenstd.c killall5.c send-email.c \ run-as-child.c # for glibc before 2.17 due to clock_gettime() watchdog_LDADD = -lrt wd_keepalive_SOURCES = wd_keepalive.c logmessage.c lock_mem.c daemon-pid.c xmalloc.c \ configfile.c keep_alive.c read-conf.c sigterm.c wd_keepalive_LDADD = -lrt wd_identify_SOURCES = wd_identify.c logmessage.c xmalloc.c configfile.c read-conf.c wd_identify_LDADD = -lrt AM_CPPFLAGS = -I@top_srcdir@/include distclean-depend: rm -rf .deps watchdog-5.16/src/sigterm.c0000644000175000017500000000040313650524716015446 0ustar michaelmichael/* > sigterm.c * * Used to tell the main() code to exit gracefully. Needed by both * the watchdog and wd_keepalive daemons. */ #include #include "extern.h" volatile sig_atomic_t _running = 1; void sigterm_handler(int arg) { _running = 0; } watchdog-5.16/src/Makefile.in0000644000175000017500000006055313650524721015705 0ustar michaelmichael# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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) \ iface.$(OBJEXT) gettime.$(OBJEXT) keep_alive.$(OBJEXT) \ load.$(OBJEXT) memory.$(OBJEXT) net.$(OBJEXT) \ pidfile.$(OBJEXT) shutdown.$(OBJEXT) temp.$(OBJEXT) \ test_binary.$(OBJEXT) watchdog.$(OBJEXT) logmessage.$(OBJEXT) \ xmalloc.$(OBJEXT) heartbeat.$(OBJEXT) lock_mem.$(OBJEXT) \ daemon-pid.$(OBJEXT) configfile.$(OBJEXT) errorcodes.$(OBJEXT) \ read-conf.$(OBJEXT) sigterm.$(OBJEXT) reopenstd.$(OBJEXT) \ killall5.$(OBJEXT) send-email.$(OBJEXT) run-as-child.$(OBJEXT) watchdog_OBJECTS = $(am_watchdog_OBJECTS) watchdog_DEPENDENCIES = am_wd_identify_OBJECTS = wd_identify.$(OBJEXT) logmessage.$(OBJEXT) \ xmalloc.$(OBJEXT) configfile.$(OBJEXT) read-conf.$(OBJEXT) wd_identify_OBJECTS = $(am_wd_identify_OBJECTS) wd_identify_DEPENDENCIES = am_wd_keepalive_OBJECTS = wd_keepalive.$(OBJEXT) logmessage.$(OBJEXT) \ lock_mem.$(OBJEXT) daemon-pid.$(OBJEXT) xmalloc.$(OBJEXT) \ configfile.$(OBJEXT) keep_alive.$(OBJEXT) read-conf.$(OBJEXT) \ sigterm.$(OBJEXT) wd_keepalive_OBJECTS = $(am_wd_keepalive_OBJECTS) wd_keepalive_DEPENDENCIES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/configfile.Po \ ./$(DEPDIR)/daemon-pid.Po ./$(DEPDIR)/errorcodes.Po \ ./$(DEPDIR)/file_stat.Po ./$(DEPDIR)/file_table.Po \ ./$(DEPDIR)/gettime.Po ./$(DEPDIR)/heartbeat.Po \ ./$(DEPDIR)/iface.Po ./$(DEPDIR)/keep_alive.Po \ ./$(DEPDIR)/killall5.Po ./$(DEPDIR)/load.Po \ ./$(DEPDIR)/lock_mem.Po ./$(DEPDIR)/logmessage.Po \ ./$(DEPDIR)/memory.Po ./$(DEPDIR)/net.Po \ ./$(DEPDIR)/pidfile.Po ./$(DEPDIR)/read-conf.Po \ ./$(DEPDIR)/reopenstd.Po ./$(DEPDIR)/run-as-child.Po \ ./$(DEPDIR)/send-email.Po ./$(DEPDIR)/shutdown.Po \ ./$(DEPDIR)/sigterm.Po ./$(DEPDIR)/temp.Po \ ./$(DEPDIR)/test_binary.Po ./$(DEPDIR)/watchdog.Po \ ./$(DEPDIR)/wd_identify.Po ./$(DEPDIR)/wd_keepalive.Po \ ./$(DEPDIR)/xmalloc.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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@ runstatedir = @runstatedir@ 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 iface.c gettime.c keep_alive.c \ load.c memory.c net.c \ pidfile.c shutdown.c \ temp.c test_binary.c watchdog.c \ logmessage.c xmalloc.c heartbeat.c lock_mem.c daemon-pid.c configfile.c \ errorcodes.c read-conf.c sigterm.c reopenstd.c killall5.c send-email.c \ run-as-child.c # for glibc before 2.17 due to clock_gettime() watchdog_LDADD = -lrt wd_keepalive_SOURCES = wd_keepalive.c logmessage.c lock_mem.c daemon-pid.c xmalloc.c \ configfile.c keep_alive.c read-conf.c sigterm.c wd_keepalive_LDADD = -lrt wd_identify_SOURCES = wd_identify.c logmessage.c xmalloc.c configfile.c read-conf.c wd_identify_LDADD = -lrt AM_CPPFLAGS = -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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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) $(AM_V_CCLD)$(LINK) $(watchdog_OBJECTS) $(watchdog_LDADD) $(LIBS) wd_identify$(EXEEXT): $(wd_identify_OBJECTS) $(wd_identify_DEPENDENCIES) $(EXTRA_wd_identify_DEPENDENCIES) @rm -f wd_identify$(EXEEXT) $(AM_V_CCLD)$(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) $(AM_V_CCLD)$(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)/configfile.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/daemon-pid.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/errorcodes.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_stat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_table.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettime.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heartbeat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iface.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keep_alive.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/killall5.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock_mem.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logmessage.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/net.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pidfile.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read-conf.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reopenstd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-as-child.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/send-email.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shutdown.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigterm.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/temp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_binary.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/watchdog.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wd_identify.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wd_keepalive.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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 -f ./$(DEPDIR)/configfile.Po -rm -f ./$(DEPDIR)/daemon-pid.Po -rm -f ./$(DEPDIR)/errorcodes.Po -rm -f ./$(DEPDIR)/file_stat.Po -rm -f ./$(DEPDIR)/file_table.Po -rm -f ./$(DEPDIR)/gettime.Po -rm -f ./$(DEPDIR)/heartbeat.Po -rm -f ./$(DEPDIR)/iface.Po -rm -f ./$(DEPDIR)/keep_alive.Po -rm -f ./$(DEPDIR)/killall5.Po -rm -f ./$(DEPDIR)/load.Po -rm -f ./$(DEPDIR)/lock_mem.Po -rm -f ./$(DEPDIR)/logmessage.Po -rm -f ./$(DEPDIR)/memory.Po -rm -f ./$(DEPDIR)/net.Po -rm -f ./$(DEPDIR)/pidfile.Po -rm -f ./$(DEPDIR)/read-conf.Po -rm -f ./$(DEPDIR)/reopenstd.Po -rm -f ./$(DEPDIR)/run-as-child.Po -rm -f ./$(DEPDIR)/send-email.Po -rm -f ./$(DEPDIR)/shutdown.Po -rm -f ./$(DEPDIR)/sigterm.Po -rm -f ./$(DEPDIR)/temp.Po -rm -f ./$(DEPDIR)/test_binary.Po -rm -f ./$(DEPDIR)/watchdog.Po -rm -f ./$(DEPDIR)/wd_identify.Po -rm -f ./$(DEPDIR)/wd_keepalive.Po -rm -f ./$(DEPDIR)/xmalloc.Po -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 -f ./$(DEPDIR)/configfile.Po -rm -f ./$(DEPDIR)/daemon-pid.Po -rm -f ./$(DEPDIR)/errorcodes.Po -rm -f ./$(DEPDIR)/file_stat.Po -rm -f ./$(DEPDIR)/file_table.Po -rm -f ./$(DEPDIR)/gettime.Po -rm -f ./$(DEPDIR)/heartbeat.Po -rm -f ./$(DEPDIR)/iface.Po -rm -f ./$(DEPDIR)/keep_alive.Po -rm -f ./$(DEPDIR)/killall5.Po -rm -f ./$(DEPDIR)/load.Po -rm -f ./$(DEPDIR)/lock_mem.Po -rm -f ./$(DEPDIR)/logmessage.Po -rm -f ./$(DEPDIR)/memory.Po -rm -f ./$(DEPDIR)/net.Po -rm -f ./$(DEPDIR)/pidfile.Po -rm -f ./$(DEPDIR)/read-conf.Po -rm -f ./$(DEPDIR)/reopenstd.Po -rm -f ./$(DEPDIR)/run-as-child.Po -rm -f ./$(DEPDIR)/send-email.Po -rm -f ./$(DEPDIR)/shutdown.Po -rm -f ./$(DEPDIR)/sigterm.Po -rm -f ./$(DEPDIR)/temp.Po -rm -f ./$(DEPDIR)/test_binary.Po -rm -f ./$(DEPDIR)/watchdog.Po -rm -f ./$(DEPDIR)/wd_identify.Po -rm -f ./$(DEPDIR)/wd_keepalive.Po -rm -f ./$(DEPDIR)/xmalloc.Po -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 TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-sbinPROGRAMS cscopelist-am ctags ctags-am \ 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 tags-am uninstall \ uninstall-am uninstall-sbinPROGRAMS .PRECIOUS: Makefile 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.16/src/daemon-pid.c0000644000175000017500000001004213650524716016011 0ustar michaelmichael/* > daemon-pid.c * * Write the PID of the running daemon to its file. * * BUGS / TO DO: The checking then writing is not atomic, so there is a small * chance of two processes thinking they have got exclusive use of the PID file, * however, that is a small probability in practice. * * (c) 2013 Paul S. Crawford (psc@sat.dundee.ac.uk) under GPL v2 license * based on existing code. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* For kill() */ #include #include /* For waitpid() */ #include #include "extern.h" /* Set when write_pid_file() is called. */ pid_t daemon_pid = 0; /* Used to keep a note of the file we used. */ static char *saved_fname = NULL; /* * Check to see if the PID file exists and is in-use by an active process. */ static int check_pid_file(const char *fname) { int pid = 0; FILE *fp = fopen(fname, "r"); if (fp != NULL) { /* File exists, read its contents. */ if (fscanf(fp, " %d", &pid) != 1) { pid = 0; } fclose(fp); if (pid != 0 && pid != (int)daemon_pid) { /* PID already written, but is it another active process? */ if (kill(pid, 0) == 0) { log_message(LOG_WARNING, "PID file %s already used by PID=%d", fname, pid); return -1; } } } return 0; } /* * Code to find the current process' PID and write it to the PID file. This should be * called just AFTER you daemonize the process (so it gets the correct PID) and BEFORE you * lock the process memory (as that function needs the PID as well). * * Return value is zero if OK, or -1 for error (null name, PID file in use, or can't write). */ int write_pid_file(const char *fname) { FILE *fp; int rv = 0; daemon_pid = getpid(); if (fname == NULL || check_pid_file(fname)) return -1; /* Remove any previous file we used, and free its name. */ remove_pid_file(); fp = fopen(fname, "w"); if (fp != NULL) { fprintf(fp, "%d\n", daemon_pid); fclose(fp); saved_fname = xstrdup(fname); } else { rv = -1; log_message(LOG_ERR, "cannot open PID file %s (%s)", fname, strerror(errno)); } return rv; } /* * Remove the PID file we previously wrote our PID value to. Can be called anywhere, * and multiple times, but really should be limited to when the daemon is exiting, and * preferably just before syslog is disconnected so any errors can be logged. */ int remove_pid_file(void) { int rv = 0; if (saved_fname != NULL) { if (unlink(saved_fname) < 0) { log_message(LOG_ERR, "cannot remove PID file %s (%s)", saved_fname, strerror(errno)); rv = -1; } free(saved_fname); } saved_fname = NULL; return rv; } /* * Function to perform the double-fork daemonization with the same sort of * calling and behaviour as BSD' daemon() function. */ int wd_daemon(int nochdir, int noclose) { pid_t child_pid; /* Become a daemon process: */ /* make sure we're on the root partition */ if (!nochdir) { if (chdir("/") < 0) { return (-1); } } /* flush any stdout/stderr message before we fork */ fflush(stdout); fflush(stderr); /* fork to go into the background */ if ((child_pid = fork()) < 0) { return (-1); } else if (child_pid > 0) { /* fork was okay */ /* wait for child to exit */ if (waitpid(child_pid, NULL, 0) != child_pid) { _exit(1); } /* and exit myself */ _exit(0); } /* and fork again to make sure we inherit all rights from init */ if ((child_pid = fork()) < 0) { _exit(1); } else if (child_pid > 0) { /* fork was OK, give child time to write PID file. */ xusleep(10000); _exit(0); } /* now we're free */ /* Okay, we're a daemon */ /* but we're still attached to the tty */ /* create our own session */ if (setsid() == -1) return (-1); /* As daemon we don't normally do any console IO */ if (!noclose) { const char *null_name = "/dev/null"; if (freopen(null_name, "r", stdin) == NULL) { return (-1); } if (freopen(null_name, "w", stdout) == NULL) { return (-1); } if (freopen(null_name, "w", stderr) == NULL) { return (-1); } } return 0; } watchdog-5.16/src/test_binary.c0000644000175000017500000001725313650524716016332 0ustar michaelmichael#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include "extern.h" #include "watch_err.h" #include "gettime.h" #define TEST_RUNNING 0 #define TEST_COMPLETED 1 #define TEST_BLANK 2 struct process { char proc_name[PATH_MAX]; pid_t pid; time_t time; int ecode; int is_done; struct process *next; }; static struct process *process_head = NULL; /* * Add a process to the list. We index by PID primarily to act on child exit * values, but check the process name when attempting to start a new child. */ static int add_process(const char *name, pid_t pid) { struct process *node = (struct process *)malloc(sizeof(struct process)); if (node == NULL) { log_message(LOG_ALERT, "out of memory adding test binary"); free_process(); return (ENOMEM); } snprintf(node->proc_name, sizeof(node->proc_name), "%s", name); node->pid = pid; node->time = gettime(); node->ecode = 0; node->is_done = FALSE; node->next = process_head; process_head = node; return (ENOERR); } /* * Free the whole chain. Used on out-of-memory case to hopefully to have enough * heap left to create the process kill-list for an orderly shut-down. */ void free_process(void) { struct process *last, *current; current = process_head; while (current != NULL) { last = current; current = current->next; free(last); } process_head = NULL; } /* * Remove a finished process from the list, indexed by PID. */ 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); } } /* * When a child process has changed state, update the list to record * the exit status (or kill signal event). */ static void update_process(pid_t pid, int result) { struct process *current; current = process_head; while (current != NULL && current->pid != pid) { current = current->next; } if (current != NULL) { /* Found a PID match in while() loop, but has something already reported? */ if (current->is_done == FALSE) { if (WIFEXITED(result)) { /* Child exited normally, report the exit code. * Log this if non-zero (i.e. error) or always when verbose. */ int ecode = WEXITSTATUS(result); if (ecode || verbose) { log_message(LOG_DEBUG, "test binary %s returned %d = '%s'", current->proc_name, ecode, wd_strerror(ecode)); } current->ecode = ecode; current->is_done = TRUE; } else if (WIFSIGNALED(result)) { /* Child was terminated by a signal. We don't care what signal did * it, so always report it simple as "process killed". When we kill * on time-out, we have already set the 'is_done' flag so don't see this. */ int sig = WTERMSIG(result); log_message(LOG_ERR, "test binary %s was killed by uncaught signal %d", current->proc_name, sig); current->ecode = ECHKILL; current->is_done = TRUE; } } } } /* * Look for any child process having changed state. This call also removes * them, so it stops programs such as 'top' reporting zombie processes. */ static void gather_children(void) { int ret, err; int result = 0; do { ret = waitpid(-1, &result, WNOHANG); err = errno; /* 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) { update_process(ret, result); } else if (ret < 0 && err != ECHILD) { log_message(LOG_ERR, "error getting child process %d = '%s'", err, strerror(err)); } } while (ret > 0); } /* See if any test processes have exceeded the timeout */ static int check_timeouts(int timeout) { struct process *current; time_t now = gettime(); current = process_head; while (current != NULL) { if (current->is_done == FALSE && (int)(now - current->time) > timeout) { /* Process has timed-out, kill it and report this. */ kill_process_tree(current->pid, SIGKILL); current->is_done = TRUE; current->ecode = ETOOLONG; log_message(LOG_ERR, "test-binary %s exceeded time limit %d", current->proc_name, timeout); } current = current->next; } return (ENOERR); } /* * Report on any past child processes. Return values are: * * 0 = TEST_RUNNING = child of this name still running. * 1 = TEST_COMPLETED = child has stopped, can use result. * 2 = TEST_BLANK = nothing in list, safe to run test program. * * So if zero returned, then don't try another child instance but * return ENOERR until we get an answer. * * In both other cases (1 or 2) you can start another child but maybe * not such a wise thing to do if there is an error condition. */ static int check_processes(const char *name, int *ecode) { struct process *current; current = process_head; while (current != NULL) { if (!strcmp(current->proc_name, name)) { /* Process still in list, but is it finished or not? */ if (current->is_done == FALSE) { /* Still running. */ return (TEST_RUNNING); } else { /* Process has terminated (or we killed it on time-out), so return * any error code and remove from list. We must return at this point, * or the loop will access freed memory for 'current->next' below. */ *ecode = current->ecode; remove_process(current->pid); return (TEST_COMPLETED); } } current = current->next; } /* No match. */ return (TEST_BLANK); } /* * execute test binary * * This has no intentional delay, so basically starts the child process asynchronously and * the next call with the same 'tbinary' name will return any error results, or start * another (if last one finished normally). While waiting (or no new run) the return * value is EDONTKNOW to make the job of the retry-timer workable. * * A time-out of zero will disable the time-out checking, but in that case a blocked child * will simply persist indefinitely and no error will be found. */ int check_bin(char *tbinary, int timeout, int version) { pid_t child_pid; int ecode = EDONTKNOW; /* Call this before test on 'tbinary' so ANY early returns can be * gathered (less zombie process reported that way). */ gather_children(); if (timeout > 0) check_timeouts(timeout); if (tbinary == NULL) return ENOERR; if (check_processes(tbinary, &ecode) == TEST_RUNNING) { /* The process 'tbinary' is still running. */ return EDONTKNOW; } 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 */ int err = reopen_std_files(FLAG_REOPEN_STD_TEST); /* If that failed, exit as bit problems likely (read-only file system?) */ if (err) { exit(err); } /* 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; log_message(LOG_ERR, "process fork failed with error = %d = '%s'", err, strerror(err)); return (EREBOOT); } else { /* fork was okay, add child to process list */ int err = add_process(tbinary, child_pid); /* if that failed, report it instead of exit code. */ if (err) ecode = err; } return ecode; } watchdog-5.16/src/reopenstd.c0000644000175000017500000001010513650524716015777 0ustar michaelmichael/* > reopenstd.c * * Reopen the stdout & stderr files to watchdog log directory to capture child * process' outputs. * * (c) 2019 Paul S. Crawford (psc@sat.dundee.ac.uk) & Michael Meskes licensed under GPL v2 * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include /* for dup2() */ #include #include #include #include "watch_err.h" #include "extern.h" static const char *fnames[] = { "repair-bin", // Longest name should be first in list. "test-bin" }; static const char *fsuffix[] = { ".stdout", // Longest name should be first in list. ".stderr" }; static char *filename_buf = NULL; static int buf_length = 0; static int buf_offset = 0; /* * Declare where we want the test/repair program's output to go to. This allocates a suitable * buffer so we don't need to worry later about out-of-memory for this (at least!). * * Call with NULL to free the buffer if needed. */ void set_reopen_dir(const char *dname) { /* Release any previous buffer memory */ if (filename_buf != NULL) { free(filename_buf); } filename_buf = NULL; buf_length = 0; buf_offset = 0; if (dname != NULL) { /* Create buffer and copy directory name. We keep a record of the * length of the 'dname' so we can simply copy fnames[]+fsuffix[] to it. * * Need some spare for nul-terminator and possible '/' addition. */ buf_offset = strlen(dname); buf_length = buf_offset + strlen(fnames[0]) + strlen(fsuffix[0]) + 2; filename_buf = xcalloc(buf_length, sizeof(char)); strcpy(filename_buf, dname); /* Finally check we have a trailing '/' character, adding one if needed. */ if (buf_offset > 0) { /* We have not specified "" so a trailing '/' is needed. */ if (filename_buf[buf_offset-1] != '/') { filename_buf[buf_offset] = '/'; buf_offset++; filename_buf[buf_offset] = 0; } } } } /* * Perform the re-open, creating the path/name as required. */ static int do_reopen(int idx, FILE *fp, const char *sfx) { int err = 0; char *rname = "/dev/null"; int fd_new; int fd_old; if (idx >= 0 && filename_buf != NULL) { /* Have a specific file to use, not just /dev/null for re-direct. Start * by removing any previous fname[]/fsufix[] stuff. */ if (buf_length > buf_offset) { filename_buf[buf_offset] = 0; rname = strcat(filename_buf, fnames[idx]); rname = strcat(rname, sfx); assert(strlen(rname) < buf_length); } } fd_new = fileno(fp); fd_old = open(rname, O_WRONLY|O_CREAT|O_APPEND, S_IWUSR|S_IRUSR|S_IRGRP); if (fd_old < 0) { err = errno; log_message(LOG_WARNING, "unable to open %s (%s)", rname, strerror(err)); return err; } if (dup2(fd_old, fd_new) < 0) { err = errno; log_message(LOG_WARNING, "unable to duplicate %s and %d (%s)", rname, fd_old, strerror(err)); } else if (verbose > 1) { log_message(LOG_DEBUG, "reopened using %s for idx = %d", rname, idx); } close(fd_old); return err; } /* * Re-open stdout & stderr to a pair of files in the previously specified directory. The * argument 'flags' has bits to signal if it is for "test" or "repair" and chooses names * from the above table accordingly. If neither is set, then the do_reopen() function * defaults to /dev/null * * Return value is any error encountered in re-opening the files. Previously this would cause * the child to exit, however, with the new use of daemon() those stdout/stderr files are * going to /dev/null so it is not such a big deal if you don't have permission to reopen * using the watchdog log directory. */ int reopen_std_files(int flags) { int err = 0; int idx = -1; int rv; /* If not set (e.g. in foreground mode) simply do nothing. */ if (filename_buf == NULL) { return 0; } /* Check to see if either specific name is in use. */ if (flags & FLAG_REOPEN_STD_REPAIR) { idx = 0; } else if (flags & FLAG_REOPEN_STD_TEST) { idx = 1; } /* Re-open as needed. */ rv = do_reopen(idx, stdout, fsuffix[0]); if (rv) { err = rv; } rv = do_reopen(idx, stderr, fsuffix[1]); if (rv) { err = rv; } return err; } watchdog-5.16/src/memory.c0000644000175000017500000001073513650524716015315 0ustar michaelmichael/* > memory.c * * Code for periodically checking the 'free' memory in the system. Added in the * functions open_memcheck() and close_memcheck() based on stuff from old watchdog.c * and shutdown.c to make it more self-contained. * * TO DO: * Should we have separate configuration for checking swap use? * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #ifdef __linux__ #include #endif #include "extern.h" #include "watch_err.h" #define FREEMEM "MemFree:" #define FREESWAP "SwapFree:" #define TOTALSWAP "SwapTotal:" #define USED_BUFFER "Buffers:" #define USED_CACHE "Cached:" static int mem_fd = -1; static const char mem_name[] = "/proc/meminfo"; /* * Read values such as: * * "MemFree: 27337188 kB" * * From the the file to retrun 27337188 in this case. * Return is 0 for failure to parse. */ static long read_svalue(const char *buf, const char *var) { long res = 0; char *ptr = NULL; if (buf != NULL && var != NULL) { ptr = strstr(buf, var); } if (ptr != NULL) { res = atol(ptr + strlen(var)); } else if (verbose > 1) { /* * Report error in parsing, but this could be due to older * kernel so don't make it an error or too verbose. */ log_message(LOG_DEBUG, "Failed to parse %s for %s", mem_name, var); } return res; } static long kb_per_page(int pages) { return pages * (long)(EXEC_PAGESIZE / 1024); } /* * Open the memory information file if such as test is configured. */ int open_memcheck(void) { int rv = -1; close_memcheck(); if (minpages > 0 || maxswap > 0) { /* open the memory info file */ mem_fd = open(mem_name, O_RDONLY); if (mem_fd == -1) { int err = errno; log_message(LOG_ERR, "cannot open %s (errno = %d = '%s')", mem_name, err, strerror(err)); } else { rv = 0; } } return rv; } /* * Read and check the contents of the memory information file. */ int check_memory(void) { char buf[2048]; long free, freemem, freeswap, used_buffer, used_cache, totalswap, used; int n; int ret = ENOERR; /* is the memory file open? */ if (mem_fd == -1) return (ENOERR); /* position pointer at start of file */ if (lseek(mem_fd, 0, SEEK_SET) < 0) { int err = errno; log_message(LOG_ERR, "lseek %s gave errno = %d = '%s'", mem_name, err, strerror(err)); return (err); } /* read the file */ if ((n = read(mem_fd, buf, sizeof(buf)-1)) < 0) { int err = errno; log_message(LOG_ERR, "read %s gave errno = %d = '%s'", mem_name, err, strerror(err)); return (err); } /* Force string to be nul-terminated. */ buf[n] = 0; /* we only care about integer values */ freemem = read_svalue(buf, FREEMEM); freeswap = read_svalue(buf, FREESWAP); totalswap = read_svalue(buf, TOTALSWAP); used_buffer = read_svalue(buf, USED_BUFFER); used_cache = read_svalue(buf, USED_CACHE); /* * Compute "free memnory" from what is reported as free, the buffers and * cache use. When pressed, the kernel will free up buffers & cache for * other use, but as a result if this measure of "free" gets below a few * tens of MB then the machine is going to be pretty sick. */ free = freemem + used_buffer + used_cache; used = totalswap - freeswap; if (verbose && logtick && ticker == 1) { log_message(LOG_DEBUG, "currently there are %ld kB usable memory and %ld of %ld swap used", free, used, freeswap); } if (minpages && (free < kb_per_page(minpages))) { log_message(LOG_ERR, "memory available %ld kB is less than %d pages", free, minpages); ret = ENOMEM; } if (maxswap && (used > kb_per_page(maxswap))) { log_message(LOG_ERR, "swap used %ld kB is more than %d pages", used, maxswap); ret = ENOMEM; } return ret; } /* * Close the special memory data file (if open). */ int close_memcheck(void) { int rv = 0; if (mem_fd != -1 && close(mem_fd) == -1) { log_message(LOG_ALERT, "cannot close %s (errno = %d)", mem_name, errno); rv = -1; } mem_fd = -1; return rv; } int check_allocatable(void) { char *mem; size_t len = EXEC_PAGESIZE * (size_t)minalloc; if (minalloc <= 0) return 0; /* * Map and fault in the pages */ mem = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, 0, 0); if (mem == MAP_FAILED) { int err = errno; log_message(LOG_ALERT, "cannot allocate %lu bytes (errno = %d = '%s')", (unsigned long)len, err, strerror(err)); return err; } munmap(mem, len); return 0; } watchdog-5.16/src/logmessage.c0000644000175000017500000001241113650524716016124 0ustar michaelmichael/* > logmessage.c * * Code for creating messages and sending them to stderr and/or to syslog. * Also has fatal_error() function to the same then exit. * * NOTE: We can't use malloc() here as one reason for a call could be the * out-of-memory condition, so we use a modest stack-based buffer for the * string "printing" before dumping it to the terminal and/or syslog. * * (c) 2013 Paul S. Crawford (psc@sat.dundee.ac.uk) licensed under GPL v2 * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "logmessage.h" #define MAX_MESSAGE 2048 #define MAX_PROG_NAME 256 static int output_message(int level, char *buf); static int using_syslog = 0; static int using_terminal = 0; static char progname[MAX_PROG_NAME]; static int err_count = 0; static int err_level = LOG_DEBUG; static char err_buf[MAX_MESSAGE]; /* * Prepare for message printing. * * On the 1st call to this should include the program's name (e.g. argv[]) * but after that you can use NULL. * * The integer flags enable/disable output to either the terminal (via 'stderr') * or to syslog (assuming it is compiled as such, otherwise terminal as well). */ int open_logging(const char *name, int flags) { int rv = 0; if (name != NULL) { strncpy(progname, name, sizeof(progname) - 1); } err_count = 0; using_terminal = (flags & MSG_TO_STDERR); if (flags & MSG_TO_SYSLOG) { if (!using_syslog) { #if USE_SYSLOG openlog(progname, LOG_PID, LOG_DAEMON); #endif /*USE_SYSLOG */ using_syslog = 1; /* Future messages to syslog. */ } } else { close_logging(); } return rv; } /* * Output a message with a given priority level. Used internally for both * log_message() and fatal_error() calls. When using syslog we can output * twice, but without syslog either mode is directed to the terminal once. */ static int output_message(int level, char *buf) { FILE *fp = stderr; int rv = 0; #if USE_SYSLOG if (using_syslog && err_count == 0) { syslog(level, "%s", buf); } else { /* In 'suspend' mode, copy message so can output on 'resume'. */ err_count++; err_level = level; strncpy(err_buf, buf, sizeof(err_buf)-1); } if (using_terminal) { #else if (using_terminal || using_syslog) { #endif /* !USE_SYSLOG */ rv = fprintf(fp, "%s: %s\n", progname, buf); if(rv < 0 || fflush(fp)) { /* Error writing out to terminal - don't bother trying again. */ using_terminal = 0; #if USE_SYSLOG && 0 syslog(LOG_WARNING, "failed writing message terminal (rv=%d, errno='%s')", rv, strerror(errno)); #endif /* USE_SYSLOG */ } } return rv; } /* * Log a message to syslog and/or the terminal. * * NOTE: Unlike syslog you can't use '%m' formatting for error codes, instead use * the string '%s' and give it strerror(errno) as an argument. */ int log_message(int level, const char *fmt, ...) { int rv = 0; char buf[MAX_MESSAGE]; va_list args; memset(buf, 0, sizeof(buf)); va_start(args, fmt); #if _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L vsnprintf(buf, sizeof(buf) - 1, fmt, args); #else vsprintf(buf, fmt, args); #endif va_end(args); rv = output_message(level, buf); return rv; } /* * Function to log a message then exit program with a given error code. */ void fatal_error(int exitcode, const char *fmt, ...) { char buf[MAX_MESSAGE]; va_list args; memset(buf, 0, sizeof(buf)); va_start(args, fmt); #if _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L vsnprintf(buf, sizeof(buf) - 1, fmt, args); #else vsprintf(buf, fmt, args); #endif va_end(args); output_message(LOG_ERR, buf); close_logging(); #if defined(DEBUG) /* * This should trigger a core dump when in debug mode, allowing trace-back * to find out why we were leaving unexpectedly. */ assert(!buf); #endif /*DEBUG*/ exit(exitcode); } /* * Stop any logging via syslog. * * Return is 0 is stopped, or -1 if not in use. * * Note you don't need to use this, it is also possible to call something * like open_logging(NULL, MSG_TO_STDERR) to close syslog. */ int close_logging(void) { int rv = -1; /* Log the closing message */ if (using_syslog) { #if USE_SYSLOG closelog(); #endif /* USE_SYSLOG */ using_syslog = 0; rv = 0; } return rv; } /* * Calling this function will stop any syslog output, and resume_logging() will start * it again. Unlike the usual options, this is not closing the syslog connection and it * will output of the last (if any) message generated during the suspended period on * resumption (again, only if syslog is already in use). */ int suspend_logging(void) { if (err_count == 0) { err_count++; /* Start at 1 */ } return 0; } /* * Allow syslog output again (if it was in use) and send the last message during the * suspended period (if any). */ int resume_logging(void) { int rv = 0; if (err_count && using_syslog) { /* We start at 1 so remove that. */ err_count--; if (err_count == 1) { /* Exactly one message sent, output as if nothing happened. */ syslog(err_level, "%s", err_buf); } else if (err_count > 1) { /* More than one needed, but we only buffer one, so report loss. */ syslog(LOG_WARNING, "had %d messages in log suspend, last: %s", err_count, err_buf); rv = -1; } } err_count = 0; return rv; } watchdog-5.16/src/xmalloc.c0000644000175000017500000000263713650524716015446 0ustar michaelmichael/* > xmalloc.c * * Versions of memory allocation that exit with error message if failure occurs. * Based on old sundries.c but with some minor improvements and the code * in it that was for mount.c/umount.c support removed. * * (c) 2013 Paul S. Crawford (psc@sat.dundee.ac.uk) licensed under GPL v2, based * on older code in sundries.c * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "xmalloc.h" #include "logmessage.h" void *xcalloc(size_t nmemb, size_t size) { void *t; if (nmemb == 0 || size == 0) return NULL; t = calloc(nmemb, size); if (t == NULL) fatal_error(EX_SYSERR, "xcalloc failed for %lu x %lu bytes", (unsigned long)nmemb, (unsigned long)size); return t; } char *xstrdup(const char *s) { char *t; if (s == NULL) return NULL; t = strdup(s); if (t == NULL) fatal_error(EX_SYSERR, "xstrdup failed for %lu byte string", (unsigned long)strlen(s)); return t; } int xusleep(const long usec) { const long US_PER_SEC = 1000000L; struct timespec req; struct timespec rem; ldiv_t d; /* Skip obvious error case. */ if (usec < 0) { return EINVAL; } /* Convert microseconds in to seconds. */ d = ldiv(usec, US_PER_SEC); req.tv_sec = d.quot; /* Convert remainder from microseconds to nanoseconds. */ req.tv_nsec = d.rem * 1000L; /* Use more modern call safely for microsecond values > 1 second. */ return nanosleep(&req, &rem); } watchdog-5.16/watchdog.sysconfig0000644000175000017500000000023513650524716016572 0ustar michaelmichael# # /etc/sysconfig/watchdog # # Controls the behaviour of the watchdog # # VERBOSE - Enables or disables verbose operation (logging to syslog) # VERBOSE=no watchdog-5.16/redhat/0000755000175000017500000000000013650524716014313 5ustar michaelmichaelwatchdog-5.16/redhat/watchdog.init0000644000175000017500000000273113650524716017003 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.16/redhat/watchdog.spec0000644000175000017500000000775113650524716017001 0ustar michaelmichaelSummary: Software and/or Hardware watchdog daemon Name: watchdog Version: 5.5 Release: 2%{?dist} License: GPL+ Group: System Environment/Daemons URL: https://sourceforge.net/projects/watchdog/ Source0: https://downloads.sourceforge.net/project/watchdog/watchdog/%{version}/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 %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 %{_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 * Tue Dec 13 2016 Paul Crawford - 5.15 - Apply changes from Marcus Furlong to fix automated CentOS 7 build - Update URLs to https and fix download address from sourceforge * 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.16/redhat/sysconf.redhat0000644000175000017500000000161613650524716017174 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.16/redhat/README.Fedora0000644000175000017500000000237213650524716016376 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.16/.gitignore0000644000175000017500000000102213650524716015027 0ustar michaelmichael# Ignore hidden/backup/compilation files .* *.o *~ # However don't ignore this file !/.gitignore # Ignore the build programs src/watchdog src/wd_identify src/wd_keepalive # Ignore remaining files create/modified by the steps: # autoreconf -i # ./configure # make Makefile Makefile.in aclocal.m4 autom4te.cache/ compile config.log config.status configure depcomp include/config.h include/config.h.in include/stamp-h1 install-sh missing src/Makefile src/Makefile.in # For the coverity (synopsis) build scan tool src/cov-int watchdog-5.16/depcomp0000755000175000017500000005602013650524721014420 0ustar michaelmichael#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 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 # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} 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" # Avoid interferences from the environment. gccflag= dashmflag= # 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 information. 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 -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## 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). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - 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 -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # 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. ## 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. tr ' ' "$nl" < "$tmpdepfile" \ | 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 -ne 0; then 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 make_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. set_dir_from "$object" set_base_from "$object" 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 -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then 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 "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$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. set_dir_from "$object" set_base_from "$object" 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 -ne 0; then 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,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_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. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool 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$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; 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 -ne 0; then 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" echo >> "$depfile" # make sure the fragment doesn't end with a backslash 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" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | 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" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | 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 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: watchdog-5.16/README0000644000175000017500000000366513650524716013736 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.16/README.watchdog.ipmi0000644000175000017500000001145313650524716016464 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.16/suse/0000755000175000017500000000000013650524716014023 5ustar michaelmichaelwatchdog-5.16/suse/rc.watchdog.suse0000644000175000017500000000471513650524716017136 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.16/INSTALL0000644000175000017500000000357713650524716014111 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.16/watchdog.conf0000644000175000017500000001372613650524716015524 0ustar michaelmichael# ==================================================================== # Configuration for the watchdog daemon. For more information on the # parameters in this file use the command 'man watchdog.conf' # ==================================================================== # =================== The hardware timer settings ==================== # # For this daemon to be effective it really needs some hardware timer # to back up any reboot actions. If you have a server then see if it # has IPMI support. Otherwise for Intel-based machines try the iTCO_wdt # module, otherwise (or if that fails) then see if any of the following # module load and work: # # it87_wdt it8712f_wdt w83627hf_wdt w83877f_wdt w83977f_wdt # # If all else fails then 'softdog' is better than no timer at all! # Or work your way through the modules listed under: # # /lib/modules/`uname -r`/kernel/drivers/watchdog/ # # To see if they load, present /dev/watchdog, and are capable of # resetting the system on time-out. # Uncomment this to use the watchdog device driver access "file". #watchdog-device = /dev/watchdog # Uncomment and edit this line for hardware timeout values that differ # from the default of one minute. #watchdog-timeout = 60 # If your watchdog trips by itself when the first timeout interval # elapses then try uncommenting the line below and changing the # value to 'yes'. #watchdog-refresh-use-settimeout = auto # If you have a buggy watchdog device (e.g. some IPMI implementations) # try uncommenting this line and setting it to 'yes'. #watchdog-refresh-ignore-errors = no # ====================== Other system settings ======================== # # Interval between tests. Should be a couple of seconds shorter than # the hardware time-out value. #interval = 1 # The number of intervals skipped before a log message is written (i.e. # a multiplier for 'interval' in terms of syslog messages) #logtick = 1 # Directory for log files (probably best not to change this) #log-dir = /var/log/watchdog # Email address for sending the reboot reason. This needs sendmail to # be installed and properly configured. Maybe you should just enable # syslog forwarding instead? #admin = root # Lock the daemon in to memory as a real-time process. This greatly # decreases the chance that watchdog won't be scheduled before your # machine is really loaded. realtime = yes priority = 1 # ====================== How to handle errors ======================= # # If you have a custom binary/script to handle errors then uncomment # this line and provide the path. For 'v1' test binary files they also # handle error cases. #repair-binary = /usr/sbin/repair #repair-timeout = 60 # The retry-timeout and repair limit are used to handle errors in a # more robust manner. Errors must persist for longer than this to # action a repair or reboot, and if repair-maximum attempts are # made without the test passing a reboot is initiated anyway. #retry-timeout = 60 #repair-maximum = 1 # Configure the delay on reboot from sending SIGTERM to all processes # and to following up with SIGKILL for any that are ignoring the polite # request to stop. #sigterm-delay = 5 # ====================== User-specified tests ======================== # # Specify the directory for auto-added 'v1' test programs (any executable # found in the 'test-directory should be listed). #test-directory = /etc/watchdog.d # Specify any v0 custom tests here. Multiple lines are permitted, but # having any 'v1' programs/scripts discovered in the 'test-directory' is # the better way. #test-binary = # Specify the time-out value for a test error to be reported. #test-timeout = 60 # ====================== Typical tests =============================== # # Specify any IPv4 numeric addresses to be probed. # NOTE: You should check you have permission to ping any machine before # using it as a test. Also remember if the target goes down then this # machine will reboot as a result! #ping = 172.16.0.1 #ping = 192.168.1.1 # Set the number of ping attempts in each 'interval' of time. Default # is 3 and it completes on the first successful ping. # NOTE: Round-trip delay has to be less than 'interval' / 'ping-count' # for test success, but this is unlikely to be exceeded except possibly # on satellite links (very unlikely case!). #ping-count = 3 # Specify any network interface to be checked for activity. #interface = eth0 # Specify any files to be checked for presence, and if desired, checked # that they have been updated more recently than 'change' seconds. #file = /var/log/syslog #change = 1407 # Uncomment to enable load average tests for 1, 5 and 15 minute # averages. 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 in most cases). #max-load-1 = 24 #max-load-5 = 18 #max-load-15 = 12 # Check available memory on the machine. # # The min-memory check is a passive test from reading the file # /proc/meminfo and computed from MemFree + Buffers + Cached # If this is below a few tens of MB you are likely to have problems. # # The allocatable-memory is an active test checking it can be paged # in to use. # # Maximum swap should be based on normal use, probably a large part of # available swap but paging 1GB of swap can take tens of seconds. # # NOTE: This is the number of pages, to get the real size, check how # large the pagesize is on your machine (typically 4kB for x86 hardware). #min-memory = 1 #allocatable-memory = 1 #max-swap = 0 # Check for over-temperature. Typically the temperature-sensor is a # 'virtual file' under /sys and it contains the temperature in # milli-Celsius. Usually these are generated by the 'sensors' package, # but take care as device enumeration may not be fixed. #temperature-sensor = #max-temperature = 90 # Check for a running process/daemon by its PID file. For example, # check if rsyslogd is still running by enabling the following line: #pidfile = /var/run/rsyslogd.pid watchdog-5.16/install-sh0000755000175000017500000003643513650524721015057 0ustar michaelmichael#!/bin/sh # install - install a program, script, or datafile scriptversion=2018-03-11.20; # 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. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # 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_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 is_target_a_directory=possibly 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 *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi 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 if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi 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. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac 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. ;; *) # Note that $RANDOM variable is not portable (e.g. dash); Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p' feature. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/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-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 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 oIFS=$IFS IFS=/ set -f set fnord $dstdir shift 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=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_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 && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $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` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && 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 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: watchdog-5.16/examples/0000755000175000017500000000000013650524716014662 5ustar michaelmichaelwatchdog-5.16/examples/README0000644000175000017500000000034413650524716015543 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.16/examples/dbcheck.sh0000755000175000017500000000104313650524716016602 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 255 (-1 as unsigned 8-bit) means reboot # and 254 (-2) means hard reset. # result=254 fi exit $result watchdog-5.16/examples/uptime.sh0000755000175000017500000000063213650524716016525 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 255 (-1 as unsigned 8-bit) means reboot # exit 255 fi exit 0 watchdog-5.16/examples/repair.sh0000755000175000017500000000436313650524716016511 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.16/examples/systemcheck.sh0000644000175000017500000000031513650524716017537 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.16/examples/another-chance.sh0000644000175000017500000000204513650524716020076 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.16/wd_keepalive.80000644000175000017500000000506613650524716015603 0ustar michaelmichael.TH WD_KEEPALIVE 8 "June 2015" .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 .B watchdog daemon. Unlike the full watchdog, this daemon run no tests and only serves to keep the hardware timer refreshed. Typically this is used on system start-up to provide protection before the services that the full version tests are running, and on shutdown to continue the refresh while those services are stopped. .PP 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 . .TP .BR \-X " \fInum\fR, " \-\-loop\-exit " \fInum" Run for 'num' loops then exit as if SIG_TERM was received. Intended for test/debug (e.g. using .B valgrind for checking memory access). If the daemon exits on a loop counter and you have the .I CONFIG_WATCHDOG_NOWAYOUT option compiled for the kernel or device-driver then an unplanned reboot will follow - be warned! .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.16/wd_identify.80000644000175000017500000000265613650524716015453 0ustar michaelmichael.TH WD_IDENTIFY 8 "Dec 2015" .UC 4 .SH NAME wd_identify \- get watchdog driver identity .SH SYNOPSIS .B wd_identify .RB [ \-c " \fIfilename\fR|" \-\-config\-file " \fIfilename\fR]" .RB [ \-v "|" \-\-verbose ] .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 An exit code of zero indicates success in getting the driver identity, while a non-zero exit code indicates an error (not configured in the config file, no device driver loaded, or driver failed to respond to ioctl request). .PP The wd_identify tool can only be used without causing a reboot if your kernel is not compiled with the .I CONFIG_WATCHDOG_NOWAYOUT option enabled. .PP Note that the .B watchdog and/or .B wd_keepalive daemons may have to be stopped to make sure that .B 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 . .TP .BR \-v ", " \-\-verbose Print more diagnostic messages. This covers parsing of the config file and also causes the program to read-back the current watchdog time-out value (if successful in opening the device). .SH FILES .TP .I /dev/watchdog The watchdog device. .SH "SEE ALSO" .BR watchdog.conf (5) .TP .BR watchdog (8) watchdog-5.16/aclocal.m40000644000175000017500000012722113650524721014705 0ustar michaelmichael# generated automatically by aclocal 1.16.2 -*- Autoconf -*- # Copyright (C) 1996-2020 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_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) 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-2020 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. # 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.16' 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.16.2], [], [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.16.2])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-2020 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. # 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], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2020 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. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$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-2020 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. # 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", "OBJC", "OBJCXX", "UPC", or "GJC". # 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 m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" 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 10 /bin/sh. echo '/* dummy */' > 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], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) 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-2020 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. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf 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. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _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. # This creates each '.Po' and '.Plo' makefile fragment that we'll 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" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2020 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 macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # 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.65])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], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) 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], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [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([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). 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])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro 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 # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) 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-2020 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. # 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+set}" != 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-2020 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. # 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-2020 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. # 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], [AS_HELP_STRING([--]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 ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2020 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. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2020 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. # 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 is modern enough. # If it is, 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 --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # -*- Autoconf -*- # Obsolete and "removed" macros, that must however still report explicit # error messages when used, to smooth transition. # # Copyright (C) 1996-2020 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. AC_DEFUN([AM_CONFIG_HEADER], [AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl AC_CONFIG_HEADERS($@)]) AC_DEFUN([AM_PROG_CC_STDC], [AC_PROG_CC am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should simply use the 'AC][_PROG_CC' macro instead. Also, your code should no longer depend upon 'am_cv_prog_cc_stdc', but upon 'ac_cv_prog_cc_stdc'.])]) AC_DEFUN([AM_C_PROTOTYPES], [AC_FATAL([automatic de-ANSI-fication support has been removed])]) AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2020 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. # _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])]) # Copyright (C) 1999-2020 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. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2020 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. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2020 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. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # 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 ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file 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 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 if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done 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]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2020 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. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2020 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. # 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-2020 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. # _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-2020 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. # _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}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} 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.16/ChangeLog0000644000175000017500000003375213650524716014630 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.16/Makefile.am0000644000175000017500000000131513650524716015100 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) $(srcdir)/watchdog.conf $(DESTDIR)$(CONFIG_FILENAME); \ fi install-data-local: install-etc-local watchdog-5.16/AUTHORS0000644000175000017500000000112413650524716014112 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.16/configure0000755000175000017500000061062513650524722014762 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__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V 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 runstatedir 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 am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules 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' runstatedir='${localstatedir}/run' 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 ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -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 runstatedir 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] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --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-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --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=16 am__api_version='1.16' 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; } # 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 ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file 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 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 if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done 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; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file 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 --is-lightweight"; then am_missing_run="$MISSING " 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+set}" != 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; } 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 # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' 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"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). 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}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi 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; } # 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 ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file 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 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 if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done 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; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file { $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 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 whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" 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" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 $as_echo "${_am_result}" >&6; } # 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 10 /bin/sh. echo '/* dummy */' > 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= 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } 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" MAKE="${MAKE-make}" _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"" || { # Older Autoconf 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. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; 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.16/watchdog.80000644000175000017500000003645613650524716014753 0ustar michaelmichael.TH WATCHDOG 8 "February 2019" .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 Is there enough allocatable 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_DEBUG. 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. You can use this twice to enable some more verbose debug message for testing. .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. Now this is implemented by disabling the error re-try timer. .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. Without this option these values are sanity checked. .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. NOTE: This still allows 'repair' actions to run, but the daemon itself will not attempt a reboot. .TP .BR \-X " \fInum\fR, " \-\-loop\-exit " \fInum" Run for 'num' loops then exit as if SIGTERM was received. Intended for test/debug (e.g. using .B valgrind for checking memory access). If the daemon exits on a loop counter and you have the .I CONFIG_WATCHDOG_NOWAYOUT option compiled for the kernel or device-driver then an unplanned reboot will follow - be warned! .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. .B watchdog will sleep for a configure interval that defaults to 1 second to make sure 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 machine with temperature sensor(s) you can specify the maximal allowed temperature. Once this temperature is reached on any sensor the system is powered off. The default value is 90 C. Typically the temperature information is provided by the .B sensors package as files in the virtual filesystem /sys/device and can be found using, for example, the command find /sys -name 'temp*input' -print These files hold the temperature in milli-Celsius. You can have multiple sensors used in the config file. For example to change to 75C maximum and to check two virtual files for the system temperature you might have this: max-temperature = 75 temperature-sensor = /sys/class/hwmon/hwmon0/device/temp1_input temperature-sensor = /sys/class/hwmon/hwmon0/device/temp2_input The .B watchdog will issue warnings once the temperature increases 90%, 95% and 98% of the configured maximum 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 the re-try time-out value (default 1 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 IPv4 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 occurred 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. .PP The re-try timer applies to most errors, except reset/reboot calls and too hot. It allows a given error source to recover, and treats most tests in this way. Exceptions are file handle test, load averages, and system memory. If set to the minimum time of 1 second it will still allow a single re-try at any polling interval of the system. .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 .IP 8. 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 exit code smaller than 245 is interpreted as an system error code (see .I errno.h for details). Values of 245 or larger than are special to .BR watchdog : .TP 255 (based on \-1 as unsigned 8\-bit number) Reboot the system. This is not exactly an error message but a command to .BR watchdog . If the return code is this the .B watchdog will not try to run a shutdown script instead. .TP 254 Reset the system. This is not exactly an error message but a command to .BR watchdog . If the return code is this the .B watchdog will attempt to hard-reset the machine without attempting any sort of orderly stopping of process, unmounting of file systems, etc. .TP 253 Maximum load average exceeded. .TP 252 The temperature inside is too high. .TP 251 .I /proc/loadavg contains no (or not enough) data. .TP 250 The given file was not changed in the given interval. .TP 249 .I /proc/meminfo contains invalid data. .TP 248 Child process was killed by a signal. .TP 247 Child process did not return in time. .TP 246 Free for personal watchdog-specific use (was \-10 as an unsigned 8\-bit number). .TP 245 Reserved for an unknown result, for example a slow background test that is still running so neither a success nor an error. .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. The configuration file parameter .B repair-maximum controls the number of successive repair attempts that report 0 (i.e. success) but fail to clear the tested fault. If this is exceeded then a reboot takes place. If set to zero then a reboot can always be blocked by the repair program reporting success. .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). 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. As for the repair binary, the configuration parameter .B repair-maximum also controls the number of successive repair attempts that report success (return 0) but fail to clear the fault. .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.16/create_tarball.sh0000644000175000017500000000107013650524716016342 0ustar michaelmichael#!/bin/sh # start this script inside the watchdog source tree to create a releasable tarball major=`grep MAJOR_VERSION= configure.ac | cut -f2 -d"="` minor=`grep MINOR_VERSION= configure.ac | 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.16/watchdog.conf.50000644000175000017500000002510613650524716015662 0ustar michaelmichael.TH WATCHDOG.CONF 5 "February 2019" .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 highest possible interval between two writes to the watchdog device. The device is triggered after each check regardless of the time it took. After finishing all checks watchdog goes to sleep for a full cycle of seconds. Default value is 1 second. The kernel drivers typically expects a write command every minute otherwise the system will be rebooted. Therefore an interval of more than a minute can only be used with the force command-line option [\-\-force | \-f]. .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 interval 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 set this parameter too low. To set a value less then the predefined minimal value of 2, you have to use the \-f command line 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 command line 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 command line option. .TP min-memory = Set the minimal amount of memory that has to stay free. Note that this is in memory pages (4kB on x86). Default value is 0 pages which means this test is disabled. The page size is taken from the system include files. The usable memory is computed from MemFree + Buffers + Cached since buffer and cache use typically expand to use most free memory but the kernel will reclaim this as needed. NOTE: If this measure gets below a few tens of MB then the system will page swap aggressively have poorer file system performance due to the lack of caching. This is a 'passive' test and works by reading /proc/meminfo .TP allocatable-memory = Set the minimum amount of allocatable memory available on the system. Note that this is in pages. Default value is 0 pages which means the test is disabled. As with min-memory, the page size is taken from the system include files. This is an 'active' test and it works by attempting to memory-map a block of the configured size. .TP max-swap = Set the maximum amount of swap use. Note that this is in memory pages (4kB on x86). Default value is 0 pages which means this test is disabled. Often this should be a large portion of available swap, but remember that paging 1GB of swap can take several/tens of seconds. This is a 'passive' test and works by reading /proc/meminfo .TP watchdog-device = Set the watchdog device name, typically /dev/watchdog. Default is to disable keep alive support. This should be tested by running the daemon from the command line before configuring it to start automatically on booting. .TP watchdog-refresh-use-settimeout = Refresh watchdog timer by setting its timeout instead of using a normal watchdog refresh operation. Might help if your watchdog trips by itself when the first timeout interval elapses. Default is 'auto' for IT87 fix-up but this can be disabled with 'no' or forced for other modules with 'yes'. .TP watchdog-refresh-ignore-errors = Ignore errors reported by writing to the watchdog device. Typically this is used for systems that have broken implementations of the IPMI driver to avoid a reboot loop. .TP watchdog-timeout = Set the watchdog device timeout during startup. If not set, a default is used that should be set to the kernel timer margin at compile time. .TP temperature-sensor = Set the temperature sensor name. This is normally a 'virtual file' under /sys and it contains the temperature in milli-Celsius. Usually these are generated by the .B sensors package, but take care as device enumeration may not be fixed. Default is to disable temperature checking. Multiple sensors can be used by having repeated temperature-sensor entries. Due to the enumeration problem any missing temp sensor is simply ignored and not treated as a reboot trigger. .TP max-temperature = Set the maximal allowed temperature in Celsius. Once this temperature is reached the system is stopped. Default value is 90 C. Watchdog will issue warnings once the temperature increases 90%, 95% and 98% of this temperature. .TP temp-power-off = Set the watchdog action on overheating. Yes option (default) is to power the machine off, no option is to halt machine and allow Ctrl-Alt-Del reboot. .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 necessarily 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 daemon test mode. This option can be given as often as you like to check several daemons, assuming they write their post-forking PID to the specified files. .TP ping = Set IPv4 address for ping mode. This option can be used more than once to check different connections. .TP ping-count = Set the number of ping attempts in each 'interval' of time. Default is 3 and it completes on the first successful ping. .TP interface = Set interface name for network mode. This option can be used more than once to check different interfaces. Note it is only possible to check physical interfaces, and not aliased IP 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', but note that the hardware timer is not refreshed in this case so the system will hard-reset at some point. .TP retry-timeout = Allow most error conditions to persist for seconds. Set to 0 for immediate action (like softboot behaviour). .TP repair-maximum = This allows no more then repair attempts against a given fault that report success (i.e. return 0), but fail to clear the fault, before a reboot is initiated anyway. If set to zero then a repairable fault can always be blocked by a repair program reporting success (previous daemon behaviour). .TP softboot-option = This acts like the \-b / \-\-softboot command line and simply sets the retry timeout to zero. .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 passed to sched_setscheduler(). .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'. .TP sigterm-delay =