3 #include DEF_MPERS_TYPE(siginfo_t)
6 #include <linux/audit.h>
11 #include "printsiginfo.h"
14 #include "xlat/audit_arch.h"
15 #include "xlat/sigbus_codes.h"
16 #include "xlat/sigchld_codes.h"
17 #include "xlat/sigfpe_codes.h"
18 #include "xlat/sigill_codes.h"
19 #include "xlat/siginfo_codes.h"
20 #include "xlat/sigpoll_codes.h"
21 #include "xlat/sigprof_codes.h"
22 #include "xlat/sigsegv_codes.h"
23 #include "xlat/sigsys_codes.h"
24 #include "xlat/sigtrap_codes.h"
27 # include "xlat/sigemt_codes.h"
31 # define SI_FROMUSER(sip) ((sip)->si_code <= 0)
35 printsigsource(const siginfo_t *sip)
37 tprintf(", si_pid=%u, si_uid=%u",
38 (unsigned int) sip->si_pid,
39 (unsigned int) sip->si_uid);
43 printsigval(const siginfo_t *sip, bool verbose)
48 tprintf(", si_value={int=%d, ptr=%#lx}",
50 (unsigned long) sip->si_ptr);
54 print_si_code(int si_signo, int si_code)
56 const char *code = xlookup(siginfo_codes, si_code);
61 code = xlookup(sigtrap_codes, si_code);
64 code = xlookup(sigchld_codes, si_code);
67 code = xlookup(sigpoll_codes, si_code);
70 code = xlookup(sigprof_codes, si_code);
73 code = xlookup(sigill_codes, si_code);
77 code = xlookup(sigemt_codes, si_code);
81 code = xlookup(sigfpe_codes, si_code);
84 code = xlookup(sigsegv_codes, si_code);
87 code = xlookup(sigbus_codes, si_code);
90 code = xlookup(sigsys_codes, si_code);
98 tprintf("%#x", si_code);
102 print_si_info(const siginfo_t *sip, bool verbose)
105 tprints(", si_errno=");
106 if ((unsigned) sip->si_errno < nerrnos
107 && errnoent[sip->si_errno])
108 tprints(errnoent[sip->si_errno]);
110 tprintf("%d", sip->si_errno);
113 if (SI_FROMUSER(sip)) {
114 switch (sip->si_code) {
121 #if defined HAVE_SIGINFO_T_SI_TIMERID && defined HAVE_SIGINFO_T_SI_OVERRUN
123 tprintf(", si_timerid=%#x, si_overrun=%d",
124 sip->si_timerid, sip->si_overrun);
125 printsigval(sip, verbose);
131 printsigval(sip, verbose);
135 switch (sip->si_signo) {
138 tprints(", si_status=");
139 if (sip->si_code == CLD_EXITED)
140 tprintf("%d", sip->si_status);
142 printsignal(sip->si_status);
146 tprintf(", si_utime=%llu, si_stime=%llu",
147 (unsigned long long) sip->si_utime,
148 (unsigned long long) sip->si_stime);
150 case SIGILL: case SIGFPE:
151 case SIGSEGV: case SIGBUS:
152 tprintf(", si_addr=%#lx",
153 (unsigned long) sip->si_addr);
156 switch (sip->si_code) {
157 case POLL_IN: case POLL_OUT: case POLL_MSG:
158 tprintf(", si_band=%ld",
159 (long) sip->si_band);
163 #ifdef HAVE_SIGINFO_T_SI_SYSCALL
165 tprintf(", si_call_addr=%#lx, si_syscall=__NR_%s, si_arch=",
166 (unsigned long) sip->si_call_addr,
167 syscall_name(sip->si_syscall));
168 printxval(audit_arch, sip->si_arch, "AUDIT_ARCH_???");
172 if (sip->si_pid || sip->si_uid)
175 printsigval(sip, verbose);
184 printsiginfo(const siginfo_t *sip, bool verbose)
186 if (sip->si_signo == 0) {
190 tprints("{si_signo=");
191 printsignal(sip->si_signo);
193 tprints(", si_code=");
194 print_si_code(sip->si_signo, sip->si_code);
197 if (sip->si_code != SI_NOINFO)
199 print_si_info(sip, verbose);
204 MPERS_PRINTER_DECL(void, printsiginfo_at)(struct tcb *tcp, long addr)
208 if (!umove_or_printaddr(tcp, addr, &si))
209 printsiginfo(&si, verbose(tcp));