108 lines
2.9 KiB
Groff
108 lines
2.9 KiB
Groff
.\" $NetBSD: crashme.9,v 1.2 2019/01/09 09:48:44 wiz Exp $
|
|
.\"
|
|
.\" Copyright (c) 2019 Matthew R. Green
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. The name of the author may not be used to endorse or promote products
|
|
.\" derived from this software without specific prior written permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.Dd January 7, 2019
|
|
.Dt CRASHME 9
|
|
.Os
|
|
.Sh NAME
|
|
.Nm crashme ,
|
|
.Nm crashme_add ,
|
|
.Nm crashme_remove
|
|
.Nd in-kernel testing of crash handling
|
|
.Sh SYNOPSIS
|
|
.In sys/crashme.h
|
|
.Ft int
|
|
.Fn crashme_add "crashme_node *cn"
|
|
.Ft int
|
|
.Fn crashme_remove "crashme_node *cn"
|
|
.Sh DESCRIPTION
|
|
The
|
|
.Nm
|
|
functions provide access to dynamically add and remove crashme nodes.
|
|
These nodes are simply named callbacks that are expected to cause the
|
|
system to crash.
|
|
.Pp
|
|
The crashme functionality is only available in kernels with the
|
|
.Xr options 4
|
|
.Dv DEBUG
|
|
option set.
|
|
.Pp
|
|
Each crashme node is maintained in a
|
|
.Vt crashme_node
|
|
structure which has the following public members:
|
|
.Bd -literal
|
|
typedef int (*crashme_fn)(int);
|
|
|
|
typedef struct crashme_node {
|
|
const char *cn_name;
|
|
const char *cn_longname;
|
|
crashme_fn cn_fn;
|
|
} crashme_node;
|
|
.Ed
|
|
.Pp
|
|
The
|
|
caller must fill in the
|
|
.Fa cn_name ,
|
|
.Fa cn_longname ,
|
|
and
|
|
.Fa cn_fn
|
|
members.
|
|
.Pp
|
|
The
|
|
.Ar flags
|
|
parameter is passed from sysctl.
|
|
The return value is 0 upon success or non zero for failure.
|
|
.Sh SYSCTL SUPPORT
|
|
The following
|
|
.Xr sysctl 8
|
|
variables are provided by the
|
|
.Nm
|
|
subsystem:
|
|
.Bl -tag -width "123456" -offset indent
|
|
.It Ic debug.crashme_enable
|
|
Must be set to 1 for any
|
|
.Nm
|
|
node to be executed.
|
|
.It Ic debug.crashme.panic
|
|
Basic panic node.
|
|
.It Ic debug.crashme.null_deref
|
|
Dereference
|
|
.Dv NULL
|
|
node.
|
|
.El
|
|
.Sh SEE ALSO
|
|
.Xr options 4 ,
|
|
.Xr panic 9
|
|
.Sh HISTORY
|
|
The
|
|
.Nm
|
|
driver appeared in
|
|
.Nx 9.0 .
|
|
.Sh AUTHORS
|
|
.An Matthew R. Green
|