aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2008-03-05 18:32:58 +0000
committerBrooks Davis <brooks@FreeBSD.org>2008-03-05 18:32:58 +0000
commitae2edb2af1f05163eadd3ad1998af8adb22001a9 (patch)
treee832b8461ba906f164938e2ac47ee22f8f876cfa /etc
parent544b955a471cdce7880362aca347ff0e85d01668 (diff)
downloadsrc-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
Diffstat (limited to 'etc')
-rw-r--r--etc/Makefile2
-rw-r--r--etc/ddb.conf15
-rw-r--r--etc/defaults/rc.conf2
-rwxr-xr-xetc/rc.d/Makefile2
-rw-r--r--etc/rc.d/ddb32
5 files changed, 51 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"