xref: /netbsd-src/share/man/man9/panic.9 (revision 4b075bd22c61b9a6a08d29bd622e75c503611487)
1*4b075bd2Sgutteridge.\"     $NetBSD: panic.9,v 1.23 2019/10/04 21:55:00 gutteridge Exp $
23e8ed4beSexplorer.\"
37ba2798fSexplorer.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
43e8ed4beSexplorer.\" All rights reserved.
53e8ed4beSexplorer.\"
67ba2798fSexplorer.\" This code is derived from software contributed to The NetBSD Foundation
77ba2798fSexplorer.\" Michael Graff.
87ba2798fSexplorer.\"
93e8ed4beSexplorer.\" Redistribution and use in source and binary forms, with or without
103e8ed4beSexplorer.\" modification, are permitted provided that the following conditions
113e8ed4beSexplorer.\" are met:
123e8ed4beSexplorer.\" 1. Redistributions of source code must retain the above copyright
133e8ed4beSexplorer.\"    notice, this list of conditions and the following disclaimer.
143e8ed4beSexplorer.\" 2. Redistributions in binary form must reproduce the above copyright
153e8ed4beSexplorer.\"    notice, this list of conditions and the following disclaimer in the
163e8ed4beSexplorer.\"    documentation and/or other materials provided with the distribution.
173e8ed4beSexplorer.\"
187ba2798fSexplorer.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
197ba2798fSexplorer.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
207ba2798fSexplorer.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
217ba2798fSexplorer.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
227ba2798fSexplorer.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
237ba2798fSexplorer.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
247ba2798fSexplorer.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
257ba2798fSexplorer.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
267ba2798fSexplorer.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
277ba2798fSexplorer.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
287ba2798fSexplorer.\" POSSIBILITY OF SUCH DAMAGE.
293e8ed4beSexplorer.\"
30*4b075bd2Sgutteridge.Dd October 4, 2019
314d3eeec1Sexplorer.Dt PANIC 9
324d3eeec1Sexplorer.Os
334d3eeec1Sexplorer.Sh NAME
344d3eeec1Sexplorer.Nm panic
35fbff87caSjdf.Nd bring down system on fatal error
364d3eeec1Sexplorer.Sh SYNOPSIS
37472351e1Swiz.In sys/types.h
38472351e1Swiz.In sys/systm.h
394d3eeec1Sexplorer.Ft void
40ce9eaca5Schristos.Fn vpanic "const char *fmt" "va_list ap"
41ce9eaca5Schristos.Ft void
421715ae66Swiz.Fn panic "const char *fmt" "..."
434d3eeec1Sexplorer.Sh DESCRIPTION
444d3eeec1SexplorerThe
454d3eeec1Sexplorer.Fn panic
46ce9eaca5Schristosand
47ce9eaca5Schristos.Fn vpanic
48ce9eaca5Schristosfunctions terminate the
4934a98169Sperry.Nx
50f69a99eeSjeremysystem.
51f69a99eeSjeremyThe message
524d3eeec1Sexplorer.Fa fmt
534d3eeec1Sexploreris a
544d3eeec1Sexplorer.Xr printf 3
55f69a99eeSjeremystyle format string which is printed to the console and saved in the
56f69a99eeSjeremyvariable
57f69a99eeSjeremy.Va panicstr
581fe6e484Sjhawkfor later retrieval via core dump inspection.
59062d0b32SwizA newline character is added at the end automatically, and is thus
60062d0b32Swiznot needed in the format string.
614d3eeec1Sexplorer.Pp
62f69a99eeSjeremyIf a kernel debugger is installed, control is passed to it after the
63062d0b32Swizmessage is printed.
64062d0b32SwizIf the kernel debugger is
651fe6e484Sjhawk.Xr ddb 4 ,
6604ceeecfSdarrenrcontrol may be passed to it, depending on the value of
6704ceeecfSdarrenr.Em ddb.onpanic .
6804ceeecfSdarrenrSee
6904ceeecfSdarrenr.Xr options 4
7004ceeecfSdarrenrfor more details on setting
7104ceeecfSdarrenr.Em ddb.onpanic .
7204ceeecfSdarrenrIf control is not passed through to
7304ceeecfSdarrenr.Xr ddb 4 ,
7404ceeecfSdarrenra
75062d0b32Swiz.Xr ddb 4 Ns -specific
761fe6e484Sjhawkfunction is used to print the kernel stack trace, and then control returns
771fe6e484Sjhawkto
781fe6e484Sjhawk.Fn panic .
791fe6e484Sjhawk.Pp
801fe6e484SjhawkIf control remains in
811fe6e484Sjhawk.Fn panic ,
821fe6e484Sjhawkan attempt is made to save an image of system memory on the
8320353052Sjdolecekconfigured dump device.
844d3eeec1Sexplorer.Pp
85f69a99eeSjeremyIf during the process of handling the panic,
864d3eeec1Sexplorer.Fn panic
87f69a99eeSjeremyis called again
88062d0b32Swiz.Pq from the filesystem synchronization routines, for example ,
89f69a99eeSjeremythe system is rebooted immediately without synchronizing any filesystems.
9024af9330Schristos.Pp
9124af9330Schristos.Fn panic
9224af9330Schristosis meant to be used in situations where something unexpected has happened
9324af9330Schristosand it is difficult to recover the system to a stable state, or in
94fbff87caSjdfsituations where proceeding might make things worse, leading to data
95fbff87caSjdfcorruption and/or loss.
9624af9330SchristosIt is not meant to be used in scenarios where the system could easily
9724af9330Schristosignore and/or isolate the condition/subsystem and proceed.
9824af9330Schristos.Pp
9924af9330SchristosIn general developers should try to reduce the number of
10024af9330Schristos.Fn panic
10124af9330Schristoscalls in the kernel to improve stability.
1024d3eeec1Sexplorer.Sh RETURN VALUES
1034d3eeec1SexplorerThe
1044d3eeec1Sexplorer.Fn panic
105fbff87caSjdffunction never returns.
106f69a99eeSjeremy.Sh SEE ALSO
107*4b075bd2Sgutteridge.Xr printf 3 ,
1081fe6e484Sjhawk.Xr sysctl 3 ,
1091fe6e484Sjhawk.Xr ddb 4 ,
110f69a99eeSjeremy.Xr options 4 ,
1111fe6e484Sjhawk.Xr savecore 8 ,
1128a84fcd9Swiz.Xr swapctl 8 ,
113*4b075bd2Sgutteridge.Xr sysctl 8 ,
114*4b075bd2Sgutteridge.Xr printf 9
115