diff options
author | smkelly <smkelly@FreeBSD.org> | 2003-07-03 03:37:04 +0000 |
---|---|---|
committer | smkelly <smkelly@FreeBSD.org> | 2003-07-03 03:37:04 +0000 |
commit | a83c8ff2e2d64ba020376027cf3e757dde490810 (patch) | |
tree | 1950d40c387fe7125df51d651974e338cc8e11ee /usr.sbin/watchdogd | |
parent | 9e382c20d57cf40ce63ac00b0568b7c203ed16b1 (diff) | |
download | FreeBSD-src-a83c8ff2e2d64ba020376027cf3e757dde490810.zip FreeBSD-src-a83c8ff2e2d64ba020376027cf3e757dde490810.tar.gz |
o style(9) fixes
- Reordered #includes
- Only include <sys/types.h>, not it and <sys/cdefs.h>
o style.Makefile(5) fixes
- No SRCS= line when only one src file with same name as program
o Use warn()/errx() instead of fprintf()
- Integrated patch from Philippe Charnier <charnier@xp11.frmug.org>
Approved by: jeff (mentor)
Diffstat (limited to 'usr.sbin/watchdogd')
-rw-r--r-- | usr.sbin/watchdogd/Makefile | 7 | ||||
-rw-r--r-- | usr.sbin/watchdogd/watchdogd.c | 21 |
2 files changed, 11 insertions, 17 deletions
diff --git a/usr.sbin/watchdogd/Makefile b/usr.sbin/watchdogd/Makefile index bc8bfd2..e7c5674 100644 --- a/usr.sbin/watchdogd/Makefile +++ b/usr.sbin/watchdogd/Makefile @@ -1,8 +1,7 @@ # $FreeBSD$ -PROG= watchdogd -SRCS= watchdogd.c -MAN= watchdogd.8 -WARNS= 6 +PROG= watchdogd +MAN= watchdogd.8 +WARNS= 6 .include <bsd.prog.mk> diff --git a/usr.sbin/watchdogd/watchdogd.c b/usr.sbin/watchdogd/watchdogd.c index cfee0eb..c536734 100644 --- a/usr.sbin/watchdogd/watchdogd.c +++ b/usr.sbin/watchdogd/watchdogd.c @@ -28,24 +28,21 @@ * Software watchdog daemon. */ -#include <sys/cdefs.h> +#include <sys/types.h> __FBSDID("$FreeBSD$"); -#include <sys/types.h> -#include <sys/errno.h> -#include <sys/sysctl.h> -#include <sys/time.h> #include <sys/rtprio.h> #include <sys/stat.h> +#include <sys/sysctl.h> +#include <sys/time.h> #include <err.h> #include <paths.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> -#include <string.h> #include <sysexits.h> #include <unistd.h> -#include <signal.h> static void parseargs(int, char *[]); static void sighandler(int); @@ -82,7 +79,7 @@ main(int argc, char *argv[]) err(EX_OSERR, "rtprio"); if (watchdog_init() == -1) - exit(EX_SOFTWARE); + errx(EX_SOFTWARE, "unable to initialize watchdog"); if (watchdog_onoff(1) == -1) exit(EX_SOFTWARE); @@ -133,8 +130,7 @@ watchdog_init() error = sysctlnametomib("debug.watchdog.reset", reset_mib, &reset_miblen); if (error == -1) { - fprintf(stderr, "Could not find reset OID: %s\n", - strerror(errno)); + warn("could not find reset OID"); return (error); } return watchdog_tickle(); @@ -189,9 +185,8 @@ watchdog_onoff(int onoff) error = sysctl(mib, len, NULL, NULL, &onoff, sizeof(onoff)); if (error == -1) { - fprintf(stderr, "Could not %s watchdog: %s\n", - (onoff > 0) ? "enable" : "disable", - strerror(errno)); + warn("could not %s watchdog", + (onoff > 0) ? "enable" : "disable"); return (error); } return (0); |