2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
6 * Copyright (c) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Linux for s390 port by D.J. Barrow
8 * <barrow_dj@mail.yahoo.com,djbarrow@de.ibm.com>
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 #include <sys/ucontext.h>
46 #if HAVE_LINUX_PTRACE_H
48 #include <linux/ptrace.h>
53 #ifndef PTRACE_PEEKUSR
54 # define PTRACE_PEEKUSR PTRACE_PEEKUSER
56 #ifndef PTRACE_POKEUSR
57 # define PTRACE_POKEUSR PTRACE_POKEUSER
63 #ifdef HAVE_ASM_SIGCONTEXT_H
64 #include <asm/sigcontext.h>
72 #else /* !HAVE_ASM_SIGCONTEXT_H */
74 struct sigcontext_struct {
75 unsigned short gs, __gsh;
76 unsigned short fs, __fsh;
77 unsigned short es, __esh;
78 unsigned short ds, __dsh;
90 unsigned short cs, __csh;
92 unsigned long esp_at_signal;
93 unsigned short ss, __ssh;
95 unsigned long oldmask;
102 unsigned long sc_mask;
103 unsigned long sc_usp;
108 unsigned short sc_sr;
110 unsigned short sc_formatvec;
114 #endif /* !HAVE_ASM_SIGCONTEXT_H */
124 char *signalent0[] = {
125 #include "signalent.h"
127 int nsignals0 = sizeof signalent0 / sizeof signalent0[0];
129 #if SUPPORTED_PERSONALITIES >= 2
130 char *signalent1[] = {
131 #include "signalent1.h"
133 int nsignals1 = sizeof signalent1 / sizeof signalent1[0];
134 #endif /* SUPPORTED_PERSONALITIES >= 2 */
136 #if SUPPORTED_PERSONALITIES >= 3
137 char *signalent2[] = {
138 #include "signalent2.h"
140 int nsignals2 = sizeof signalent2 / sizeof signalent2[0];
141 #endif /* SUPPORTED_PERSONALITIES >= 3 */
148 static struct xlat sigvec_flags[] = {
149 { SV_ONSTACK, "SV_ONSTACK" },
150 { SV_INTERRUPT, "SV_INTERRUPT" },
151 { SV_RESETHAND, "SV_RESETHAND" },
152 { SA_NOCLDSTOP, "SA_NOCLDSTOP" },
158 #ifdef HAVE_SIGACTION
160 static struct xlat sigact_flags[] = {
162 { SA_STACK, "SA_STACK" },
165 { SA_RESTART, "SA_RESTART" },
168 { SA_INTERRUPT, "SA_INTERRUPT" },
171 { SA_NOMASK, "SA_NOMASK" },
174 { SA_ONESHOT, "SA_ONESHOT" },
177 { SA_SIGINFO, "SA_SIGINFO" },
180 { SA_RESETHAND, "SA_RESETHAND" },
183 { SA_ONSTACK, "SA_ONSTACK" },
186 { SA_NODEFER, "SA_NODEFER" },
189 { SA_NOCLDSTOP, "SA_NOCLDSTOP" },
192 { SA_NOCLDWAIT, "SA_NOCLDWAIT" },
195 { _SA_BSDCALL, "_SA_BSDCALL" },
200 static struct xlat sigprocmaskcmds[] = {
201 { SIG_BLOCK, "SIG_BLOCK" },
202 { SIG_UNBLOCK, "SIG_UNBLOCK" },
203 { SIG_SETMASK, "SIG_SETMASK" },
205 { SIG_SETMASK32,"SIG_SETMASK32" },
210 #endif /* HAVE_SIGACTION */
212 /* Anonymous realtime signals. */
213 /* Under glibc 2.1, SIGRTMIN et al are functions, but __SIGRTMIN is a
214 constant. This is what we want. Otherwise, just use SIGRTMIN. */
217 #define __SIGRTMIN SIGRTMIN
218 #define __SIGRTMAX SIGRTMAX /* likewise */
227 if (sig < nsignals) {
228 return signalent[sig];
230 } else if (sig >= __SIGRTMIN && sig <= __SIGRTMAX) {
231 sprintf(buf, "SIGRT_%ld", (long)(sig - __SIGRTMIN));
233 #endif /* SIGRTMIN */
235 sprintf(buf, "%d", sig);
252 copy_sigset_len(tcp, addr, s, len)
258 if (len > sizeof(*s))
261 if (umoven(tcp, addr, len, (char *)s) < 0)
267 /* Original sigset is unsigned long */
268 #define copy_sigset(tcp, addr, s) copy_sigset_len(tcp, addr, s, sizeof(long))
270 #define copy_sigset(tcp, addr, s) copy_sigset_len(tcp, addr, s, sizeof(sigset_t))
274 sprintsigmask(s, mask, rt)
277 int rt; /* set might include realtime sigs */
282 static char outstr[256];
285 s = outstr + strlen(outstr);
290 maxsigs = __SIGRTMAX; /* instead */
292 for (i = 1; i < maxsigs; i++) {
293 if (sigismember(mask, i) == 1)
296 if (nsigs >= nsignals * 2 / 3) {
298 for (i = 1; i < maxsigs; i++) {
299 switch (sigismember(mask, i)) {
311 for (i = 1; i < maxsigs; i++) {
312 if (sigismember(mask, i) == 1) {
313 sprintf(s, format, signame(i) + 3); s += strlen(s);
323 printsigmask(mask, rt)
327 tprintf("%s", sprintsigmask("", mask, rt));
334 tprintf(signame(nr));
338 * Check process TCP for the disposition of signal SIG.
339 * Return 1 if the process would somehow manage to survive signal SIG,
340 * else return 0. This routine will never be called with SIGKILL.
343 sigishandled(tcp, sig)
353 unsigned int signalled, blocked, ignored, caught;
355 /* This is incredibly costly but it's worth it. */
356 sprintf(sname, "/proc/%d/stat", tcp->pid);
357 if ((sfd = open(sname, O_RDONLY)) == -1) {
361 i = read(sfd, buf, 1024);
365 * Skip the extraneous fields. This loses if the
366 * command name has any spaces in it. So be it.
368 for (i = 0, s = buf; i < 30; i++) {
369 while (*++s != ' ') {
374 if (sscanf(s, "%u%u%u%u",
375 &signalled, &blocked, &ignored, &caught) != 4) {
376 fprintf(stderr, "/proc/pid/stat format error\n");
380 fprintf(stderr, "sigs: %08x %08x %08x %08x\n",
381 signalled, blocked, ignored, caught);
383 if ((ignored & sigmask(sig)) || (caught & sigmask(sig)))
390 if (upeek(tcp->pid, uoff(u_signal[0]) + sig*sizeof(u_signal),
391 (long *) &u_signal) < 0) {
394 if (u_signal != SIG_DFL)
400 * Since procfs doesn't interfere with wait I think it is safe
401 * to punt on this question. If not, the information is there.
413 #if defined(SIGURG) && SIGURG != SIGIO
417 /* Gloria Gaynor says ... */
436 printsignal(tcp->u_arg[0]);
438 addr = tcp->u_arg[1];
440 addr = tcp->u_arg[2];
444 else if (!verbose(tcp))
445 tprintf("%#lx", addr);
446 else if (umove(tcp, addr, &sv) < 0)
449 switch ((int) sv.sv_handler) {
451 tprintf("{SIG_ERR}");
454 tprintf("{SIG_DFL}");
457 if (tcp->u_arg[0] == SIGTRAP) {
458 tcp->flags |= TCB_SIGTRAPPED;
459 kill(tcp->pid, SIGSTOP);
461 tprintf("{SIG_IGN}");
464 if (tcp->u_arg[0] == SIGTRAP) {
465 tcp->flags |= TCB_SIGTRAPPED;
466 kill(tcp->pid, SIGSTOP);
471 if (tcp->u_arg[0] == SIGTRAP) {
472 tcp->flags |= TCB_SIGTRAPPED;
473 kill(tcp->pid, SIGSTOP);
475 tprintf("{%#lx, ", (unsigned long) sv.sv_handler);
476 printsigmask(&sv.sv_mask, 0);
478 if (!printflags(sigvec_flags, sv.sv_flags))
492 if (entering(tcp)) { /* WTA: UD had a bug here: he forgot the braces */
494 long_to_sigset(tcp->u_arg[0], &sigm);
495 printsigmask(&sigm, 0);
508 addr = tcp->u_arg[0];
510 addr = tcp->u_arg[1];
513 else if (umove(tcp, addr, &ss) < 0)
514 tprintf("%#lx", addr);
516 tprintf("{ss_sp %#lx ", (unsigned long) ss.ss_sp);
517 tprintf("ss_onstack %s}", ss.ss_onstack ? "YES" : "NO");
541 long_to_sigset(tcp->u_arg[0], &sigm);
542 printsigmask(&sigm, 0);
543 if ((tcp->u_arg[0] & sigmask(SIGTRAP))) {
544 /* Mark attempt to block SIGTRAP */
545 tcp->flags |= TCB_SIGTRAPPED;
546 /* Send unblockable signal */
547 kill(tcp->pid, SIGSTOP);
550 else if (!syserror(tcp)) {
552 long_to_sigset(tcp->u_rval, &sigm);
553 tcp->auxstr = sprintsigmask("old mask ", &sigm, 0);
555 return RVAL_HEX | RVAL_STR;
564 return sys_sigsetmask(tcp);
569 #ifdef HAVE_SIGACTION
572 struct old_sigaction {
573 __sighandler_t __sa_handler;
574 unsigned long sa_mask;
575 unsigned long sa_flags;
576 void (*sa_restorer)(void);
578 #define SA_HANDLER __sa_handler
582 #define SA_HANDLER sa_handler
592 struct old_sigaction sa;
599 printsignal(tcp->u_arg[0]);
601 addr = tcp->u_arg[1];
603 addr = tcp->u_arg[2];
606 else if (!verbose(tcp))
607 tprintf("%#lx", addr);
608 else if (umove(tcp, addr, &sa) < 0)
611 switch ((long) sa.SA_HANDLER) {
613 tprintf("{SIG_ERR}");
616 tprintf("{SIG_DFL}");
620 if (tcp->u_arg[0] == SIGTRAP) {
621 tcp->flags |= TCB_SIGTRAPPED;
622 kill(tcp->pid, SIGSTOP);
625 tprintf("{SIG_IGN}");
629 if (tcp->u_arg[0] == SIGTRAP) {
630 tcp->flags |= TCB_SIGTRAPPED;
631 kill(tcp->pid, SIGSTOP);
634 tprintf("{%#lx, ", (long) sa.SA_HANDLER);
636 printsigmask (&sa.sa_mask, 0);
638 long_to_sigset(sa.sa_mask, &sigset);
639 printsigmask(&sigset, 0);
642 if (!printflags(sigact_flags, sa.sa_flags))
651 tprintf(", %#lx", (unsigned long) sa.sa_restorer);
661 printsignal(tcp->u_arg[0]);
662 switch (tcp->u_arg[1]) {
671 if (tcp->u_arg[0] == SIGTRAP) {
672 tcp->flags |= TCB_SIGTRAPPED;
673 kill(tcp->pid, SIGSTOP);
680 if (tcp->u_arg[0] == SIGTRAP) {
681 tcp->flags |= TCB_SIGTRAPPED;
682 kill(tcp->pid, SIGSTOP);
685 tprintf("%#lx", tcp->u_arg[1]);
691 #endif /* HAVE_SIGACTION */
701 struct sigcontext_struct sc;
705 if (upeek(tcp->pid,PT_GPR15,&usp)<0)
707 if (umove(tcp, usp+__SIGNAL_FRAMESIZE, &sc) < 0)
710 memcpy(&tcp->u_arg[1],&sc.oldmask[0],sizeof(sigset_t));
712 tcp->u_rval = tcp->u_error = 0;
713 if (tcp->u_arg[0] == 0)
715 tcp->auxstr = sprintsigmask("mask now ",(sigset_t *)&tcp->u_arg[1]);
716 return RVAL_NONE | RVAL_STR;
722 struct sigcontext_struct sc;
726 if (upeek(tcp->pid, 4*UESP, &esp) < 0)
728 if (umove(tcp, esp, &sc) < 0)
731 tcp->u_arg[1] = sc.oldmask;
735 long_to_sigset(tcp->u_arg[1], &sigm);
736 tcp->u_rval = tcp->u_error = 0;
737 if (tcp->u_arg[0] == 0)
739 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
740 return RVAL_NONE | RVAL_STR;
746 struct sigcontext_struct sc;
750 if (upeek(tcp->pid, 4*PT_R1, &esp) < 0)
752 if (umove(tcp, esp, &sc) < 0)
755 tcp->u_arg[1] = sc.oldmask;
759 long_to_sigset(tcp->u_arg[1], &sigm);
760 tcp->u_rval = tcp->u_error = 0;
761 if (tcp->u_arg[0] == 0)
763 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
764 return RVAL_NONE | RVAL_STR;
770 struct sigcontext sc;
774 if (upeek(tcp->pid, 4*PT_USP, &usp) < 0)
776 if (umove(tcp, usp, &sc) < 0)
779 tcp->u_arg[1] = sc.sc_mask;
783 long_to_sigset(tcp->u_arg[1], &sigm);
784 tcp->u_rval = tcp->u_error = 0;
785 if (tcp->u_arg[0] == 0)
787 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
788 return RVAL_NONE | RVAL_STR;
794 struct sigcontext_struct sc;
798 if (upeek(tcp->pid, REG_FP, &fp) < 0)
800 if (umove(tcp, fp, &sc) < 0)
803 tcp->u_arg[1] = sc.sc_mask;
807 long_to_sigset(tcp->u_arg[1], &sigm);
808 tcp->u_rval = tcp->u_error = 0;
809 if (tcp->u_arg[0] == 0)
811 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
812 return RVAL_NONE | RVAL_STR;
821 if(ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) {
822 perror("sigreturn: PTRACE_GETREGS ");
828 if(umove(tcp, i1, &si) < 0) {
829 perror("sigreturn: umove ");
833 tcp->u_arg[1] = si.si_mask;
836 long_to_sigset(tcp->u_arg[1], &sigm);
837 tcp->u_rval = tcp->u_error = 0;
838 if(tcp->u_arg[0] == 0)
840 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
841 return RVAL_NONE | RVAL_STR;
847 struct sigcontext sc;
851 if (upeek(tcp->pid, REG_SP, &sp) < 0)
853 if (umove(tcp, sp, &sc) < 0)
856 tcp->u_arg[1] = sc.sc_sigset;
858 tcp->u_rval = tcp->u_error = 0;
859 if(tcp->u_arg[0] == 0)
861 tcp->auxstr = sprintsigmask("mask now ", tcp->u_arg[1]);
862 return RVAL_NONE | RVAL_STR;
869 #endif /* !POWERPC */
880 long_to_sigset(tcp->u_rval, &sigm);
881 tcp->auxstr = sprintsigmask("mask ", &sigm, 0);
883 return RVAL_HEX | RVAL_STR;
892 long_to_sigset(tcp->u_arg[2], &sigm);
894 /* first two are not really arguments, but print them anyway */
895 /* nevermind, they are an anachronism now, too bad... */
896 tprintf("%d, %#x, ", tcp->u_arg[0], tcp->u_arg[1]);
898 printsigmask(&sigm, 0);
914 if (umove(tcp, tcp->u_arg[0], &sigset) < 0)
917 printsigmask(&sigset, 0);
921 static struct xlat ucontext_flags[] = {
922 { UC_SIGMASK, "UC_SIGMASK" },
923 { UC_STACK, "UC_STACK" },
924 { UC_CPU, "UC_CPU" },
926 { UC_FPU, "UC_FPU" },
929 { UC_INTR, "UC_INTR" },
936 #if defined SVR4 || defined LINUX
937 #if defined LINUX && !defined SS_ONSTACK
940 #if __GLIBC_MINOR__ == 0
950 static struct xlat sigaltstack_flags[] = {
951 { SS_ONSTACK, "SS_ONSTACK" },
952 { SS_DISABLE, "SS_DISABLE" },
959 printcontext(tcp, ucp)
965 tprintf("uc_flags=");
966 if (!printflags(ucontext_flags, ucp->uc_flags))
968 tprintf(", uc_link=%#lx, ", (unsigned long) ucp->uc_link);
970 tprintf("uc_sigmask=");
971 printsigmask(ucp->uc_sigmask, 0);
973 tprintf(", uc_stack={ss_sp=%#lx, ss_size=%d, ss_flags=",
974 (unsigned long) ucp->uc_stack.ss_sp,
975 ucp->uc_stack.ss_size);
976 if (!printflags(sigaltstack_flags, ucp->uc_stack.ss_flags))
992 else if (umove(tcp, tcp->u_arg[0], &uc) < 0)
995 printcontext(tcp, &uc);
1006 if (entering(tcp)) {
1009 else if (umove(tcp, tcp->u_arg[0], &uc) < 0)
1012 printcontext(tcp, &uc);
1015 tcp->u_rval = tcp->u_error = 0;
1016 if (tcp->u_arg[0] == 0)
1028 print_stack_t(tcp, addr)
1033 if (umove(tcp, addr, &ss) < 0)
1035 tprintf("{ss_sp=%#lx, ss_flags=", (unsigned long) ss.ss_sp);
1036 if (!printflags(sigaltstack_flags, ss.ss_flags))
1038 tprintf(", ss_size=%lu}", (unsigned long) ss.ss_size);
1043 sys_sigaltstack(tcp)
1046 if (entering(tcp)) {
1047 if (tcp->u_arg[0] == 0)
1049 else if (print_stack_t(tcp, tcp->u_arg[0]) < 0)
1054 if (tcp->u_arg[1] == 0)
1056 else if (print_stack_t(tcp, tcp->u_arg[1]) < 0)
1063 #ifdef HAVE_SIGACTION
1066 sys_sigprocmask(tcp)
1070 if (entering(tcp)) {
1071 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
1073 printsigmask(tcp->u_arg[1], 0);
1075 else if (!syserror(tcp)) {
1076 tcp->auxstr = sprintsigmask("old mask ", tcp->u_rval, 0);
1077 return RVAL_HEX | RVAL_STR;
1082 if (entering(tcp)) {
1084 if (tcp->u_arg[0] == 0)
1088 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
1092 else if (copy_sigset(tcp, tcp->u_arg[1], &sigset) < 0)
1093 tprintf("%#lx, ", tcp->u_arg[1]);
1095 printsigmask(&sigset, 0);
1102 else if (syserror(tcp))
1103 tprintf("%#lx", tcp->u_arg[2]);
1104 else if (copy_sigset(tcp, tcp->u_arg[2], &sigset) < 0)
1107 printsigmask(&sigset, 0);
1113 #endif /* HAVE_SIGACTION */
1119 if (entering(tcp)) {
1120 tprintf("%ld, %s", tcp->u_arg[0], signame(tcp->u_arg[1]));
1129 return sys_kill(tcp);
1140 tprintf("%#lx", tcp->u_arg[0]);
1141 else if (copy_sigset(tcp, tcp->u_arg[0], &sigset) < 0)
1144 printsigmask(&sigset, 0);
1152 sys_rt_sigprocmask(tcp)
1157 /* Note: arg[3] is the length of the sigset. */
1158 if (entering(tcp)) {
1159 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
1163 else if (copy_sigset_len(tcp, tcp->u_arg[1], &sigset, tcp->u_arg[3]) < 0)
1164 tprintf("%#lx, ", tcp->u_arg[1]);
1166 printsigmask(&sigset, 1);
1174 else if (syserror(tcp))
1175 tprintf("%#lx", tcp->u_arg[2]);
1176 else if (copy_sigset_len(tcp, tcp->u_arg[2], &sigset, tcp->u_arg[3]) < 0)
1179 printsigmask(&sigset, 1);
1180 tprintf(", %lu", tcp->u_arg[3]);
1185 #if __GLIBC_MINOR__ < 1
1186 /* Type for data associated with a signal. */
1187 typedef union sigval
1193 # define __SI_MAX_SIZE 128
1194 # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
1196 typedef struct siginfo
1198 int si_signo; /* Signal number. */
1199 int si_errno; /* If non-zero, an errno value associated with
1200 this signal, as defined in <errno.h>. */
1201 int si_code; /* Signal code. */
1205 int _pad[__SI_PAD_SIZE];
1210 __pid_t si_pid; /* Sending process ID. */
1211 __uid_t si_uid; /* Real user ID of sending process. */
1214 /* POSIX.1b timers. */
1217 unsigned int _timer1;
1218 unsigned int _timer2;
1221 /* POSIX.1b signals. */
1224 __pid_t si_pid; /* Sending process ID. */
1225 __uid_t si_uid; /* Real user ID of sending process. */
1226 sigval_t si_sigval; /* Signal value. */
1232 __pid_t si_pid; /* Which child. */
1233 int si_status; /* Exit value or signal. */
1238 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */
1241 void *si_addr; /* Faulting insn/memory ref. */
1247 int si_band; /* Band event for SIGPOLL. */
1254 /* Structure describing the action to be taken when a signal arrives. */
1255 struct new_sigaction
1259 __sighandler_t __sa_handler;
1260 void (*__sa_sigaction) (int, siginfo_t *, void *);
1262 __sigaction_handler;
1263 unsigned long sa_flags;
1264 void (*sa_restorer) (void);
1265 unsigned long int sa_mask[2];
1270 sys_rt_sigaction(tcp)
1273 struct new_sigaction sa;
1277 if (entering(tcp)) {
1278 printsignal(tcp->u_arg[0]);
1280 addr = tcp->u_arg[1];
1282 addr = tcp->u_arg[2];
1285 else if (!verbose(tcp))
1286 tprintf("%#lx", addr);
1287 else if (umove(tcp, addr, &sa) < 0)
1290 switch ((long) sa.__sigaction_handler.__sa_handler) {
1291 case (long) SIG_ERR:
1292 tprintf("{SIG_ERR}");
1294 case (long) SIG_DFL:
1295 tprintf("{SIG_DFL}");
1297 case (long) SIG_IGN:
1298 tprintf("{SIG_IGN}");
1302 (long) sa.__sigaction_handler.__sa_handler);
1303 sigemptyset(&sigset);
1305 if (tcp->u_arg[4] <= sizeof(sigset))
1306 memcpy(&sigset, &sa.sa_mask, tcp->u_arg[4]);
1308 if (tcp->u_arg[3] <= sizeof(sigset))
1309 memcpy(&sigset, &sa.sa_mask, tcp->u_arg[3]);
1312 memcpy(&sigset, &sa.sa_mask, sizeof(sigset));
1313 printsigmask(&sigset, 1);
1315 if (!printflags(sigact_flags, sa.sa_flags))
1324 tprintf(", %#lx, %lu", tcp->u_arg[3], tcp->u_arg[4]);
1325 #elif defined(ALPHA)
1326 tprintf(", %lu, %#lx", tcp->u_arg[3], tcp->u_arg[4]);
1328 tprintf(", %lu", addr = tcp->u_arg[3]);
1334 sys_rt_sigpending(tcp)
1341 tprintf("%#lx", tcp->u_arg[0]);
1342 else if (copy_sigset_len(tcp, tcp->u_arg[0],
1343 &sigset, tcp->u_arg[1]) < 0)
1346 printsigmask(&sigset, 1);
1351 sys_rt_sigsuspend(tcp)
1354 if (entering(tcp)) {
1356 if (copy_sigset_len(tcp, tcp->u_arg[0], &sigm, tcp->u_arg[1]) < 0)
1359 printsigmask(&sigm, 1);
1364 #define ILL_ILLOPC 1 /* illegal opcode */
1365 #define ILL_ILLOPN 2 /* illegal operand */
1366 #define ILL_ILLADR 3 /* illegal addressing mode */
1367 #define ILL_ILLTRP 4 /* illegal trap */
1368 #define ILL_PRVOPC 5 /* privileged opcode */
1369 #define ILL_PRVREG 6 /* privileged register */
1370 #define ILL_COPROC 7 /* coprocessor error */
1371 #define ILL_BADSTK 8 /* internal stack error */
1372 #define FPE_INTDIV 1 /* integer divide by zero */
1373 #define FPE_INTOVF 2 /* integer overflow */
1374 #define FPE_FLTDIV 3 /* floating point divide by zero */
1375 #define FPE_FLTOVF 4 /* floating point overflow */
1376 #define FPE_FLTUND 5 /* floating point underflow */
1377 #define FPE_FLTRES 6 /* floating point inexact result */
1378 #define FPE_FLTINV 7 /* floating point invalid operation */
1379 #define FPE_FLTSUB 8 /* subscript out of range */
1380 #define SEGV_MAPERR 1 /* address not mapped to object */
1381 #define SEGV_ACCERR 2 /* invalid permissions for mapped object */
1382 #define BUS_ADRALN 1 /* invalid address alignment */
1383 #define BUS_ADRERR 2 /* non-existant physical address */
1384 #define BUS_OBJERR 3 /* object specific hardware error */
1385 #define TRAP_BRKPT 1 /* process breakpoint */
1386 #define TRAP_TRACE 2 /* process trace trap */
1387 #define CLD_EXITED 1 /* child has exited */
1388 #define CLD_KILLED 2 /* child was killed */
1389 #define CLD_DUMPED 3 /* child terminated abnormally */
1390 #define CLD_TRAPPED 4 /* traced child has trapped */
1391 #define CLD_STOPPED 5 /* child has stopped */
1392 #define CLD_CONTINUED 6 /* stopped child has continued */
1393 #define POLL_IN 1 /* data input available */
1394 #define POLL_OUT 2 /* output buffers available */
1395 #define POLL_MSG 3 /* input message available */
1396 #define POLL_ERR 4 /* i/o error */
1397 #define POLL_PRI 5 /* high priority input available */
1398 #define POLL_HUP 6 /* device disconnected */
1399 #define SI_USER 0 /* sent by kill, sigsend, raise */
1400 #define SI_QUEUE -1 /* sent by sigqueue */
1401 #define SI_TIMER -2 /* sent by timer expiration */
1402 #define SI_MESGQ -3 /* sent by real time mesq state change */
1403 #define SI_ASYNCIO -4 /* sent by AIO completion */
1418 static struct xlat sigill_flags[] = {
1419 {ILL_ILLOPC, "ILL_ILLOPC"},
1420 {ILL_ILLOPN, "ILL_ILLOPN"},
1421 {ILL_ILLADR, "ILL_ILLADR"},
1422 {ILL_ILLTRP, "ILL_ILLTRP"},
1423 {ILL_PRVOPC, "ILL_PRVOPC"},
1424 {ILL_PRVREG, "ILL_PRVREG"},
1425 {ILL_COPROC, "ILL_COPROC"},
1426 {ILL_BADSTK, "ILL_BADSTK"},
1430 static struct xlat sigfpe_flags[] = {
1431 {FPE_INTDIV, "FPE_INTDIV"},
1432 {FPE_INTOVF, "FPE_INTOVF"},
1433 {FPE_FLTDIV, "FPE_FLTDIV"},
1434 {FPE_FLTOVF, "FPE_FLTOVF"},
1435 {FPE_FLTUND, "FPE_FLTUND"},
1436 {FPE_FLTRES, "FPE_FLTRES"},
1437 {FPE_FLTINV, "FPE_FLTINV"},
1438 {FPE_FLTSUB, "FPE_FLTSUB"},
1442 static struct xlat sigsegv_flags[] = {
1443 {SEGV_MAPERR, "SEGV_MAPERR"},
1444 {SEGV_ACCERR, "SEGV_ACCERR"},
1448 static struct xlat sigbus_flags[] = {
1449 {BUS_ADRALN, "BUS_ADRALN"},
1450 {BUS_ADRERR, "BUS_ADRERR"},
1451 {BUS_OBJERR, "BUS_OBJERR"},
1455 static struct xlat sigtrap_flags[] = {
1456 {TRAP_BRKPT, "TRAP_BRKPT"},
1457 {TRAP_TRACE, "TRAP_TRACE"},
1461 static struct xlat sigchld_flags[] = {
1462 {CLD_EXITED, "CLD_EXITED"},
1463 {CLD_KILLED, "CLD_KILLED"},
1464 {CLD_DUMPED, "CLD_DUMPED"},
1465 {CLD_TRAPPED, "CLD_TRAPPED"},
1466 {CLD_STOPPED, "CLD_STOPPED"},
1467 {CLD_CONTINUED, "CLD_CONTINUED"},
1471 static struct xlat sigpoll_flags[] = {
1472 {POLL_IN, "POLL_IN"},
1473 {POLL_OUT, "POLL_OUT"},
1474 {POLL_MSG, "POLL_MSG"},
1475 {POLL_ERR, "POLL_ERR"},
1476 {POLL_PRI, "POLL_PRI"},
1477 {POLL_HUP, "POLL_HUP"},
1481 static struct xlat siginfo_flags[] = {
1482 {SI_USER, "SI_USER"},
1483 {SI_QUEUE, "SI_QUEUE"},
1484 {SI_TIMER, "SI_TIMER"},
1485 {SI_MESGQ, "SI_MESGQ"},
1486 {SI_ASYNCIO, "SI_ASYNCIO"},
1491 printsiginfo(tcp, si)
1495 tprintf("{si_signo=");
1496 printsignal(si->si_signo);
1497 tprintf(", si_errno=%d, si_code=", si->si_errno);
1498 switch(si->si_signo)
1501 if (!printflags(sigill_flags, si->si_code))
1502 tprintf("%d /* ILL_??? */", si->si_code);
1503 tprintf(", si_addr=%lx",
1504 (unsigned long) si->_sifields._sigfault.si_addr);
1507 if (!printflags(sigfpe_flags, si->si_code))
1508 tprintf("%d /* FPE_??? */", si->si_code);
1509 tprintf(", si_addr=%lx",
1510 (unsigned long) si->_sifields._sigfault.si_addr);
1513 if (!printflags(sigsegv_flags, si->si_code))
1514 tprintf("%d /* SEGV_??? */", si->si_code);
1515 tprintf(", si_addr=%lx",
1516 (unsigned long) si->_sifields._sigfault.si_addr);
1519 if (!printflags(sigbus_flags, si->si_code))
1520 tprintf("%d /* BUS_??? */", si->si_code);
1521 tprintf(", si_addr=%lx",
1522 (unsigned long) si->_sifields._sigfault.si_addr);
1525 if (!printflags(sigtrap_flags, si->si_code))
1526 tprintf("%d /* TRAP_??? */", si->si_code);
1529 if (!printflags(sigchld_flags, si->si_code))
1530 tprintf("%d /* CLD_??? */", si->si_code);
1534 tprintf(", si_pid=%d, si_uid=%d, si_status=%d, si_utime=%lu, si_stime=%lu",
1535 si->_sifields._kill.si_pid,
1536 si->_sifields._kill.si_uid,
1537 si->_sifields._sigchld.si_status,
1538 si->_sifields._sigchld.si_utime,
1539 si->_sifields._sigchld.si_stime);
1542 if (!printflags(sigpoll_flags, si->si_code))
1543 tprintf("%d /* POLL_??? */", si->si_code);
1544 if (si->si_code == POLL_IN
1545 || si->si_code == POLL_OUT
1546 || si->si_code == POLL_MSG)
1547 tprintf(", si_bind=%lu, si_fd=%d",
1548 (unsigned long) si->_sifields._sigpoll.si_band,
1549 si->_sifields._sigpoll.si_fd);
1552 if (!printflags(siginfo_flags, si->si_code))
1553 tprintf("%d /* SI_??? */", si->si_code);
1554 tprintf(", si_pid=%lu, si_uid=%lu, si_value={",
1555 (unsigned long) si->_sifields._rt.si_pid,
1556 (unsigned long) si->_sifields._rt.si_uid);
1560 tprintf("sival_int=%u, sival_ptr=%#lx",
1561 si->_sifields._rt.si_sigval.sival_int,
1562 (unsigned long) si->_sifields._rt.si_sigval.sival_ptr);
1571 sys_rt_sigqueueinfo(tcp)
1574 if (entering(tcp)) {
1576 tprintf("%lu, ", tcp->u_arg[0]);
1577 printsignal(tcp->u_arg[1]);
1579 if (umove(tcp, tcp->u_arg[2], &si) < 0)
1580 tprintf("%#lx", tcp->u_arg[2]);
1587 int sys_rt_sigtimedwait(tcp)
1590 if (entering(tcp)) {
1593 if (copy_sigset_len(tcp, tcp->u_arg[0],
1594 &sigset, tcp->u_arg[3]) < 0)
1597 printsigmask(&sigset, 1);
1602 tprintf("%#lx", tcp->u_arg[0]);
1605 if (umove(tcp, tcp->u_arg[1], &si) < 0)
1606 tprintf("%#lx", tcp->u_arg[1]);
1610 tprintf(", %#lx", tcp->u_arg[2]);
1611 tprintf(", %d", (int) tcp->u_arg[3]);