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.
37 # warning NSIG is not defined, using 32
43 /* The libc headers do not define this constant since it should only be
44 used by the implementation. So we define it here. */
46 # ifdef ASM_SA_RESTORER
47 # define SA_RESTORER ASM_SA_RESTORER
52 * Some architectures define SA_RESTORER in their headers,
53 * but do not actually have sa_restorer.
55 * Some architectures, otherwise, do not define SA_RESTORER in their headers,
56 * but actually have sa_restorer.
59 # if defined HPPA || defined IA64
60 # define HAVE_SA_RESTORER 0
62 # define HAVE_SA_RESTORER 1
64 #else /* !SA_RESTORER */
65 # if defined SPARC || defined SPARC64 || defined M68K
66 # define HAVE_SA_RESTORER 1
68 # define HAVE_SA_RESTORER 0
72 #include "xlat/sigact_flags.h"
73 #include "xlat/sigprocmaskcmds.h"
75 /* Anonymous realtime signals. */
77 /* Linux kernel >= 3.18 defines SIGRTMIN to 32 on all architectures. */
78 # define ASM_SIGRTMIN 32
81 /* Under glibc 2.1, SIGRTMAX et al are functions, but __SIGRTMAX is a
82 constant. This is what we want. Otherwise, just use SIGRTMAX. */
85 # define __SIGRTMAX SIGRTMAX
89 # define ASM_SIGRTMAX __SIGRTMAX
93 /* Note on the size of sigset_t:
95 * In glibc, sigset_t is an array with space for 1024 bits (!),
96 * even though all arches supported by Linux have only 64 signals
97 * except MIPS, which has 128. IOW, it is 128 bytes long.
99 * In-kernel sigset_t is sized correctly (it is either 64 or 128 bit long).
100 * However, some old syscall return only 32 lower bits (one word).
101 * Example: sys_sigpending vs sys_rt_sigpending.
103 * Be aware of this fact when you try to
104 * memcpy(&tcp->u_arg[1], &something, sizeof(sigset_t))
105 * - sizeof(sigset_t) is much bigger than you think,
106 * it may overflow tcp->u_arg[] array, and it may try to copy more data
107 * than is really available in <something>.
109 * umoven(tcp, addr, sizeof(sigset_t), &sigset)
110 * may be a bad idea: it'll try to read much more data than needed
111 * to fetch a sigset_t.
112 * Use (NSIG / 8) as a size instead.
116 signame(const int sig)
118 static char buf[sizeof("SIGRT_%u") + sizeof(int)*3];
121 const unsigned int s = sig;
126 if (s >= ASM_SIGRTMIN && s <= ASM_SIGRTMAX) {
127 sprintf(buf, "SIGRT_%u", s - ASM_SIGRTMIN);
132 sprintf(buf, "%d", sig);
137 popcount32(const uint32_t *a, unsigned int size)
139 unsigned int count = 0;
141 for (; size; ++a, --size) {
144 #ifdef HAVE___BUILTIN_POPCOUNT
145 count += __builtin_popcount(x);
156 sprintsigmask_n(const char *prefix, const void *sig_mask, unsigned int bytes)
159 * The maximum number of signal names to be printed is NSIG * 2 / 3.
160 * Most of signal names have length 7,
161 * average length of signal names is less than 7.
162 * The length of prefix string does not exceed 16.
164 static char outstr[128 + 8 * (NSIG * 2 / 3)];
167 const uint32_t *mask;
168 uint32_t inverted_mask[NSIG / 32];
173 s = stpcpy(outstr, prefix);
176 /* length of signal mask in 4-byte words */
177 size = (bytes >= NSIG / 8) ? NSIG / 32 : (bytes + 3) / 4;
179 /* check whether 2/3 or more bits are set */
180 if (popcount32(mask, size) >= size * 32 * 2 / 3) {
181 /* show those signals that are NOT in the mask */
183 for (j = 0; j < size; ++j)
184 inverted_mask[j] = ~mask[j];
185 mask = inverted_mask;
190 for (i = 0; (i = next_set_bit(mask, i, size * 32)) >= 0; ) {
193 if ((unsigned) i < nsignals) {
194 s = stpcpy(s, signalent[i] + 3);
197 else if (i >= ASM_SIGRTMIN && i <= ASM_SIGRTMAX) {
198 s += sprintf(s, "RT_%u", i - ASM_SIGRTMIN);
202 s += sprintf(s, "%u", i);
213 #define sprintsigmask_val(prefix, mask) \
214 sprintsigmask_n((prefix), &(mask), sizeof(mask))
216 #define tprintsigmask_val(prefix, mask) \
217 tprints(sprintsigmask_n((prefix), &(mask), sizeof(mask)))
222 tprints(signame(nr));
226 print_sigset_addr_len(struct tcb *tcp, long addr, long len)
234 /* Here len is usually equals NSIG / 8 or current_wordsize.
235 * But we code this defensively:
239 tprintf("%#lx", addr);
245 len = (len + 3) & ~3;
247 if (umoven(tcp, addr, len, mask) < 0)
249 tprints(sprintsigmask_n("", mask, len));
253 #define ILL_ILLOPC 1 /* illegal opcode */
254 #define ILL_ILLOPN 2 /* illegal operand */
255 #define ILL_ILLADR 3 /* illegal addressing mode */
256 #define ILL_ILLTRP 4 /* illegal trap */
257 #define ILL_PRVOPC 5 /* privileged opcode */
258 #define ILL_PRVREG 6 /* privileged register */
259 #define ILL_COPROC 7 /* coprocessor error */
260 #define ILL_BADSTK 8 /* internal stack error */
261 #define FPE_INTDIV 1 /* integer divide by zero */
262 #define FPE_INTOVF 2 /* integer overflow */
263 #define FPE_FLTDIV 3 /* floating point divide by zero */
264 #define FPE_FLTOVF 4 /* floating point overflow */
265 #define FPE_FLTUND 5 /* floating point underflow */
266 #define FPE_FLTRES 6 /* floating point inexact result */
267 #define FPE_FLTINV 7 /* floating point invalid operation */
268 #define FPE_FLTSUB 8 /* subscript out of range */
269 #define SEGV_MAPERR 1 /* address not mapped to object */
270 #define SEGV_ACCERR 2 /* invalid permissions for mapped object */
271 #define BUS_ADRALN 1 /* invalid address alignment */
272 #define BUS_ADRERR 2 /* non-existant physical address */
273 #define BUS_OBJERR 3 /* object specific hardware error */
274 #define SYS_SECCOMP 1 /* seccomp triggered */
275 #define TRAP_BRKPT 1 /* process breakpoint */
276 #define TRAP_TRACE 2 /* process trace trap */
277 #define CLD_EXITED 1 /* child has exited */
278 #define CLD_KILLED 2 /* child was killed */
279 #define CLD_DUMPED 3 /* child terminated abnormally */
280 #define CLD_TRAPPED 4 /* traced child has trapped */
281 #define CLD_STOPPED 5 /* child has stopped */
282 #define CLD_CONTINUED 6 /* stopped child has continued */
283 #define POLL_IN 1 /* data input available */
284 #define POLL_OUT 2 /* output buffers available */
285 #define POLL_MSG 3 /* input message available */
286 #define POLL_ERR 4 /* i/o error */
287 #define POLL_PRI 5 /* high priority input available */
288 #define POLL_HUP 6 /* device disconnected */
289 #define SI_KERNEL 0x80 /* sent by kernel */
290 #define SI_USER 0 /* sent by kill, sigsend, raise */
291 #define SI_QUEUE -1 /* sent by sigqueue */
292 #define SI_TIMER -2 /* sent by timer expiration */
293 #define SI_MESGQ -3 /* sent by real time mesq state change */
294 #define SI_ASYNCIO -4 /* sent by AIO completion */
295 #define SI_SIGIO -5 /* sent by SIGIO */
296 #define SI_TKILL -6 /* sent by tkill */
297 #define SI_DETHREAD -7 /* sent by execve killing subsidiary threads */
298 #define SI_ASYNCNL -60 /* sent by asynch name lookup completion */
302 # define SI_FROMUSER(sip) ((sip)->si_code <= 0)
305 #include "xlat/siginfo_codes.h"
306 #include "xlat/sigill_codes.h"
307 #include "xlat/sigfpe_codes.h"
308 #include "xlat/sigtrap_codes.h"
309 #include "xlat/sigchld_codes.h"
310 #include "xlat/sigpoll_codes.h"
311 #include "xlat/sigprof_codes.h"
314 #include "xlat/sigemt_codes.h"
317 #include "xlat/sigsegv_codes.h"
318 #include "xlat/sigbus_codes.h"
321 # define SYS_SECCOMP 1
323 #include "xlat/sigsys_codes.h"
326 printsigsource(const siginfo_t *sip)
328 tprintf(", si_pid=%lu, si_uid=%lu",
329 (unsigned long) sip->si_pid,
330 (unsigned long) sip->si_uid);
334 printsigval(const siginfo_t *sip, int verbose)
339 tprintf(", si_value={int=%u, ptr=%#lx}",
341 (unsigned long) sip->si_ptr);
345 printsiginfo(const siginfo_t *sip, int verbose)
349 if (sip->si_signo == 0) {
353 tprints("{si_signo=");
354 printsignal(sip->si_signo);
355 code = xlookup(siginfo_codes, sip->si_code);
357 switch (sip->si_signo) {
359 code = xlookup(sigtrap_codes, sip->si_code);
362 code = xlookup(sigchld_codes, sip->si_code);
365 code = xlookup(sigpoll_codes, sip->si_code);
368 code = xlookup(sigprof_codes, sip->si_code);
371 code = xlookup(sigill_codes, sip->si_code);
375 code = xlookup(sigemt_codes, sip->si_code);
379 code = xlookup(sigfpe_codes, sip->si_code);
382 code = xlookup(sigsegv_codes, sip->si_code);
385 code = xlookup(sigbus_codes, sip->si_code);
388 code = xlookup(sigsys_codes, sip->si_code);
393 tprintf(", si_code=%s", code);
395 tprintf(", si_code=%#x", sip->si_code);
397 if (sip->si_code != SI_NOINFO)
401 tprints(", si_errno=");
402 if ((unsigned) sip->si_errno < nerrnos
403 && errnoent[sip->si_errno])
404 tprints(errnoent[sip->si_errno]);
406 tprintf("%d", sip->si_errno);
409 if (SI_FROMUSER(sip)) {
410 switch (sip->si_code) {
421 #if defined SI_TIMER \
422 && defined HAVE_SIGINFO_T_SI_TIMERID && defined HAVE_SIGINFO_T_SI_OVERRUN
424 tprintf(", si_timerid=%#x, si_overrun=%d",
425 sip->si_timerid, sip->si_overrun);
426 printsigval(sip, verbose);
432 printsigval(sip, verbose);
437 #endif /* SI_FROMUSER */
439 switch (sip->si_signo) {
442 tprints(", si_status=");
443 if (sip->si_code == CLD_EXITED)
444 tprintf("%d", sip->si_status);
446 printsignal(sip->si_status);
450 tprintf(", si_utime=%llu, si_stime=%llu",
451 (unsigned long long) sip->si_utime,
452 (unsigned long long) sip->si_stime);
454 case SIGILL: case SIGFPE:
455 case SIGSEGV: case SIGBUS:
456 tprintf(", si_addr=%#lx",
457 (unsigned long) sip->si_addr);
460 switch (sip->si_code) {
461 case POLL_IN: case POLL_OUT: case POLL_MSG:
462 tprintf(", si_band=%ld",
463 (long) sip->si_band);
467 #ifdef HAVE_SIGINFO_T_SI_SYSCALL
469 tprintf(", si_call_addr=%#lx, si_syscall=%d, si_arch=%u",
470 (unsigned long) sip->si_call_addr,
471 sip->si_syscall, sip->si_arch);
475 if (sip->si_pid || sip->si_uid)
478 printsigval(sip, verbose);
486 printsiginfo_at(struct tcb *tcp, long addr)
494 tprintf("%#lx", addr);
497 if (umove(tcp, addr, &si) < 0) {
501 printsiginfo(&si, verbose(tcp));
505 sys_sigsetmask(struct tcb *tcp)
508 tprintsigmask_val("", tcp->u_arg[0]);
510 else if (!syserror(tcp)) {
511 tcp->auxstr = sprintsigmask_val("old mask ", tcp->u_rval);
512 return RVAL_HEX | RVAL_STR;
517 #ifdef HAVE_SIGACTION
519 struct old_sigaction {
520 /* sa_handler may be a libc #define, need to use other name: */
522 unsigned int sa_flags;
523 void (*__sa_handler)(int);
524 /* Kernel treats sa_mask as an array of longs. */
525 unsigned long sa_mask[NSIG / sizeof(long) ? NSIG / sizeof(long) : 1];
527 void (*__sa_handler)(int);
528 unsigned long sa_mask;
529 unsigned long sa_flags;
532 void (*sa_restorer)(void);
536 struct old_sigaction32 {
537 /* sa_handler may be a libc #define, need to use other name: */
538 uint32_t __sa_handler;
542 uint32_t sa_restorer;
547 decode_old_sigaction(struct tcb *tcp, long addr)
549 struct old_sigaction sa;
556 if (!verbose(tcp) || (exiting(tcp) && syserror(tcp))) {
557 tprintf("%#lx", addr);
561 #if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
562 if (current_wordsize != sizeof(sa.__sa_handler) && current_wordsize == 4) {
563 struct old_sigaction32 sa32;
564 r = umove(tcp, addr, &sa32);
566 memset(&sa, 0, sizeof(sa));
567 sa.__sa_handler = (void*)(uintptr_t)sa32.__sa_handler;
568 sa.sa_flags = sa32.sa_flags;
569 #if HAVE_SA_RESTORER && defined SA_RESTORER
570 sa.sa_restorer = (void*)(uintptr_t)sa32.sa_restorer;
572 sa.sa_mask = sa32.sa_mask;
577 r = umove(tcp, addr, &sa);
584 /* Architectures using function pointers, like
585 * hppa, may need to manipulate the function pointer
586 * to compute the result of a comparison. However,
587 * the __sa_handler function pointer exists only in
588 * the address space of the traced process, and can't
589 * be manipulated by strace. In order to prevent the
590 * compiler from generating code to manipulate
591 * __sa_handler we cast the function pointers to long. */
592 if ((long)sa.__sa_handler == (long)SIG_ERR)
593 tprints("{SIG_ERR, ");
594 else if ((long)sa.__sa_handler == (long)SIG_DFL)
595 tprints("{SIG_DFL, ");
596 else if ((long)sa.__sa_handler == (long)SIG_IGN)
597 tprints("{SIG_IGN, ");
599 tprintf("{%#lx, ", (long) sa.__sa_handler);
601 tprintsigmask_addr("", sa.sa_mask);
603 tprintsigmask_val("", sa.sa_mask);
606 printflags(sigact_flags, sa.sa_flags, "SA_???");
607 #if HAVE_SA_RESTORER && defined SA_RESTORER
608 if (sa.sa_flags & SA_RESTORER)
609 tprintf(", %p", sa.sa_restorer);
615 sys_sigaction(struct tcb *tcp)
618 printsignal(tcp->u_arg[0]);
620 decode_old_sigaction(tcp, tcp->u_arg[1]);
623 decode_old_sigaction(tcp, tcp->u_arg[2]);
628 sys_signal(struct tcb *tcp)
631 printsignal(tcp->u_arg[0]);
633 switch (tcp->u_arg[1]) {
644 tprintf("%#lx", tcp->u_arg[1]);
648 else if (!syserror(tcp)) {
649 switch (tcp->u_rval) {
651 tcp->auxstr = "SIG_ERR"; break;
653 tcp->auxstr = "SIG_DFL"; break;
655 tcp->auxstr = "SIG_IGN"; break;
659 return RVAL_HEX | RVAL_STR;
664 #endif /* HAVE_SIGACTION */
667 sys_siggetmask(struct tcb *tcp)
670 tcp->auxstr = sprintsigmask_val("mask ", tcp->u_rval);
672 return RVAL_HEX | RVAL_STR;
676 sys_sigsuspend(struct tcb *tcp)
679 tprintsigmask_val("", tcp->u_arg[2]);
684 #if !defined SS_ONSTACK
689 #include "xlat/sigaltstack_flags.h"
692 print_stack_t(struct tcb *tcp, unsigned long addr)
702 #if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
703 if (current_wordsize != sizeof(ss.ss_sp) && current_wordsize == 4) {
709 r = umove(tcp, addr, &ss32);
711 memset(&ss, 0, sizeof(ss));
712 ss.ss_sp = (void*)(unsigned long) ss32.ss_sp;
713 ss.ss_flags = ss32.ss_flags;
714 ss.ss_size = (unsigned long) ss32.ss_size;
719 r = umove(tcp, addr, &ss);
722 tprintf("%#lx", addr);
724 tprintf("{ss_sp=%#lx, ss_flags=", (unsigned long) ss.ss_sp);
725 printflags(sigaltstack_flags, ss.ss_flags, "SS_???");
726 tprintf(", ss_size=%lu}", (unsigned long) ss.ss_size);
731 sys_sigaltstack(struct tcb *tcp)
734 print_stack_t(tcp, tcp->u_arg[0]);
738 print_stack_t(tcp, tcp->u_arg[1]);
743 #ifdef HAVE_SIGACTION
745 /* "Old" sigprocmask, which operates with word-sized signal masks */
747 sys_sigprocmask(struct tcb *tcp)
752 * Alpha/OSF is different: it doesn't pass in two pointers,
753 * but rather passes in the new bitmask as an argument and
754 * then returns the old bitmask. This "works" because we
755 * only have 64 signals to worry about. If you want more,
756 * use of the rt_sigprocmask syscall is required.
758 * old = osf_sigprocmask(how, new);
760 * ret = sigprocmask(how, &new, &old, ...);
762 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
763 tprintsigmask_val(", ", tcp->u_arg[1]);
765 else if (!syserror(tcp)) {
766 tcp->auxstr = sprintsigmask_val("old mask ", tcp->u_rval);
767 return RVAL_HEX | RVAL_STR;
771 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
773 print_sigset_addr_len(tcp, tcp->u_arg[1], current_wordsize);
778 tprintf("%#lx", tcp->u_arg[2]);
780 print_sigset_addr_len(tcp, tcp->u_arg[2], current_wordsize);
786 #endif /* HAVE_SIGACTION */
789 sys_kill(struct tcb *tcp)
793 widen_to_long(tcp->u_arg[0]),
794 signame(tcp->u_arg[1])
801 sys_tgkill(struct tcb *tcp)
804 tprintf("%ld, %ld, %s",
805 widen_to_long(tcp->u_arg[0]),
806 widen_to_long(tcp->u_arg[1]),
807 signame(tcp->u_arg[2])
814 sys_sigpending(struct tcb *tcp)
818 tprintf("%#lx", tcp->u_arg[0]);
820 print_sigset_addr_len(tcp, tcp->u_arg[0], current_wordsize);
826 sys_rt_sigprocmask(struct tcb *tcp)
828 /* Note: arg[3] is the length of the sigset. Kernel requires NSIG / 8 */
830 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
832 print_sigset_addr_len(tcp, tcp->u_arg[1], tcp->u_arg[3]);
837 tprintf("%#lx", tcp->u_arg[2]);
839 print_sigset_addr_len(tcp, tcp->u_arg[2], tcp->u_arg[3]);
840 tprintf(", %lu", tcp->u_arg[3]);
845 /* Structure describing the action to be taken when a signal arrives. */
848 /* sa_handler may be a libc #define, need to use other name: */
850 unsigned int sa_flags;
851 void (*__sa_handler)(int);
853 void (*__sa_handler)(int);
854 unsigned long sa_flags;
857 void (*sa_restorer)(void);
859 /* Kernel treats sa_mask as an array of longs. */
860 unsigned long sa_mask[NSIG / sizeof(long) ? NSIG / sizeof(long) : 1];
862 /* Same for i386-on-x86_64 and similar cases */
863 struct new_sigaction32
865 uint32_t __sa_handler;
868 uint32_t sa_restorer;
870 uint32_t sa_mask[2 * (NSIG / sizeof(long) ? NSIG / sizeof(long) : 1)];
874 decode_new_sigaction(struct tcb *tcp, long addr)
876 struct new_sigaction sa;
883 if (!verbose(tcp) || (exiting(tcp) && syserror(tcp))) {
884 tprintf("%#lx", addr);
887 #if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
888 if (current_wordsize != sizeof(sa.sa_flags) && current_wordsize == 4) {
889 struct new_sigaction32 sa32;
890 r = umove(tcp, addr, &sa32);
892 memset(&sa, 0, sizeof(sa));
893 sa.__sa_handler = (void*)(unsigned long)sa32.__sa_handler;
894 sa.sa_flags = sa32.sa_flags;
895 #if HAVE_SA_RESTORER && defined SA_RESTORER
896 sa.sa_restorer = (void*)(unsigned long)sa32.sa_restorer;
898 /* Kernel treats sa_mask as an array of longs.
899 * For 32-bit process, "long" is uint32_t, thus, for example,
900 * 32th bit in sa_mask will end up as bit 0 in sa_mask[1].
901 * But for (64-bit) kernel, 32th bit in sa_mask is
902 * 32th bit in 0th (64-bit) long!
903 * For little-endian, it's the same.
904 * For big-endian, we swap 32-bit words.
906 sa.sa_mask[0] = sa32.sa_mask[0] + ((long)(sa32.sa_mask[1]) << 32);
911 r = umove(tcp, addr, &sa);
917 /* Architectures using function pointers, like
918 * hppa, may need to manipulate the function pointer
919 * to compute the result of a comparison. However,
920 * the __sa_handler function pointer exists only in
921 * the address space of the traced process, and can't
922 * be manipulated by strace. In order to prevent the
923 * compiler from generating code to manipulate
924 * __sa_handler we cast the function pointers to long. */
925 if ((long)sa.__sa_handler == (long)SIG_ERR)
926 tprints("{SIG_ERR, ");
927 else if ((long)sa.__sa_handler == (long)SIG_DFL)
928 tprints("{SIG_DFL, ");
929 else if ((long)sa.__sa_handler == (long)SIG_IGN)
930 tprints("{SIG_IGN, ");
932 tprintf("{%#lx, ", (long) sa.__sa_handler);
934 * Sigset size is in tcp->u_arg[4] (SPARC)
935 * or in tcp->u_arg[3] (all other),
936 * but kernel won't handle sys_rt_sigaction
937 * with wrong sigset size (just returns EINVAL instead).
938 * We just fetch the right size, which is NSIG / 8.
940 tprintsigmask_val("", sa.sa_mask);
943 printflags(sigact_flags, sa.sa_flags, "SA_???");
944 #if HAVE_SA_RESTORER && defined SA_RESTORER
945 if (sa.sa_flags & SA_RESTORER)
946 tprintf(", %p", sa.sa_restorer);
952 sys_rt_sigaction(struct tcb *tcp)
955 printsignal(tcp->u_arg[0]);
957 decode_new_sigaction(tcp, tcp->u_arg[1]);
960 decode_new_sigaction(tcp, tcp->u_arg[2]);
961 #if defined(SPARC) || defined(SPARC64)
962 tprintf(", %#lx, %lu", tcp->u_arg[3], tcp->u_arg[4]);
964 tprintf(", %lu, %#lx", tcp->u_arg[3], tcp->u_arg[4]);
966 tprintf(", %lu", tcp->u_arg[3]);
973 sys_rt_sigpending(struct tcb *tcp)
977 * One of the few syscalls where sigset size (arg[1])
978 * is allowed to be <= NSIG / 8, not strictly ==.
979 * This allows non-rt sigpending() syscall
980 * to reuse rt_sigpending() code in kernel.
983 tprintf("%#lx", tcp->u_arg[0]);
985 print_sigset_addr_len(tcp, tcp->u_arg[0], tcp->u_arg[1]);
986 tprintf(", %lu", tcp->u_arg[1]);
992 sys_rt_sigsuspend(struct tcb *tcp)
995 /* NB: kernel requires arg[1] == NSIG / 8 */
996 print_sigset_addr_len(tcp, tcp->u_arg[0], tcp->u_arg[1]);
997 tprintf(", %lu", tcp->u_arg[1]);
1003 print_sigqueueinfo(struct tcb *tcp, int sig, unsigned long uinfo)
1007 printsiginfo_at(tcp, uinfo);
1011 sys_rt_sigqueueinfo(struct tcb *tcp)
1013 if (entering(tcp)) {
1014 tprintf("%lu, ", tcp->u_arg[0]);
1015 print_sigqueueinfo(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1021 sys_rt_tgsigqueueinfo(struct tcb *tcp)
1023 if (entering(tcp)) {
1024 tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
1025 print_sigqueueinfo(tcp, tcp->u_arg[2], tcp->u_arg[3]);
1030 int sys_rt_sigtimedwait(struct tcb *tcp)
1032 /* NB: kernel requires arg[3] == NSIG / 8 */
1033 if (entering(tcp)) {
1034 print_sigset_addr_len(tcp, tcp->u_arg[0], tcp->u_arg[3]);
1036 /* This is the only "return" parameter, */
1037 if (tcp->u_arg[1] != 0)
1039 /* ... if it's NULL, can decode all on entry */
1042 else if (tcp->u_arg[1] != 0) {
1043 /* syscall exit, and u_arg[1] wasn't NULL */
1044 printsiginfo_at(tcp, tcp->u_arg[1]);
1048 /* syscall exit, and u_arg[1] was NULL */
1051 print_timespec(tcp, tcp->u_arg[2]);
1052 tprintf(", %lu", tcp->u_arg[3]);
1057 sys_restart_syscall(struct tcb *tcp)
1060 tprints("<... resuming interrupted call ...>");
1065 do_signalfd(struct tcb *tcp, int flags_arg)
1067 /* NB: kernel requires arg[2] == NSIG / 8 */
1068 if (entering(tcp)) {
1069 printfd(tcp, tcp->u_arg[0]);
1071 print_sigset_addr_len(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1072 tprintf(", %lu", tcp->u_arg[2]);
1073 if (flags_arg >= 0) {
1075 printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
1082 sys_signalfd(struct tcb *tcp)
1084 return do_signalfd(tcp, -1);
1088 sys_signalfd4(struct tcb *tcp)
1090 return do_signalfd(tcp, 3);