Merge SVR4/Linux printsiginfo
diff --git a/process.c b/process.c
index e03be2d..a160982 100644
--- a/process.c
+++ b/process.c
@@ -1456,213 +1456,6 @@
{ 0, NULL },
};
-static struct xlat siginfo_codes[] = {
-#ifdef SI_NOINFO
- { SI_NOINFO, "SI_NOINFO" },
-#endif
-#ifdef SI_USER
- { SI_USER, "SI_USER" },
-#endif
-#ifdef SI_LWP
- { SI_LWP, "SI_LWP" },
-#endif
-#ifdef SI_QUEUE
- { SI_QUEUE, "SI_QUEUE" },
-#endif
-#ifdef SI_TIMER
- { SI_TIMER, "SI_TIMER" },
-#endif
-#ifdef SI_ASYNCIO
- { SI_ASYNCIO, "SI_ASYNCIO" },
-#endif
-#ifdef SI_MESGQ
- { SI_MESGQ, "SI_MESGQ" },
-#endif
- { 0, NULL },
-};
-
-static struct xlat sigtrap_codes[] = {
- { TRAP_BRKPT, "TRAP_BRKPT" },
- { TRAP_TRACE, "TRAP_TRACE" },
- { 0, NULL },
-};
-
-static struct xlat sigcld_codes[] = {
- { CLD_EXITED, "CLD_EXITED" },
- { CLD_KILLED, "CLD_KILLED" },
- { CLD_DUMPED, "CLD_DUMPED" },
- { CLD_TRAPPED, "CLD_TRAPPED" },
- { CLD_STOPPED, "CLD_STOPPED" },
- { CLD_CONTINUED,"CLD_CONTINUED" },
- { 0, NULL },
-};
-
-static struct xlat sigpoll_codes[] = {
- { POLL_IN, "POLL_IN" },
- { POLL_OUT, "POLL_OUT" },
- { POLL_MSG, "POLL_MSG" },
- { POLL_ERR, "POLL_ERR" },
- { POLL_PRI, "POLL_PRI" },
- { POLL_HUP, "POLL_HUP" },
- { 0, NULL },
-};
-
-static struct xlat sigprof_codes[] = {
-#ifdef PROF_SIG
- { PROF_SIG, "PROF_SIG" },
-#endif
- { 0, NULL },
-};
-
-static struct xlat sigill_codes[] = {
- { ILL_ILLOPC, "ILL_ILLOPC" },
- { ILL_ILLOPN, "ILL_ILLOPN" },
- { ILL_ILLADR, "ILL_ILLADR" },
- { ILL_ILLTRP, "ILL_ILLTRP" },
- { ILL_PRVOPC, "ILL_PRVOPC" },
- { ILL_PRVREG, "ILL_PRVREG" },
- { ILL_COPROC, "ILL_COPROC" },
- { ILL_BADSTK, "ILL_BADSTK" },
- { 0, NULL },
-};
-
-static struct xlat sigemt_codes[] = {
-#ifdef EMT_TAGOVF
- { EMT_TAGOVF, "EMT_TAGOVF" },
-#endif
- { 0, NULL },
-};
-
-static struct xlat sigfpe_codes[] = {
- { FPE_INTDIV, "FPE_INTDIV" },
- { FPE_INTOVF, "FPE_INTOVF" },
- { FPE_FLTDIV, "FPE_FLTDIV" },
- { FPE_FLTOVF, "FPE_FLTOVF" },
- { FPE_FLTUND, "FPE_FLTUND" },
- { FPE_FLTRES, "FPE_FLTRES" },
- { FPE_FLTINV, "FPE_FLTINV" },
- { FPE_FLTSUB, "FPE_FLTSUB" },
- { 0, NULL },
-};
-
-static struct xlat sigsegv_codes[] = {
- { SEGV_MAPERR, "SEGV_MAPERR" },
- { SEGV_ACCERR, "SEGV_ACCERR" },
- { 0, NULL },
-};
-
-static struct xlat sigbus_codes[] = {
- { BUS_ADRALN, "BUS_ADRALN" },
- { BUS_ADRERR, "BUS_ADRERR" },
- { BUS_OBJERR, "BUS_OBJERR" },
- { 0, NULL },
-};
-
-void
-printsiginfo(sip)
-siginfo_t *sip;
-{
- char *code;
-
- tprintf("{si_signo=");
- printsignal(sip->si_signo);
- code = xlookup(siginfo_codes, sip->si_code);
- if (!code) {
- switch (sip->si_signo) {
- case SIGTRAP:
- code = xlookup(sigtrap_codes, sip->si_code);
- break;
- case SIGCHLD:
- code = xlookup(sigcld_codes, sip->si_code);
- break;
- case SIGPOLL:
- code = xlookup(sigpoll_codes, sip->si_code);
- break;
- case SIGPROF:
- code = xlookup(sigprof_codes, sip->si_code);
- break;
- case SIGILL:
- code = xlookup(sigill_codes, sip->si_code);
- break;
- case SIGEMT:
- code = xlookup(sigemt_codes, sip->si_code);
- break;
- case SIGFPE:
- code = xlookup(sigfpe_codes, sip->si_code);
- break;
- case SIGSEGV:
- code = xlookup(sigsegv_codes, sip->si_code);
- break;
- case SIGBUS:
- code = xlookup(sigbus_codes, sip->si_code);
- break;
- }
- }
- if (code)
- tprintf(", si_code=%s", code);
- else
- tprintf(", si_code=%#x", sip->si_code);
-#ifdef SI_NOINFO
- if (sip->si_code != SI_NOINFO) {
-#endif
- if (sip->si_errno) {
- if (sip->si_errno < 0 || sip->si_errno >= nerrnos)
- tprintf(", si_errno=%d", sip->si_errno);
- else
- tprintf(", si_errno=%s",
- errnoent[sip->si_errno]);
- }
- if (SI_FROMUSER(sip)) {
-#ifdef SI_QUEUE
- tprintf(", si_pid=%ld, si_uid=%ld",
- sip->si_pid, sip->si_uid);
- switch (sip->si_code) {
- case SI_QUEUE:
-#ifdef SI_TIMER
- case SI_TIMER:
-#endif /* SI_QUEUE */
- case SI_ASYNCIO:
-#ifdef SI_MESGQ
- case SI_MESGQ:
-#endif /* SI_MESGQ */
- tprintf(", si_value=%d",
- sip->si_value.sival_int);
- break;
- }
-#endif /* SI_QUEUE */
- }
- else {
- switch (sip->si_signo) {
- case SIGCHLD:
- tprintf(", si_pid=%ld, si_status=",
- sip->si_pid);
- if (sip->si_code == CLD_EXITED)
- tprintf("%d", sip->si_status);
- else
- printsignal(sip->si_status);
- break;
- case SIGILL: case SIGFPE:
- case SIGSEGV: case SIGBUS:
- tprintf(", si_addr=%#lx",
- (unsigned long) sip->si_addr);
- break;
- case SIGPOLL:
- switch (sip->si_code) {
- case POLL_IN: case POLL_OUT: case POLL_MSG:
- tprintf(", si_band=%ld",
- (long) sip->si_band);
- break;
- }
- break;
- }
- }
- tprintf(", ...");
-#ifdef SI_NOINFO
- }
-#endif
- tprintf("}");
-}
-
int
sys_waitid(tcp)
struct tcb *tcp;
@@ -1689,7 +1482,7 @@
else if (umove(tcp, tcp->u_arg[2], &si) < 0)
tprintf("{???}");
else
- printsiginfo(&si);
+ printsiginfo(&si, verbose (tcp));
/* options */
tprintf(", ");
if (!printflags(wait4_options, tcp->u_arg[3]))