1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 * 22 * Portions Copyright 2008 John Birrell jb@freebsd.org 23 * Portions Copyright 2018 Devin Teske dteske@freebsd.org 24 */ 25 26 inline int SIGHUP = 1; 27 #pragma D binding "1.0" SIGHUP 28 inline int SIGINT = 2; 29 #pragma D binding "1.0" SIGINT 30 inline int SIGQUIT = 3; 31 #pragma D binding "1.0" SIGQUIT 32 inline int SIGILL = 4; 33 #pragma D binding "1.0" SIGILL 34 inline int SIGTRAP = 5; 35 #pragma D binding "1.0" SIGTRAP 36 inline int SIGABRT = 6; 37 #pragma D binding "1.0" SIGABRT 38 inline int SIGEMT = 7; 39 #pragma D binding "1.0" SIGEMT 40 inline int SIGFPE = 8; 41 #pragma D binding "1.0" SIGFPE 42 inline int SIGKILL = 9; 43 #pragma D binding "1.0" SIGKILL 44 inline int SIGBUS = 10; 45 #pragma D binding "1.0" SIGBUS 46 inline int SIGSEGV = 11; 47 #pragma D binding "1.0" SIGSEGV 48 inline int SIGSYS = 12; 49 #pragma D binding "1.0" SIGSYS 50 inline int SIGPIPE = 13; 51 #pragma D binding "1.0" SIGPIPE 52 inline int SIGALRM = 14; 53 #pragma D binding "1.0" SIGALRM 54 inline int SIGTERM = 15; 55 #pragma D binding "1.0" SIGTERM 56 inline int SIGURG = 16; 57 #pragma D binding "1.0" SIGURG 58 inline int SIGSTOP = 17; 59 #pragma D binding "1.0" SIGSTOP 60 inline int SIGTSTP = 18; 61 #pragma D binding "1.0" SIGTSTP 62 inline int SIGCONT = 19; 63 #pragma D binding "1.0" SIGCONT 64 inline int SIGCHLD = 20; 65 #pragma D binding "1.0" SIGCHLD 66 inline int SIGTTIN = 21; 67 #pragma D binding "1.0" SIGTTIN 68 inline int SIGTTOU = 22; 69 #pragma D binding "1.0" SIGTTOU 70 inline int SIGIO = 23; 71 #pragma D binding "1.0" SIGIO 72 inline int SIGXCPU = 24; 73 #pragma D binding "1.0" SIGXCPU 74 inline int SIGXFSZ = 25; 75 #pragma D binding "1.0" SIGXFSZ 76 inline int SIGVTALRM = 26; 77 #pragma D binding "1.0" SIGVTALRM 78 inline int SIGPROF = 27; 79 #pragma D binding "1.0" SIGPROF 80 inline int SIGWINCH = 28; 81 #pragma D binding "1.0" SIGWINCH 82 inline int SIGINFO = 29; 83 #pragma D binding "1.0" SIGINFO 84 inline int SIGUSR1 = 30; 85 #pragma D binding "1.0" SIGUSR1 86 inline int SIGUSR2 = 31; 87 #pragma D binding "1.0" SIGUSR2 88 inline int SIGTHR = 32; 89 #pragma D binding "1.13" SIGTHR 90 inline int SIGLIBRT = 33; 91 #pragma D binding "1.13" SIGLIBRT 92 93 #pragma D binding "1.13" signal_string 94 inline string signal_string[int signal] = 95 signal == SIGHUP ? "SIGHUP" : 96 signal == SIGINT ? "SIGINT" : 97 signal == SIGQUIT ? "SIGQUIT" : 98 signal == SIGILL ? "SIGILL": 99 signal == SIGTRAP ? "SIGTRAP" : 100 signal == SIGABRT ? "SIGABRT" : 101 signal == SIGEMT ? "SIGEMT" : 102 signal == SIGFPE ? "SIGFPE" : 103 signal == SIGKILL ? "SIGKILL" : 104 signal == SIGBUS ? "SIGBUS" : 105 signal == SIGSEGV ? "SIGSEGV" : 106 signal == SIGSYS ? "SIGSYS" : 107 signal == SIGPIPE ? "SIGPIPE" : 108 signal == SIGALRM ? "SIGALRM" : 109 signal == SIGTERM ? "SIGTERM" : 110 signal == SIGURG ? "SIGURG" : 111 signal == SIGSTOP ? "SIGSTOP" : 112 signal == SIGTSTP ? "SIGTSTP" : 113 signal == SIGCONT ? "SIGCONT" : 114 signal == SIGCHLD ? "SIGCHLD" : 115 signal == SIGTTIN ? "SIGTTIN" : 116 signal == SIGTTOU ? "SIGTTOU" : 117 signal == SIGIO ? "SIGIO" : 118 signal == SIGXCPU ? "SIGXCPU" : 119 signal == SIGXFSZ ? "SIGXFSZ" : 120 signal == SIGVTALRM ? "SIGVTALRM" : 121 signal == SIGPROF ? "SIGPROF" : 122 signal == SIGWINCH ? "SIGWINCH" : 123 signal == SIGINFO ? "SIGINFO" : 124 signal == SIGUSR1 ? "SIGUSR1" : 125 signal == SIGUSR2 ? "SIGUSR2" : 126 signal == SIGTHR ? "SIGTHR" : 127 signal == SIGLIBRT ? "SIGLIBRT" : 128 "UNKNOWN"; 129 130 inline int CLD_EXITED = 1; 131 #pragma D binding "1.0" CLD_EXITED 132 inline int CLD_KILLED = 2; 133 #pragma D binding "1.0" CLD_KILLED 134 inline int CLD_DUMPED = 3; 135 #pragma D binding "1.0" CLD_DUMPED 136 inline int CLD_TRAPPED = 4; 137 #pragma D binding "1.0" CLD_TRAPPED 138 inline int CLD_STOPPED = 5; 139 #pragma D binding "1.0" CLD_STOPPED 140 inline int CLD_CONTINUED = 6; 141 #pragma D binding "1.0" CLD_CONTINUED 142 143 #pragma D binding "1.13" child_signal_string 144 inline string child_signal_string[int child_signal] = 145 child_signal == CLD_EXITED ? "child exited" : 146 child_signal == CLD_KILLED ? "child terminated abnormally" : 147 child_signal == CLD_DUMPED ? "child core dumped" : 148 child_signal == CLD_TRAPPED ? "traced child trapped" : 149 child_signal == CLD_STOPPED ? "child stopped" : 150 child_signal == CLD_CONTINUED ? "stopped child continued" : 151 strjoin("unknown SIGCHLD code (", strjoin(lltostr(child_signal), ")")); 152