summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--share/man/man5/rc.conf.513
6 files changed, 64 insertions, 2 deletions
diff --git a/etc/Makefile b/etc/Makefile
index 9745a15..1fef1ff 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 0000000..a793705
--- /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 195facd..1fc0368 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 3626915..aa094f6 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 0000000..f4d34b1
--- /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 af6506b..3c7b67a 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
OpenPOWER on IntegriCloud