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.
44 #include <sys/ucontext.h>
49 #ifndef PTRACE_PEEKUSR
50 # define PTRACE_PEEKUSR PTRACE_PEEKUSER
52 #ifndef PTRACE_POKEUSR
53 # define PTRACE_POKEUSR PTRACE_POKEUSER
55 #elif defined(HAVE_LINUX_PTRACE_H)
57 # ifdef HAVE_STRUCT_IA64_FPREG
58 # define ia64_fpreg XXX_ia64_fpreg
60 # ifdef HAVE_STRUCT_PT_ALL_USER_REGS
61 # define pt_all_user_regs XXX_pt_all_user_regs
63 #include <linux/ptrace.h>
65 # undef pt_all_user_regs
72 # include <asm/ptrace_offsets.h>
75 #if defined (LINUX) && defined (SPARC64)
76 # undef PTRACE_GETREGS
77 # define PTRACE_GETREGS PTRACE_GETREGS64
78 # undef PTRACE_SETREGS
79 # define PTRACE_SETREGS PTRACE_SETREGS64
80 #endif /* LINUX && SPARC64 */
82 #if defined (SPARC) || defined (SPARC64) || defined (MIPS)
84 struct pt_regs si_regs;
87 #elif defined HAVE_ASM_SIGCONTEXT_H
88 #if !defined(IA64) && !defined(X86_64)
89 #include <asm/sigcontext.h>
90 #endif /* !IA64 && !X86_64 */
91 #else /* !HAVE_ASM_SIGCONTEXT_H */
92 #if defined I386 && !defined HAVE_STRUCT_SIGCONTEXT_STRUCT
93 struct sigcontext_struct {
94 unsigned short gs, __gsh;
95 unsigned short fs, __fsh;
96 unsigned short es, __esh;
97 unsigned short ds, __dsh;
106 unsigned long trapno;
109 unsigned short cs, __csh;
110 unsigned long eflags;
111 unsigned long esp_at_signal;
112 unsigned short ss, __ssh;
114 unsigned long oldmask;
118 #if defined M68K && !defined HAVE_STRUCT_SIGCONTEXT
121 unsigned long sc_mask;
122 unsigned long sc_usp;
127 unsigned short sc_sr;
129 unsigned short sc_formatvec;
133 #endif /* !HAVE_ASM_SIGCONTEXT_H */
143 const char *const signalent0[] = {
144 #include "signalent.h"
146 const int nsignals0 = sizeof signalent0 / sizeof signalent0[0];
148 #if SUPPORTED_PERSONALITIES >= 2
149 const char *const signalent1[] = {
150 #include "signalent1.h"
152 const int nsignals1 = sizeof signalent1 / sizeof signalent1[0];
153 #endif /* SUPPORTED_PERSONALITIES >= 2 */
155 #if SUPPORTED_PERSONALITIES >= 3
156 const char *const signalent2[] = {
157 #include "signalent2.h"
159 const int nsignals2 = sizeof signalent2 / sizeof signalent2[0];
160 #endif /* SUPPORTED_PERSONALITIES >= 3 */
162 const char *const *signalent;
165 #if defined(SUNOS4) || defined(FREEBSD)
167 static const struct xlat sigvec_flags[] = {
168 { SV_ONSTACK, "SV_ONSTACK" },
169 { SV_INTERRUPT, "SV_INTERRUPT" },
170 { SV_RESETHAND, "SV_RESETHAND" },
171 { SA_NOCLDSTOP, "SA_NOCLDSTOP" },
175 #endif /* SUNOS4 || FREEBSD */
177 #ifdef HAVE_SIGACTION
179 #if defined LINUX && (defined I386 || defined X86_64)
180 /* The libc headers do not define this constant since it should only be
181 used by the implementation. So wwe define it here. */
183 # define SA_RESTORER 0x04000000
187 static const struct xlat sigact_flags[] = {
189 { SA_RESTORER, "SA_RESTORER" },
192 { SA_STACK, "SA_STACK" },
195 { SA_RESTART, "SA_RESTART" },
198 { SA_INTERRUPT, "SA_INTERRUPT" },
201 { SA_NODEFER, "SA_NODEFER" },
203 #if defined SA_NOMASK && SA_NODEFER != SA_NOMASK
204 { SA_NOMASK, "SA_NOMASK" },
207 { SA_RESETHAND, "SA_RESETHAND" },
209 #if defined SA_ONESHOT && SA_ONESHOT != SA_RESETHAND
210 { SA_ONESHOT, "SA_ONESHOT" },
213 { SA_SIGINFO, "SA_SIGINFO" },
216 { SA_RESETHAND, "SA_RESETHAND" },
219 { SA_ONSTACK, "SA_ONSTACK" },
222 { SA_NODEFER, "SA_NODEFER" },
225 { SA_NOCLDSTOP, "SA_NOCLDSTOP" },
228 { SA_NOCLDWAIT, "SA_NOCLDWAIT" },
231 { _SA_BSDCALL, "_SA_BSDCALL" },
234 { SA_NOPTRACE, "SA_NOPTRACE" },
239 static const struct xlat sigprocmaskcmds[] = {
240 { SIG_BLOCK, "SIG_BLOCK" },
241 { SIG_UNBLOCK, "SIG_UNBLOCK" },
242 { SIG_SETMASK, "SIG_SETMASK" },
244 { SIG_SETMASK32,"SIG_SETMASK32" },
249 #endif /* HAVE_SIGACTION */
251 /* Anonymous realtime signals. */
252 /* Under glibc 2.1, SIGRTMIN et al are functions, but __SIGRTMIN is a
253 constant. This is what we want. Otherwise, just use SIGRTMIN. */
256 #define __SIGRTMIN SIGRTMIN
257 #define __SIGRTMAX SIGRTMAX /* likewise */
266 if (sig >= 0 && sig < nsignals) {
267 return signalent[sig];
269 } else if (sig >= __SIGRTMIN && sig <= __SIGRTMAX) {
270 sprintf(buf, "SIGRT_%ld", (long)(sig - __SIGRTMIN));
272 #endif /* SIGRTMIN */
274 sprintf(buf, "%d", sig);
291 copy_sigset_len(tcp, addr, s, len)
297 if (len > sizeof(*s))
300 if (umoven(tcp, addr, len, (char *)s) < 0)
306 /* Original sigset is unsigned long */
307 #define copy_sigset(tcp, addr, s) copy_sigset_len(tcp, addr, s, sizeof(long))
309 #define copy_sigset(tcp, addr, s) copy_sigset_len(tcp, addr, s, sizeof(sigset_t))
313 sprintsigmask(const char *str, sigset_t *mask, int rt)
314 /* set might include realtime sigs */
320 static char outstr[8 * sizeof(sigset_t) * 8];
323 s = outstr + strlen(outstr);
328 maxsigs = __SIGRTMAX; /* instead */
330 for (i = 1; i < maxsigs; i++) {
331 if (sigismember(mask, i) == 1)
334 if (nsigs >= nsignals * 2 / 3) {
336 for (i = 1; i < maxsigs; i++) {
337 switch (sigismember(mask, i)) {
349 for (i = 1; i < maxsigs; i++) {
350 if (sigismember(mask, i) == 1) {
351 /* real-time signals on solaris don't have
355 sprintf(s, format, signalent[i] + 3);
358 else if (i >= __SIGRTMIN && i <= __SIGRTMAX) {
360 sprintf(tsig, "RT_%u", i - __SIGRTMIN);
361 sprintf(s, format, tsig);
363 #endif /* SIGRTMIN */
366 sprintf(tsig, "%u", i);
367 sprintf(s, format, tsig);
379 printsigmask(mask, rt)
383 tprintf("%s", sprintsigmask("", mask, rt));
390 tprintf("%s", signame(nr));
394 print_sigset(struct tcb *tcp, long addr, int rt)
400 else if (copy_sigset(tcp, addr, &ss) < 0)
401 tprintf("%#lx", addr);
403 printsigmask(&ss, rt);
409 #define ILL_ILLOPC 1 /* illegal opcode */
410 #define ILL_ILLOPN 2 /* illegal operand */
411 #define ILL_ILLADR 3 /* illegal addressing mode */
412 #define ILL_ILLTRP 4 /* illegal trap */
413 #define ILL_PRVOPC 5 /* privileged opcode */
414 #define ILL_PRVREG 6 /* privileged register */
415 #define ILL_COPROC 7 /* coprocessor error */
416 #define ILL_BADSTK 8 /* internal stack error */
417 #define FPE_INTDIV 1 /* integer divide by zero */
418 #define FPE_INTOVF 2 /* integer overflow */
419 #define FPE_FLTDIV 3 /* floating point divide by zero */
420 #define FPE_FLTOVF 4 /* floating point overflow */
421 #define FPE_FLTUND 5 /* floating point underflow */
422 #define FPE_FLTRES 6 /* floating point inexact result */
423 #define FPE_FLTINV 7 /* floating point invalid operation */
424 #define FPE_FLTSUB 8 /* subscript out of range */
425 #define SEGV_MAPERR 1 /* address not mapped to object */
426 #define SEGV_ACCERR 2 /* invalid permissions for mapped object */
427 #define BUS_ADRALN 1 /* invalid address alignment */
428 #define BUS_ADRERR 2 /* non-existant physical address */
429 #define BUS_OBJERR 3 /* object specific hardware error */
430 #define TRAP_BRKPT 1 /* process breakpoint */
431 #define TRAP_TRACE 2 /* process trace trap */
432 #define CLD_EXITED 1 /* child has exited */
433 #define CLD_KILLED 2 /* child was killed */
434 #define CLD_DUMPED 3 /* child terminated abnormally */
435 #define CLD_TRAPPED 4 /* traced child has trapped */
436 #define CLD_STOPPED 5 /* child has stopped */
437 #define CLD_CONTINUED 6 /* stopped child has continued */
438 #define POLL_IN 1 /* data input available */
439 #define POLL_OUT 2 /* output buffers available */
440 #define POLL_MSG 3 /* input message available */
441 #define POLL_ERR 4 /* i/o error */
442 #define POLL_PRI 5 /* high priority input available */
443 #define POLL_HUP 6 /* device disconnected */
444 #define SI_KERNEL 0x80 /* sent by kernel */
445 #define SI_USER 0 /* sent by kill, sigsend, raise */
446 #define SI_QUEUE -1 /* sent by sigqueue */
447 #define SI_TIMER -2 /* sent by timer expiration */
448 #define SI_MESGQ -3 /* sent by real time mesq state change */
449 #define SI_ASYNCIO -4 /* sent by AIO completion */
450 #define SI_SIGIO -5 /* sent by SIGIO */
451 #define SI_TKILL -6 /* sent by tkill */
452 #define SI_ASYNCNL -60 /* sent by asynch name lookup completion */
454 #define SI_FROMUSER(sip) ((sip)->si_code <= 0)
458 #if __GLIBC_MINOR__ < 1
459 /* Type for data associated with a signal. */
466 # define __SI_MAX_SIZE 128
467 # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
469 typedef struct siginfo
471 int si_signo; /* Signal number. */
472 int si_errno; /* If non-zero, an errno value associated with
473 this signal, as defined in <errno.h>. */
474 int si_code; /* Signal code. */
478 int _pad[__SI_PAD_SIZE];
483 __pid_t si_pid; /* Sending process ID. */
484 __uid_t si_uid; /* Real user ID of sending process. */
487 /* POSIX.1b timers. */
490 unsigned int _timer1;
491 unsigned int _timer2;
494 /* POSIX.1b signals. */
497 __pid_t si_pid; /* Sending process ID. */
498 __uid_t si_uid; /* Real user ID of sending process. */
499 sigval_t si_sigval; /* Signal value. */
505 __pid_t si_pid; /* Which child. */
506 int si_status; /* Exit value or signal. */
511 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */
514 void *si_addr; /* Faulting insn/memory ref. */
520 int si_band; /* Band event for SIGPOLL. */
526 #define si_pid _sifields._kill.si_pid
527 #define si_uid _sifields._kill.si_uid
528 #define si_status _sifields._sigchld.si_status
529 #define si_utime _sifields._sigchld.si_utime
530 #define si_stime _sifields._sigchld.si_stime
531 #define si_value _sifields._rt.si_sigval
532 #define si_int _sifields._rt.si_sigval.sival_int
533 #define si_ptr _sifields._rt.si_sigval.sival_ptr
534 #define si_addr _sifields._sigfault.si_addr
535 #define si_band _sifields._sigpoll.si_band
536 #define si_fd _sifields._sigpoll.si_fd
542 #if defined (SVR4) || defined (LINUX)
544 static const struct xlat siginfo_codes[] = {
546 { SI_KERNEL, "SI_KERNEL" },
549 { SI_USER, "SI_USER" },
552 { SI_QUEUE, "SI_QUEUE" },
555 { SI_TIMER, "SI_TIMER" },
558 { SI_MESGQ, "SI_MESGQ" },
561 { SI_ASYNCIO, "SI_ASYNCIO" },
564 { SI_SIGIO, "SI_SIGIO" },
567 { SI_TKILL, "SI_TKILL" },
570 { SI_ASYNCNL, "SI_ASYNCNL" },
573 { SI_NOINFO, "SI_NOINFO" },
576 { SI_LWP, "SI_LWP" },
581 static const struct xlat sigill_codes[] = {
582 { ILL_ILLOPC, "ILL_ILLOPC" },
583 { ILL_ILLOPN, "ILL_ILLOPN" },
584 { ILL_ILLADR, "ILL_ILLADR" },
585 { ILL_ILLTRP, "ILL_ILLTRP" },
586 { ILL_PRVOPC, "ILL_PRVOPC" },
587 { ILL_PRVREG, "ILL_PRVREG" },
588 { ILL_COPROC, "ILL_COPROC" },
589 { ILL_BADSTK, "ILL_BADSTK" },
593 static const struct xlat sigfpe_codes[] = {
594 { FPE_INTDIV, "FPE_INTDIV" },
595 { FPE_INTOVF, "FPE_INTOVF" },
596 { FPE_FLTDIV, "FPE_FLTDIV" },
597 { FPE_FLTOVF, "FPE_FLTOVF" },
598 { FPE_FLTUND, "FPE_FLTUND" },
599 { FPE_FLTRES, "FPE_FLTRES" },
600 { FPE_FLTINV, "FPE_FLTINV" },
601 { FPE_FLTSUB, "FPE_FLTSUB" },
605 static const struct xlat sigtrap_codes[] = {
606 { TRAP_BRKPT, "TRAP_BRKPT" },
607 { TRAP_TRACE, "TRAP_TRACE" },
611 static const struct xlat sigchld_codes[] = {
612 { CLD_EXITED, "CLD_EXITED" },
613 { CLD_KILLED, "CLD_KILLED" },
614 { CLD_DUMPED, "CLD_DUMPED" },
615 { CLD_TRAPPED, "CLD_TRAPPED" },
616 { CLD_STOPPED, "CLD_STOPPED" },
617 { CLD_CONTINUED,"CLD_CONTINUED" },
621 static const struct xlat sigpoll_codes[] = {
622 { POLL_IN, "POLL_IN" },
623 { POLL_OUT, "POLL_OUT" },
624 { POLL_MSG, "POLL_MSG" },
625 { POLL_ERR, "POLL_ERR" },
626 { POLL_PRI, "POLL_PRI" },
627 { POLL_HUP, "POLL_HUP" },
631 static const struct xlat sigprof_codes[] = {
633 { PROF_SIG, "PROF_SIG" },
639 static const struct xlat sigemt_codes[] = {
641 { EMT_TAGOVF, "EMT_TAGOVF" },
647 static const struct xlat sigsegv_codes[] = {
648 { SEGV_MAPERR, "SEGV_MAPERR" },
649 { SEGV_ACCERR, "SEGV_ACCERR" },
653 static const struct xlat sigbus_codes[] = {
654 { BUS_ADRALN, "BUS_ADRALN" },
655 { BUS_ADRERR, "BUS_ADRERR" },
656 { BUS_OBJERR, "BUS_OBJERR" },
661 printsiginfo(siginfo_t *sip, int verbose)
665 if (sip->si_signo == 0) {
669 tprintf("{si_signo=");
670 printsignal(sip->si_signo);
671 code = xlookup(siginfo_codes, sip->si_code);
673 switch (sip->si_signo) {
675 code = xlookup(sigtrap_codes, sip->si_code);
678 code = xlookup(sigchld_codes, sip->si_code);
681 code = xlookup(sigpoll_codes, sip->si_code);
684 code = xlookup(sigprof_codes, sip->si_code);
687 code = xlookup(sigill_codes, sip->si_code);
691 code = xlookup(sigemt_codes, sip->si_code);
695 code = xlookup(sigfpe_codes, sip->si_code);
698 code = xlookup(sigsegv_codes, sip->si_code);
701 code = xlookup(sigbus_codes, sip->si_code);
706 tprintf(", si_code=%s", code);
708 tprintf(", si_code=%#x", sip->si_code);
710 if (sip->si_code != SI_NOINFO)
714 if (sip->si_errno < 0 || sip->si_errno >= nerrnos)
715 tprintf(", si_errno=%d", sip->si_errno);
717 tprintf(", si_errno=%s",
718 errnoent[sip->si_errno]);
721 if (SI_FROMUSER(sip)) {
722 tprintf(", si_pid=%lu, si_uid=%lu",
723 (unsigned long) sip->si_pid,
724 (unsigned long) sip->si_uid);
725 switch (sip->si_code) {
736 tprintf(", si_value=%d", sip->si_int);
746 tprintf(", si_value={int=%u, ptr=%#lx}",
748 (unsigned long) sip->si_ptr);
754 #endif /* SI_FROMUSER */
756 switch (sip->si_signo) {
758 tprintf(", si_pid=%ld, si_status=",
760 if (sip->si_code == CLD_EXITED)
761 tprintf("%d", sip->si_status);
763 printsignal(sip->si_status);
768 tprintf(", si_utime=%lu, si_stime=%lu",
773 case SIGILL: case SIGFPE:
774 case SIGSEGV: case SIGBUS:
775 tprintf(", si_addr=%#lx",
776 (unsigned long) sip->si_addr);
779 switch (sip->si_code) {
780 case POLL_IN: case POLL_OUT: case POLL_MSG:
781 tprintf(", si_band=%ld",
782 (long) sip->si_band);
788 if (sip->si_pid || sip->si_uid)
789 tprintf(", si_pid=%lu, si_uid=%lu",
790 (unsigned long) sip->si_pid,
791 (unsigned long) sip->si_uid);
797 tprintf(", si_value={int=%u, ptr=%#lx}",
799 (unsigned long) sip->si_ptr);
809 #endif /* SVR4 || LINUX */
814 parse_sigset_t(const char *str, sigset_t *set)
822 p = strchr(str, '\n');
824 p = strchr(str, '\0');
825 for (i = 0; p-- > str; i += 4) {
826 if (*p >= '0' && *p <= '9')
828 else if (*p >= 'a' && *p <= 'f')
829 digit = *p - 'a' + 10;
830 else if (*p >= 'A' && *p <= 'F')
831 digit = *p - 'A' + 10;
835 sigaddset(set, i + 1);
837 sigaddset(set, i + 2);
839 sigaddset(set, i + 3);
841 sigaddset(set, i + 4);
848 * Check process TCP for the disposition of signal SIG.
849 * Return 1 if the process would somehow manage to survive signal SIG,
850 * else return 0. This routine will never be called with SIGKILL.
853 sigishandled(tcp, sig)
863 sigset_t ignored, caught;
867 * Since procfs doesn't interfere with wait I think it is safe
868 * to punt on this question. If not, the information is there.
880 #if defined(SIGURG) && SIGURG != SIGIO
884 /* Gloria Gaynor says ... */
892 /* This is incredibly costly but it's worth it. */
893 /* NOTE: LinuxThreads internally uses SIGRTMIN, SIGRTMIN + 1 and
894 SIGRTMIN + 2, so we can't use the obsolete /proc/%d/stat which
895 doesn't handle real-time signals). */
896 sprintf(sname, "/proc/%d/status", tcp->pid);
897 if ((sfd = open(sname, O_RDONLY)) == -1) {
901 i = read(sfd, buf, sizeof(buf));
905 * Skip the extraneous fields. We need to skip
906 * command name has any spaces in it. So be it.
908 s = strstr(buf, "SigIgn:\t");
911 fprintf(stderr, "/proc/pid/status format error\n");
914 parse_sigset_t(s + 8, &ignored);
916 s = strstr(buf, "SigCgt:\t");
919 fprintf(stderr, "/proc/pid/status format error\n");
922 parse_sigset_t(s + 8, &caught);
925 fprintf(stderr, "sigs: %016qx %016qx (sig=%d)\n",
926 *(long long *) &ignored, *(long long *) &caught, sig);
928 if (sigismember(&ignored, sig) || sigismember(&caught, sig))
935 if (upeek(tcp, uoff(u_signal[0]) + sig*sizeof(u_signal),
936 (long *) &u_signal) < 0) {
939 if (u_signal != SIG_DFL)
946 #if defined(SUNOS4) || defined(FREEBSD)
956 printsignal(tcp->u_arg[0]);
958 addr = tcp->u_arg[1];
960 addr = tcp->u_arg[2];
964 else if (!verbose(tcp))
965 tprintf("%#lx", addr);
966 else if (umove(tcp, addr, &sv) < 0)
969 switch ((int) sv.sv_handler) {
971 tprintf("{SIG_ERR}");
974 tprintf("{SIG_DFL}");
977 if (tcp->u_arg[0] == SIGTRAP) {
978 tcp->flags |= TCB_SIGTRAPPED;
979 kill(tcp->pid, SIGSTOP);
981 tprintf("{SIG_IGN}");
984 if (tcp->u_arg[0] == SIGTRAP) {
985 tcp->flags |= TCB_SIGTRAPPED;
986 kill(tcp->pid, SIGSTOP);
991 if (tcp->u_arg[0] == SIGTRAP) {
992 tcp->flags |= TCB_SIGTRAPPED;
993 kill(tcp->pid, SIGSTOP);
995 tprintf("{%#lx, ", (unsigned long) sv.sv_handler);
996 printsigmask(&sv.sv_mask, 0);
998 printflags(sigvec_flags, sv.sv_flags, "SV_???");
1011 if (entering(tcp)) { /* WTA: UD had a bug here: he forgot the braces */
1013 long_to_sigset(tcp->u_arg[0], &sigm);
1014 printsigmask(&sigm, 0);
1027 addr = tcp->u_arg[0];
1029 addr = tcp->u_arg[1];
1032 else if (umove(tcp, addr, &ss) < 0)
1033 tprintf("%#lx", addr);
1035 tprintf("{ss_sp %#lx ", (unsigned long) ss.ss_sp);
1036 tprintf("ss_onstack %s}", ss.ss_onstack ? "YES" : "NO");
1050 #endif /* SUNOS4 || FREEBSD */
1058 if (entering(tcp)) {
1060 long_to_sigset(tcp->u_arg[0], &sigm);
1061 printsigmask(&sigm, 0);
1063 if ((tcp->u_arg[0] & sigmask(SIGTRAP))) {
1064 /* Mark attempt to block SIGTRAP */
1065 tcp->flags |= TCB_SIGTRAPPED;
1066 /* Send unblockable signal */
1067 kill(tcp->pid, SIGSTOP);
1069 #endif /* !USE_PROCFS */
1071 else if (!syserror(tcp)) {
1073 long_to_sigset(tcp->u_rval, &sigm);
1074 tcp->auxstr = sprintsigmask("old mask ", &sigm, 0);
1076 return RVAL_HEX | RVAL_STR;
1081 #if defined(SUNOS4) || defined(FREEBSD)
1086 return sys_sigsetmask(tcp);
1088 #endif /* SUNOS4 || FREEBSD */
1092 #ifdef HAVE_SIGACTION
1095 struct old_sigaction {
1096 __sighandler_t __sa_handler;
1097 unsigned long sa_mask;
1098 unsigned long sa_flags;
1099 void (*sa_restorer)(void);
1101 #define SA_HANDLER __sa_handler
1105 #define SA_HANDLER sa_handler
1115 struct old_sigaction sa;
1117 struct sigaction sa;
1121 if (entering(tcp)) {
1122 printsignal(tcp->u_arg[0]);
1124 addr = tcp->u_arg[1];
1126 addr = tcp->u_arg[2];
1129 else if (!verbose(tcp))
1130 tprintf("%#lx", addr);
1131 else if (umove(tcp, addr, &sa) < 0)
1134 /* Architectures using function pointers, like
1135 * hppa, may need to manipulate the function pointer
1136 * to compute the result of a comparison. However,
1137 * the SA_HANDLER function pointer exists only in
1138 * the address space of the traced process, and can't
1139 * be manipulated by strace. In order to prevent the
1140 * compiler from generating code to manipulate
1141 * SA_HANDLER we cast the function pointers to long. */
1142 if ((long)sa.SA_HANDLER == (long)SIG_ERR)
1143 tprintf("{SIG_ERR, ");
1144 else if ((long)sa.SA_HANDLER == (long)SIG_DFL)
1145 tprintf("{SIG_DFL, ");
1146 else if ((long)sa.SA_HANDLER == (long)SIG_IGN) {
1148 if (tcp->u_arg[0] == SIGTRAP) {
1149 tcp->flags |= TCB_SIGTRAPPED;
1150 kill(tcp->pid, SIGSTOP);
1152 #endif /* !USE_PROCFS */
1153 tprintf("{SIG_IGN, ");
1157 if (tcp->u_arg[0] == SIGTRAP) {
1158 tcp->flags |= TCB_SIGTRAPPED;
1159 kill(tcp->pid, SIGSTOP);
1161 #endif /* !USE_PROCFS */
1162 tprintf("{%#lx, ", (long) sa.SA_HANDLER);
1164 printsigmask (&sa.sa_mask, 0);
1166 long_to_sigset(sa.sa_mask, &sigset);
1167 printsigmask(&sigset, 0);
1170 printflags(sigact_flags, sa.sa_flags, "SA_???");
1172 if (sa.sa_flags & SA_RESTORER)
1173 tprintf(", %p", sa.sa_restorer);
1182 tprintf(", %#lx", (unsigned long) sa.sa_restorer);
1191 if (entering(tcp)) {
1192 printsignal(tcp->u_arg[0]);
1194 switch (tcp->u_arg[1]) {
1195 case (long) SIG_ERR:
1198 case (long) SIG_DFL:
1201 case (long) SIG_IGN:
1203 if (tcp->u_arg[0] == SIGTRAP) {
1204 tcp->flags |= TCB_SIGTRAPPED;
1205 kill(tcp->pid, SIGSTOP);
1207 #endif /* !USE_PROCFS */
1212 if (tcp->u_arg[0] == SIGTRAP) {
1213 tcp->flags |= TCB_SIGTRAPPED;
1214 kill(tcp->pid, SIGSTOP);
1216 #endif /* !USE_PROCFS */
1217 tprintf("%#lx", tcp->u_arg[1]);
1221 else if (!syserror(tcp)) {
1222 switch (tcp->u_rval) {
1223 case (long) SIG_ERR:
1224 tcp->auxstr = "SIG_ERR"; break;
1225 case (long) SIG_DFL:
1226 tcp->auxstr = "SIG_DFL"; break;
1227 case (long) SIG_IGN:
1228 tcp->auxstr = "SIG_IGN"; break;
1232 return RVAL_HEX | RVAL_STR;
1242 if (entering(tcp)) {
1243 printsignal(tcp->u_arg[0]);
1249 #endif /* HAVE_SIGACTION */
1254 sys_sigreturn(struct tcb *tcp)
1257 struct pt_regs regs;
1258 struct sigcontext_struct sc;
1260 if (entering(tcp)) {
1263 if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (void *)®s) == -1)
1266 if (umove(tcp, regs.ARM_sp, &sc) < 0)
1270 tcp->u_arg[1] = sc.oldmask;
1273 long_to_sigset(tcp->u_arg[1], &sigm);
1274 tcp->u_rval = tcp->u_error = 0;
1275 if (tcp->u_arg[0] == 0)
1277 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1278 return RVAL_NONE | RVAL_STR;
1281 #elif defined(S390) || defined(S390X)
1283 struct sigcontext_struct sc;
1285 if (entering(tcp)) {
1287 if (upeek(tcp,PT_GPR15,&usp)<0)
1289 if (umove(tcp, usp+__SIGNAL_FRAMESIZE, &sc) < 0)
1292 memcpy(&tcp->u_arg[1],&sc.oldmask[0],sizeof(sigset_t));
1294 tcp->u_rval = tcp->u_error = 0;
1295 if (tcp->u_arg[0] == 0)
1297 tcp->auxstr = sprintsigmask("mask now ",(sigset_t *)&tcp->u_arg[1],0);
1298 return RVAL_NONE | RVAL_STR;
1303 struct sigcontext_struct sc;
1305 if (entering(tcp)) {
1307 if (upeek(tcp, 4*UESP, &esp) < 0)
1309 if (umove(tcp, esp, &sc) < 0)
1312 tcp->u_arg[1] = sc.oldmask;
1316 long_to_sigset(tcp->u_arg[1], &sigm);
1317 tcp->u_rval = tcp->u_error = 0;
1318 if (tcp->u_arg[0] == 0)
1320 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1321 return RVAL_NONE | RVAL_STR;
1325 struct sigcontext sc;
1328 if (entering(tcp)) {
1329 /* offset of sigcontext in the kernel's sigframe structure: */
1330 # define SIGFRAME_SC_OFFSET 0x90
1332 if (upeek(tcp, PT_R12, &sp) < 0)
1334 if (umove(tcp, sp + 16 + SIGFRAME_SC_OFFSET, &sc) < 0)
1337 memcpy(tcp->u_arg + 1, &sc.sc_mask, sizeof(sc.sc_mask));
1342 memcpy(&sigm, tcp->u_arg + 1, sizeof (sigm));
1343 tcp->u_rval = tcp->u_error = 0;
1344 if (tcp->u_arg[0] == 0)
1346 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1347 return RVAL_NONE | RVAL_STR;
1350 #elif defined(POWERPC)
1352 struct sigcontext_struct sc;
1354 if (entering(tcp)) {
1356 if (upeek(tcp, sizeof(unsigned long)*PT_R1, &esp) < 0)
1358 /* Skip dummy stack frame. */
1360 if (current_personality == 0)
1367 if (umove(tcp, esp, &sc) < 0)
1370 tcp->u_arg[1] = sc.oldmask;
1374 long_to_sigset(tcp->u_arg[1], &sigm);
1375 tcp->u_rval = tcp->u_error = 0;
1376 if (tcp->u_arg[0] == 0)
1378 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1379 return RVAL_NONE | RVAL_STR;
1384 struct sigcontext sc;
1386 if (entering(tcp)) {
1388 if (upeek(tcp, 4*PT_USP, &usp) < 0)
1390 if (umove(tcp, usp, &sc) < 0)
1393 tcp->u_arg[1] = sc.sc_mask;
1397 long_to_sigset(tcp->u_arg[1], &sigm);
1398 tcp->u_rval = tcp->u_error = 0;
1399 if (tcp->u_arg[0] == 0)
1401 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1402 return RVAL_NONE | RVAL_STR;
1405 #elif defined(ALPHA)
1407 struct sigcontext_struct sc;
1409 if (entering(tcp)) {
1411 if (upeek(tcp, REG_FP, &fp) < 0)
1413 if (umove(tcp, fp, &sc) < 0)
1416 tcp->u_arg[1] = sc.sc_mask;
1420 long_to_sigset(tcp->u_arg[1], &sigm);
1421 tcp->u_rval = tcp->u_error = 0;
1422 if (tcp->u_arg[0] == 0)
1424 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1425 return RVAL_NONE | RVAL_STR;
1428 #elif defined (SPARC) || defined (SPARC64)
1430 struct pt_regs regs;
1433 if(ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) {
1434 perror("sigreturn: PTRACE_GETREGS ");
1439 i1 = regs.u_regs[U_REG_O1];
1440 if(umove(tcp, i1, &si) < 0) {
1441 perror("sigreturn: umove ");
1445 tcp->u_arg[1] = si.si_mask;
1448 long_to_sigset(tcp->u_arg[1], &sigm);
1449 tcp->u_rval = tcp->u_error = 0;
1450 if(tcp->u_arg[0] == 0)
1452 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1453 return RVAL_NONE | RVAL_STR;
1456 #elif defined (LINUX_MIPSN32) || defined (LINUX_MIPSN64)
1457 /* This decodes rt_sigreturn. The 64-bit ABIs do not have
1464 if (upeek(tcp, REG_SP, &sp) < 0)
1466 /* There are six words followed by a 128-byte siginfo. */
1467 sp = sp + 6 * 4 + 128;
1468 if (umove(tcp, sp, &uc) < 0)
1471 tcp->u_arg[1] = *(long *) &uc.uc_sigmask;
1474 long_to_sigset(tcp->u_arg[1], &sigm);
1475 tcp->u_rval = tcp->u_error = 0;
1476 if(tcp->u_arg[0] == 0)
1478 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1479 return RVAL_NONE | RVAL_STR;
1484 struct pt_regs regs;
1487 if(ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) {
1488 perror("sigreturn: PTRACE_GETREGS ");
1494 if (umove(tcp, sp, &si) < 0)
1496 tcp->u_arg[1] = si.si_mask;
1499 long_to_sigset(tcp->u_arg[1], &sigm);
1500 tcp->u_rval = tcp->u_error = 0;
1501 if(tcp->u_arg[0] == 0)
1503 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1504 return RVAL_NONE | RVAL_STR;
1507 #elif defined(CRISV10) || defined(CRISV32)
1508 struct sigcontext sc;
1510 if (entering(tcp)) {
1511 long regs[PT_MAX+1];
1515 if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (long)regs) < 0) {
1516 perror("sigreturn: PTRACE_GETREGS");
1519 if (umove(tcp, regs[PT_USP], &sc) < 0)
1522 tcp->u_arg[1] = sc.oldmask;
1525 long_to_sigset(tcp->u_arg[1], &sigm);
1526 tcp->u_rval = tcp->u_error = 0;
1528 if (tcp->u_arg[0] == 0)
1530 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1531 return RVAL_NONE | RVAL_STR;
1538 /* offset of ucontext in the kernel's sigframe structure */
1539 # define SIGFRAME_UC_OFFSET C_ABI_SAVE_AREA_SIZE + sizeof(struct siginfo)
1541 if (entering(tcp)) {
1543 if (upeek(tcp, PTREGS_OFFSET_SP, &sp) < 0)
1545 if (umove(tcp, sp + SIGFRAME_UC_OFFSET, &uc) < 0)
1548 memcpy(tcp->u_arg + 1, &uc.uc_sigmask, sizeof(uc.uc_sigmask));
1553 memcpy(&sigm, tcp->u_arg + 1, sizeof (sigm));
1554 tcp->u_rval = tcp->u_error = 0;
1555 if (tcp->u_arg[0] == 0)
1557 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1558 return RVAL_NONE | RVAL_STR;
1561 #elif defined(MICROBLAZE)
1562 struct sigcontext sc;
1564 /* TODO: Verify that this is correct... */
1565 if (entering(tcp)) {
1570 /* Read r1, the stack pointer. */
1571 if (upeek(tcp, 1 * 4, &sp) < 0)
1573 if (umove(tcp, sp, &sc) < 0)
1576 tcp->u_arg[1] = sc.oldmask;
1579 long_to_sigset(tcp->u_arg[1], &sigm);
1580 tcp->u_rval = tcp->u_error = 0;
1581 if (tcp->u_arg[0] == 0)
1583 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1584 return RVAL_NONE | RVAL_STR;
1588 #warning No sys_sigreturn() for this architecture
1589 #warning (no problem, just a reminder :-)
1600 long_to_sigset(tcp->u_rval, &sigm);
1601 tcp->auxstr = sprintsigmask("mask ", &sigm, 0);
1603 return RVAL_HEX | RVAL_STR;
1607 sys_sigsuspend(struct tcb *tcp)
1609 if (entering(tcp)) {
1611 long_to_sigset(tcp->u_arg[2], &sigm);
1612 printsigmask(&sigm, 0);
1619 #if defined(SVR4) || defined(FREEBSD)
1627 if (entering(tcp)) {
1628 if (umove(tcp, tcp->u_arg[0], &sigset) < 0)
1631 printsigmask(&sigset, 0);
1636 static const struct xlat ucontext_flags[] = {
1637 { UC_SIGMASK, "UC_SIGMASK" },
1638 { UC_STACK, "UC_STACK" },
1639 { UC_CPU, "UC_CPU" },
1641 { UC_FPU, "UC_FPU" },
1644 { UC_INTR, "UC_INTR" },
1648 #endif /* !FREEBSD */
1649 #endif /* SVR4 || FREEBSD */
1651 #if defined SVR4 || defined LINUX || defined FREEBSD
1652 #if defined LINUX && !defined SS_ONSTACK
1653 #define SS_ONSTACK 1
1654 #define SS_DISABLE 2
1655 #if __GLIBC_MINOR__ == 0
1665 #define stack_t struct sigaltstack
1668 static const struct xlat sigaltstack_flags[] = {
1669 { SS_ONSTACK, "SS_ONSTACK" },
1670 { SS_DISABLE, "SS_DISABLE" },
1677 printcontext(tcp, ucp)
1683 tprintf("uc_flags=");
1684 printflags(ucontext_flags, ucp->uc_flags, "UC_???");
1685 tprintf(", uc_link=%#lx, ", (unsigned long) ucp->uc_link);
1687 tprintf("uc_sigmask=");
1688 printsigmask(&ucp->uc_sigmask, 0);
1690 tprintf(", uc_stack={ss_sp=%#lx, ss_size=%d, ss_flags=",
1691 (unsigned long) ucp->uc_stack.ss_sp,
1692 ucp->uc_stack.ss_size);
1693 printflags(sigaltstack_flags, ucp->uc_stack.ss_flags, "SS_???");
1707 tprintf("%#lx", tcp->u_arg[0]);
1708 else if (!tcp->u_arg[0])
1710 else if (umove(tcp, tcp->u_arg[0], &uc) < 0)
1713 printcontext(tcp, &uc);
1724 if (entering(tcp)) {
1727 else if (umove(tcp, tcp->u_arg[0], &uc) < 0)
1730 printcontext(tcp, &uc);
1733 tcp->u_rval = tcp->u_error = 0;
1734 if (tcp->u_arg[0] == 0)
1743 #if defined(LINUX) || defined(FREEBSD)
1746 print_stack_t(tcp, addr)
1751 if (umove(tcp, addr, &ss) < 0)
1753 tprintf("{ss_sp=%#lx, ss_flags=", (unsigned long) ss.ss_sp);
1754 printflags(sigaltstack_flags, ss.ss_flags, "SS_???");
1755 tprintf(", ss_size=%lu}", (unsigned long) ss.ss_size);
1760 sys_sigaltstack(tcp)
1763 if (entering(tcp)) {
1764 if (tcp->u_arg[0] == 0)
1766 else if (print_stack_t(tcp, tcp->u_arg[0]) < 0)
1771 if (tcp->u_arg[1] == 0)
1773 else if (print_stack_t(tcp, tcp->u_arg[1]) < 0)
1780 #ifdef HAVE_SIGACTION
1783 sys_sigprocmask(tcp)
1787 if (entering(tcp)) {
1788 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
1790 printsigmask(tcp->u_arg[1], 0);
1792 else if (!syserror(tcp)) {
1793 tcp->auxstr = sprintsigmask("old mask ", tcp->u_rval, 0);
1794 return RVAL_HEX | RVAL_STR;
1797 if (entering(tcp)) {
1799 if (tcp->u_arg[0] == 0)
1803 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
1805 print_sigset(tcp, tcp->u_arg[1], 0);
1811 else if (syserror(tcp))
1812 tprintf("%#lx", tcp->u_arg[2]);
1814 print_sigset(tcp, tcp->u_arg[2], 0);
1820 #endif /* HAVE_SIGACTION */
1826 if (entering(tcp)) {
1828 * Sign-extend a 32-bit value when that's what it is.
1830 long pid = tcp->u_arg[0];
1831 if (personality_wordsize[current_personality] < sizeof pid)
1832 pid = (long) (int) pid;
1833 tprintf("%ld, %s", pid, signame(tcp->u_arg[1]));
1838 #if defined(FREEBSD) || defined(SUNOS4)
1843 return sys_kill(tcp);
1845 #endif /* FREEBSD || SUNOS4 */
1852 if (entering(tcp)) {
1853 tprintf("%ld, %ld, %s",
1854 tcp->u_arg[0], tcp->u_arg[1], signame(tcp->u_arg[2]));
1868 tprintf("%#lx", tcp->u_arg[0]);
1869 else if (copy_sigset(tcp, tcp->u_arg[0], &sigset) < 0)
1872 printsigmask(&sigset, 0);
1878 int sys_sigwait(tcp)
1883 if (entering(tcp)) {
1884 if (copy_sigset(tcp, tcp->u_arg[0], &sigset) < 0)
1887 printsigmask(&sigset, 0);
1890 if (!syserror(tcp)) {
1891 tcp->auxstr = signalent[tcp->u_rval];
1892 return RVAL_DECIMAL | RVAL_STR;
1902 sys_rt_sigprocmask(tcp)
1907 /* Note: arg[3] is the length of the sigset. */
1908 if (entering(tcp)) {
1909 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
1913 else if (copy_sigset_len(tcp, tcp->u_arg[1], &sigset, tcp->u_arg[3]) < 0)
1914 tprintf("%#lx, ", tcp->u_arg[1]);
1916 printsigmask(&sigset, 1);
1924 else if (syserror(tcp))
1925 tprintf("%#lx", tcp->u_arg[2]);
1926 else if (copy_sigset_len(tcp, tcp->u_arg[2], &sigset, tcp->u_arg[3]) < 0)
1929 printsigmask(&sigset, 1);
1930 tprintf(", %lu", tcp->u_arg[3]);
1936 /* Structure describing the action to be taken when a signal arrives. */
1937 struct new_sigaction
1939 __sighandler_t __sa_handler;
1940 unsigned long sa_flags;
1941 void (*sa_restorer) (void);
1942 /* Kernel treats sa_mask as an array of longs. */
1943 unsigned long sa_mask[NSIG / sizeof(long) ? NSIG / sizeof(long) : 1];
1945 /* Same for i386-on-x86_64 and similar cases */
1946 struct new_sigaction32
1948 uint32_t __sa_handler;
1950 uint32_t sa_restorer;
1951 uint32_t sa_mask[2 * (NSIG / sizeof(long) ? NSIG / sizeof(long) : 1)];
1956 sys_rt_sigaction(struct tcb *tcp)
1958 struct new_sigaction sa;
1963 if (entering(tcp)) {
1964 printsignal(tcp->u_arg[0]);
1966 addr = tcp->u_arg[1];
1968 addr = tcp->u_arg[2];
1974 if (!verbose(tcp)) {
1975 tprintf("%#lx", addr);
1978 #if SUPPORTED_PERSONALITIES > 1
1979 if (personality_wordsize[current_personality] != sizeof(sa.sa_flags)
1980 && personality_wordsize[current_personality] == 4
1982 struct new_sigaction32 sa32;
1983 r = umove(tcp, addr, &sa32);
1985 memset(&sa, 0, sizeof(sa));
1986 sa.__sa_handler = (void*)(unsigned long)sa32.__sa_handler;
1987 sa.sa_flags = sa32.sa_flags;
1988 sa.sa_restorer = (void*)(unsigned long)sa32.sa_restorer;
1989 /* Kernel treats sa_mask as an array of longs.
1990 * For 32-bit process, "long" is uint32_t, thus, for example,
1991 * 32th bit in sa_mask will end up as bit 0 in sa_mask[1].
1992 * But for (64-bit) kernel, 32th bit in sa_mask is
1993 * 32th bit in 0th (64-bit) long!
1994 * For little-endian, it's the same.
1995 * For big-endian, we swap 32-bit words.
1997 sa.sa_mask[0] = sa32.sa_mask[0] + ((long)(sa32.sa_mask[1]) << 32);
2002 r = umove(tcp, addr, &sa);
2008 /* Architectures using function pointers, like
2009 * hppa, may need to manipulate the function pointer
2010 * to compute the result of a comparison. However,
2011 * the SA_HANDLER function pointer exists only in
2012 * the address space of the traced process, and can't
2013 * be manipulated by strace. In order to prevent the
2014 * compiler from generating code to manipulate
2015 * SA_HANDLER we cast the function pointers to long. */
2016 if ((long)sa.__sa_handler == (long)SIG_ERR)
2017 tprintf("{SIG_ERR, ");
2018 else if ((long)sa.__sa_handler == (long)SIG_DFL)
2019 tprintf("{SIG_DFL, ");
2020 else if ((long)sa.__sa_handler == (long)SIG_IGN)
2021 tprintf("{SIG_IGN, ");
2023 tprintf("{%#lx, ", (long) sa.__sa_handler);
2024 /* Questionable code below.
2025 * Kernel won't handle sys_rt_sigaction
2026 * with wrong sigset size (just returns EINVAL)
2027 * therefore tcp->u_arg[3(4)] _must_ be NSIG / 8 here,
2028 * and we always use smaller memcpy. */
2029 sigemptyset(&sigset);
2031 if (tcp->u_arg[4] <= sizeof(sigset))
2032 memcpy(&sigset, &sa.sa_mask, tcp->u_arg[4]);
2034 if (tcp->u_arg[3] <= sizeof(sigset))
2035 memcpy(&sigset, &sa.sa_mask, tcp->u_arg[3]);
2038 memcpy(&sigset, &sa.sa_mask, sizeof(sigset));
2039 printsigmask(&sigset, 1);
2041 printflags(sigact_flags, sa.sa_flags, "SA_???");
2043 if (sa.sa_flags & SA_RESTORER)
2044 tprintf(", %p", sa.sa_restorer);
2053 tprintf(", %#lx, %lu", tcp->u_arg[3], tcp->u_arg[4]);
2054 #elif defined(ALPHA)
2055 tprintf(", %lu, %#lx", tcp->u_arg[3], tcp->u_arg[4]);
2057 tprintf(", %lu", tcp->u_arg[3]);
2063 sys_rt_sigpending(struct tcb *tcp)
2069 tprintf("%#lx", tcp->u_arg[0]);
2070 else if (copy_sigset_len(tcp, tcp->u_arg[0],
2071 &sigset, tcp->u_arg[1]) < 0)
2074 printsigmask(&sigset, 1);
2080 sys_rt_sigsuspend(struct tcb *tcp)
2082 if (entering(tcp)) {
2084 if (copy_sigset_len(tcp, tcp->u_arg[0], &sigm, tcp->u_arg[1]) < 0)
2087 printsigmask(&sigm, 1);
2093 sys_rt_sigqueueinfo(struct tcb *tcp)
2095 if (entering(tcp)) {
2097 tprintf("%lu, ", tcp->u_arg[0]);
2098 printsignal(tcp->u_arg[1]);
2100 if (umove(tcp, tcp->u_arg[2], &si) < 0)
2101 tprintf("%#lx", tcp->u_arg[2]);
2103 printsiginfo(&si, verbose(tcp));
2108 int sys_rt_sigtimedwait(struct tcb *tcp)
2110 if (entering(tcp)) {
2113 if (copy_sigset_len(tcp, tcp->u_arg[0],
2114 &sigset, tcp->u_arg[3]) < 0)
2117 printsigmask(&sigset, 1);
2119 /* This is the only "return" parameter, */
2120 if (tcp->u_arg[1] != 0)
2122 /* ... if it's NULL, can decode all on entry */
2125 else if (tcp->u_arg[1] != 0) {
2126 /* syscall exit, and u_arg[1] wasn't NULL */
2128 tprintf("%#lx, ", tcp->u_arg[1]);
2131 if (umove(tcp, tcp->u_arg[1], &si) < 0)
2132 tprintf("%#lx, ", tcp->u_arg[1]);
2134 printsiginfo(&si, verbose(tcp));
2140 /* syscall exit, and u_arg[1] was NULL */
2143 print_timespec(tcp, tcp->u_arg[2]);
2144 tprintf(", %d", (int) tcp->u_arg[3]);
2149 sys_restart_syscall(struct tcb *tcp)
2152 tprintf("<... resuming interrupted call ...>");
2157 do_signalfd(struct tcb *tcp, int flags_arg)
2159 if (entering(tcp)) {
2160 printfd(tcp, tcp->u_arg[0]);
2162 print_sigset(tcp, tcp->u_arg[1], 1);
2163 tprintf(", %lu", tcp->u_arg[2]);
2164 if (flags_arg >= 0) {
2166 printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
2173 sys_signalfd(struct tcb *tcp)
2175 return do_signalfd(tcp, -1);
2179 sys_signalfd4(struct tcb *tcp)
2181 return do_signalfd(tcp, 3);