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 */
319 static char outstr[8 * sizeof(sigset_t) * 8];
322 s = outstr + strlen(outstr);
327 maxsigs = __SIGRTMAX; /* instead */
329 for (i = 1; i < maxsigs; i++) {
330 if (sigismember(mask, i) == 1)
333 if (nsigs >= nsignals * 2 / 3) {
335 for (i = 1; i < maxsigs; i++) {
336 switch (sigismember(mask, i)) {
348 for (i = 1; i < maxsigs; i++) {
349 if (sigismember(mask, i) == 1) {
350 /* real-time signals on solaris don't have
354 sprintf(s, format, signalent[i] + 3);
357 else if (i >= __SIGRTMIN && i <= __SIGRTMAX) {
359 sprintf(tsig, "RT_%u", i - __SIGRTMIN);
360 sprintf(s, format, tsig);
362 #endif /* SIGRTMIN */
365 sprintf(tsig, "%u", i);
366 sprintf(s, format, tsig);
378 printsigmask(mask, rt)
382 tprintf("%s", sprintsigmask("", mask, rt));
389 tprintf("%s", signame(nr));
393 print_sigset(struct tcb *tcp, long addr, int rt)
399 else if (copy_sigset(tcp, addr, &ss) < 0)
400 tprintf("%#lx", addr);
402 printsigmask(&ss, rt);
408 #define ILL_ILLOPC 1 /* illegal opcode */
409 #define ILL_ILLOPN 2 /* illegal operand */
410 #define ILL_ILLADR 3 /* illegal addressing mode */
411 #define ILL_ILLTRP 4 /* illegal trap */
412 #define ILL_PRVOPC 5 /* privileged opcode */
413 #define ILL_PRVREG 6 /* privileged register */
414 #define ILL_COPROC 7 /* coprocessor error */
415 #define ILL_BADSTK 8 /* internal stack error */
416 #define FPE_INTDIV 1 /* integer divide by zero */
417 #define FPE_INTOVF 2 /* integer overflow */
418 #define FPE_FLTDIV 3 /* floating point divide by zero */
419 #define FPE_FLTOVF 4 /* floating point overflow */
420 #define FPE_FLTUND 5 /* floating point underflow */
421 #define FPE_FLTRES 6 /* floating point inexact result */
422 #define FPE_FLTINV 7 /* floating point invalid operation */
423 #define FPE_FLTSUB 8 /* subscript out of range */
424 #define SEGV_MAPERR 1 /* address not mapped to object */
425 #define SEGV_ACCERR 2 /* invalid permissions for mapped object */
426 #define BUS_ADRALN 1 /* invalid address alignment */
427 #define BUS_ADRERR 2 /* non-existant physical address */
428 #define BUS_OBJERR 3 /* object specific hardware error */
429 #define TRAP_BRKPT 1 /* process breakpoint */
430 #define TRAP_TRACE 2 /* process trace trap */
431 #define CLD_EXITED 1 /* child has exited */
432 #define CLD_KILLED 2 /* child was killed */
433 #define CLD_DUMPED 3 /* child terminated abnormally */
434 #define CLD_TRAPPED 4 /* traced child has trapped */
435 #define CLD_STOPPED 5 /* child has stopped */
436 #define CLD_CONTINUED 6 /* stopped child has continued */
437 #define POLL_IN 1 /* data input available */
438 #define POLL_OUT 2 /* output buffers available */
439 #define POLL_MSG 3 /* input message available */
440 #define POLL_ERR 4 /* i/o error */
441 #define POLL_PRI 5 /* high priority input available */
442 #define POLL_HUP 6 /* device disconnected */
443 #define SI_USER 0 /* sent by kill, sigsend, raise */
444 #define SI_QUEUE -1 /* sent by sigqueue */
445 #define SI_TIMER -2 /* sent by timer expiration */
446 #define SI_MESGQ -3 /* sent by real time mesq state change */
447 #define SI_ASYNCIO -4 /* sent by AIO completion */
448 #define SI_SIGIO -5 /* Sent by SIGIO */
449 #define SI_TKILL -6 /* Sent by tkill */
452 #if __GLIBC_MINOR__ < 1
453 /* Type for data associated with a signal. */
460 # define __SI_MAX_SIZE 128
461 # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
463 typedef struct siginfo
465 int si_signo; /* Signal number. */
466 int si_errno; /* If non-zero, an errno value associated with
467 this signal, as defined in <errno.h>. */
468 int si_code; /* Signal code. */
472 int _pad[__SI_PAD_SIZE];
477 __pid_t si_pid; /* Sending process ID. */
478 __uid_t si_uid; /* Real user ID of sending process. */
481 /* POSIX.1b timers. */
484 unsigned int _timer1;
485 unsigned int _timer2;
488 /* POSIX.1b signals. */
491 __pid_t si_pid; /* Sending process ID. */
492 __uid_t si_uid; /* Real user ID of sending process. */
493 sigval_t si_sigval; /* Signal value. */
499 __pid_t si_pid; /* Which child. */
500 int si_status; /* Exit value or signal. */
505 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */
508 void *si_addr; /* Faulting insn/memory ref. */
514 int si_band; /* Band event for SIGPOLL. */
520 #define si_pid _sifields._kill.si_pid
521 #define si_uid _sifields._kill.si_uid
522 #define si_status _sifields._sigchld.si_status
523 #define si_utime _sifields._sigchld.si_utime
524 #define si_stime _sifields._sigchld.si_stime
525 #define si_value _sifields._rt.si_sigval
526 #define si_int _sifields._rt.si_sigval.sival_int
527 #define si_ptr _sifields._rt.si_sigval.sival_ptr
528 #define si_addr _sifields._sigfault.si_addr
529 #define si_band _sifields._sigpoll.si_band
530 #define si_fd _sifields._sigpoll.si_fd
536 #if defined (SVR4) || defined (LINUX)
538 static const struct xlat siginfo_codes[] = {
540 { SI_NOINFO, "SI_NOINFO" },
543 { SI_USER, "SI_USER" },
546 { SI_LWP, "SI_LWP" },
549 { SI_QUEUE, "SI_QUEUE" },
552 { SI_TIMER, "SI_TIMER" },
555 { SI_ASYNCIO, "SI_ASYNCIO" },
558 { SI_MESGQ, "SI_MESGQ" },
561 { SI_SIGIO, "SI_SIGIO" },
564 { SI_TKILL, "SI_TKILL" },
569 static const struct xlat sigill_codes[] = {
570 { ILL_ILLOPC, "ILL_ILLOPC" },
571 { ILL_ILLOPN, "ILL_ILLOPN" },
572 { ILL_ILLADR, "ILL_ILLADR" },
573 { ILL_ILLTRP, "ILL_ILLTRP" },
574 { ILL_PRVOPC, "ILL_PRVOPC" },
575 { ILL_PRVREG, "ILL_PRVREG" },
576 { ILL_COPROC, "ILL_COPROC" },
577 { ILL_BADSTK, "ILL_BADSTK" },
581 static const struct xlat sigfpe_codes[] = {
582 { FPE_INTDIV, "FPE_INTDIV" },
583 { FPE_INTOVF, "FPE_INTOVF" },
584 { FPE_FLTDIV, "FPE_FLTDIV" },
585 { FPE_FLTOVF, "FPE_FLTOVF" },
586 { FPE_FLTUND, "FPE_FLTUND" },
587 { FPE_FLTRES, "FPE_FLTRES" },
588 { FPE_FLTINV, "FPE_FLTINV" },
589 { FPE_FLTSUB, "FPE_FLTSUB" },
593 static const struct xlat sigtrap_codes[] = {
594 { TRAP_BRKPT, "TRAP_BRKPT" },
595 { TRAP_TRACE, "TRAP_TRACE" },
599 static const struct xlat sigchld_codes[] = {
600 { CLD_EXITED, "CLD_EXITED" },
601 { CLD_KILLED, "CLD_KILLED" },
602 { CLD_DUMPED, "CLD_DUMPED" },
603 { CLD_TRAPPED, "CLD_TRAPPED" },
604 { CLD_STOPPED, "CLD_STOPPED" },
605 { CLD_CONTINUED,"CLD_CONTINUED" },
609 static const struct xlat sigpoll_codes[] = {
610 { POLL_IN, "POLL_IN" },
611 { POLL_OUT, "POLL_OUT" },
612 { POLL_MSG, "POLL_MSG" },
613 { POLL_ERR, "POLL_ERR" },
614 { POLL_PRI, "POLL_PRI" },
615 { POLL_HUP, "POLL_HUP" },
619 static const struct xlat sigprof_codes[] = {
621 { PROF_SIG, "PROF_SIG" },
627 static const struct xlat sigemt_codes[] = {
629 { EMT_TAGOVF, "EMT_TAGOVF" },
635 static const struct xlat sigsegv_codes[] = {
636 { SEGV_MAPERR, "SEGV_MAPERR" },
637 { SEGV_ACCERR, "SEGV_ACCERR" },
641 static const struct xlat sigbus_codes[] = {
642 { BUS_ADRALN, "BUS_ADRALN" },
643 { BUS_ADRERR, "BUS_ADRERR" },
644 { BUS_OBJERR, "BUS_OBJERR" },
649 printsiginfo(sip, verbose)
655 if (sip->si_signo == 0) {
659 tprintf("{si_signo=");
660 printsignal(sip->si_signo);
661 code = xlookup(siginfo_codes, sip->si_code);
663 switch (sip->si_signo) {
665 code = xlookup(sigtrap_codes, sip->si_code);
668 code = xlookup(sigchld_codes, sip->si_code);
671 code = xlookup(sigpoll_codes, sip->si_code);
674 code = xlookup(sigprof_codes, sip->si_code);
677 code = xlookup(sigill_codes, sip->si_code);
681 code = xlookup(sigemt_codes, sip->si_code);
685 code = xlookup(sigfpe_codes, sip->si_code);
688 code = xlookup(sigsegv_codes, sip->si_code);
691 code = xlookup(sigbus_codes, sip->si_code);
696 tprintf(", si_code=%s", code);
698 tprintf(", si_code=%#x", sip->si_code);
700 if (sip->si_code != SI_NOINFO)
704 if (sip->si_errno < 0 || sip->si_errno >= nerrnos)
705 tprintf(", si_errno=%d", sip->si_errno);
707 tprintf(", si_errno=%s",
708 errnoent[sip->si_errno]);
711 if (SI_FROMUSER(sip)) {
712 tprintf(", si_pid=%ld, si_uid=%ld",
713 sip->si_pid, sip->si_uid);
715 switch (sip->si_code) {
719 #endif /* SI_QUEUE */
723 #endif /* SI_MESGQ */
724 tprintf(", si_value=%d",
725 sip->si_value.sival_int);
728 #endif /* SI_QUEUE */
731 #endif /* SI_FROMUSER */
733 switch (sip->si_signo) {
735 tprintf(", si_pid=%ld, si_status=",
737 if (sip->si_code == CLD_EXITED)
738 tprintf("%d", sip->si_status);
740 printsignal(sip->si_status);
745 tprintf(", si_utime=%lu, si_stime=%lu",
750 case SIGILL: case SIGFPE:
751 case SIGSEGV: case SIGBUS:
752 tprintf(", si_addr=%#lx",
753 (unsigned long) sip->si_addr);
756 switch (sip->si_code) {
757 case POLL_IN: case POLL_OUT: case POLL_MSG:
758 tprintf(", si_band=%ld",
759 (long) sip->si_band);
765 tprintf(", si_pid=%lu, si_uid=%lu, ",
766 (unsigned long) sip->si_pid,
767 (unsigned long) sip->si_uid);
771 tprintf("si_value={int=%u, ptr=%#lx}",
773 (unsigned long) sip->si_ptr);
783 #endif /* SVR4 || LINUX */
788 parse_sigset_t (const char *str, sigset_t *set)
796 p = strchr(str, '\n');
798 p = strchr(str, '\0');
799 for (i = 0; p-- > str; i += 4) {
800 if (*p >= '0' && *p <= '9')
802 else if (*p >= 'a' && *p <= 'f')
803 digit = *p - 'a' + 10;
804 else if (*p >= 'A' && *p <= 'F')
805 digit = *p - 'A' + 10;
809 sigaddset(set, i + 1);
811 sigaddset(set, i + 2);
813 sigaddset(set, i + 3);
815 sigaddset(set, i + 4);
822 * Check process TCP for the disposition of signal SIG.
823 * Return 1 if the process would somehow manage to survive signal SIG,
824 * else return 0. This routine will never be called with SIGKILL.
827 sigishandled(tcp, sig)
837 sigset_t ignored, caught;
841 * Since procfs doesn't interfere with wait I think it is safe
842 * to punt on this question. If not, the information is there.
854 #if defined(SIGURG) && SIGURG != SIGIO
858 /* Gloria Gaynor says ... */
866 /* This is incredibly costly but it's worth it. */
867 /* NOTE: LinuxThreads internally uses SIGRTMIN, SIGRTMIN + 1 and
868 SIGRTMIN + 2, so we can't use the obsolete /proc/%d/stat which
869 doesn't handle real-time signals). */
870 sprintf(sname, "/proc/%d/status", tcp->pid);
871 if ((sfd = open(sname, O_RDONLY)) == -1) {
875 i = read(sfd, buf, sizeof(buf));
879 * Skip the extraneous fields. We need to skip
880 * command name has any spaces in it. So be it.
882 s = strstr(buf, "SigIgn:\t");
885 fprintf(stderr, "/proc/pid/status format error\n");
888 parse_sigset_t(s + 8, &ignored);
890 s = strstr(buf, "SigCgt:\t");
893 fprintf(stderr, "/proc/pid/status format error\n");
896 parse_sigset_t(s + 8, &caught);
899 fprintf(stderr, "sigs: %016qx %016qx (sig=%d)\n",
900 *(long long *) &ignored, *(long long *) &caught, sig);
902 if (sigismember(&ignored, sig) || sigismember(&caught, sig))
909 if (upeek(tcp, uoff(u_signal[0]) + sig*sizeof(u_signal),
910 (long *) &u_signal) < 0) {
913 if (u_signal != SIG_DFL)
920 #if defined(SUNOS4) || defined(FREEBSD)
930 printsignal(tcp->u_arg[0]);
932 addr = tcp->u_arg[1];
934 addr = tcp->u_arg[2];
938 else if (!verbose(tcp))
939 tprintf("%#lx", addr);
940 else if (umove(tcp, addr, &sv) < 0)
943 switch ((int) sv.sv_handler) {
945 tprintf("{SIG_ERR}");
948 tprintf("{SIG_DFL}");
951 if (tcp->u_arg[0] == SIGTRAP) {
952 tcp->flags |= TCB_SIGTRAPPED;
953 kill(tcp->pid, SIGSTOP);
955 tprintf("{SIG_IGN}");
958 if (tcp->u_arg[0] == SIGTRAP) {
959 tcp->flags |= TCB_SIGTRAPPED;
960 kill(tcp->pid, SIGSTOP);
965 if (tcp->u_arg[0] == SIGTRAP) {
966 tcp->flags |= TCB_SIGTRAPPED;
967 kill(tcp->pid, SIGSTOP);
969 tprintf("{%#lx, ", (unsigned long) sv.sv_handler);
970 printsigmask(&sv.sv_mask, 0);
972 printflags(sigvec_flags, sv.sv_flags, "SV_???");
985 if (entering(tcp)) { /* WTA: UD had a bug here: he forgot the braces */
987 long_to_sigset(tcp->u_arg[0], &sigm);
988 printsigmask(&sigm, 0);
1001 addr = tcp->u_arg[0];
1003 addr = tcp->u_arg[1];
1006 else if (umove(tcp, addr, &ss) < 0)
1007 tprintf("%#lx", addr);
1009 tprintf("{ss_sp %#lx ", (unsigned long) ss.ss_sp);
1010 tprintf("ss_onstack %s}", ss.ss_onstack ? "YES" : "NO");
1024 #endif /* SUNOS4 || FREEBSD */
1032 if (entering(tcp)) {
1034 long_to_sigset(tcp->u_arg[0], &sigm);
1035 printsigmask(&sigm, 0);
1037 if ((tcp->u_arg[0] & sigmask(SIGTRAP))) {
1038 /* Mark attempt to block SIGTRAP */
1039 tcp->flags |= TCB_SIGTRAPPED;
1040 /* Send unblockable signal */
1041 kill(tcp->pid, SIGSTOP);
1043 #endif /* !USE_PROCFS */
1045 else if (!syserror(tcp)) {
1047 long_to_sigset(tcp->u_rval, &sigm);
1048 tcp->auxstr = sprintsigmask("old mask ", &sigm, 0);
1050 return RVAL_HEX | RVAL_STR;
1055 #if defined(SUNOS4) || defined(FREEBSD)
1060 return sys_sigsetmask(tcp);
1062 #endif /* SUNOS4 || FREEBSD */
1066 #ifdef HAVE_SIGACTION
1069 struct old_sigaction {
1070 __sighandler_t __sa_handler;
1071 unsigned long sa_mask;
1072 unsigned long sa_flags;
1073 void (*sa_restorer)(void);
1075 #define SA_HANDLER __sa_handler
1079 #define SA_HANDLER sa_handler
1089 struct old_sigaction sa;
1091 struct sigaction sa;
1095 if (entering(tcp)) {
1096 printsignal(tcp->u_arg[0]);
1098 addr = tcp->u_arg[1];
1100 addr = tcp->u_arg[2];
1103 else if (!verbose(tcp))
1104 tprintf("%#lx", addr);
1105 else if (umove(tcp, addr, &sa) < 0)
1108 /* Architectures using function pointers, like
1109 * hppa, may need to manipulate the function pointer
1110 * to compute the result of a comparison. However,
1111 * the SA_HANDLER function pointer exists only in
1112 * the address space of the traced process, and can't
1113 * be manipulated by strace. In order to prevent the
1114 * compiler from generating code to manipulate
1115 * SA_HANDLER we cast the function pointers to long. */
1116 if ((long)sa.SA_HANDLER == (long)SIG_ERR)
1117 tprintf("{SIG_ERR, ");
1118 else if ((long)sa.SA_HANDLER == (long)SIG_DFL)
1119 tprintf("{SIG_DFL, ");
1120 else if ((long)sa.SA_HANDLER == (long)SIG_IGN) {
1122 if (tcp->u_arg[0] == SIGTRAP) {
1123 tcp->flags |= TCB_SIGTRAPPED;
1124 kill(tcp->pid, SIGSTOP);
1126 #endif /* !USE_PROCFS */
1127 tprintf("{SIG_IGN, ");
1131 if (tcp->u_arg[0] == SIGTRAP) {
1132 tcp->flags |= TCB_SIGTRAPPED;
1133 kill(tcp->pid, SIGSTOP);
1135 #endif /* !USE_PROCFS */
1136 tprintf("{%#lx, ", (long) sa.SA_HANDLER);
1138 printsigmask (&sa.sa_mask, 0);
1140 long_to_sigset(sa.sa_mask, &sigset);
1141 printsigmask(&sigset, 0);
1144 printflags(sigact_flags, sa.sa_flags, "SA_???");
1146 if (sa.sa_flags & SA_RESTORER)
1147 tprintf(", %p", sa.sa_restorer);
1156 tprintf(", %#lx", (unsigned long) sa.sa_restorer);
1165 if (entering(tcp)) {
1166 printsignal(tcp->u_arg[0]);
1168 switch (tcp->u_arg[1]) {
1169 case (long) SIG_ERR:
1172 case (long) SIG_DFL:
1175 case (long) SIG_IGN:
1177 if (tcp->u_arg[0] == SIGTRAP) {
1178 tcp->flags |= TCB_SIGTRAPPED;
1179 kill(tcp->pid, SIGSTOP);
1181 #endif /* !USE_PROCFS */
1186 if (tcp->u_arg[0] == SIGTRAP) {
1187 tcp->flags |= TCB_SIGTRAPPED;
1188 kill(tcp->pid, SIGSTOP);
1190 #endif /* !USE_PROCFS */
1191 tprintf("%#lx", tcp->u_arg[1]);
1195 else if (!syserror(tcp)) {
1196 switch (tcp->u_rval) {
1197 case (long) SIG_ERR:
1198 tcp->auxstr = "SIG_ERR"; break;
1199 case (long) SIG_DFL:
1200 tcp->auxstr = "SIG_DFL"; break;
1201 case (long) SIG_IGN:
1202 tcp->auxstr = "SIG_IGN"; break;
1206 return RVAL_HEX | RVAL_STR;
1216 if (entering(tcp)) {
1217 printsignal(tcp->u_arg[0]);
1223 #endif /* HAVE_SIGACTION */
1228 sys_sigreturn(struct tcb *tcp)
1231 struct pt_regs regs;
1232 struct sigcontext_struct sc;
1234 if (entering(tcp)) {
1237 if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (void *)®s) == -1)
1240 if (umove(tcp, regs.ARM_sp, &sc) < 0)
1244 tcp->u_arg[1] = sc.oldmask;
1247 long_to_sigset(tcp->u_arg[1], &sigm);
1248 tcp->u_rval = tcp->u_error = 0;
1249 if (tcp->u_arg[0] == 0)
1251 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1252 return RVAL_NONE | RVAL_STR;
1255 #elif defined(S390) || defined(S390X)
1257 struct sigcontext_struct sc;
1259 if (entering(tcp)) {
1261 if (upeek(tcp,PT_GPR15,&usp)<0)
1263 if (umove(tcp, usp+__SIGNAL_FRAMESIZE, &sc) < 0)
1266 memcpy(&tcp->u_arg[1],&sc.oldmask[0],sizeof(sigset_t));
1268 tcp->u_rval = tcp->u_error = 0;
1269 if (tcp->u_arg[0] == 0)
1271 tcp->auxstr = sprintsigmask("mask now ",(sigset_t *)&tcp->u_arg[1],0);
1272 return RVAL_NONE | RVAL_STR;
1277 struct sigcontext_struct sc;
1279 if (entering(tcp)) {
1281 if (upeek(tcp, 4*UESP, &esp) < 0)
1283 if (umove(tcp, esp, &sc) < 0)
1286 tcp->u_arg[1] = sc.oldmask;
1290 long_to_sigset(tcp->u_arg[1], &sigm);
1291 tcp->u_rval = tcp->u_error = 0;
1292 if (tcp->u_arg[0] == 0)
1294 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1295 return RVAL_NONE | RVAL_STR;
1299 struct sigcontext sc;
1302 if (entering(tcp)) {
1303 /* offset of sigcontext in the kernel's sigframe structure: */
1304 # define SIGFRAME_SC_OFFSET 0x90
1306 if (upeek(tcp, PT_R12, &sp) < 0)
1308 if (umove(tcp, sp + 16 + SIGFRAME_SC_OFFSET, &sc) < 0)
1311 memcpy(tcp->u_arg + 1, &sc.sc_mask, sizeof(sc.sc_mask));
1316 memcpy(&sigm, tcp->u_arg + 1, sizeof (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;
1324 #elif defined(POWERPC)
1326 struct sigcontext_struct sc;
1328 if (entering(tcp)) {
1330 if (upeek(tcp, sizeof(unsigned long)*PT_R1, &esp) < 0)
1332 /* Skip dummy stack frame. */
1334 if (current_personality == 0)
1341 if (umove(tcp, esp, &sc) < 0)
1344 tcp->u_arg[1] = sc.oldmask;
1348 long_to_sigset(tcp->u_arg[1], &sigm);
1349 tcp->u_rval = tcp->u_error = 0;
1350 if (tcp->u_arg[0] == 0)
1352 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1353 return RVAL_NONE | RVAL_STR;
1358 struct sigcontext sc;
1360 if (entering(tcp)) {
1362 if (upeek(tcp, 4*PT_USP, &usp) < 0)
1364 if (umove(tcp, usp, &sc) < 0)
1367 tcp->u_arg[1] = sc.sc_mask;
1371 long_to_sigset(tcp->u_arg[1], &sigm);
1372 tcp->u_rval = tcp->u_error = 0;
1373 if (tcp->u_arg[0] == 0)
1375 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1376 return RVAL_NONE | RVAL_STR;
1379 #elif defined(ALPHA)
1381 struct sigcontext_struct sc;
1383 if (entering(tcp)) {
1385 if (upeek(tcp, REG_FP, &fp) < 0)
1387 if (umove(tcp, fp, &sc) < 0)
1390 tcp->u_arg[1] = sc.sc_mask;
1394 long_to_sigset(tcp->u_arg[1], &sigm);
1395 tcp->u_rval = tcp->u_error = 0;
1396 if (tcp->u_arg[0] == 0)
1398 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1399 return RVAL_NONE | RVAL_STR;
1402 #elif defined (SPARC) || defined (SPARC64)
1404 struct pt_regs regs;
1407 if(ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) {
1408 perror("sigreturn: PTRACE_GETREGS ");
1413 i1 = regs.u_regs[U_REG_O1];
1414 if(umove(tcp, i1, &si) < 0) {
1415 perror("sigreturn: umove ");
1419 tcp->u_arg[1] = si.si_mask;
1422 long_to_sigset(tcp->u_arg[1], &sigm);
1423 tcp->u_rval = tcp->u_error = 0;
1424 if(tcp->u_arg[0] == 0)
1426 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1427 return RVAL_NONE | RVAL_STR;
1430 #elif defined (LINUX_MIPSN32) || defined (LINUX_MIPSN64)
1431 /* This decodes rt_sigreturn. The 64-bit ABIs do not have
1438 if (upeek(tcp, REG_SP, &sp) < 0)
1440 /* There are six words followed by a 128-byte siginfo. */
1441 sp = sp + 6 * 4 + 128;
1442 if (umove(tcp, sp, &uc) < 0)
1445 tcp->u_arg[1] = *(long *) &uc.uc_sigmask;
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;
1458 struct pt_regs regs;
1461 if(ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) {
1462 perror("sigreturn: PTRACE_GETREGS ");
1468 if (umove(tcp, sp, &si) < 0)
1470 tcp->u_arg[1] = si.si_mask;
1473 long_to_sigset(tcp->u_arg[1], &sigm);
1474 tcp->u_rval = tcp->u_error = 0;
1475 if(tcp->u_arg[0] == 0)
1477 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1478 return RVAL_NONE | RVAL_STR;
1481 #elif defined(CRISV10) || defined(CRISV32)
1482 struct sigcontext sc;
1484 if (entering(tcp)) {
1485 long regs[PT_MAX+1];
1489 if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (long)regs) < 0) {
1490 perror("sigreturn: PTRACE_GETREGS");
1493 if (umove(tcp, regs[PT_USP], &sc) < 0)
1496 tcp->u_arg[1] = sc.oldmask;
1499 long_to_sigset(tcp->u_arg[1], &sigm);
1500 tcp->u_rval = tcp->u_error = 0;
1502 if (tcp->u_arg[0] == 0)
1504 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1505 return RVAL_NONE | RVAL_STR;
1512 /* offset of ucontext in the kernel's sigframe structure */
1513 # define SIGFRAME_UC_OFFSET C_ABI_SAVE_AREA_SIZE + sizeof(struct siginfo)
1515 if (entering(tcp)) {
1517 if (upeek(tcp, PTREGS_OFFSET_SP, &sp) < 0)
1519 if (umove(tcp, sp + SIGFRAME_UC_OFFSET, &uc) < 0)
1522 memcpy(tcp->u_arg + 1, &uc.uc_sigmask, sizeof(uc.uc_sigmask));
1527 memcpy(&sigm, tcp->u_arg + 1, sizeof (sigm));
1528 tcp->u_rval = tcp->u_error = 0;
1529 if (tcp->u_arg[0] == 0)
1531 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1532 return RVAL_NONE | RVAL_STR;
1535 #elif defined(MICROBLAZE)
1536 struct sigcontext sc;
1538 /* TODO: Verify that this is correct... */
1539 if (entering(tcp)) {
1544 /* Read r1, the stack pointer. */
1545 if (upeek(tcp, 1 * 4, &sp) < 0)
1547 if (umove(tcp, sp, &sc) < 0)
1550 tcp->u_arg[1] = sc.oldmask;
1553 long_to_sigset(tcp->u_arg[1], &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;
1562 #warning No sys_sigreturn() for this architecture
1563 #warning (no problem, just a reminder :-)
1574 long_to_sigset(tcp->u_rval, &sigm);
1575 tcp->auxstr = sprintsigmask("mask ", &sigm, 0);
1577 return RVAL_HEX | RVAL_STR;
1581 sys_sigsuspend(struct tcb *tcp)
1583 if (entering(tcp)) {
1585 long_to_sigset(tcp->u_arg[2], &sigm);
1586 printsigmask(&sigm, 0);
1593 #if defined(SVR4) || defined(FREEBSD)
1601 if (entering(tcp)) {
1602 if (umove(tcp, tcp->u_arg[0], &sigset) < 0)
1605 printsigmask(&sigset, 0);
1610 static const struct xlat ucontext_flags[] = {
1611 { UC_SIGMASK, "UC_SIGMASK" },
1612 { UC_STACK, "UC_STACK" },
1613 { UC_CPU, "UC_CPU" },
1615 { UC_FPU, "UC_FPU" },
1618 { UC_INTR, "UC_INTR" },
1622 #endif /* !FREEBSD */
1623 #endif /* SVR4 || FREEBSD */
1625 #if defined SVR4 || defined LINUX || defined FREEBSD
1626 #if defined LINUX && !defined SS_ONSTACK
1627 #define SS_ONSTACK 1
1628 #define SS_DISABLE 2
1629 #if __GLIBC_MINOR__ == 0
1639 #define stack_t struct sigaltstack
1642 static const struct xlat sigaltstack_flags[] = {
1643 { SS_ONSTACK, "SS_ONSTACK" },
1644 { SS_DISABLE, "SS_DISABLE" },
1651 printcontext(tcp, ucp)
1657 tprintf("uc_flags=");
1658 printflags(ucontext_flags, ucp->uc_flags, "UC_???");
1659 tprintf(", uc_link=%#lx, ", (unsigned long) ucp->uc_link);
1661 tprintf("uc_sigmask=");
1662 printsigmask(&ucp->uc_sigmask, 0);
1664 tprintf(", uc_stack={ss_sp=%#lx, ss_size=%d, ss_flags=",
1665 (unsigned long) ucp->uc_stack.ss_sp,
1666 ucp->uc_stack.ss_size);
1667 printflags(sigaltstack_flags, ucp->uc_stack.ss_flags, "SS_???");
1681 tprintf("%#lx", tcp->u_arg[0]);
1682 else if (!tcp->u_arg[0])
1684 else if (umove(tcp, tcp->u_arg[0], &uc) < 0)
1687 printcontext(tcp, &uc);
1698 if (entering(tcp)) {
1701 else if (umove(tcp, tcp->u_arg[0], &uc) < 0)
1704 printcontext(tcp, &uc);
1707 tcp->u_rval = tcp->u_error = 0;
1708 if (tcp->u_arg[0] == 0)
1717 #if defined(LINUX) || defined(FREEBSD)
1720 print_stack_t(tcp, addr)
1725 if (umove(tcp, addr, &ss) < 0)
1727 tprintf("{ss_sp=%#lx, ss_flags=", (unsigned long) ss.ss_sp);
1728 printflags(sigaltstack_flags, ss.ss_flags, "SS_???");
1729 tprintf(", ss_size=%lu}", (unsigned long) ss.ss_size);
1734 sys_sigaltstack(tcp)
1737 if (entering(tcp)) {
1738 if (tcp->u_arg[0] == 0)
1740 else if (print_stack_t(tcp, tcp->u_arg[0]) < 0)
1745 if (tcp->u_arg[1] == 0)
1747 else if (print_stack_t(tcp, tcp->u_arg[1]) < 0)
1754 #ifdef HAVE_SIGACTION
1757 sys_sigprocmask(tcp)
1761 if (entering(tcp)) {
1762 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
1764 printsigmask(tcp->u_arg[1], 0);
1766 else if (!syserror(tcp)) {
1767 tcp->auxstr = sprintsigmask("old mask ", tcp->u_rval, 0);
1768 return RVAL_HEX | RVAL_STR;
1771 if (entering(tcp)) {
1773 if (tcp->u_arg[0] == 0)
1777 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
1779 print_sigset(tcp, tcp->u_arg[1], 0);
1785 else if (syserror(tcp))
1786 tprintf("%#lx", tcp->u_arg[2]);
1788 print_sigset(tcp, tcp->u_arg[2], 0);
1794 #endif /* HAVE_SIGACTION */
1800 if (entering(tcp)) {
1802 * Sign-extend a 32-bit value when that's what it is.
1804 long pid = tcp->u_arg[0];
1805 if (personality_wordsize[current_personality] < sizeof pid)
1806 pid = (long) (int) pid;
1807 tprintf("%ld, %s", pid, signame(tcp->u_arg[1]));
1812 #if defined(FREEBSD) || defined(SUNOS4)
1817 return sys_kill(tcp);
1819 #endif /* FREEBSD || SUNOS4 */
1826 if (entering(tcp)) {
1827 tprintf("%ld, %ld, %s",
1828 tcp->u_arg[0], tcp->u_arg[1], signame(tcp->u_arg[2]));
1842 tprintf("%#lx", tcp->u_arg[0]);
1843 else if (copy_sigset(tcp, tcp->u_arg[0], &sigset) < 0)
1846 printsigmask(&sigset, 0);
1852 int sys_sigwait(tcp)
1857 if (entering(tcp)) {
1858 if (copy_sigset(tcp, tcp->u_arg[0], &sigset) < 0)
1861 printsigmask(&sigset, 0);
1864 if (!syserror(tcp)) {
1865 tcp->auxstr = signalent[tcp->u_rval];
1866 return RVAL_DECIMAL | RVAL_STR;
1876 sys_rt_sigprocmask(tcp)
1881 /* Note: arg[3] is the length of the sigset. */
1882 if (entering(tcp)) {
1883 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
1887 else if (copy_sigset_len(tcp, tcp->u_arg[1], &sigset, tcp->u_arg[3]) < 0)
1888 tprintf("%#lx, ", tcp->u_arg[1]);
1890 printsigmask(&sigset, 1);
1898 else if (syserror(tcp))
1899 tprintf("%#lx", tcp->u_arg[2]);
1900 else if (copy_sigset_len(tcp, tcp->u_arg[2], &sigset, tcp->u_arg[3]) < 0)
1903 printsigmask(&sigset, 1);
1904 tprintf(", %lu", tcp->u_arg[3]);
1910 /* Structure describing the action to be taken when a signal arrives. */
1911 struct new_sigaction
1913 __sighandler_t __sa_handler;
1914 unsigned long sa_flags;
1915 void (*sa_restorer) (void);
1916 /* Kernel treats sa_mask as an array of longs. */
1917 unsigned long sa_mask[NSIG / sizeof(long) ? NSIG / sizeof(long) : 1];
1919 /* Same for i386-on-x86_64 and similar cases */
1920 struct new_sigaction32
1922 uint32_t __sa_handler;
1924 uint32_t sa_restorer;
1925 uint32_t sa_mask[2 * (NSIG / sizeof(long) ? NSIG / sizeof(long) : 1)];
1930 sys_rt_sigaction(struct tcb *tcp)
1932 struct new_sigaction sa;
1937 if (entering(tcp)) {
1938 printsignal(tcp->u_arg[0]);
1940 addr = tcp->u_arg[1];
1942 addr = tcp->u_arg[2];
1948 if (!verbose(tcp)) {
1949 tprintf("%#lx", addr);
1952 #if SUPPORTED_PERSONALITIES > 1
1953 if (personality_wordsize[current_personality] != sizeof(sa.sa_flags)
1954 && personality_wordsize[current_personality] == 4
1956 struct new_sigaction32 sa32;
1957 r = umove(tcp, addr, &sa32);
1959 memset(&sa, 0, sizeof(sa));
1960 sa.__sa_handler = (void*)(unsigned long)sa32.__sa_handler;
1961 sa.sa_flags = sa32.sa_flags;
1962 sa.sa_restorer = (void*)(unsigned long)sa32.sa_restorer;
1963 /* Kernel treats sa_mask as an array of longs.
1964 * For 32-bit process, "long" is uint32_t, thus, for example,
1965 * 32th bit in sa_mask will end up as bit 0 in sa_mask[1].
1966 * But for (64-bit) kernel, 32th bit in sa_mask is
1967 * 32th bit in 0th (64-bit) long!
1968 * For little-endian, it's the same.
1969 * For big-endian, we swap 32-bit words.
1971 sa.sa_mask[0] = sa32.sa_mask[0] + ((long)(sa32.sa_mask[1]) << 32);
1976 r = umove(tcp, addr, &sa);
1982 /* Architectures using function pointers, like
1983 * hppa, may need to manipulate the function pointer
1984 * to compute the result of a comparison. However,
1985 * the SA_HANDLER function pointer exists only in
1986 * the address space of the traced process, and can't
1987 * be manipulated by strace. In order to prevent the
1988 * compiler from generating code to manipulate
1989 * SA_HANDLER we cast the function pointers to long. */
1990 if ((long)sa.__sa_handler == (long)SIG_ERR)
1991 tprintf("{SIG_ERR, ");
1992 else if ((long)sa.__sa_handler == (long)SIG_DFL)
1993 tprintf("{SIG_DFL, ");
1994 else if ((long)sa.__sa_handler == (long)SIG_IGN)
1995 tprintf("{SIG_IGN, ");
1997 tprintf("{%#lx, ", (long) sa.__sa_handler);
1998 /* Questionable code below.
1999 * Kernel won't handle sys_rt_sigaction
2000 * with wrong sigset size (just returns EINVAL)
2001 * therefore tcp->u_arg[3(4)] _must_ be NSIG / 8 here,
2002 * and we always use smaller memcpy. */
2003 sigemptyset(&sigset);
2005 if (tcp->u_arg[4] <= sizeof(sigset))
2006 memcpy(&sigset, &sa.sa_mask, tcp->u_arg[4]);
2008 if (tcp->u_arg[3] <= sizeof(sigset))
2009 memcpy(&sigset, &sa.sa_mask, tcp->u_arg[3]);
2012 memcpy(&sigset, &sa.sa_mask, sizeof(sigset));
2013 printsigmask(&sigset, 1);
2015 printflags(sigact_flags, sa.sa_flags, "SA_???");
2017 if (sa.sa_flags & SA_RESTORER)
2018 tprintf(", %p", sa.sa_restorer);
2027 tprintf(", %#lx, %lu", tcp->u_arg[3], tcp->u_arg[4]);
2028 #elif defined(ALPHA)
2029 tprintf(", %lu, %#lx", tcp->u_arg[3], tcp->u_arg[4]);
2031 tprintf(", %lu", tcp->u_arg[3]);
2037 sys_rt_sigpending(struct tcb *tcp)
2043 tprintf("%#lx", tcp->u_arg[0]);
2044 else if (copy_sigset_len(tcp, tcp->u_arg[0],
2045 &sigset, tcp->u_arg[1]) < 0)
2048 printsigmask(&sigset, 1);
2054 sys_rt_sigsuspend(struct tcb *tcp)
2056 if (entering(tcp)) {
2058 if (copy_sigset_len(tcp, tcp->u_arg[0], &sigm, tcp->u_arg[1]) < 0)
2061 printsigmask(&sigm, 1);
2067 sys_rt_sigqueueinfo(struct tcb *tcp)
2069 if (entering(tcp)) {
2071 tprintf("%lu, ", tcp->u_arg[0]);
2072 printsignal(tcp->u_arg[1]);
2074 if (umove(tcp, tcp->u_arg[2], &si) < 0)
2075 tprintf("%#lx", tcp->u_arg[2]);
2077 printsiginfo(&si, verbose(tcp));
2082 int sys_rt_sigtimedwait(struct tcb *tcp)
2084 if (entering(tcp)) {
2087 if (copy_sigset_len(tcp, tcp->u_arg[0],
2088 &sigset, tcp->u_arg[3]) < 0)
2091 printsigmask(&sigset, 1);
2093 /* This is the only "return" parameter, */
2094 if (tcp->u_arg[1] != 0)
2096 /* ... if it's NULL, can decode all on entry */
2099 else if (tcp->u_arg[1] != 0) {
2100 /* syscall exit, and u_arg[1] wasn't NULL */
2102 tprintf("%#lx, ", tcp->u_arg[1]);
2105 if (umove(tcp, tcp->u_arg[1], &si) < 0)
2106 tprintf("%#lx, ", tcp->u_arg[1]);
2108 printsiginfo(&si, verbose(tcp));
2114 /* syscall exit, and u_arg[1] was NULL */
2117 print_timespec(tcp, tcp->u_arg[2]);
2118 tprintf(", %d", (int) tcp->u_arg[3]);
2123 sys_restart_syscall(struct tcb *tcp)
2126 tprintf("<... resuming interrupted call ...>");
2131 do_signalfd(struct tcb *tcp, int flags_arg)
2133 if (entering(tcp)) {
2134 tprintf("%ld, ", tcp->u_arg[0]);
2135 print_sigset(tcp, tcp->u_arg[1], 1);
2136 tprintf(", %lu", tcp->u_arg[2]);
2137 if (flags_arg >= 0) {
2139 printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
2146 sys_signalfd(struct tcb *tcp)
2148 return do_signalfd(tcp, -1);
2152 sys_signalfd4(struct tcb *tcp)
2154 return do_signalfd(tcp, 3);