]> granicus.if.org Git - strace/blob - signal.c
ptrace: do not print data argument of some requests on sparc
[strace] / signal.c
1 /*
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>
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
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.
21  *
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.
32  */
33
34 #include "defs.h"
35 #include <signal.h>
36
37 #ifndef NSIG
38 # warning NSIG is not defined, using 32
39 # define NSIG 32
40 #elif NSIG < 32
41 # error NSIG < 32
42 #endif
43
44 /* The libc headers do not define this constant since it should only be
45    used by the implementation.  So we define it here.  */
46 #ifndef SA_RESTORER
47 # ifdef ASM_SA_RESTORER
48 #  define SA_RESTORER ASM_SA_RESTORER
49 # endif
50 #endif
51
52 /*
53  * Some architectures define SA_RESTORER in their headers,
54  * but do not actually have sa_restorer.
55  *
56  * Some architectures, otherwise, do not define SA_RESTORER in their headers,
57  * but actually have sa_restorer.
58  */
59 #ifdef SA_RESTORER
60 # if defined HPPA || defined IA64
61 #  define HAVE_SA_RESTORER 0
62 # else
63 #  define HAVE_SA_RESTORER 1
64 # endif
65 #else /* !SA_RESTORER */
66 # if defined SPARC || defined SPARC64 || defined M68K
67 #  define HAVE_SA_RESTORER 1
68 # else
69 #  define HAVE_SA_RESTORER 0
70 # endif
71 #endif
72
73 #include "xlat/sigact_flags.h"
74 #include "xlat/sigprocmaskcmds.h"
75
76 /* Anonymous realtime signals. */
77 #ifndef ASM_SIGRTMIN
78 /* Linux kernel >= 3.18 defines SIGRTMIN to 32 on all architectures. */
79 # define ASM_SIGRTMIN 32
80 #endif
81 #ifndef ASM_SIGRTMAX
82 /* Under glibc 2.1, SIGRTMAX et al are functions, but __SIGRTMAX is a
83    constant.  This is what we want.  Otherwise, just use SIGRTMAX. */
84 # ifdef SIGRTMAX
85 #  ifndef __SIGRTMAX
86 #   define __SIGRTMAX SIGRTMAX
87 #  endif
88 # endif
89 # ifdef __SIGRTMAX
90 #  define ASM_SIGRTMAX __SIGRTMAX
91 # endif
92 #endif
93
94 /* Note on the size of sigset_t:
95  *
96  * In glibc, sigset_t is an array with space for 1024 bits (!),
97  * even though all arches supported by Linux have only 64 signals
98  * except MIPS, which has 128. IOW, it is 128 bytes long.
99  *
100  * In-kernel sigset_t is sized correctly (it is either 64 or 128 bit long).
101  * However, some old syscall return only 32 lower bits (one word).
102  * Example: sys_sigpending vs sys_rt_sigpending.
103  *
104  * Be aware of this fact when you try to
105  *     memcpy(&tcp->u_arg[1], &something, sizeof(sigset_t))
106  * - sizeof(sigset_t) is much bigger than you think,
107  * it may overflow tcp->u_arg[] array, and it may try to copy more data
108  * than is really available in <something>.
109  * Similarly,
110  *     umoven(tcp, addr, sizeof(sigset_t), &sigset)
111  * may be a bad idea: it'll try to read much more data than needed
112  * to fetch a sigset_t.
113  * Use (NSIG / 8) as a size instead.
114  */
115
116 const char *
117 signame(const int sig)
118 {
119         static char buf[sizeof("SIGRT_%u") + sizeof(int)*3];
120
121         if (sig >= 0) {
122                 const unsigned int s = sig;
123
124                 if (s < nsignals)
125                         return signalent[s];
126 #ifdef ASM_SIGRTMAX
127                 if (s >= ASM_SIGRTMIN && s <= (unsigned int) ASM_SIGRTMAX) {
128                         sprintf(buf, "SIGRT_%u", s - ASM_SIGRTMIN);
129                         return buf;
130                 }
131 #endif
132         }
133         sprintf(buf, "%d", sig);
134         return buf;
135 }
136
137 static unsigned int
138 popcount32(const uint32_t *a, unsigned int size)
139 {
140         unsigned int count = 0;
141
142         for (; size; ++a, --size) {
143                 uint32_t x = *a;
144
145 #ifdef HAVE___BUILTIN_POPCOUNT
146                 count += __builtin_popcount(x);
147 #else
148                 for (; x; ++count)
149                         x &= x - 1;
150 #endif
151         }
152
153         return count;
154 }
155
156 const char *
157 sprintsigmask_n(const char *prefix, const void *sig_mask, unsigned int bytes)
158 {
159         /*
160          * The maximum number of signal names to be printed is NSIG * 2 / 3.
161          * Most of signal names have length 7,
162          * average length of signal names is less than 7.
163          * The length of prefix string does not exceed 16.
164          */
165         static char outstr[128 + 8 * (NSIG * 2 / 3)];
166
167         char *s;
168         const uint32_t *mask;
169         uint32_t inverted_mask[NSIG / 32];
170         unsigned int size;
171         int i;
172         char sep;
173
174         s = stpcpy(outstr, prefix);
175
176         mask = sig_mask;
177         /* length of signal mask in 4-byte words */
178         size = (bytes >= NSIG / 8) ? NSIG / 32 : (bytes + 3) / 4;
179
180         /* check whether 2/3 or more bits are set */
181         if (popcount32(mask, size) >= size * 32 * 2 / 3) {
182                 /* show those signals that are NOT in the mask */
183                 unsigned int j;
184                 for (j = 0; j < size; ++j)
185                         inverted_mask[j] = ~mask[j];
186                 mask = inverted_mask;
187                 *s++ = '~';
188         }
189
190         sep = '[';
191         for (i = 0; (i = next_set_bit(mask, i, size * 32)) >= 0; ) {
192                 ++i;
193                 *s++ = sep;
194                 if ((unsigned) i < nsignals) {
195                         s = stpcpy(s, signalent[i] + 3);
196                 }
197 #ifdef ASM_SIGRTMAX
198                 else if (i >= ASM_SIGRTMIN && i <= ASM_SIGRTMAX) {
199                         s += sprintf(s, "RT_%u", i - ASM_SIGRTMIN);
200                 }
201 #endif
202                 else {
203                         s += sprintf(s, "%u", i);
204                 }
205                 sep = ' ';
206         }
207         if (sep == '[')
208                 *s++ = sep;
209         *s++ = ']';
210         *s = '\0';
211         return outstr;
212 }
213
214 #define sprintsigmask_val(prefix, mask) \
215         sprintsigmask_n((prefix), &(mask), sizeof(mask))
216
217 #define tprintsigmask_val(prefix, mask) \
218         tprints(sprintsigmask_n((prefix), &(mask), sizeof(mask)))
219
220 void
221 printsignal(int nr)
222 {
223         tprints(signame(nr));
224 }
225
226 static void
227 print_sigset_addr_len_limit(struct tcb *tcp, long addr, long len, long min_len)
228 {
229         /*
230          * Here len is usually equal to NSIG / 8 or current_wordsize.
231          * But we code this defensively:
232          */
233         if (len < min_len || len > NSIG / 8) {
234                 printaddr(addr);
235                 return;
236         }
237         int mask[NSIG / 8 / sizeof(int)] = {};
238         if (umoven_or_printaddr(tcp, addr, len, mask))
239                 return;
240         tprints(sprintsigmask_n("", mask, len));
241 }
242
243 void
244 print_sigset_addr_len(struct tcb *tcp, long addr, long len)
245 {
246         print_sigset_addr_len_limit(tcp, addr, len, current_wordsize);
247 }
248
249 SYS_FUNC(sigsetmask)
250 {
251         if (entering(tcp)) {
252                 tprintsigmask_val("", tcp->u_arg[0]);
253         }
254         else if (!syserror(tcp)) {
255                 tcp->auxstr = sprintsigmask_val("old mask ", tcp->u_rval);
256                 return RVAL_HEX | RVAL_STR;
257         }
258         return 0;
259 }
260
261 #ifdef HAVE_SIGACTION
262
263 struct old_sigaction {
264         /* sa_handler may be a libc #define, need to use other name: */
265 #ifdef MIPS
266         unsigned int sa_flags;
267         void (*__sa_handler)(int);
268         /* Kernel treats sa_mask as an array of longs. */
269         unsigned long sa_mask[NSIG / sizeof(long) ? NSIG / sizeof(long) : 1];
270 #else
271         void (*__sa_handler)(int);
272         unsigned long sa_mask;
273         unsigned long sa_flags;
274 #endif /* !MIPS */
275 #if HAVE_SA_RESTORER
276         void (*sa_restorer)(void);
277 #endif
278 };
279
280 struct old_sigaction32 {
281         /* sa_handler may be a libc #define, need to use other name: */
282         uint32_t __sa_handler;
283         uint32_t sa_mask;
284         uint32_t sa_flags;
285 #if HAVE_SA_RESTORER
286         uint32_t sa_restorer;
287 #endif
288 };
289
290 static void
291 decode_old_sigaction(struct tcb *tcp, long addr)
292 {
293         struct old_sigaction sa;
294
295 #if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
296         if (current_wordsize != sizeof(sa.__sa_handler) && current_wordsize == 4) {
297                 struct old_sigaction32 sa32;
298
299                 if (umove_or_printaddr(tcp, addr, &sa32))
300                         return;
301
302                 memset(&sa, 0, sizeof(sa));
303                 sa.__sa_handler = (void*)(uintptr_t)sa32.__sa_handler;
304                 sa.sa_flags = sa32.sa_flags;
305 #if HAVE_SA_RESTORER && defined SA_RESTORER
306                 sa.sa_restorer = (void*)(uintptr_t)sa32.sa_restorer;
307 #endif
308                 sa.sa_mask = sa32.sa_mask;
309         } else
310 #endif
311         if (umove_or_printaddr(tcp, addr, &sa))
312                 return;
313
314         /* Architectures using function pointers, like
315          * hppa, may need to manipulate the function pointer
316          * to compute the result of a comparison. However,
317          * the __sa_handler function pointer exists only in
318          * the address space of the traced process, and can't
319          * be manipulated by strace. In order to prevent the
320          * compiler from generating code to manipulate
321          * __sa_handler we cast the function pointers to long. */
322         tprints("{");
323         if ((long)sa.__sa_handler == (long)SIG_ERR)
324                 tprints("SIG_ERR");
325         else if ((long)sa.__sa_handler == (long)SIG_DFL)
326                 tprints("SIG_DFL");
327         else if ((long)sa.__sa_handler == (long)SIG_IGN)
328                 tprints("SIG_IGN");
329         else
330                 printaddr((long) sa.__sa_handler);
331         tprints(", ");
332 #ifdef MIPS
333         tprintsigmask_addr("", sa.sa_mask);
334 #else
335         tprintsigmask_val("", sa.sa_mask);
336 #endif
337         tprints(", ");
338         printflags(sigact_flags, sa.sa_flags, "SA_???");
339 #if HAVE_SA_RESTORER && defined SA_RESTORER
340         if (sa.sa_flags & SA_RESTORER)
341                 tprintf(", %p", sa.sa_restorer);
342 #endif
343         tprints("}");
344 }
345
346 SYS_FUNC(sigaction)
347 {
348         if (entering(tcp)) {
349                 printsignal(tcp->u_arg[0]);
350                 tprints(", ");
351                 decode_old_sigaction(tcp, tcp->u_arg[1]);
352                 tprints(", ");
353         } else
354                 decode_old_sigaction(tcp, tcp->u_arg[2]);
355         return 0;
356 }
357
358 SYS_FUNC(signal)
359 {
360         if (entering(tcp)) {
361                 printsignal(tcp->u_arg[0]);
362                 tprints(", ");
363                 switch (tcp->u_arg[1]) {
364                 case (long) SIG_ERR:
365                         tprints("SIG_ERR");
366                         break;
367                 case (long) SIG_DFL:
368                         tprints("SIG_DFL");
369                         break;
370                 case (long) SIG_IGN:
371                         tprints("SIG_IGN");
372                         break;
373                 default:
374                         printaddr(tcp->u_arg[1]);
375                 }
376                 return 0;
377         }
378         else if (!syserror(tcp)) {
379                 switch (tcp->u_rval) {
380                 case (long) SIG_ERR:
381                         tcp->auxstr = "SIG_ERR"; break;
382                 case (long) SIG_DFL:
383                         tcp->auxstr = "SIG_DFL"; break;
384                 case (long) SIG_IGN:
385                         tcp->auxstr = "SIG_IGN"; break;
386                 default:
387                         tcp->auxstr = NULL;
388                 }
389                 return RVAL_HEX | RVAL_STR;
390         }
391         return 0;
392 }
393
394 #endif /* HAVE_SIGACTION */
395
396 SYS_FUNC(siggetmask)
397 {
398         if (exiting(tcp)) {
399                 tcp->auxstr = sprintsigmask_val("mask ", tcp->u_rval);
400         }
401         return RVAL_HEX | RVAL_STR;
402 }
403
404 SYS_FUNC(sigsuspend)
405 {
406         tprintsigmask_val("", tcp->u_arg[2]);
407
408         return RVAL_DECODED;
409 }
410
411 #ifdef HAVE_SIGACTION
412
413 /* "Old" sigprocmask, which operates with word-sized signal masks */
414 SYS_FUNC(sigprocmask)
415 {
416 # ifdef ALPHA
417         if (entering(tcp)) {
418                 /*
419                  * Alpha/OSF is different: it doesn't pass in two pointers,
420                  * but rather passes in the new bitmask as an argument and
421                  * then returns the old bitmask.  This "works" because we
422                  * only have 64 signals to worry about.  If you want more,
423                  * use of the rt_sigprocmask syscall is required.
424                  * Alpha:
425                  *      old = osf_sigprocmask(how, new);
426                  * Everyone else:
427                  *      ret = sigprocmask(how, &new, &old, ...);
428                  */
429                 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
430                 tprintsigmask_val(", ", tcp->u_arg[1]);
431         }
432         else if (!syserror(tcp)) {
433                 tcp->auxstr = sprintsigmask_val("old mask ", tcp->u_rval);
434                 return RVAL_HEX | RVAL_STR;
435         }
436 # else /* !ALPHA */
437         if (entering(tcp)) {
438                 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
439                 tprints(", ");
440                 print_sigset_addr_len(tcp, tcp->u_arg[1], current_wordsize);
441                 tprints(", ");
442         }
443         else {
444                 print_sigset_addr_len(tcp, tcp->u_arg[2], current_wordsize);
445         }
446 # endif /* !ALPHA */
447         return 0;
448 }
449
450 #endif /* HAVE_SIGACTION */
451
452 SYS_FUNC(kill)
453 {
454         tprintf("%d, %s",
455                 (int) tcp->u_arg[0],
456                 signame(tcp->u_arg[1]));
457
458         return RVAL_DECODED;
459 }
460
461 SYS_FUNC(tgkill)
462 {
463         tprintf("%d, %d, %s",
464                 (int) tcp->u_arg[0],
465                 (int) tcp->u_arg[1],
466                 signame(tcp->u_arg[2]));
467
468         return RVAL_DECODED;
469 }
470
471 SYS_FUNC(sigpending)
472 {
473         if (exiting(tcp))
474                 print_sigset_addr_len(tcp, tcp->u_arg[0], current_wordsize);
475         return 0;
476 }
477
478 SYS_FUNC(rt_sigprocmask)
479 {
480         /* Note: arg[3] is the length of the sigset. Kernel requires NSIG / 8 */
481         if (entering(tcp)) {
482                 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
483                 tprints(", ");
484                 print_sigset_addr_len(tcp, tcp->u_arg[1], tcp->u_arg[3]);
485                 tprints(", ");
486         }
487         else {
488                 print_sigset_addr_len(tcp, tcp->u_arg[2], tcp->u_arg[3]);
489                 tprintf(", %lu", tcp->u_arg[3]);
490         }
491         return 0;
492 }
493
494 /* Structure describing the action to be taken when a signal arrives.  */
495 struct new_sigaction
496 {
497         /* sa_handler may be a libc #define, need to use other name: */
498 #ifdef MIPS
499         unsigned int sa_flags;
500         void (*__sa_handler)(int);
501 #else
502         void (*__sa_handler)(int);
503         unsigned long sa_flags;
504 #endif /* !MIPS */
505 #if HAVE_SA_RESTORER
506         void (*sa_restorer)(void);
507 #endif
508         /* Kernel treats sa_mask as an array of longs. */
509         unsigned long sa_mask[NSIG / sizeof(long) ? NSIG / sizeof(long) : 1];
510 };
511 /* Same for i386-on-x86_64 and similar cases */
512 struct new_sigaction32
513 {
514         uint32_t __sa_handler;
515         uint32_t sa_flags;
516 #if HAVE_SA_RESTORER
517         uint32_t sa_restorer;
518 #endif
519         uint32_t sa_mask[2 * (NSIG / sizeof(long) ? NSIG / sizeof(long) : 1)];
520 };
521
522 static void
523 decode_new_sigaction(struct tcb *tcp, long addr)
524 {
525         struct new_sigaction sa;
526
527 #if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
528         if (current_wordsize != sizeof(sa.sa_flags) && current_wordsize == 4) {
529                 struct new_sigaction32 sa32;
530
531                 if (umove_or_printaddr(tcp, addr, &sa32))
532                         return;
533
534                 memset(&sa, 0, sizeof(sa));
535                 sa.__sa_handler = (void*)(unsigned long)sa32.__sa_handler;
536                 sa.sa_flags     = sa32.sa_flags;
537 #if HAVE_SA_RESTORER && defined SA_RESTORER
538                 sa.sa_restorer  = (void*)(unsigned long)sa32.sa_restorer;
539 #endif
540                 /* Kernel treats sa_mask as an array of longs.
541                  * For 32-bit process, "long" is uint32_t, thus, for example,
542                  * 32th bit in sa_mask will end up as bit 0 in sa_mask[1].
543                  * But for (64-bit) kernel, 32th bit in sa_mask is
544                  * 32th bit in 0th (64-bit) long!
545                  * For little-endian, it's the same.
546                  * For big-endian, we swap 32-bit words.
547                  */
548                 sa.sa_mask[0] = sa32.sa_mask[0] + ((long)(sa32.sa_mask[1]) << 32);
549         } else
550 #endif
551         if (umove_or_printaddr(tcp, addr, &sa))
552                 return;
553
554         /* Architectures using function pointers, like
555          * hppa, may need to manipulate the function pointer
556          * to compute the result of a comparison. However,
557          * the __sa_handler function pointer exists only in
558          * the address space of the traced process, and can't
559          * be manipulated by strace. In order to prevent the
560          * compiler from generating code to manipulate
561          * __sa_handler we cast the function pointers to long. */
562         if ((long)sa.__sa_handler == (long)SIG_ERR)
563                 tprints("{SIG_ERR, ");
564         else if ((long)sa.__sa_handler == (long)SIG_DFL)
565                 tprints("{SIG_DFL, ");
566         else if ((long)sa.__sa_handler == (long)SIG_IGN)
567                 tprints("{SIG_IGN, ");
568         else
569                 tprintf("{%#lx, ", (long) sa.__sa_handler);
570         /*
571          * Sigset size is in tcp->u_arg[4] (SPARC)
572          * or in tcp->u_arg[3] (all other),
573          * but kernel won't handle sys_rt_sigaction
574          * with wrong sigset size (just returns EINVAL instead).
575          * We just fetch the right size, which is NSIG / 8.
576          */
577         tprintsigmask_val("", sa.sa_mask);
578         tprints(", ");
579
580         printflags(sigact_flags, sa.sa_flags, "SA_???");
581 #if HAVE_SA_RESTORER && defined SA_RESTORER
582         if (sa.sa_flags & SA_RESTORER)
583                 tprintf(", %p", sa.sa_restorer);
584 #endif
585         tprints("}");
586 }
587
588 SYS_FUNC(rt_sigaction)
589 {
590         if (entering(tcp)) {
591                 printsignal(tcp->u_arg[0]);
592                 tprints(", ");
593                 decode_new_sigaction(tcp, tcp->u_arg[1]);
594                 tprints(", ");
595         } else {
596                 decode_new_sigaction(tcp, tcp->u_arg[2]);
597 #if defined(SPARC) || defined(SPARC64)
598                 tprintf(", %#lx, %lu", tcp->u_arg[3], tcp->u_arg[4]);
599 #elif defined(ALPHA)
600                 tprintf(", %lu, %#lx", tcp->u_arg[3], tcp->u_arg[4]);
601 #else
602                 tprintf(", %lu", tcp->u_arg[3]);
603 #endif
604         }
605         return 0;
606 }
607
608 SYS_FUNC(rt_sigpending)
609 {
610         if (exiting(tcp)) {
611                 /*
612                  * One of the few syscalls where sigset size (arg[1])
613                  * is allowed to be <= NSIG / 8, not strictly ==.
614                  * This allows non-rt sigpending() syscall
615                  * to reuse rt_sigpending() code in kernel.
616                  */
617                 print_sigset_addr_len_limit(tcp, tcp->u_arg[0],
618                                             tcp->u_arg[1], 1);
619                 tprintf(", %lu", tcp->u_arg[1]);
620         }
621         return 0;
622 }
623
624 SYS_FUNC(rt_sigsuspend)
625 {
626         /* NB: kernel requires arg[1] == NSIG / 8 */
627         print_sigset_addr_len(tcp, tcp->u_arg[0], tcp->u_arg[1]);
628         tprintf(", %lu", tcp->u_arg[1]);
629
630         return RVAL_DECODED;
631 }
632
633 static void
634 print_sigqueueinfo(struct tcb *tcp, int sig, unsigned long uinfo)
635 {
636         printsignal(sig);
637         tprints(", ");
638         printsiginfo_at(tcp, uinfo);
639 }
640
641 SYS_FUNC(rt_sigqueueinfo)
642 {
643         tprintf("%d, ", (int) tcp->u_arg[0]);
644         print_sigqueueinfo(tcp, tcp->u_arg[1], tcp->u_arg[2]);
645
646         return RVAL_DECODED;
647 }
648
649 SYS_FUNC(rt_tgsigqueueinfo)
650 {
651         tprintf("%d, %d, ", (int) tcp->u_arg[0], (int) tcp->u_arg[1]);
652         print_sigqueueinfo(tcp, tcp->u_arg[2], tcp->u_arg[3]);
653
654         return RVAL_DECODED;
655 }
656
657 SYS_FUNC(rt_sigtimedwait)
658 {
659         /* NB: kernel requires arg[3] == NSIG / 8 */
660         if (entering(tcp)) {
661                 print_sigset_addr_len(tcp, tcp->u_arg[0], tcp->u_arg[3]);
662                 tprints(", ");
663                 if (!tcp->u_arg[1]) {
664                         /*
665                          * This is the only "return" parameter,
666                          * if it's NULL, decode all parameters on entry.
667                          */
668                         tprints("NULL, ");
669                         print_timespec(tcp, tcp->u_arg[2]);
670                         tprintf(", %lu", tcp->u_arg[3]);
671                         tcp->auxstr = NULL;
672                 } else {
673                         tcp->auxstr = sprint_timespec(tcp, tcp->u_arg[2]);
674                 }
675         } else {
676                 if (tcp->auxstr) {
677                         printsiginfo_at(tcp, tcp->u_arg[1]);
678                         tprintf(", %s, %lu", tcp->auxstr, tcp->u_arg[3]);
679                         tcp->auxstr = NULL;
680                 }
681
682                 if (!syserror(tcp) && tcp->u_rval) {
683                         tcp->auxstr = signame(tcp->u_rval);
684                         return RVAL_STR;
685                 }
686         }
687         return 0;
688 };
689
690 SYS_FUNC(restart_syscall)
691 {
692         tprintf("<... resuming interrupted %s ...>",
693                 tcp->s_prev_ent ? tcp->s_prev_ent->sys_name : "system call");
694
695         return RVAL_DECODED;
696 }