1*8269e767SBrooks Davis.\" Copyright (c) 2005 Wojciech A. Koszek <dunstan@FreeBSD.czest.pl> 2*8269e767SBrooks Davis.\" All rights reserved. 3*8269e767SBrooks Davis.\" 4*8269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without 5*8269e767SBrooks Davis.\" modification, are permitted provided that the following conditions 6*8269e767SBrooks Davis.\" are met: 7*8269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright 8*8269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer. 9*8269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright 10*8269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer in the 11*8269e767SBrooks Davis.\" documentation and/or other materials provided with the distribution. 12*8269e767SBrooks Davis.\" 13*8269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14*8269e767SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15*8269e767SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16*8269e767SBrooks Davis.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17*8269e767SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18*8269e767SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19*8269e767SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20*8269e767SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21*8269e767SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22*8269e767SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23*8269e767SBrooks Davis.\" SUCH DAMAGE. 24*8269e767SBrooks Davis.\" 25*8269e767SBrooks Davis.Dd September 30, 2006 26*8269e767SBrooks Davis.Dt ABORT2 2 27*8269e767SBrooks Davis.Os 28*8269e767SBrooks Davis.Sh NAME 29*8269e767SBrooks Davis.Nm abort2 30*8269e767SBrooks Davis.Nd "abort process with diagnostics" 31*8269e767SBrooks Davis.Sh LIBRARY 32*8269e767SBrooks Davis.Lb libc 33*8269e767SBrooks Davis.Sh SYNOPSIS 34*8269e767SBrooks Davis.In stdlib.h 35*8269e767SBrooks Davis.Ft void 36*8269e767SBrooks Davis.Fn abort2 "const char *why" "int nargs" "void **args" 37*8269e767SBrooks Davis.Sh DESCRIPTION 38*8269e767SBrooks DavisThe 39*8269e767SBrooks Davis.Fn abort2 40*8269e767SBrooks Davissystem call causes the process to be killed and the specified diagnostic 41*8269e767SBrooks Davismessage (with arguments) to be delivered by the kernel to the 42*8269e767SBrooks Davis.Xr syslogd 8 43*8269e767SBrooks Davisdaemon. 44*8269e767SBrooks Davis.Pp 45*8269e767SBrooks DavisThe 46*8269e767SBrooks Davis.Fa why 47*8269e767SBrooks Davisargument points to a 48*8269e767SBrooks Davis.Dv NUL- Ns 49*8269e767SBrooks Davisterminated string specifying a reason of the program's termination 50*8269e767SBrooks Davis(maximum 128 characters long). 51*8269e767SBrooks DavisThe 52*8269e767SBrooks Davis.Fa args 53*8269e767SBrooks Davisarray contains pointers which will be logged numerically 54*8269e767SBrooks Davis(with the kernel's 55*8269e767SBrooks Davis.Ql %p 56*8269e767SBrooks Davis.Xr printf 9 57*8269e767SBrooks Davisformat). 58*8269e767SBrooks DavisThe 59*8269e767SBrooks Davis.Fa nargs 60*8269e767SBrooks Davisargument specifies the number of pointers in 61*8269e767SBrooks Davis.Fa args 62*8269e767SBrooks Davis(maximum 16). 63*8269e767SBrooks Davis.Pp 64*8269e767SBrooks DavisThe 65*8269e767SBrooks Davis.Fn abort2 66*8269e767SBrooks Davissystem call 67*8269e767SBrooks Davisis intended for use in situations where continuation of a process 68*8269e767SBrooks Davisis impossible or for other definitive reasons is unwanted, and normal 69*8269e767SBrooks Davisdiagnostic channels cannot be trusted to deliver the message. 70*8269e767SBrooks Davis.Sh RETURN VALUES 71*8269e767SBrooks DavisThe 72*8269e767SBrooks Davis.Fn abort2 73*8269e767SBrooks Davisfunction 74*8269e767SBrooks Davisnever returns. 75*8269e767SBrooks Davis.Pp 76*8269e767SBrooks DavisThe process is killed with 77*8269e767SBrooks Davis.Dv SIGABRT 78*8269e767SBrooks Davisunless the arguments to 79*8269e767SBrooks Davis.Fn abort2 80*8269e767SBrooks Davisare invalid, in which case 81*8269e767SBrooks Davis.Dv SIGKILL 82*8269e767SBrooks Davisis used. 83*8269e767SBrooks Davis.Sh EXAMPLES 84*8269e767SBrooks Davis.Bd -literal -compact 85*8269e767SBrooks Davis#include <stdlib.h> 86*8269e767SBrooks Davis 87*8269e767SBrooks Davisif (weight_kg > max_load) { 88*8269e767SBrooks Davis void *ptrs[3]; 89*8269e767SBrooks Davis 90*8269e767SBrooks Davis ptrs[0] = (void *)(intptr_t)weight_kg; 91*8269e767SBrooks Davis ptrs[1] = (void *)(intptr_t)max_load; 92*8269e767SBrooks Davis ptrs[2] = haystack; 93*8269e767SBrooks Davis abort2("Camel overloaded", 3, ptrs); 94*8269e767SBrooks Davis} 95*8269e767SBrooks Davis.Ed 96*8269e767SBrooks Davis.Sh SEE ALSO 97*8269e767SBrooks Davis.Xr abort 3 , 98*8269e767SBrooks Davis.Xr exit 3 99*8269e767SBrooks Davis.Sh HISTORY 100*8269e767SBrooks DavisThe 101*8269e767SBrooks Davis.Fn abort2 102*8269e767SBrooks Davissystem call first appeared in 103*8269e767SBrooks Davis.Fx 7.0 . 104*8269e767SBrooks Davis.Sh AUTHORS 105*8269e767SBrooks Davis.An -nosplit 106*8269e767SBrooks DavisThe 107*8269e767SBrooks Davis.Fn abort2 108*8269e767SBrooks Davissystem call was designed by 109*8269e767SBrooks Davis.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . 110*8269e767SBrooks DavisIt was implemented by 111*8269e767SBrooks Davis.An Wojciech A. Koszek Aq Mt dunstan@freebsd.czest.pl . 112