diff options
author | Brooks Davis <brooks@FreeBSD.org> | 2008-03-05 18:32:58 +0000 |
---|---|---|
committer | Brooks Davis <brooks@FreeBSD.org> | 2008-03-05 18:32:58 +0000 |
commit | ae2edb2af1f05163eadd3ad1998af8adb22001a9 (patch) | |
tree | e832b8461ba906f164938e2ac47ee22f8f876cfa | |
parent | 544b955a471cdce7880362aca347ff0e85d01668 (diff) | |
download | src-ae2edb2af1f05163eadd3ad1998af8adb22001a9.tar.gz src-ae2edb2af1f05163eadd3ad1998af8adb22001a9.zip |
Use the new command file feature of ddb(8) to support setting ddb(4)
scripts at boot. This is currently disabled by default. /etc/ddb.conf
contains some potentially reasonable default scripts.
PR: conf/119995
Submitted by: Scot Hetzel <swhetzel at gmail dot com> (Earlier version)
X-MFC after: textdumps
Notes
Notes:
svn path=/head/; revision=176835
-rw-r--r-- | etc/Makefile | 2 | ||||
-rw-r--r-- | etc/ddb.conf | 15 | ||||
-rw-r--r-- | etc/defaults/rc.conf | 2 | ||||
-rwxr-xr-x | etc/rc.d/Makefile | 2 | ||||
-rw-r--r-- | etc/rc.d/ddb | 32 | ||||
-rw-r--r-- | share/man/man5/rc.conf.5 | 13 |
6 files changed, 64 insertions, 2 deletions
diff --git a/etc/Makefile b/etc/Makefile index 9745a1574f42..1fef1ff5243b 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -9,7 +9,7 @@ SUBDIR= sendmail BIN1= amd.map apmd.conf auth.conf \ crontab csh.cshrc csh.login csh.logout devd.conf devfs.conf \ - dhclient.conf disktab fbtab freebsd-update.conf \ + ddb.conf dhclient.conf disktab fbtab freebsd-update.conf \ ftpusers gettytab group \ hosts hosts.allow hosts.equiv hosts.lpd \ inetd.conf libalias.conf login.access login.conf mac.conf motd \ diff --git a/etc/ddb.conf b/etc/ddb.conf new file mode 100644 index 000000000000..a793705c6585 --- /dev/null +++ b/etc/ddb.conf @@ -0,0 +1,15 @@ +# $FreeBSD$ +# +# This file is read when going to multi-user and its contents piped thru +# ``ddb'' to define debugging scripts. +# +# see ``man 4 ddb'' and ``man 8 ddb'' for details. +# + +script lockinfo=show locks; show alllocks; show lockedvnods + +# kdb.enter.panic panic(9) was called. +script kdb.enter.panic=textdump set; capture on; run lockinfo; show pcpu; bt; ps; alltrace; capture off; call doadump; reset + +# kdb.enter.witness witness(4) detected a locking error. +script kdb.enter.witness=run lockinfo diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf index 195facdcc395..1fc03682d7e8 100644 --- a/etc/defaults/rc.conf +++ b/etc/defaults/rc.conf @@ -33,6 +33,8 @@ swapfile="NO" # Set to name of swapfile if aux swapfile desired. apm_enable="NO" # Set to YES to enable APM BIOS functions (or NO). apmd_enable="NO" # Run apmd to handle APM event from userland. apmd_flags="" # Flags to apmd (if enabled). +ddb_enable="NO" # Set to YES to load ddb scripts at boot. +ddb_config="/etc/ddb.conf" # ddb(8) config file. devd_enable="YES" # Run devd, to trigger programs on device tree changes. devd_flags="" # Additional flags for devd(8). kldxref_enable="NO" # Build linker.hints files with kldxref(8). diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile index 36269159ff51..aa094f683639 100755 --- a/etc/rc.d/Makefile +++ b/etc/rc.d/Makefile @@ -7,7 +7,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKING SERVERS \ apm apmd archdep atm1 atm2 atm3 auditd auto_linklocal \ bgfsck bluetooth bootparams bridge bsnmpd bthidd \ ccd cleanvar cleartmp cron \ - devd devfs dhclient \ + ddb devd devfs dhclient \ dmesg dumpon \ early.sh encswap \ fsck ftp-proxy ftpd \ diff --git a/etc/rc.d/ddb b/etc/rc.d/ddb new file mode 100644 index 000000000000..f4d34b198b45 --- /dev/null +++ b/etc/rc.d/ddb @@ -0,0 +1,32 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: ddb +# REQUIRE: dumpon +# BEFORE: disks savecore initrandom +# KEYWORD: nojail + +. /etc/rc.subr + +name="ddb" +rcvar=`set_rcvar` +command="/sbin/${name}" +start_precmd="ddb_prestart" +stop_cmd=":" + +ddb_prestart() +{ + # Silently exit if ddb is not enabled + if [ -z "`sysctl -Nq debug.ddb.scripting.scripts`" ]; then + return 1 + fi +} + +load_rc_config $name + +required_files="${ddb_config}" +command_args="${ddb_config}" + +run_rc_command "$1" diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index af6506bdc138..3c7b67af897b 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -164,6 +164,19 @@ daemon. Run .Xr devd 8 to handle device added, removed or unknown events from the kernel. +.It Va ddb_enable +.Pq Vt bool +Run +.Xr ddb 8 +to install +.Xr ddb 4 +scripts at boot time. +.It Va ddb_config +.Pq Vt str +Configuration file for +.Xr ddb 8 . +Default +.Pa /etc/ddb.conf . .It Va kldxref_enable .Pq Vt bool Set to |