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