blob: d717e66f443169f64eeb44695c2d2ef56471e857 [file] [log] [blame]
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001/*
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>
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +00005 * 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>
Elliott Hughesb7556142018-02-20 17:03:16 -08009 * Copyright (c) 2001-2018 The strace developers.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000010 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000033 */
34
35#include "defs.h"
Elliott Hughesd35df492017-02-15 15:19:05 -080036#include "nsig.h"
Elliott Hughesb7556142018-02-20 17:03:16 -080037#include "xstring.h"
Denys Vlasenko041b3ee2011-08-18 12:48:56 +020038
Roland McGrath2638cb42002-12-15 23:58:41 +000039/* The libc headers do not define this constant since it should only be
Denys Vlasenko041b3ee2011-08-18 12:48:56 +020040 used by the implementation. So we define it here. */
Dmitry V. Levin5c7f6272014-02-08 00:26:06 +000041#ifndef SA_RESTORER
42# ifdef ASM_SA_RESTORER
43# define SA_RESTORER ASM_SA_RESTORER
Roland McGrath2638cb42002-12-15 23:58:41 +000044# endif
45#endif
46
Dmitry V. Levin24b8eb02015-02-28 17:17:09 +000047/*
48 * Some architectures define SA_RESTORER in their headers,
49 * but do not actually have sa_restorer.
50 *
51 * Some architectures, otherwise, do not define SA_RESTORER in their headers,
52 * but actually have sa_restorer.
53 */
Elliott Hughesb7556142018-02-20 17:03:16 -080054#ifdef HAVE_ARCH_SA_RESTORER
55# define HAVE_SA_RESTORER HAVE_ARCH_SA_RESTORER
56#else /* !HAVE_ARCH_SA_RESTORER */
57# ifdef SA_RESTORER
Dmitry V. Levin24b8eb02015-02-28 17:17:09 +000058# define HAVE_SA_RESTORER 1
59# else
60# define HAVE_SA_RESTORER 0
61# endif
Elliott Hughesb7556142018-02-20 17:03:16 -080062#endif /* HAVE_ARCH_SA_RESTORER */
Mike Frysingerd632e102014-08-09 09:04:18 -040063
Eugene Syromiatnikov2909c7c2016-08-17 01:08:49 +000064#include "xlat/sa_handler_values.h"
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +000065#include "xlat/sigact_flags.h"
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +000066#include "xlat/sigprocmaskcmds.h"
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000067
Nate Sammonsce780fc1999-03-29 23:23:13 +000068/* Anonymous realtime signals. */
Dmitry V. Levin59f63d32015-03-05 05:03:41 +000069#ifndef ASM_SIGRTMIN
70/* Linux kernel >= 3.18 defines SIGRTMIN to 32 on all architectures. */
71# define ASM_SIGRTMIN 32
Nate Sammonsce780fc1999-03-29 23:23:13 +000072#endif
Dmitry V. Levin59f63d32015-03-05 05:03:41 +000073#ifndef ASM_SIGRTMAX
74/* Under glibc 2.1, SIGRTMAX et al are functions, but __SIGRTMAX is a
75 constant. This is what we want. Otherwise, just use SIGRTMAX. */
76# ifdef SIGRTMAX
77# ifndef __SIGRTMAX
78# define __SIGRTMAX SIGRTMAX
79# endif
80# endif
81# ifdef __SIGRTMAX
82# define ASM_SIGRTMAX __SIGRTMAX
83# endif
Nate Sammonsce780fc1999-03-29 23:23:13 +000084#endif
85
Denys Vlasenkod9560c12011-08-19 17:41:28 +020086/* Note on the size of sigset_t:
87 *
88 * In glibc, sigset_t is an array with space for 1024 bits (!),
89 * even though all arches supported by Linux have only 64 signals
90 * except MIPS, which has 128. IOW, it is 128 bytes long.
91 *
92 * In-kernel sigset_t is sized correctly (it is either 64 or 128 bit long).
93 * However, some old syscall return only 32 lower bits (one word).
94 * Example: sys_sigpending vs sys_rt_sigpending.
95 *
96 * Be aware of this fact when you try to
97 * memcpy(&tcp->u_arg[1], &something, sizeof(sigset_t))
98 * - sizeof(sigset_t) is much bigger than you think,
99 * it may overflow tcp->u_arg[] array, and it may try to copy more data
100 * than is really available in <something>.
101 * Similarly,
102 * umoven(tcp, addr, sizeof(sigset_t), &sigset)
103 * may be a bad idea: it'll try to read much more data than needed
104 * to fetch a sigset_t.
Elliott Hughesd35df492017-02-15 15:19:05 -0800105 * Use NSIG_BYTES as a size instead.
Denys Vlasenkod9560c12011-08-19 17:41:28 +0200106 */
107
Eugene Syromiatnikov2909c7c2016-08-17 01:08:49 +0000108static const char *
Elliott Hughesd35df492017-02-15 15:19:05 -0800109get_sa_handler_str(kernel_ulong_t handler)
Eugene Syromiatnikov2909c7c2016-08-17 01:08:49 +0000110{
111 return xlookup(sa_handler_values, handler);
112}
113
114static void
Elliott Hughesd35df492017-02-15 15:19:05 -0800115print_sa_handler(kernel_ulong_t handler)
Eugene Syromiatnikov2909c7c2016-08-17 01:08:49 +0000116{
117 const char *sa_handler_str = get_sa_handler_str(handler);
118
119 if (sa_handler_str)
Elliott Hughes03a418e2018-06-15 13:11:40 -0700120 print_xlat_ex(handler, sa_handler_str, XLAT_STYLE_DEFAULT);
Eugene Syromiatnikov2909c7c2016-08-17 01:08:49 +0000121 else
122 printaddr(handler);
123}
124
Roland McGrathee36ce12004-09-04 03:53:10 +0000125const char *
Dmitry V. Levin3ed5d022014-09-10 13:46:04 +0000126signame(const int sig)
Nate Sammonsce780fc1999-03-29 23:23:13 +0000127{
Dmitry V. Levin3ed5d022014-09-10 13:46:04 +0000128 static char buf[sizeof("SIGRT_%u") + sizeof(int)*3];
Denys Vlasenko041b3ee2011-08-18 12:48:56 +0200129
Dmitry V. Levin3ed5d022014-09-10 13:46:04 +0000130 if (sig >= 0) {
131 const unsigned int s = sig;
132
133 if (s < nsignals)
134 return signalent[s];
Dmitry V. Levin59f63d32015-03-05 05:03:41 +0000135#ifdef ASM_SIGRTMAX
Dmitry V. Levin07572c62016-01-12 00:04:15 +0000136 if (s >= ASM_SIGRTMIN && s <= (unsigned int) ASM_SIGRTMAX) {
Elliott Hughesb7556142018-02-20 17:03:16 -0800137 xsprintf(buf, "SIGRT_%u", s - ASM_SIGRTMIN);
Dmitry V. Levin3ed5d022014-09-10 13:46:04 +0000138 return buf;
139 }
Denys Vlasenko041b3ee2011-08-18 12:48:56 +0200140#endif
Dmitry V. Levin3ed5d022014-09-10 13:46:04 +0000141 }
Elliott Hughesb7556142018-02-20 17:03:16 -0800142 xsprintf(buf, "%d", sig);
Denys Vlasenko041b3ee2011-08-18 12:48:56 +0200143 return buf;
Nate Sammonsce780fc1999-03-29 23:23:13 +0000144}
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000145
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000146static unsigned int
147popcount32(const uint32_t *a, unsigned int size)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000148{
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000149 unsigned int count = 0;
Denys Vlasenkod9560c12011-08-19 17:41:28 +0200150
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000151 for (; size; ++a, --size) {
152 uint32_t x = *a;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000153
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000154#ifdef HAVE___BUILTIN_POPCOUNT
155 count += __builtin_popcount(x);
Denys Vlasenkoa8773792013-07-18 20:42:41 +0200156#else
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000157 for (; x; ++count)
158 x &= x - 1;
Nate Sammons4a121431999-04-06 01:19:39 +0000159#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000160 }
Denys Vlasenko4f3df072012-01-29 22:38:35 +0100161
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000162 return count;
163}
164
Dmitry V. Levin74219ea2015-03-06 01:47:18 +0000165const char *
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000166sprintsigmask_n(const char *prefix, const void *sig_mask, unsigned int bytes)
167{
168 /*
Elliott Hughesd35df492017-02-15 15:19:05 -0800169 * The maximum number of signal names to be printed
170 * is NSIG_BYTES * 8 * 2 / 3.
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000171 * Most of signal names have length 7,
172 * average length of signal names is less than 7.
173 * The length of prefix string does not exceed 16.
174 */
Elliott Hughesd35df492017-02-15 15:19:05 -0800175 static char outstr[128 + 8 * (NSIG_BYTES * 8 * 2 / 3)];
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000176
177 char *s;
178 const uint32_t *mask;
Elliott Hughesd35df492017-02-15 15:19:05 -0800179 uint32_t inverted_mask[NSIG_BYTES / 4];
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000180 unsigned int size;
181 int i;
182 char sep;
183
184 s = stpcpy(outstr, prefix);
185
186 mask = sig_mask;
187 /* length of signal mask in 4-byte words */
Elliott Hughesd35df492017-02-15 15:19:05 -0800188 size = (bytes >= NSIG_BYTES) ? NSIG_BYTES / 4 : (bytes + 3) / 4;
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000189
190 /* check whether 2/3 or more bits are set */
Elliott Hughesd35df492017-02-15 15:19:05 -0800191 if (popcount32(mask, size) >= size * (4 * 8) * 2 / 3) {
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000192 /* show those signals that are NOT in the mask */
193 unsigned int j;
194 for (j = 0; j < size; ++j)
195 inverted_mask[j] = ~mask[j];
196 mask = inverted_mask;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000197 *s++ = '~';
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000198 }
Denys Vlasenko4f3df072012-01-29 22:38:35 +0100199
200 sep = '[';
Elliott Hughesd35df492017-02-15 15:19:05 -0800201 for (i = 0; (i = next_set_bit(mask, i, size * (4 * 8))) >= 0; ) {
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000202 ++i;
203 *s++ = sep;
Dmitry V. Levin3ed5d022014-09-10 13:46:04 +0000204 if ((unsigned) i < nsignals) {
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000205 s = stpcpy(s, signalent[i] + 3);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000206 }
Dmitry V. Levin59f63d32015-03-05 05:03:41 +0000207#ifdef ASM_SIGRTMAX
208 else if (i >= ASM_SIGRTMIN && i <= ASM_SIGRTMAX) {
Elliott Hughesb7556142018-02-20 17:03:16 -0800209 s = xappendstr(outstr, s, "RT_%u", i - ASM_SIGRTMIN);
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000210 }
211#endif
212 else {
Elliott Hughesb7556142018-02-20 17:03:16 -0800213 s = xappendstr(outstr, s, "%u", i);
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000214 }
215 sep = ' ';
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000216 }
Denys Vlasenko4f3df072012-01-29 22:38:35 +0100217 if (sep == '[')
218 *s++ = sep;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000219 *s++ = ']';
220 *s = '\0';
221 return outstr;
222}
223
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000224#define sprintsigmask_val(prefix, mask) \
225 sprintsigmask_n((prefix), &(mask), sizeof(mask))
226
227#define tprintsigmask_val(prefix, mask) \
228 tprints(sprintsigmask_n((prefix), &(mask), sizeof(mask)))
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000229
Elliott Hughes39bac052017-05-25 16:56:11 -0700230static const char *
231sprint_old_sigmask_val(const char *const prefix, const unsigned long mask)
232{
233#if defined(current_wordsize) || !defined(WORDS_BIGENDIAN)
234 return sprintsigmask_n(prefix, &mask, current_wordsize);
235#else /* !current_wordsize && WORDS_BIGENDIAN */
236 if (current_wordsize == sizeof(mask)) {
237 return sprintsigmask_val(prefix, mask);
238 } else {
239 uint32_t mask32 = mask;
240 return sprintsigmask_val(prefix, mask32);
241 }
242#endif
243}
244
245#define tprint_old_sigmask_val(prefix, mask) \
246 tprints(sprint_old_sigmask_val((prefix), (mask)))
247
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000248void
Denys Vlasenkoeccc48c2011-06-09 01:28:11 +0200249printsignal(int nr)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000250{
Denys Vlasenko5940e652011-09-01 09:55:05 +0200251 tprints(signame(nr));
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000252}
253
Dmitry V. Levin11656202016-02-18 00:08:30 +0000254static void
Elliott Hughesd35df492017-02-15 15:19:05 -0800255print_sigset_addr_len_limit(struct tcb *const tcp, const kernel_ulong_t addr,
256 const kernel_ulong_t len, const unsigned int min_len)
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000257{
Dmitry V. Levin11656202016-02-18 00:08:30 +0000258 /*
Elliott Hughesd35df492017-02-15 15:19:05 -0800259 * Here len is usually equal to NSIG_BYTES or current_wordsize.
Denys Vlasenko5e133aa2013-07-18 17:02:21 +0200260 * But we code this defensively:
261 */
Elliott Hughesd35df492017-02-15 15:19:05 -0800262 if (len < min_len || len > NSIG_BYTES) {
Dmitry V. Levin735843e2015-07-17 00:37:39 +0000263 printaddr(addr);
Denys Vlasenko5e133aa2013-07-18 17:02:21 +0200264 return;
265 }
Elliott Hughesd35df492017-02-15 15:19:05 -0800266 int mask[NSIG_BYTES / sizeof(int)] = {};
Dmitry V. Levin735843e2015-07-17 00:37:39 +0000267 if (umoven_or_printaddr(tcp, addr, len, mask))
268 return;
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000269 tprints(sprintsigmask_n("", mask, len));
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000270}
271
Dmitry V. Levin11656202016-02-18 00:08:30 +0000272void
Elliott Hughesd35df492017-02-15 15:19:05 -0800273print_sigset_addr_len(struct tcb *const tcp, const kernel_ulong_t addr,
274 const kernel_ulong_t len)
Dmitry V. Levin11656202016-02-18 00:08:30 +0000275{
276 print_sigset_addr_len_limit(tcp, addr, len, current_wordsize);
277}
278
Elliott Hughes39bac052017-05-25 16:56:11 -0700279void
280print_sigset_addr(struct tcb *const tcp, const kernel_ulong_t addr)
281{
282 print_sigset_addr_len_limit(tcp, addr, NSIG_BYTES, NSIG_BYTES);
283}
284
285SYS_FUNC(ssetmask)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000286{
287 if (entering(tcp)) {
Elliott Hughes39bac052017-05-25 16:56:11 -0700288 tprint_old_sigmask_val("", (unsigned) tcp->u_arg[0]);
Elliott Hughesdc75b012017-07-05 13:54:44 -0700289 } else if (!syserror(tcp)) {
Elliott Hughes39bac052017-05-25 16:56:11 -0700290 tcp->auxstr = sprint_old_sigmask_val("old mask ",
291 (unsigned) tcp->u_rval);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000292 return RVAL_HEX | RVAL_STR;
293 }
294 return 0;
295}
296
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000297struct old_sigaction {
Denys Vlasenko86d94842013-02-08 12:59:13 +0100298 /* sa_handler may be a libc #define, need to use other name: */
Elliott Hughesdc75b012017-07-05 13:54:44 -0700299#if defined MIPS
Chris Dearman2b4bb1c2013-12-09 19:58:42 -0800300 unsigned int sa_flags;
Elliott Hughesd35df492017-02-15 15:19:05 -0800301 unsigned long sa_handler__;
Elliott Hughesdc75b012017-07-05 13:54:44 -0700302 unsigned long sa_mask;
303#elif defined ALPHA
304 unsigned long sa_handler__;
305 unsigned long sa_mask;
306 unsigned int sa_flags;
Chris Dearman2b4bb1c2013-12-09 19:58:42 -0800307#else
Elliott Hughesd35df492017-02-15 15:19:05 -0800308 unsigned long sa_handler__;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000309 unsigned long sa_mask;
310 unsigned long sa_flags;
Elliott Hughesd35df492017-02-15 15:19:05 -0800311 unsigned long sa_restorer;
Vicente Olivert Rierac3a5c012014-09-11 20:05:18 +0100312#endif
Elliott Hughesdc75b012017-07-05 13:54:44 -0700313}
314#ifdef ALPHA
315 ATTRIBUTE_PACKED
Vicente Olivert Rierac3a5c012014-09-11 20:05:18 +0100316#endif
Elliott Hughesdc75b012017-07-05 13:54:44 -0700317;
Elliott Hughes458b3f22014-02-28 23:21:35 +0000318
Dmitry V. Levinac655a82014-01-07 22:41:30 +0000319static void
Elliott Hughesd35df492017-02-15 15:19:05 -0800320decode_old_sigaction(struct tcb *const tcp, const kernel_ulong_t addr)
Dmitry V. Levinac655a82014-01-07 22:41:30 +0000321{
322 struct old_sigaction sa;
Elliott Hughes458b3f22014-02-28 23:21:35 +0000323
Elliott Hughesd35df492017-02-15 15:19:05 -0800324#ifndef current_wordsize
325 if (current_wordsize < sizeof(sa.sa_handler__)) {
Elliott Hughesdc75b012017-07-05 13:54:44 -0700326 struct old_sigaction32 {
327 uint32_t sa_handler__;
328 uint32_t sa_mask;
329 uint32_t sa_flags;
330 uint32_t sa_restorer;
331 } sa32;
Dmitry V. Levin735843e2015-07-17 00:37:39 +0000332
333 if (umove_or_printaddr(tcp, addr, &sa32))
334 return;
335
336 memset(&sa, 0, sizeof(sa));
Elliott Hughesd35df492017-02-15 15:19:05 -0800337 sa.sa_handler__ = sa32.sa_handler__;
Dmitry V. Levin735843e2015-07-17 00:37:39 +0000338 sa.sa_flags = sa32.sa_flags;
Elliott Hughesd35df492017-02-15 15:19:05 -0800339 sa.sa_restorer = sa32.sa_restorer;
Dmitry V. Levin735843e2015-07-17 00:37:39 +0000340 sa.sa_mask = sa32.sa_mask;
Elliott Hughes458b3f22014-02-28 23:21:35 +0000341 } else
342#endif
Dmitry V. Levin735843e2015-07-17 00:37:39 +0000343 if (umove_or_printaddr(tcp, addr, &sa))
Dmitry V. Levinac655a82014-01-07 22:41:30 +0000344 return;
Dmitry V. Levinac655a82014-01-07 22:41:30 +0000345
Elliott Hughesd35df492017-02-15 15:19:05 -0800346 tprints("{sa_handler=");
347 print_sa_handler(sa.sa_handler__);
348 tprints(", sa_mask=");
Elliott Hughesdc75b012017-07-05 13:54:44 -0700349 tprint_old_sigmask_val("", sa.sa_mask);
Elliott Hughesd35df492017-02-15 15:19:05 -0800350 tprints(", sa_flags=");
Dmitry V. Levinac655a82014-01-07 22:41:30 +0000351 printflags(sigact_flags, sa.sa_flags, "SA_???");
Elliott Hughesdc75b012017-07-05 13:54:44 -0700352#if !(defined ALPHA || defined MIPS)
353 if (sa.sa_flags & 0x04000000U) {
Elliott Hughesd35df492017-02-15 15:19:05 -0800354 tprints(", sa_restorer=");
355 printaddr(sa.sa_restorer);
356 }
Dmitry V. Levinac655a82014-01-07 22:41:30 +0000357#endif
358 tprints("}");
359}
360
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000361SYS_FUNC(sigaction)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000362{
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000363 if (entering(tcp)) {
Elliott Hughesdc75b012017-07-05 13:54:44 -0700364 int signo = tcp->u_arg[0];
365#if defined SPARC || defined SPARC64
366 if (signo < 0) {
367 tprints("-");
368 signo = -signo;
369 }
370#endif
371 printsignal(signo);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200372 tprints(", ");
Dmitry V. Levinac655a82014-01-07 22:41:30 +0000373 decode_old_sigaction(tcp, tcp->u_arg[1]);
374 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000375 } else
Dmitry V. Levinac655a82014-01-07 22:41:30 +0000376 decode_old_sigaction(tcp, tcp->u_arg[2]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000377 return 0;
378}
379
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000380SYS_FUNC(signal)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000381{
382 if (entering(tcp)) {
383 printsignal(tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200384 tprints(", ");
Eugene Syromiatnikov2909c7c2016-08-17 01:08:49 +0000385 print_sa_handler(tcp->u_arg[1]);
Wichert Akkerman16a03d22000-08-10 02:14:04 +0000386 return 0;
Eugene Syromiatnikov2909c7c2016-08-17 01:08:49 +0000387 } else if (!syserror(tcp)) {
388 tcp->auxstr = get_sa_handler_str(tcp->u_rval);
Wichert Akkerman16a03d22000-08-10 02:14:04 +0000389 return RVAL_HEX | RVAL_STR;
390 }
Dmitry V. Levin21a75342008-09-03 01:22:18 +0000391 return 0;
Wichert Akkerman16a03d22000-08-10 02:14:04 +0000392}
393
Elliott Hughes39bac052017-05-25 16:56:11 -0700394SYS_FUNC(sgetmask)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000395{
Elliott Hughes39bac052017-05-25 16:56:11 -0700396 if (exiting(tcp) && !syserror(tcp)) {
397 tcp->auxstr = sprint_old_sigmask_val("mask ", tcp->u_rval);
398 return RVAL_HEX | RVAL_STR;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000399 }
Elliott Hughes39bac052017-05-25 16:56:11 -0700400 return 0;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000401}
402
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000403SYS_FUNC(sigsuspend)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000404{
Elliott Hughes39bac052017-05-25 16:56:11 -0700405#ifdef MIPS
406 print_sigset_addr_len(tcp, tcp->u_arg[tcp->s_ent->nargs - 1],
407 current_wordsize);
408#else
409 tprint_old_sigmask_val("", tcp->u_arg[tcp->s_ent->nargs - 1]);
410#endif
Dmitry V. Levin0e45b502015-07-17 00:51:45 +0000411
412 return RVAL_DECODED;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000413}
414
Elliott Hughesdc75b012017-07-05 13:54:44 -0700415#ifdef ALPHA
416/*
417 * The OSF/1 sigprocmask is different: it doesn't pass in two pointers,
418 * but rather passes in the new bitmask as an argument and then returns
419 * the old bitmask. This "works" because we only have 64 signals to worry
420 * about. If you want more, use of the rt_sigprocmask syscall is required.
421 *
422 * Alpha:
423 * old = osf_sigprocmask(how, new);
424 * Everyone else:
425 * ret = sigprocmask(how, &new, &old, ...);
426 */
427SYS_FUNC(osf_sigprocmask)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000428{
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000429 if (entering(tcp)) {
430 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000431 tprintsigmask_val(", ", tcp->u_arg[1]);
Elliott Hughesdc75b012017-07-05 13:54:44 -0700432 } else if (!syserror(tcp)) {
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000433 tcp->auxstr = sprintsigmask_val("old mask ", tcp->u_rval);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000434 return RVAL_HEX | RVAL_STR;
435 }
Elliott Hughesdc75b012017-07-05 13:54:44 -0700436 return 0;
437}
438
439#else /* !ALPHA */
440
441/* "Old" sigprocmask, which operates with word-sized signal masks */
442SYS_FUNC(sigprocmask)
443{
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000444 if (entering(tcp)) {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000445 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200446 tprints(", ");
Denys Vlasenko5e133aa2013-07-18 17:02:21 +0200447 print_sigset_addr_len(tcp, tcp->u_arg[1], current_wordsize);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200448 tprints(", ");
Elliott Hughesdc75b012017-07-05 13:54:44 -0700449 } else {
Dmitry V. Levin735843e2015-07-17 00:37:39 +0000450 print_sigset_addr_len(tcp, tcp->u_arg[2], current_wordsize);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000451 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000452 return 0;
453}
Elliott Hughesdc75b012017-07-05 13:54:44 -0700454#endif /* !ALPHA */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000455
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000456SYS_FUNC(kill)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000457{
Dmitry V. Levinf1cadc22016-04-27 11:49:38 +0000458 tprintf("%d, %s",
459 (int) tcp->u_arg[0],
Dmitry V. Levin0e45b502015-07-17 00:51:45 +0000460 signame(tcp->u_arg[1]));
461
462 return RVAL_DECODED;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000463}
464
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000465SYS_FUNC(tgkill)
Roland McGrath8ffc3522003-07-09 09:47:49 +0000466{
Dmitry V. Levinf1cadc22016-04-27 11:49:38 +0000467 tprintf("%d, %d, %s",
468 (int) tcp->u_arg[0],
469 (int) tcp->u_arg[1],
Dmitry V. Levin0e45b502015-07-17 00:51:45 +0000470 signame(tcp->u_arg[2]));
471
472 return RVAL_DECODED;
Roland McGrath8ffc3522003-07-09 09:47:49 +0000473}
Roland McGrath8ffc3522003-07-09 09:47:49 +0000474
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000475SYS_FUNC(sigpending)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000476{
Dmitry V. Levin735843e2015-07-17 00:37:39 +0000477 if (exiting(tcp))
478 print_sigset_addr_len(tcp, tcp->u_arg[0], current_wordsize);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000479 return 0;
480}
481
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000482SYS_FUNC(rt_sigprocmask)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000483{
Elliott Hughesd35df492017-02-15 15:19:05 -0800484 /* Note: arg[3] is the length of the sigset. Kernel requires NSIG_BYTES */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000485 if (entering(tcp)) {
486 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200487 tprints(", ");
Denys Vlasenko5e133aa2013-07-18 17:02:21 +0200488 print_sigset_addr_len(tcp, tcp->u_arg[1], tcp->u_arg[3]);
489 tprints(", ");
Elliott Hughesdc75b012017-07-05 13:54:44 -0700490 } else {
Dmitry V. Levin735843e2015-07-17 00:37:39 +0000491 print_sigset_addr_len(tcp, tcp->u_arg[2], tcp->u_arg[3]);
Elliott Hughesd35df492017-02-15 15:19:05 -0800492 tprintf(", %" PRI_klu, tcp->u_arg[3]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000493 }
494 return 0;
495}
496
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000497/* Structure describing the action to be taken when a signal arrives. */
Elliott Hughesdc75b012017-07-05 13:54:44 -0700498struct new_sigaction {
Denys Vlasenko86d94842013-02-08 12:59:13 +0100499 /* sa_handler may be a libc #define, need to use other name: */
Chris Dearman2b4bb1c2013-12-09 19:58:42 -0800500#ifdef MIPS
501 unsigned int sa_flags;
Elliott Hughesd35df492017-02-15 15:19:05 -0800502 unsigned long sa_handler__;
Chris Dearman2b4bb1c2013-12-09 19:58:42 -0800503#else
Elliott Hughesd35df492017-02-15 15:19:05 -0800504 unsigned long sa_handler__;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000505 unsigned long sa_flags;
Chris Dearman2b4bb1c2013-12-09 19:58:42 -0800506#endif /* !MIPS */
Dmitry V. Levin24b8eb02015-02-28 17:17:09 +0000507#if HAVE_SA_RESTORER
Elliott Hughesd35df492017-02-15 15:19:05 -0800508 unsigned long sa_restorer;
Vicente Olivert Rierac3a5c012014-09-11 20:05:18 +0100509#endif
Denys Vlasenko7a862d72009-04-15 13:22:59 +0000510 /* Kernel treats sa_mask as an array of longs. */
Elliott Hughesd35df492017-02-15 15:19:05 -0800511 unsigned long sa_mask[NSIG / sizeof(long)];
Denys Vlasenko7a862d72009-04-15 13:22:59 +0000512};
513/* Same for i386-on-x86_64 and similar cases */
Elliott Hughesdc75b012017-07-05 13:54:44 -0700514struct new_sigaction32 {
Elliott Hughesd35df492017-02-15 15:19:05 -0800515 uint32_t sa_handler__;
Denys Vlasenko7a862d72009-04-15 13:22:59 +0000516 uint32_t sa_flags;
Dmitry V. Levin24b8eb02015-02-28 17:17:09 +0000517#if HAVE_SA_RESTORER
Denys Vlasenko7a862d72009-04-15 13:22:59 +0000518 uint32_t sa_restorer;
Vicente Olivert Rierac3a5c012014-09-11 20:05:18 +0100519#endif
Elliott Hughesd35df492017-02-15 15:19:05 -0800520 uint32_t sa_mask[2 * (NSIG / sizeof(long))];
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000521};
522
Dmitry V. Levinac655a82014-01-07 22:41:30 +0000523static void
Elliott Hughesd35df492017-02-15 15:19:05 -0800524decode_new_sigaction(struct tcb *const tcp, const kernel_ulong_t addr)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000525{
526 struct new_sigaction sa;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000527
Elliott Hughesd35df492017-02-15 15:19:05 -0800528#ifndef current_wordsize
529 if (current_wordsize < sizeof(sa.sa_handler__)) {
Denys Vlasenko7a862d72009-04-15 13:22:59 +0000530 struct new_sigaction32 sa32;
Dmitry V. Levin735843e2015-07-17 00:37:39 +0000531
532 if (umove_or_printaddr(tcp, addr, &sa32))
533 return;
534
535 memset(&sa, 0, sizeof(sa));
Elliott Hughesd35df492017-02-15 15:19:05 -0800536 sa.sa_handler__ = sa32.sa_handler__;
Dmitry V. Levin735843e2015-07-17 00:37:39 +0000537 sa.sa_flags = sa32.sa_flags;
Dmitry V. Levin24b8eb02015-02-28 17:17:09 +0000538#if HAVE_SA_RESTORER && defined SA_RESTORER
Elliott Hughesd35df492017-02-15 15:19:05 -0800539 sa.sa_restorer = sa32.sa_restorer;
Vicente Olivert Rierac3a5c012014-09-11 20:05:18 +0100540#endif
Dmitry V. Levin735843e2015-07-17 00:37:39 +0000541 /* Kernel treats sa_mask as an array of longs.
542 * For 32-bit process, "long" is uint32_t, thus, for example,
543 * 32th bit in sa_mask will end up as bit 0 in sa_mask[1].
544 * But for (64-bit) kernel, 32th bit in sa_mask is
545 * 32th bit in 0th (64-bit) long!
546 * For little-endian, it's the same.
547 * For big-endian, we swap 32-bit words.
548 */
Elliott Hughesd35df492017-02-15 15:19:05 -0800549 sa.sa_mask[0] = ULONG_LONG(sa32.sa_mask[0], sa32.sa_mask[1]);
Denys Vlasenko7a862d72009-04-15 13:22:59 +0000550 } else
551#endif
Dmitry V. Levin735843e2015-07-17 00:37:39 +0000552 if (umove_or_printaddr(tcp, addr, &sa))
Dmitry V. Levinac655a82014-01-07 22:41:30 +0000553 return;
Dmitry V. Levin735843e2015-07-17 00:37:39 +0000554
Elliott Hughesd35df492017-02-15 15:19:05 -0800555 tprints("{sa_handler=");
556 print_sa_handler(sa.sa_handler__);
557 tprints(", sa_mask=");
Denys Vlasenko80b73a22013-07-18 10:10:46 +0200558 /*
559 * Sigset size is in tcp->u_arg[4] (SPARC)
560 * or in tcp->u_arg[3] (all other),
561 * but kernel won't handle sys_rt_sigaction
562 * with wrong sigset size (just returns EINVAL instead).
Elliott Hughesd35df492017-02-15 15:19:05 -0800563 * We just fetch the right size, which is NSIG_BYTES.
Denys Vlasenko80b73a22013-07-18 10:10:46 +0200564 */
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000565 tprintsigmask_val("", sa.sa_mask);
Elliott Hughesd35df492017-02-15 15:19:05 -0800566 tprints(", sa_flags=");
Denys Vlasenko80b73a22013-07-18 10:10:46 +0200567
Denys Vlasenko7a862d72009-04-15 13:22:59 +0000568 printflags(sigact_flags, sa.sa_flags, "SA_???");
Dmitry V. Levin24b8eb02015-02-28 17:17:09 +0000569#if HAVE_SA_RESTORER && defined SA_RESTORER
Elliott Hughesd35df492017-02-15 15:19:05 -0800570 if (sa.sa_flags & SA_RESTORER) {
571 tprints(", sa_restorer=");
572 printaddr(sa.sa_restorer);
573 }
Denys Vlasenko7a862d72009-04-15 13:22:59 +0000574#endif
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200575 tprints("}");
Dmitry V. Levinac655a82014-01-07 22:41:30 +0000576}
Denys Vlasenko7a862d72009-04-15 13:22:59 +0000577
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000578SYS_FUNC(rt_sigaction)
Dmitry V. Levinac655a82014-01-07 22:41:30 +0000579{
580 if (entering(tcp)) {
581 printsignal(tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200582 tprints(", ");
Dmitry V. Levinac655a82014-01-07 22:41:30 +0000583 decode_new_sigaction(tcp, tcp->u_arg[1]);
584 tprints(", ");
585 } else {
586 decode_new_sigaction(tcp, tcp->u_arg[2]);
Denys Vlasenko9472a272013-02-12 11:43:46 +0100587#if defined(SPARC) || defined(SPARC64)
Elliott Hughesd35df492017-02-15 15:19:05 -0800588 tprintf(", %#" PRI_klx ", %" PRI_klu, tcp->u_arg[3], tcp->u_arg[4]);
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000589#elif defined(ALPHA)
Elliott Hughesd35df492017-02-15 15:19:05 -0800590 tprintf(", %" PRI_klu ", %#" PRI_klx, tcp->u_arg[3], tcp->u_arg[4]);
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000591#else
Elliott Hughesd35df492017-02-15 15:19:05 -0800592 tprintf(", %" PRI_klu, tcp->u_arg[3]);
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000593#endif
Dmitry V. Levinac655a82014-01-07 22:41:30 +0000594 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000595 return 0;
596}
597
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000598SYS_FUNC(rt_sigpending)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000599{
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000600 if (exiting(tcp)) {
Denys Vlasenko5e133aa2013-07-18 17:02:21 +0200601 /*
602 * One of the few syscalls where sigset size (arg[1])
Elliott Hughesd35df492017-02-15 15:19:05 -0800603 * is allowed to be <= NSIG_BYTES, not strictly ==.
Denys Vlasenko5e133aa2013-07-18 17:02:21 +0200604 * This allows non-rt sigpending() syscall
605 * to reuse rt_sigpending() code in kernel.
606 */
Dmitry V. Levin11656202016-02-18 00:08:30 +0000607 print_sigset_addr_len_limit(tcp, tcp->u_arg[0],
608 tcp->u_arg[1], 1);
Elliott Hughesd35df492017-02-15 15:19:05 -0800609 tprintf(", %" PRI_klu, tcp->u_arg[1]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000610 }
611 return 0;
612}
Denys Vlasenko1d632462009-04-14 12:51:00 +0000613
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000614SYS_FUNC(rt_sigsuspend)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000615{
Elliott Hughesd35df492017-02-15 15:19:05 -0800616 /* NB: kernel requires arg[1] == NSIG_BYTES */
Dmitry V. Levin0e45b502015-07-17 00:51:45 +0000617 print_sigset_addr_len(tcp, tcp->u_arg[0], tcp->u_arg[1]);
Elliott Hughesd35df492017-02-15 15:19:05 -0800618 tprintf(", %" PRI_klu, tcp->u_arg[1]);
Dmitry V. Levin0e45b502015-07-17 00:51:45 +0000619
620 return RVAL_DECODED;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000621}
Denys Vlasenko1d632462009-04-14 12:51:00 +0000622
Dmitry V. Levin297632b2012-03-13 15:51:13 +0000623static void
Elliott Hughesd35df492017-02-15 15:19:05 -0800624print_sigqueueinfo(struct tcb *const tcp, const int sig,
625 const kernel_ulong_t addr)
Dmitry V. Levin297632b2012-03-13 15:51:13 +0000626{
Dmitry V. Levin297632b2012-03-13 15:51:13 +0000627 printsignal(sig);
628 tprints(", ");
Elliott Hughesd35df492017-02-15 15:19:05 -0800629 printsiginfo_at(tcp, addr);
Dmitry V. Levin297632b2012-03-13 15:51:13 +0000630}
631
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000632SYS_FUNC(rt_sigqueueinfo)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000633{
Dmitry V. Levin11d623f2016-02-17 05:24:43 +0000634 tprintf("%d, ", (int) tcp->u_arg[0]);
Dmitry V. Levin0e45b502015-07-17 00:51:45 +0000635 print_sigqueueinfo(tcp, tcp->u_arg[1], tcp->u_arg[2]);
636
637 return RVAL_DECODED;
Dmitry V. Levin297632b2012-03-13 15:51:13 +0000638}
639
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000640SYS_FUNC(rt_tgsigqueueinfo)
Dmitry V. Levin297632b2012-03-13 15:51:13 +0000641{
Dmitry V. Levin11d623f2016-02-17 05:24:43 +0000642 tprintf("%d, %d, ", (int) tcp->u_arg[0], (int) tcp->u_arg[1]);
Dmitry V. Levin0e45b502015-07-17 00:51:45 +0000643 print_sigqueueinfo(tcp, tcp->u_arg[2], tcp->u_arg[3]);
644
645 return RVAL_DECODED;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000646}
647
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000648SYS_FUNC(rt_sigtimedwait)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000649{
Elliott Hughesd35df492017-02-15 15:19:05 -0800650 /* NB: kernel requires arg[3] == NSIG_BYTES */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000651 if (entering(tcp)) {
Denys Vlasenko5e133aa2013-07-18 17:02:21 +0200652 print_sigset_addr_len(tcp, tcp->u_arg[0], tcp->u_arg[3]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200653 tprints(", ");
Dmitry V. Levinc5d69182016-07-15 17:33:26 +0000654 if (!(tcp->u_arg[1] && verbose(tcp))) {
Dmitry V. Levin49faae92016-02-19 03:27:09 +0000655 /*
656 * This is the only "return" parameter,
Dmitry V. Levinc5d69182016-07-15 17:33:26 +0000657 * if we are not going to fetch it on exit,
658 * decode all parameters on entry.
Dmitry V. Levin49faae92016-02-19 03:27:09 +0000659 */
Dmitry V. Levinc5d69182016-07-15 17:33:26 +0000660 printaddr(tcp->u_arg[1]);
661 tprints(", ");
Dmitry V. Levin49faae92016-02-19 03:27:09 +0000662 print_timespec(tcp, tcp->u_arg[2]);
Elliott Hughesd35df492017-02-15 15:19:05 -0800663 tprintf(", %" PRI_klu, tcp->u_arg[3]);
Dmitry V. Levin49faae92016-02-19 03:27:09 +0000664 } else {
Dmitry V. Levinc5d69182016-07-15 17:33:26 +0000665 char *sts = xstrdup(sprint_timespec(tcp, tcp->u_arg[2]));
666 set_tcb_priv_data(tcp, sts, free);
Dmitry V. Levin49faae92016-02-19 03:27:09 +0000667 }
668 } else {
Dmitry V. Levinc5d69182016-07-15 17:33:26 +0000669 if (tcp->u_arg[1] && verbose(tcp)) {
Dmitry V. Levin49faae92016-02-19 03:27:09 +0000670 printsiginfo_at(tcp, tcp->u_arg[1]);
Dmitry V. Levinc5d69182016-07-15 17:33:26 +0000671 tprints(", ");
672 tprints(get_tcb_priv_data(tcp));
Elliott Hughesd35df492017-02-15 15:19:05 -0800673 tprintf(", %" PRI_klu, tcp->u_arg[3]);
Dmitry V. Levin49faae92016-02-19 03:27:09 +0000674 }
Dmitry V. Levin3858b932015-09-18 01:54:59 +0000675
Dmitry V. Levin49faae92016-02-19 03:27:09 +0000676 if (!syserror(tcp) && tcp->u_rval) {
677 tcp->auxstr = signame(tcp->u_rval);
678 return RVAL_STR;
679 }
680 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000681 return 0;
Elliott Hughesb7556142018-02-20 17:03:16 -0800682}
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000683
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000684SYS_FUNC(restart_syscall)
Roland McGrath79dcd7a2006-01-12 22:34:50 +0000685{
Dmitry V. Levin0e45b502015-07-17 00:51:45 +0000686 tprintf("<... resuming interrupted %s ...>",
687 tcp->s_prev_ent ? tcp->s_prev_ent->sys_name : "system call");
688
689 return RVAL_DECODED;
Roland McGrath79dcd7a2006-01-12 22:34:50 +0000690}