From 9799315b43664f502ba4e79aabbf4207565ff2f9 Mon Sep 17 00:00:00 2001 From: dteske Date: Sun, 25 Feb 2018 23:59:47 +0000 Subject: [PATCH] Updates and enhancements to signal.d to aid DTrace scripting + Add missing signals SIGTHR (32) and SIGLIBRT (33) + Add inline for converting SIG* int to string + Add inline for converting CLD_* int to string Reviewed by: markj Sponsored by: Smule, Inc. Differential Revision: https://reviews.freebsd.org/D14497 --- cddl/lib/libdtrace/signal.d | 52 +++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/cddl/lib/libdtrace/signal.d b/cddl/lib/libdtrace/signal.d index 5a4c2f6b5dc5..fd766147d959 100644 --- a/cddl/lib/libdtrace/signal.d +++ b/cddl/lib/libdtrace/signal.d @@ -20,6 +20,7 @@ * CDDL HEADER END * * Portions Copyright 2008 John Birrell jb@freebsd.org + * Portions Copyright 2018 Devin Teske dteske@freebsd.org * * $FreeBSD$ */ @@ -86,6 +87,47 @@ inline int SIGUSR1 = 30; #pragma D binding "1.0" SIGUSR1 inline int SIGUSR2 = 31; #pragma D binding "1.0" SIGUSR2 +inline int SIGTHR = 32; +#pragma D binding "1.13" SIGTHR +inline int SIGLIBRT = 33; +#pragma D binding "1.13" SIGLIBRT + +#pragma D binding "1.13" signal_string +inline string signal_string[int signal] = + signal == SIGHUP ? "SIGHUP" : + signal == SIGINT ? "SIGINT" : + signal == SIGQUIT ? "SIGQUIT" : + signal == SIGILL ? "SIGILL": + signal == SIGTRAP ? "SIGTRAP" : + signal == SIGABRT ? "SIGABRT" : + signal == SIGEMT ? "SIGEMT" : + signal == SIGFPE ? "SIGFPE" : + signal == SIGKILL ? "SIGKILL" : + signal == SIGBUS ? "SIGBUS" : + signal == SIGSEGV ? "SIGSEGV" : + signal == SIGSYS ? "SIGSYS" : + signal == SIGPIPE ? "SIGPIPE" : + signal == SIGALRM ? "SIGALRM" : + signal == SIGTERM ? "SIGTERM" : + signal == SIGURG ? "SIGURG" : + signal == SIGSTOP ? "SIGSTOP" : + signal == SIGTSTP ? "SIGTSTP" : + signal == SIGCONT ? "SIGCONT" : + signal == SIGCHLD ? "SIGCHLD" : + signal == SIGTTIN ? "SIGTTIN" : + signal == SIGTTOU ? "SIGTTOU" : + signal == SIGIO ? "SIGIO" : + signal == SIGXCPU ? "SIGXCPU" : + signal == SIGXFSZ ? "SIGXFSZ" : + signal == SIGVTALRM ? "SIGVTALRM" : + signal == SIGPROF ? "SIGPROF" : + signal == SIGWINCH ? "SIGWINCH" : + signal == SIGINFO ? "SIGINFO" : + signal == SIGUSR1 ? "SIGUSR1" : + signal == SIGUSR2 ? "SIGUSR2" : + signal == SIGTHR ? "SIGTHR" : + signal == SIGLIBRT ? "SIGLIBRT" : + "UNKNOWN"; inline int CLD_EXITED = 1; #pragma D binding "1.0" CLD_EXITED @@ -99,3 +141,13 @@ inline int CLD_STOPPED = 5; #pragma D binding "1.0" CLD_STOPPED inline int CLD_CONTINUED = 6; #pragma D binding "1.0" CLD_CONTINUED + +#pragma D binding "1.13" child_signal_string +inline string child_signal_string[int child_signal] = + child_signal == CLD_EXITED ? "child exited" : + child_signal == CLD_KILLED ? "child terminated abnormally" : + child_signal == CLD_DUMPED ? "child core dumped" : + child_signal == CLD_TRAPPED ? "traced child trapped" : + child_signal == CLD_STOPPED ? "child stopped" : + child_signal == CLD_CONTINUED ? "stopped child continued" : + strjoin("Unknown SIGCHLD code (", strjoin(lltostr(child_signal), ")"));