Module Name: src Committed By: mrg Date: Wed Jan 9 04:02:26 UTC 2019
Added Files: src/share/man/man9: crashme.9 Log Message: document crashme(9) functionality. XXX: install me To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/share/man/man9/crashme.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Added files: Index: src/share/man/man9/crashme.9 diff -u /dev/null src/share/man/man9/crashme.9:1.1 --- /dev/null Wed Jan 9 04:02:26 2019 +++ src/share/man/man9/crashme.9 Wed Jan 9 04:02:26 2019 @@ -0,0 +1,104 @@ +.\" $NetBSD: crashme.9,v 1.1 2019/01/09 04:02:26 mrg 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 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 +Derefence NULL node. +.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 .