Commit Graph

46 Commits

Author SHA1 Message Date
alfred
075cac9cbd Fix bug in r253719: fix command line watchdog disable.
r253719 disallowed watchdog(8) from disabling the watchdog
by breaking the ability to pass 0 as a timeout arg.  Fix this.
2013-08-10 01:48:15 +00:00
jhb
82720cf8ad Apply a casting sledgehammer.
Submitted by:	dhw
2013-07-30 16:20:54 +00:00
ian
430fe32cc6 Fix printf of seconds for systems where time_t is 64 bits. 2013-07-28 16:56:31 +00:00
joel
526b0b7d6d mdoc and language improvements. 2013-07-28 06:15:25 +00:00
alfred
6b7d3341e2 Provide some examples for watchdogd usage. 2013-07-27 22:23:32 +00:00
alfred
fdd68bea0e Fix watchdog pretimeout.
The original API calls for pow2ns, however the new APIs from
Linux call for seconds.

We need to be able to convert to/from 2^Nns to seconds in both
userland and kernel to fix this and properly compare units.
2013-07-27 20:47:01 +00:00
ed
e2882f4306 Mark the act_tbl static/const.
This table is only used within this source file and is only accessed
read-only.

MFC after:	1 week
2013-04-08 08:05:15 +00:00
markj
b664987a1a Invert the meaning of -S (added in r247405) and document its meaning. Also,
don't carp about the watchdog command taking too long until after the
watchdog has been patted, and don't carp via warnx(3) unless -S is set
since syslog(3) already logs to standard error otherwise.

Discussed with:	alfred
Reviewed by:	alfred
Approved by:	emaste (co-mentor)
2013-03-26 19:43:18 +00:00
joel
4422c2240b Remove EOL whitespace. 2013-02-27 20:16:30 +00:00
joel
2f5ad9a3d9 mdoc: begin sentence on new line. 2013-02-27 20:15:06 +00:00
alfred
743bccf1ec watchdogd(8) and watchdog(4) enhancements.
The following support was added to watchdog(4):
- Support to query the outstanding timeout.
- Support to set a software pre-timeout function watchdog with an 'action'
- Support to set a software only watchdog with a configurable 'action'

'action' can be a mask specifying a single operation or a combination of:
 log(9), printf(9), panic(9) and/or kdb_enter(9).

Support the following in watchdogged:
- Support to utilize the new additions to watchdog(4).
- Support to warn if a watchdog script runs for too long.
- Support for "dry run" where we do not actually arm the watchdog,
  but only report on our timing.

Sponsored by:   iXsystems, Inc.
MFC after:      1 month
2013-02-27 19:03:31 +00:00
ian
2c49431420 Revert accidental regression to previous misspelling.
Approved by:	cognet (mentor)
2013-01-26 22:02:40 +00:00
ian
fc60ef94da Reduce watchdogd's memory footprint when running daemonized.
This uses the recently-added jemalloc(3) feature of setting the lg_chunk
tuning option to zero to request that memory be allocated in the smallest
chunks possible.  Without this option, the default is to initally map 8MB,
and then the mlockall() call wires that entire allocation even though the
program only uses a few Kbytes of it at runtime.

PR:		bin/173332
Approved by:	cognet (mentor)
2013-01-26 21:29:45 +00:00
alfred
42ff7995ba Spelling: exitting -> exiting
MFC after:	2 weeks
2013-01-18 02:36:06 +00:00
delphij
8dbd4c35e8 Replace log(3) with flsll(3) for watchdogd(8) and drop libm dependency.
MFC after:	2 weeks
2012-11-03 18:38:28 +00:00
zont
2d3909f027 - It's also need to lock current memory.
Approved by:	kib (mentor)
MFC after:	1 week
2012-08-30 08:07:37 +00:00
zont
aae8be3bc8 - Don't allow watchdogd(8) to be swapped out.
On machines with huge amount of swap and high IO activity,
  watchdogd(8) may wait for a swap memory longer than timeout and
  sometimes fires.

Approved by:	kib (mentor)
MFC after:	1 week
2012-08-28 08:38:53 +00:00
emaste
a774d4e29c Protect the watchdog daemon against swap OOM killer. This is similar to
SVN r199804 which added protection to sshd, cron, syslogd, and inetd.
2010-09-26 01:45:33 +00:00
delphij
fd28c2f495 Staticify local variables.
While I'm there also add a 'static' keyword for a function to make it
consistent with prototype.

Reviewed by:	phk
MFC after:	3 months
2010-07-20 17:42:13 +00:00
ed
073cafdd42 The last big commit: let usr.sbin/ use WARNS=6 by default. 2010-01-02 11:07:44 +00:00
ed
b9ca89bfc4 ANSIfy almost all applications that use WARNS=6.
I was considering committing all these patches one by one, but as
discussed with brooks@, there is no need to do this. If we ever
need/want to merge these changes back, it is still possible to do this
per application.
2009-12-29 22:53:27 +00:00
ru
d2993e53cd Don't hide an error if the initial attempt to program a watchdog from
within watchdogd(8) fails.  This is also consistent with watchdog(8).
2009-12-21 15:50:37 +00:00
n_hibma
22a6932ccb Don't exit from watchdogd on receiving a signal if we cannot stop the watchdog.
That'll require -KILL. This avoids resetting your system on one of the
watchdogs that you cannot disable.
2006-12-15 22:47:36 +00:00
ru
081fcce9b9 Markup fixes. 2006-09-29 17:57:04 +00:00
phk
8200abddc7 Document that the default timeout is 16 seconds 2006-09-02 09:11:58 +00:00
phk
00fe269292 Fix usage().
Submitted by:	Adrian Steinmann <ast@marabu.ch>
2006-03-06 07:42:52 +00:00
phk
f6f17c1957 Report any errors we might see when disabling the watchdog.
Complain about extra arguments so people don't get surprised
if they type "watchdog 0"
2005-09-30 08:30:20 +00:00
pjd
c71407b589 Pidfiles should be created with permission preventing users from opening
them for reading. When user can open file for reading, he can also
flock(2) it, which can lead to confusions.

Pointed out by:	green
2005-09-16 11:24:28 +00:00
pjd
9de6caadfa Use pidfile(3) in watchdogd(8). 2005-08-24 19:28:33 +00:00
marius
8581a4176e When disarming a watchdog by using an interval of WD_TO_NEVER a non-zero
return value of the ioctl doesn't indicate that the command has failed
so don't let watchdog(8) return an error in this case.

MFC after:	3 days
2005-03-19 01:46:37 +00:00
ru
c05985f13f Sort sections. 2005-01-18 20:02:45 +00:00
green
f63839abf8 Disable memory locking that could keep watchdogd from deadlocking itself
if the swap subsystem failed.

Requested by:	phk
2004-07-28 22:13:04 +00:00
green
296061987a Now that mlockall(2) is unbroken, use it to keep watchdogd(8) permanently
out of swap.
2004-07-23 15:24:57 +00:00
ru
9f45c1d92e mdoc(7) fixes. 2004-07-07 19:57:16 +00:00
phk
64fb1c58d5 Document -d flag 2004-06-14 07:27:27 +00:00
ru
dc54ee200d Assorted markup, grammar, and spelling fixes. 2004-06-13 18:03:44 +00:00
smkelly
faf8cf3425 Bump the copyright year since I forgot last time. 2004-05-03 21:41:02 +00:00
smkelly
0de7ed8ede Update comments to reflect changes made by phk. Also no longer need
<sys/sysctl.h>.
2004-04-28 07:35:03 +00:00
simon
b48fc012b6 mdoc(7) janitor:
- Sort SEE ALSO by section number.
- Remove redundant ','.
2004-04-25 14:13:48 +00:00
simon
76fc89f312 mdoc(7) janitor:
- Remove EOL whitespace.
- Expand contracted words.
- Correct usage of .Fl macro.
- Use complete argument to -width.
- Remove redundant ','.
2004-04-25 14:09:38 +00:00
phk
1ea4f5b08e Rename the WATCHDOG option to SW_WATCHDOG and make it use the
generic watchdoc(9) interface.

Make watchdogd(8) perform as watchdog(8) as well, and make it
possible to specify a check command to run, timeout and sleep
periods.

Update watchdog(4) to talk about the generic interface and add
new watchdog(8) page.
2004-02-28 20:56:35 +00:00
johan
31854a224a style.Makefile(5):
Use WARNS?= instead of WARNS=.
2004-02-23 20:25:27 +00:00
smkelly
a83c8ff2e2 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)
2003-07-03 03:37:04 +00:00
smkelly
cf65bb428f Unbreak this for alpha and friends.
Double pointy hat to me, or something.
2003-06-26 18:36:57 +00:00
maxim
a70925a0c1 o Fix typo.
Submitted by:	smkelly
2003-06-26 11:24:10 +00:00
smkelly
d45e58ad73 - Add a software watchdog facility.
This commit has two pieces. One half is the watchdog kernel code which lives
primarily in hardclock() in sys/kern/kern_clock.c. The other half is a userland
daemon which, when run, will keep the watchdog from firing while the userland
is intact and functioning.

Approved by:	jeff (mentor)
2003-06-26 09:50:52 +00:00