xref: /freebsd/cddl/lib/libdtrace/signal.d (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
1ebe86aacSJohn Birrell /*
2ebe86aacSJohn Birrell  * CDDL HEADER START
3ebe86aacSJohn Birrell  *
4ebe86aacSJohn Birrell  * The contents of this file are subject to the terms of the
5ebe86aacSJohn Birrell  * Common Development and Distribution License, Version 1.0 only
6ebe86aacSJohn Birrell  * (the "License").  You may not use this file except in compliance
7ebe86aacSJohn Birrell  * with the License.
8ebe86aacSJohn Birrell  *
9ebe86aacSJohn Birrell  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10ebe86aacSJohn Birrell  * or http://www.opensolaris.org/os/licensing.
11ebe86aacSJohn Birrell  * See the License for the specific language governing permissions
12ebe86aacSJohn Birrell  * and limitations under the License.
13ebe86aacSJohn Birrell  *
14ebe86aacSJohn Birrell  * When distributing Covered Code, include this CDDL HEADER in each
15ebe86aacSJohn Birrell  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16ebe86aacSJohn Birrell  * If applicable, add the following below this CDDL HEADER, with the
17ebe86aacSJohn Birrell  * fields enclosed by brackets "[]" replaced with your own identifying
18ebe86aacSJohn Birrell  * information: Portions Copyright [yyyy] [name of copyright owner]
19ebe86aacSJohn Birrell  *
20ebe86aacSJohn Birrell  * CDDL HEADER END
21ebe86aacSJohn Birrell  *
22ebe86aacSJohn Birrell  * Portions Copyright 2008 John Birrell jb@freebsd.org
234b9c94e5SDevin Teske  * Portions Copyright 2018 Devin Teske dteske@freebsd.org
24ebe86aacSJohn Birrell  */
25ebe86aacSJohn Birrell 
26ebe86aacSJohn Birrell inline int SIGHUP = 1;
27ebe86aacSJohn Birrell #pragma D binding "1.0" SIGHUP
28ebe86aacSJohn Birrell inline int SIGINT = 2;
29ebe86aacSJohn Birrell #pragma D binding "1.0" SIGINT
30ebe86aacSJohn Birrell inline int SIGQUIT = 3;
31ebe86aacSJohn Birrell #pragma D binding "1.0" SIGQUIT
32ebe86aacSJohn Birrell inline int SIGILL = 4;
33ebe86aacSJohn Birrell #pragma D binding "1.0" SIGILL
34ebe86aacSJohn Birrell inline int SIGTRAP = 5;
35ebe86aacSJohn Birrell #pragma D binding "1.0" SIGTRAP
36ebe86aacSJohn Birrell inline int SIGABRT = 6;
37ebe86aacSJohn Birrell #pragma D binding "1.0" SIGABRT
38ebe86aacSJohn Birrell inline int SIGEMT = 7;
39ebe86aacSJohn Birrell #pragma D binding "1.0" SIGEMT
40ebe86aacSJohn Birrell inline int SIGFPE = 8;
41ebe86aacSJohn Birrell #pragma D binding "1.0" SIGFPE
42ebe86aacSJohn Birrell inline int SIGKILL = 9;
43ebe86aacSJohn Birrell #pragma D binding "1.0" SIGKILL
44ebe86aacSJohn Birrell inline int SIGBUS = 10;
45ebe86aacSJohn Birrell #pragma D binding "1.0" SIGBUS
46ebe86aacSJohn Birrell inline int SIGSEGV = 11;
47ebe86aacSJohn Birrell #pragma D binding "1.0" SIGSEGV
48ebe86aacSJohn Birrell inline int SIGSYS = 12;
49ebe86aacSJohn Birrell #pragma D binding "1.0" SIGSYS
50ebe86aacSJohn Birrell inline int SIGPIPE = 13;
51ebe86aacSJohn Birrell #pragma D binding "1.0" SIGPIPE
52ebe86aacSJohn Birrell inline int SIGALRM = 14;
53ebe86aacSJohn Birrell #pragma D binding "1.0" SIGALRM
54ebe86aacSJohn Birrell inline int SIGTERM = 15;
55ebe86aacSJohn Birrell #pragma D binding "1.0" SIGTERM
56ebe86aacSJohn Birrell inline int SIGURG = 16;
57ebe86aacSJohn Birrell #pragma D binding "1.0" SIGURG
58ebe86aacSJohn Birrell inline int SIGSTOP = 17;
59ebe86aacSJohn Birrell #pragma D binding "1.0" SIGSTOP
60ebe86aacSJohn Birrell inline int SIGTSTP = 18;
61ebe86aacSJohn Birrell #pragma D binding "1.0" SIGTSTP
62ebe86aacSJohn Birrell inline int SIGCONT = 19;
63ebe86aacSJohn Birrell #pragma D binding "1.0" SIGCONT
64ebe86aacSJohn Birrell inline int SIGCHLD = 20;
65ebe86aacSJohn Birrell #pragma D binding "1.0" SIGCHLD
66ebe86aacSJohn Birrell inline int SIGTTIN = 21;
67ebe86aacSJohn Birrell #pragma D binding "1.0" SIGTTIN
68ebe86aacSJohn Birrell inline int SIGTTOU = 22;
69ebe86aacSJohn Birrell #pragma D binding "1.0" SIGTTOU
70ebe86aacSJohn Birrell inline int SIGIO = 23;
71ebe86aacSJohn Birrell #pragma D binding "1.0" SIGIO
72ebe86aacSJohn Birrell inline int SIGXCPU = 24;
73ebe86aacSJohn Birrell #pragma D binding "1.0" SIGXCPU
74ebe86aacSJohn Birrell inline int SIGXFSZ = 25;
75ebe86aacSJohn Birrell #pragma D binding "1.0" SIGXFSZ
76ebe86aacSJohn Birrell inline int SIGVTALRM = 26;
77ebe86aacSJohn Birrell #pragma D binding "1.0" SIGVTALRM
78ebe86aacSJohn Birrell inline int SIGPROF = 27;
79ebe86aacSJohn Birrell #pragma D binding "1.0" SIGPROF
80ebe86aacSJohn Birrell inline int SIGWINCH = 28;
81ebe86aacSJohn Birrell #pragma D binding "1.0" SIGWINCH
82ebe86aacSJohn Birrell inline int SIGINFO = 29;
83ebe86aacSJohn Birrell #pragma D binding "1.0" SIGINFO
84ebe86aacSJohn Birrell inline int SIGUSR1 = 30;
85ebe86aacSJohn Birrell #pragma D binding "1.0" SIGUSR1
86ebe86aacSJohn Birrell inline int SIGUSR2 = 31;
87ebe86aacSJohn Birrell #pragma D binding "1.0" SIGUSR2
884b9c94e5SDevin Teske inline int SIGTHR = 32;
894b9c94e5SDevin Teske #pragma D binding "1.13" SIGTHR
904b9c94e5SDevin Teske inline int SIGLIBRT = 33;
914b9c94e5SDevin Teske #pragma D binding "1.13" SIGLIBRT
924b9c94e5SDevin Teske 
934b9c94e5SDevin Teske #pragma D binding "1.13" signal_string
944b9c94e5SDevin Teske inline string signal_string[int signal] =
954b9c94e5SDevin Teske 	signal == SIGHUP ?	"SIGHUP" :
964b9c94e5SDevin Teske 	signal == SIGINT ?	"SIGINT" :
974b9c94e5SDevin Teske 	signal == SIGQUIT ?	"SIGQUIT" :
984b9c94e5SDevin Teske 	signal == SIGILL ?	"SIGILL":
994b9c94e5SDevin Teske 	signal == SIGTRAP ?	"SIGTRAP" :
1004b9c94e5SDevin Teske 	signal == SIGABRT ?	"SIGABRT" :
1014b9c94e5SDevin Teske 	signal == SIGEMT ?	"SIGEMT" :
1024b9c94e5SDevin Teske 	signal == SIGFPE ?	"SIGFPE" :
1034b9c94e5SDevin Teske 	signal == SIGKILL ?	"SIGKILL" :
1044b9c94e5SDevin Teske 	signal == SIGBUS ?	"SIGBUS" :
1054b9c94e5SDevin Teske 	signal == SIGSEGV ?	"SIGSEGV" :
1064b9c94e5SDevin Teske 	signal == SIGSYS ?	"SIGSYS" :
1074b9c94e5SDevin Teske 	signal == SIGPIPE ?	"SIGPIPE" :
1084b9c94e5SDevin Teske 	signal == SIGALRM ?	"SIGALRM" :
1094b9c94e5SDevin Teske 	signal == SIGTERM ?	"SIGTERM" :
1104b9c94e5SDevin Teske 	signal == SIGURG ?	"SIGURG" :
1114b9c94e5SDevin Teske 	signal == SIGSTOP ?	"SIGSTOP" :
1124b9c94e5SDevin Teske 	signal == SIGTSTP ?	"SIGTSTP" :
1134b9c94e5SDevin Teske 	signal == SIGCONT ?	"SIGCONT" :
1144b9c94e5SDevin Teske 	signal == SIGCHLD ?	"SIGCHLD" :
1154b9c94e5SDevin Teske 	signal == SIGTTIN ?	"SIGTTIN" :
1164b9c94e5SDevin Teske 	signal == SIGTTOU ?	"SIGTTOU" :
1174b9c94e5SDevin Teske 	signal == SIGIO ?	"SIGIO" :
1184b9c94e5SDevin Teske 	signal == SIGXCPU ?	"SIGXCPU" :
1194b9c94e5SDevin Teske 	signal == SIGXFSZ ?	"SIGXFSZ" :
1204b9c94e5SDevin Teske 	signal == SIGVTALRM ?	"SIGVTALRM" :
1214b9c94e5SDevin Teske 	signal == SIGPROF ?	"SIGPROF" :
1224b9c94e5SDevin Teske 	signal == SIGWINCH ?	"SIGWINCH" :
1234b9c94e5SDevin Teske 	signal == SIGINFO ?	"SIGINFO" :
1244b9c94e5SDevin Teske 	signal == SIGUSR1 ?	"SIGUSR1" :
1254b9c94e5SDevin Teske 	signal == SIGUSR2 ?	"SIGUSR2" :
1264b9c94e5SDevin Teske 	signal == SIGTHR ?	"SIGTHR" :
1274b9c94e5SDevin Teske 	signal == SIGLIBRT ?	"SIGLIBRT" :
1284b9c94e5SDevin Teske 	"UNKNOWN";
129ebe86aacSJohn Birrell 
130ebe86aacSJohn Birrell inline int CLD_EXITED = 1;
131ebe86aacSJohn Birrell #pragma D binding "1.0" CLD_EXITED
132ebe86aacSJohn Birrell inline int CLD_KILLED = 2;
133ebe86aacSJohn Birrell #pragma D binding "1.0" CLD_KILLED
134ebe86aacSJohn Birrell inline int CLD_DUMPED = 3;
135ebe86aacSJohn Birrell #pragma D binding "1.0" CLD_DUMPED
136ebe86aacSJohn Birrell inline int CLD_TRAPPED = 4;
137ebe86aacSJohn Birrell #pragma D binding "1.0" CLD_TRAPPED
138ebe86aacSJohn Birrell inline int CLD_STOPPED = 5;
139ebe86aacSJohn Birrell #pragma D binding "1.0" CLD_STOPPED
140ebe86aacSJohn Birrell inline int CLD_CONTINUED = 6;
141ebe86aacSJohn Birrell #pragma D binding "1.0" CLD_CONTINUED
1424b9c94e5SDevin Teske 
1434b9c94e5SDevin Teske #pragma D binding "1.13" child_signal_string
1444b9c94e5SDevin Teske inline string child_signal_string[int child_signal] =
1454b9c94e5SDevin Teske 	child_signal == CLD_EXITED ?	"child exited" :
1464b9c94e5SDevin Teske 	child_signal == CLD_KILLED ?	"child terminated abnormally" :
1474b9c94e5SDevin Teske 	child_signal == CLD_DUMPED ?	"child core dumped" :
1484b9c94e5SDevin Teske 	child_signal == CLD_TRAPPED ?	"traced child trapped" :
1494b9c94e5SDevin Teske 	child_signal == CLD_STOPPED ?	"child stopped" :
1504b9c94e5SDevin Teske 	child_signal == CLD_CONTINUED ?	"stopped child continued" :
151*16e39c48SDevin Teske 	strjoin("unknown SIGCHLD code (", strjoin(lltostr(child_signal), ")"));
152