Switch the default value (if no options DDB_ONPANIC is defined) for

ddb.onpanic to 1, change it back to 0 in sysctl.conf and make sure
postinstall installs this setting.
This avoids us trying to dump while booting from install CD, but keeps
the default the same once we are far enough through /etc/rc.d. Failing
earlier is unlikely to be recovered by an automatic reboot.
OK: core.
This commit is contained in:
martin 2009-03-11 23:22:57 +00:00
parent 9b750ed7d6
commit 7d53797861
3 changed files with 42 additions and 5 deletions

View File

@ -1,9 +1,17 @@
#!/sbin/sysctl -f
#
# $NetBSD: sysctl.conf,v 1.5 2003/11/03 15:12:06 briggs Exp $
# $NetBSD: sysctl.conf,v 1.6 2009/03/11 23:22:57 martin Exp $
#
# sysctl(8) variables to set at boot time.
# Default on panic: dump core and reboot. See savecore(8) for information.
# Switch this to 1 if you want to enter the kernel debugger on crashes
# instead. See ddb(4) for an introduction and also try the "help" command
# at the db> prompt.
# If you understand the implication and want to change the behaviour before
# /etc/rc.d/sysctl is run, use the kernel option DDB_ONPANIC, see options(4).
ddb.onpanic=0
# Default core name template:
#kern.defcorename=%n.core

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_variables.c,v 1.41 2009/03/07 22:02:17 ad Exp $ */
/* $NetBSD: db_variables.c,v 1.42 2009/03/11 23:22:57 martin Exp $ */
/*
* Mach Operating System
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_variables.c,v 1.41 2009/03/07 22:02:17 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_variables.c,v 1.42 2009/03/11 23:22:57 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddbparam.h"
@ -46,7 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_variables.c,v 1.41 2009/03/07 22:02:17 ad Exp $")
* panics. Initialize it so that it's patchable.
*/
#ifndef DDB_ONPANIC
#define DDB_ONPANIC 0
#define DDB_ONPANIC 1
#endif
int db_onpanic = DDB_ONPANIC;

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: postinstall,v 1.90 2009/02/26 10:32:43 apb Exp $
# $NetBSD: postinstall,v 1.91 2009/03/11 23:22:57 martin Exp $
#
# Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
# All rights reserved.
@ -662,6 +662,35 @@ do_bluetooth()
return ${failed}
}
#
# ddbonpanic
#
additem ddbonpanic "verify ddb.onpanic is configured in sysctl.conf"
do_ddbonpanic()
{
[ -n "$1" ] || err 3 "USAGE: do_ddbonpanic fix|check"
if ${GREP} -E '^[[:space:]]*ddb\.onpanic[[:space:]]*=[[:space:]]*[[:digit:]]+' \
"${DEST_DIR}/etc/sysctl.conf" >/dev/null 2>&1
then
result=0
else
if [ "$1" = check ]; then
msg \
"The ddb.onpanic behaviour is not explicitly specified in /etc/sysctl.conf"
result=1
else
echo >> "${DEST_DIR}/etc/sysctl.conf"
sed < "${SRC_DIR}/etc/sysctl.conf" \
-e '/^ddb\.onpanic/q' | \
sed -e '1,/^$/d' >> \
"${DEST_DIR}/etc/sysctl.conf"
result=$?
fi
fi
return ${result}
}
#
# defaults
#