blob: 9caba795b79cb2b6cebcc152a3ebd78c8364be2f [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>
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00009 * 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 * $Id$
34 */
35
36#include "defs.h"
37
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000038#include <signal.h>
39#include <sys/user.h>
40#include <fcntl.h>
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000041
42#ifdef SVR4
43#include <sys/ucontext.h>
44#endif /* SVR4 */
45
Wichert Akkerman36915a11999-07-13 15:45:02 +000046#ifdef HAVE_SYS_REG_H
47# include <sys/reg.h>
Wichert Akkerman15dea971999-10-06 13:06:34 +000048#ifndef PTRACE_PEEKUSR
Wichert Akkerman36915a11999-07-13 15:45:02 +000049# define PTRACE_PEEKUSR PTRACE_PEEKUSER
Wichert Akkerman15dea971999-10-06 13:06:34 +000050#endif
51#ifndef PTRACE_POKEUSR
Wichert Akkerman36915a11999-07-13 15:45:02 +000052# define PTRACE_POKEUSR PTRACE_POKEUSER
Wichert Akkerman2e2553a1999-05-09 00:29:58 +000053#endif
Wichert Akkermanfaf72222000-02-19 23:59:03 +000054#elif defined(HAVE_LINUX_PTRACE_H)
55#undef PTRACE_SYSCALL
Roland McGrathb0acdfd2004-03-01 21:31:02 +000056# ifdef HAVE_STRUCT_IA64_FPREG
57# define ia64_fpreg XXX_ia64_fpreg
58# endif
59# ifdef HAVE_STRUCT_PT_ALL_USER_REGS
60# define pt_all_user_regs XXX_pt_all_user_regs
61# endif
Wichert Akkermanfaf72222000-02-19 23:59:03 +000062#include <linux/ptrace.h>
Roland McGrathb0acdfd2004-03-01 21:31:02 +000063# undef ia64_fpreg
64# undef pt_all_user_regs
Wichert Akkerman15dea971999-10-06 13:06:34 +000065#endif
Wichert Akkerman36915a11999-07-13 15:45:02 +000066
Wichert Akkermanfaf72222000-02-19 23:59:03 +000067
Wichert Akkerman36915a11999-07-13 15:45:02 +000068#ifdef LINUX
69
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +000070#ifdef IA64
71# include <asm/ptrace_offsets.h>
72#endif /* !IA64 */
73
Wichert Akkerman00a82ee2001-03-28 20:29:17 +000074#if HAVE_ASM_REG_H
Roland McGrath6d1a65c2004-07-12 07:44:08 +000075# if defined (SPARC) || defined (SPARC64)
Wichert Akkerman00a82ee2001-03-28 20:29:17 +000076# define fpq kernel_fpq
77# define fq kernel_fq
78# define fpu kernel_fpu
Roland McGrath30ff45e2003-01-30 20:15:23 +000079# endif
80# include <asm/reg.h>
Roland McGrath6d1a65c2004-07-12 07:44:08 +000081# if defined (SPARC) || defined (SPARC64)
Wichert Akkerman00a82ee2001-03-28 20:29:17 +000082# undef fpq
83# undef fq
Roland McGratha39c5a12002-12-17 05:10:37 +000084# undef fpu
Roland McGrath30ff45e2003-01-30 20:15:23 +000085# endif
Roland McGrath6d1a65c2004-07-12 07:44:08 +000086#if defined (LINUX) && defined (SPARC64)
87# define r_pc r_tpc
88# undef PTRACE_GETREGS
89# define PTRACE_GETREGS PTRACE_GETREGS64
90# undef PTRACE_SETREGS
91# define PTRACE_SETREGS PTRACE_SETREGS64
92#endif /* LINUX && SPARC64 */
Wichert Akkerman00a82ee2001-03-28 20:29:17 +000093#endif /* HAVE_ASM_REG_H */
Roland McGrath30ff45e2003-01-30 20:15:23 +000094
Roland McGrath6d1a65c2004-07-12 07:44:08 +000095#if defined (SPARC) || defined (SPARC64)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000096typedef struct {
Wichert Akkerman9ce1a631999-08-29 23:15:07 +000097 struct regs si_regs;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000098 int si_mask;
99} m_siginfo_t;
Roland McGrath576b7842007-11-04 00:00:00 +0000100#elif defined (MIPS)
101typedef struct {
102 struct pt_regs si_regs;
103 int si_mask;
104} m_siginfo_t;
Roland McGrath30ff45e2003-01-30 20:15:23 +0000105#elif defined HAVE_ASM_SIGCONTEXT_H
106#if !defined(IA64) && !defined(X86_64)
Wichert Akkerman00a82ee2001-03-28 20:29:17 +0000107#include <asm/sigcontext.h>
Roland McGrath30ff45e2003-01-30 20:15:23 +0000108#endif /* !IA64 && !X86_64 */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000109#else /* !HAVE_ASM_SIGCONTEXT_H */
Roland McGrath0cbb4e42008-05-20 01:26:21 +0000110#if defined I386 && !defined HAVE_STRUCT_SIGCONTEXT_STRUCT
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000111struct sigcontext_struct {
112 unsigned short gs, __gsh;
113 unsigned short fs, __fsh;
114 unsigned short es, __esh;
115 unsigned short ds, __dsh;
116 unsigned long edi;
117 unsigned long esi;
118 unsigned long ebp;
119 unsigned long esp;
120 unsigned long ebx;
121 unsigned long edx;
122 unsigned long ecx;
123 unsigned long eax;
124 unsigned long trapno;
125 unsigned long err;
126 unsigned long eip;
127 unsigned short cs, __csh;
128 unsigned long eflags;
129 unsigned long esp_at_signal;
130 unsigned short ss, __ssh;
131 unsigned long i387;
132 unsigned long oldmask;
133 unsigned long cr2;
134};
135#else /* !I386 */
136#ifdef M68K
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000137struct sigcontext
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000138{
139 unsigned long sc_mask;
140 unsigned long sc_usp;
141 unsigned long sc_d0;
142 unsigned long sc_d1;
143 unsigned long sc_a0;
144 unsigned long sc_a1;
145 unsigned short sc_sr;
146 unsigned long sc_pc;
147 unsigned short sc_formatvec;
148};
149#endif /* M68K */
150#endif /* !I386 */
151#endif /* !HAVE_ASM_SIGCONTEXT_H */
152#ifndef NSIG
153#define NSIG 32
154#endif
155#ifdef ARM
156#undef NSIG
157#define NSIG 32
158#endif
159#endif /* LINUX */
160
Roland McGrathee36ce12004-09-04 03:53:10 +0000161const char *const signalent0[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000162#include "signalent.h"
163};
Roland McGrathee36ce12004-09-04 03:53:10 +0000164const int nsignals0 = sizeof signalent0 / sizeof signalent0[0];
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000165
166#if SUPPORTED_PERSONALITIES >= 2
Roland McGrathee36ce12004-09-04 03:53:10 +0000167const char *const signalent1[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000168#include "signalent1.h"
169};
Roland McGrathee36ce12004-09-04 03:53:10 +0000170const int nsignals1 = sizeof signalent1 / sizeof signalent1[0];
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000171#endif /* SUPPORTED_PERSONALITIES >= 2 */
172
173#if SUPPORTED_PERSONALITIES >= 3
Roland McGrathee36ce12004-09-04 03:53:10 +0000174const char *const signalent2[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000175#include "signalent2.h"
176};
Roland McGrathee36ce12004-09-04 03:53:10 +0000177const int nsignals2 = sizeof signalent2 / sizeof signalent2[0];
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000178#endif /* SUPPORTED_PERSONALITIES >= 3 */
179
Roland McGrathee36ce12004-09-04 03:53:10 +0000180const char *const *signalent;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000181int nsignals;
182
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000183#if defined(SUNOS4) || defined(FREEBSD)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000184
Roland McGrathd9f816f2004-09-04 03:39:20 +0000185static const struct xlat sigvec_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000186 { SV_ONSTACK, "SV_ONSTACK" },
187 { SV_INTERRUPT, "SV_INTERRUPT" },
188 { SV_RESETHAND, "SV_RESETHAND" },
189 { SA_NOCLDSTOP, "SA_NOCLDSTOP" },
190 { 0, NULL },
191};
192
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000193#endif /* SUNOS4 || FREEBSD */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000194
195#ifdef HAVE_SIGACTION
196
Roland McGrath063ae2d2005-02-02 04:16:54 +0000197#if defined LINUX && (defined I386 || defined X86_64)
Roland McGrath2638cb42002-12-15 23:58:41 +0000198/* The libc headers do not define this constant since it should only be
199 used by the implementation. So wwe define it here. */
200# ifndef SA_RESTORER
201# define SA_RESTORER 0x04000000
202# endif
203#endif
204
Roland McGrathd9f816f2004-09-04 03:39:20 +0000205static const struct xlat sigact_flags[] = {
Wichert Akkermanc7926982000-04-10 22:22:31 +0000206#ifdef SA_RESTORER
207 { SA_RESTORER, "SA_RESTORER" },
208#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000209#ifdef SA_STACK
210 { SA_STACK, "SA_STACK" },
211#endif
212#ifdef SA_RESTART
213 { SA_RESTART, "SA_RESTART" },
214#endif
215#ifdef SA_INTERRUPT
216 { SA_INTERRUPT, "SA_INTERRUPT" },
217#endif
Roland McGrath4fef51d2008-07-18 01:02:41 +0000218#ifdef SA_NODEFER
219 { SA_NODEFER, "SA_NODEFER" },
220#endif
221#if defined SA_NOMASK && SA_NODEFER != SA_NOMASK
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000222 { SA_NOMASK, "SA_NOMASK" },
223#endif
Roland McGrath4fef51d2008-07-18 01:02:41 +0000224#ifdef SA_RESETHAND
225 { SA_RESETHAND, "SA_RESETHAND" },
226#endif
227#if defined SA_ONESHOT && SA_ONESHOT != SA_RESETHAND
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000228 { SA_ONESHOT, "SA_ONESHOT" },
229#endif
230#ifdef SA_SIGINFO
231 { SA_SIGINFO, "SA_SIGINFO" },
232#endif
233#ifdef SA_RESETHAND
234 { SA_RESETHAND, "SA_RESETHAND" },
235#endif
236#ifdef SA_ONSTACK
237 { SA_ONSTACK, "SA_ONSTACK" },
238#endif
239#ifdef SA_NODEFER
240 { SA_NODEFER, "SA_NODEFER" },
241#endif
242#ifdef SA_NOCLDSTOP
243 { SA_NOCLDSTOP, "SA_NOCLDSTOP" },
244#endif
245#ifdef SA_NOCLDWAIT
246 { SA_NOCLDWAIT, "SA_NOCLDWAIT" },
247#endif
248#ifdef _SA_BSDCALL
249 { _SA_BSDCALL, "_SA_BSDCALL" },
250#endif
251 { 0, NULL },
252};
253
Roland McGrathd9f816f2004-09-04 03:39:20 +0000254static const struct xlat sigprocmaskcmds[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000255 { SIG_BLOCK, "SIG_BLOCK" },
256 { SIG_UNBLOCK, "SIG_UNBLOCK" },
257 { SIG_SETMASK, "SIG_SETMASK" },
258#ifdef SIG_SETMASK32
259 { SIG_SETMASK32,"SIG_SETMASK32" },
260#endif
261 { 0, NULL },
262};
263
264#endif /* HAVE_SIGACTION */
265
Nate Sammonsce780fc1999-03-29 23:23:13 +0000266/* Anonymous realtime signals. */
267/* Under glibc 2.1, SIGRTMIN et al are functions, but __SIGRTMIN is a
268 constant. This is what we want. Otherwise, just use SIGRTMIN. */
269#ifdef SIGRTMIN
270#ifndef __SIGRTMIN
271#define __SIGRTMIN SIGRTMIN
272#define __SIGRTMAX SIGRTMAX /* likewise */
273#endif
274#endif
275
Roland McGrathee36ce12004-09-04 03:53:10 +0000276const char *
Nate Sammonsce780fc1999-03-29 23:23:13 +0000277signame(sig)
278int sig;
279{
280 static char buf[30];
Roland McGrathad81dce2005-05-09 07:40:30 +0000281 if (sig >= 0 && sig < nsignals) {
Nate Sammonsce780fc1999-03-29 23:23:13 +0000282 return signalent[sig];
283#ifdef SIGRTMIN
Nate Sammons3080aa41999-03-30 00:16:41 +0000284 } else if (sig >= __SIGRTMIN && sig <= __SIGRTMAX) {
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000285 sprintf(buf, "SIGRT_%ld", (long)(sig - __SIGRTMIN));
Nate Sammonsce780fc1999-03-29 23:23:13 +0000286 return buf;
287#endif /* SIGRTMIN */
288 } else {
289 sprintf(buf, "%d", sig);
290 return buf;
291 }
292}
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000293
Wichert Akkerman9ce1a631999-08-29 23:15:07 +0000294#ifndef UNIXWARE
Nate Sammons4a121431999-04-06 01:19:39 +0000295static void
296long_to_sigset(l, s)
297long l;
298sigset_t *s;
299{
300 sigemptyset(s);
301 *(long *)s = l;
302}
Wichert Akkerman9ce1a631999-08-29 23:15:07 +0000303#endif
Nate Sammons4a121431999-04-06 01:19:39 +0000304
305static int
306copy_sigset_len(tcp, addr, s, len)
307struct tcb *tcp;
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +0000308long addr;
Nate Sammons4a121431999-04-06 01:19:39 +0000309sigset_t *s;
310int len;
311{
312 if (len > sizeof(*s))
313 len = sizeof(*s);
314 sigemptyset(s);
315 if (umoven(tcp, addr, len, (char *)s) < 0)
316 return -1;
317 return 0;
318}
319
320#ifdef LINUX
321/* Original sigset is unsigned long */
322#define copy_sigset(tcp, addr, s) copy_sigset_len(tcp, addr, s, sizeof(long))
323#else
324#define copy_sigset(tcp, addr, s) copy_sigset_len(tcp, addr, s, sizeof(sigset_t))
325#endif
326
Dmitry V. Levinab9008b2007-01-11 22:05:04 +0000327static const char *
328sprintsigmask(const char *str, sigset_t *mask, int rt)
329/* set might include realtime sigs */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000330{
331 int i, nsigs;
Nate Sammons4a121431999-04-06 01:19:39 +0000332 int maxsigs;
Dmitry V. Levinab9008b2007-01-11 22:05:04 +0000333 char *format, *s;
Roland McGratha39c5a12002-12-17 05:10:37 +0000334 static char outstr[8 * sizeof(sigset_t) * 8];
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000335
Dmitry V. Levinab9008b2007-01-11 22:05:04 +0000336 strcpy(outstr, str);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000337 s = outstr + strlen(outstr);
338 nsigs = 0;
Nate Sammons4a121431999-04-06 01:19:39 +0000339 maxsigs = nsignals;
340#ifdef __SIGRTMAX
341 if (rt)
342 maxsigs = __SIGRTMAX; /* instead */
343#endif
344 for (i = 1; i < maxsigs; i++) {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000345 if (sigismember(mask, i) == 1)
346 nsigs++;
347 }
348 if (nsigs >= nsignals * 2 / 3) {
349 *s++ = '~';
Nate Sammons4a121431999-04-06 01:19:39 +0000350 for (i = 1; i < maxsigs; i++) {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000351 switch (sigismember(mask, i)) {
352 case 1:
353 sigdelset(mask, i);
354 break;
355 case 0:
356 sigaddset(mask, i);
357 break;
358 }
359 }
360 }
361 format = "%s";
362 *s++ = '[';
Nate Sammons4a121431999-04-06 01:19:39 +0000363 for (i = 1; i < maxsigs; i++) {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000364 if (sigismember(mask, i) == 1) {
John Hughesbdf48f52001-03-06 15:08:09 +0000365 /* real-time signals on solaris don't have
366 * signalent entries
367 */
368 if (i < nsignals) {
369 sprintf(s, format, signalent[i] + 3);
370 }
Roland McGrath90b4cb52003-09-23 22:19:32 +0000371#ifdef SIGRTMIN
372 else if (i >= __SIGRTMIN && i <= __SIGRTMAX) {
373 char tsig[40];
374 sprintf(tsig, "RT_%u", i - __SIGRTMIN);
375 sprintf(s, format, tsig);
376 }
377#endif /* SIGRTMIN */
John Hughesbdf48f52001-03-06 15:08:09 +0000378 else {
379 char tsig[32];
380 sprintf(tsig, "%u", i);
381 sprintf(s, format, tsig);
382 }
383 s += strlen(s);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000384 format = " %s";
385 }
386 }
387 *s++ = ']';
388 *s = '\0';
389 return outstr;
390}
391
392static void
Nate Sammons4a121431999-04-06 01:19:39 +0000393printsigmask(mask, rt)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000394sigset_t *mask;
Nate Sammons4a121431999-04-06 01:19:39 +0000395int rt;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000396{
Nate Sammons4a121431999-04-06 01:19:39 +0000397 tprintf("%s", sprintsigmask("", mask, rt));
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000398}
399
400void
401printsignal(nr)
402int nr;
403{
Nate Sammonsce780fc1999-03-29 23:23:13 +0000404 tprintf(signame(nr));
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000405}
406
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000407void
408print_sigset(struct tcb *tcp, long addr, int rt)
409{
410 sigset_t ss;
411
412 if (!addr)
413 tprintf("NULL");
414 else if (copy_sigset(tcp, addr, &ss) < 0)
415 tprintf("%#lx", addr);
416 else
417 printsigmask(&ss, rt);
418}
419
Wichert Akkerman7b3346b2001-10-09 23:47:38 +0000420#ifdef LINUX
421
John Hughes58265892001-10-18 15:13:53 +0000422#ifndef ILL_ILLOPC
423#define ILL_ILLOPC 1 /* illegal opcode */
424#define ILL_ILLOPN 2 /* illegal operand */
425#define ILL_ILLADR 3 /* illegal addressing mode */
426#define ILL_ILLTRP 4 /* illegal trap */
427#define ILL_PRVOPC 5 /* privileged opcode */
428#define ILL_PRVREG 6 /* privileged register */
429#define ILL_COPROC 7 /* coprocessor error */
430#define ILL_BADSTK 8 /* internal stack error */
431#define FPE_INTDIV 1 /* integer divide by zero */
432#define FPE_INTOVF 2 /* integer overflow */
433#define FPE_FLTDIV 3 /* floating point divide by zero */
434#define FPE_FLTOVF 4 /* floating point overflow */
435#define FPE_FLTUND 5 /* floating point underflow */
436#define FPE_FLTRES 6 /* floating point inexact result */
437#define FPE_FLTINV 7 /* floating point invalid operation */
438#define FPE_FLTSUB 8 /* subscript out of range */
439#define SEGV_MAPERR 1 /* address not mapped to object */
440#define SEGV_ACCERR 2 /* invalid permissions for mapped object */
441#define BUS_ADRALN 1 /* invalid address alignment */
442#define BUS_ADRERR 2 /* non-existant physical address */
443#define BUS_OBJERR 3 /* object specific hardware error */
444#define TRAP_BRKPT 1 /* process breakpoint */
445#define TRAP_TRACE 2 /* process trace trap */
446#define CLD_EXITED 1 /* child has exited */
447#define CLD_KILLED 2 /* child was killed */
448#define CLD_DUMPED 3 /* child terminated abnormally */
449#define CLD_TRAPPED 4 /* traced child has trapped */
450#define CLD_STOPPED 5 /* child has stopped */
451#define CLD_CONTINUED 6 /* stopped child has continued */
452#define POLL_IN 1 /* data input available */
453#define POLL_OUT 2 /* output buffers available */
454#define POLL_MSG 3 /* input message available */
455#define POLL_ERR 4 /* i/o error */
456#define POLL_PRI 5 /* high priority input available */
457#define POLL_HUP 6 /* device disconnected */
458#define SI_USER 0 /* sent by kill, sigsend, raise */
459#define SI_QUEUE -1 /* sent by sigqueue */
460#define SI_TIMER -2 /* sent by timer expiration */
461#define SI_MESGQ -3 /* sent by real time mesq state change */
462#define SI_ASYNCIO -4 /* sent by AIO completion */
Roland McGrath941b7402003-05-23 00:29:02 +0000463#define SI_SIGIO -5 /* Sent by SIGIO */
464#define SI_TKILL -6 /* Sent by tkill */
John Hughes58265892001-10-18 15:13:53 +0000465#endif
466
467#if __GLIBC_MINOR__ < 1
468/* Type for data associated with a signal. */
469typedef union sigval
470{
471 int sival_int;
472 void *sival_ptr;
473} sigval_t;
474
475# define __SI_MAX_SIZE 128
476# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
477
478typedef struct siginfo
479{
480 int si_signo; /* Signal number. */
481 int si_errno; /* If non-zero, an errno value associated with
482 this signal, as defined in <errno.h>. */
483 int si_code; /* Signal code. */
484
485 union
486 {
487 int _pad[__SI_PAD_SIZE];
488
489 /* kill(). */
490 struct
491 {
492 __pid_t si_pid; /* Sending process ID. */
493 __uid_t si_uid; /* Real user ID of sending process. */
494 } _kill;
495
496 /* POSIX.1b timers. */
497 struct
498 {
499 unsigned int _timer1;
500 unsigned int _timer2;
501 } _timer;
502
503 /* POSIX.1b signals. */
504 struct
505 {
506 __pid_t si_pid; /* Sending process ID. */
507 __uid_t si_uid; /* Real user ID of sending process. */
508 sigval_t si_sigval; /* Signal value. */
509 } _rt;
510
511 /* SIGCHLD. */
512 struct
513 {
514 __pid_t si_pid; /* Which child. */
515 int si_status; /* Exit value or signal. */
516 __clock_t si_utime;
517 __clock_t si_stime;
518 } _sigchld;
519
520 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */
521 struct
522 {
523 void *si_addr; /* Faulting insn/memory ref. */
524 } _sigfault;
525
526 /* SIGPOLL. */
527 struct
528 {
529 int si_band; /* Band event for SIGPOLL. */
530 int si_fd;
531 } _sigpoll;
532 } _sifields;
533} siginfo_t;
534
535#define si_pid _sifields._kill.si_pid
536#define si_uid _sifields._kill.si_uid
537#define si_status _sifields._sigchld.si_status
538#define si_utime _sifields._sigchld.si_utime
539#define si_stime _sifields._sigchld.si_stime
540#define si_value _sifields._rt.si_sigval
541#define si_int _sifields._rt.si_sigval.sival_int
542#define si_ptr _sifields._rt.si_sigval.sival_ptr
543#define si_addr _sifields._sigfault.si_addr
544#define si_band _sifields._sigpoll.si_band
545#define si_fd _sifields._sigpoll.si_fd
546
547#endif
548
549#endif
550
551#if defined (SVR4) || defined (LINUX)
552
Roland McGrathd9f816f2004-09-04 03:39:20 +0000553static const struct xlat siginfo_codes[] = {
John Hughes58265892001-10-18 15:13:53 +0000554#ifdef SI_NOINFO
555 { SI_NOINFO, "SI_NOINFO" },
556#endif
557#ifdef SI_USER
558 { SI_USER, "SI_USER" },
559#endif
560#ifdef SI_LWP
561 { SI_LWP, "SI_LWP" },
562#endif
563#ifdef SI_QUEUE
564 { SI_QUEUE, "SI_QUEUE" },
565#endif
566#ifdef SI_TIMER
567 { SI_TIMER, "SI_TIMER" },
568#endif
569#ifdef SI_ASYNCIO
570 { SI_ASYNCIO, "SI_ASYNCIO" },
571#endif
572#ifdef SI_MESGQ
573 { SI_MESGQ, "SI_MESGQ" },
574#endif
Roland McGrath941b7402003-05-23 00:29:02 +0000575#ifdef SI_SIGIO
576 { SI_SIGIO, "SI_SIGIO" },
577#endif
578#ifdef SI_TKILL
579 { SI_TKILL, "SI_TKILL" },
580#endif
John Hughes58265892001-10-18 15:13:53 +0000581 { 0, NULL },
582};
583
Roland McGrathd9f816f2004-09-04 03:39:20 +0000584static const struct xlat sigill_codes[] = {
John Hughes58265892001-10-18 15:13:53 +0000585 { ILL_ILLOPC, "ILL_ILLOPC" },
586 { ILL_ILLOPN, "ILL_ILLOPN" },
587 { ILL_ILLADR, "ILL_ILLADR" },
588 { ILL_ILLTRP, "ILL_ILLTRP" },
589 { ILL_PRVOPC, "ILL_PRVOPC" },
590 { ILL_PRVREG, "ILL_PRVREG" },
591 { ILL_COPROC, "ILL_COPROC" },
592 { ILL_BADSTK, "ILL_BADSTK" },
593 { 0, NULL },
594};
595
Roland McGrathd9f816f2004-09-04 03:39:20 +0000596static const struct xlat sigfpe_codes[] = {
John Hughes58265892001-10-18 15:13:53 +0000597 { FPE_INTDIV, "FPE_INTDIV" },
598 { FPE_INTOVF, "FPE_INTOVF" },
599 { FPE_FLTDIV, "FPE_FLTDIV" },
600 { FPE_FLTOVF, "FPE_FLTOVF" },
601 { FPE_FLTUND, "FPE_FLTUND" },
602 { FPE_FLTRES, "FPE_FLTRES" },
603 { FPE_FLTINV, "FPE_FLTINV" },
604 { FPE_FLTSUB, "FPE_FLTSUB" },
605 { 0, NULL },
606};
607
Roland McGrathd9f816f2004-09-04 03:39:20 +0000608static const struct xlat sigtrap_codes[] = {
John Hughes58265892001-10-18 15:13:53 +0000609 { TRAP_BRKPT, "TRAP_BRKPT" },
610 { TRAP_TRACE, "TRAP_TRACE" },
611 { 0, NULL },
612};
613
Roland McGrathd9f816f2004-09-04 03:39:20 +0000614static const struct xlat sigchld_codes[] = {
John Hughes58265892001-10-18 15:13:53 +0000615 { CLD_EXITED, "CLD_EXITED" },
616 { CLD_KILLED, "CLD_KILLED" },
617 { CLD_DUMPED, "CLD_DUMPED" },
618 { CLD_TRAPPED, "CLD_TRAPPED" },
619 { CLD_STOPPED, "CLD_STOPPED" },
620 { CLD_CONTINUED,"CLD_CONTINUED" },
621 { 0, NULL },
622};
623
Roland McGrathd9f816f2004-09-04 03:39:20 +0000624static const struct xlat sigpoll_codes[] = {
John Hughes58265892001-10-18 15:13:53 +0000625 { POLL_IN, "POLL_IN" },
626 { POLL_OUT, "POLL_OUT" },
627 { POLL_MSG, "POLL_MSG" },
628 { POLL_ERR, "POLL_ERR" },
629 { POLL_PRI, "POLL_PRI" },
630 { POLL_HUP, "POLL_HUP" },
631 { 0, NULL },
632};
633
Roland McGrathd9f816f2004-09-04 03:39:20 +0000634static const struct xlat sigprof_codes[] = {
John Hughes58265892001-10-18 15:13:53 +0000635#ifdef PROF_SIG
636 { PROF_SIG, "PROF_SIG" },
637#endif
638 { 0, NULL },
639};
640
641#ifdef SIGEMT
Roland McGrathd9f816f2004-09-04 03:39:20 +0000642static const struct xlat sigemt_codes[] = {
John Hughes58265892001-10-18 15:13:53 +0000643#ifdef EMT_TAGOVF
644 { EMT_TAGOVF, "EMT_TAGOVF" },
645#endif
646 { 0, NULL },
647};
648#endif
649
Roland McGrathd9f816f2004-09-04 03:39:20 +0000650static const struct xlat sigsegv_codes[] = {
John Hughes58265892001-10-18 15:13:53 +0000651 { SEGV_MAPERR, "SEGV_MAPERR" },
652 { SEGV_ACCERR, "SEGV_ACCERR" },
653 { 0, NULL },
654};
655
Roland McGrathd9f816f2004-09-04 03:39:20 +0000656static const struct xlat sigbus_codes[] = {
John Hughes58265892001-10-18 15:13:53 +0000657 { BUS_ADRALN, "BUS_ADRALN" },
658 { BUS_ADRERR, "BUS_ADRERR" },
659 { BUS_OBJERR, "BUS_OBJERR" },
660 { 0, NULL },
661};
662
663void
664printsiginfo(sip, verbose)
665siginfo_t *sip;
666int verbose;
667{
Roland McGrathf9c49b22004-10-06 22:11:54 +0000668 const char *code;
John Hughes58265892001-10-18 15:13:53 +0000669
670 if (sip->si_signo == 0) {
671 tprintf ("{}");
672 return;
673 }
674 tprintf("{si_signo=");
675 printsignal(sip->si_signo);
676 code = xlookup(siginfo_codes, sip->si_code);
677 if (!code) {
678 switch (sip->si_signo) {
679 case SIGTRAP:
680 code = xlookup(sigtrap_codes, sip->si_code);
681 break;
682 case SIGCHLD:
683 code = xlookup(sigchld_codes, sip->si_code);
684 break;
685 case SIGPOLL:
686 code = xlookup(sigpoll_codes, sip->si_code);
687 break;
688 case SIGPROF:
689 code = xlookup(sigprof_codes, sip->si_code);
690 break;
691 case SIGILL:
692 code = xlookup(sigill_codes, sip->si_code);
693 break;
694#ifdef SIGEMT
695 case SIGEMT:
696 code = xlookup(sigemt_codes, sip->si_code);
697 break;
698#endif
699 case SIGFPE:
700 code = xlookup(sigfpe_codes, sip->si_code);
701 break;
702 case SIGSEGV:
703 code = xlookup(sigsegv_codes, sip->si_code);
704 break;
705 case SIGBUS:
706 code = xlookup(sigbus_codes, sip->si_code);
707 break;
708 }
709 }
710 if (code)
711 tprintf(", si_code=%s", code);
712 else
713 tprintf(", si_code=%#x", sip->si_code);
714#ifdef SI_NOINFO
715 if (sip->si_code != SI_NOINFO)
716#endif
717 {
718 if (sip->si_errno) {
719 if (sip->si_errno < 0 || sip->si_errno >= nerrnos)
720 tprintf(", si_errno=%d", sip->si_errno);
721 else
722 tprintf(", si_errno=%s",
723 errnoent[sip->si_errno]);
724 }
725#ifdef SI_FROMUSER
726 if (SI_FROMUSER(sip)) {
727 tprintf(", si_pid=%ld, si_uid=%ld",
728 sip->si_pid, sip->si_uid);
729#ifdef SI_QUEUE
730 switch (sip->si_code) {
731 case SI_QUEUE:
732#ifdef SI_TIMER
733 case SI_TIMER:
734#endif /* SI_QUEUE */
735 case SI_ASYNCIO:
736#ifdef SI_MESGQ
737 case SI_MESGQ:
738#endif /* SI_MESGQ */
739 tprintf(", si_value=%d",
740 sip->si_value.sival_int);
741 break;
742 }
743#endif /* SI_QUEUE */
744 }
745 else
746#endif /* SI_FROMUSER */
747 {
748 switch (sip->si_signo) {
749 case SIGCHLD:
750 tprintf(", si_pid=%ld, si_status=",
751 (long) sip->si_pid);
752 if (sip->si_code == CLD_EXITED)
753 tprintf("%d", sip->si_status);
754 else
755 printsignal(sip->si_status);
756#if LINUX
757 if (!verbose)
758 tprintf(", ...");
759 else
760 tprintf(", si_utime=%lu, si_stime=%lu",
761 sip->si_utime,
762 sip->si_stime);
763#endif
764 break;
765 case SIGILL: case SIGFPE:
766 case SIGSEGV: case SIGBUS:
767 tprintf(", si_addr=%#lx",
768 (unsigned long) sip->si_addr);
769 break;
770 case SIGPOLL:
771 switch (sip->si_code) {
772 case POLL_IN: case POLL_OUT: case POLL_MSG:
773 tprintf(", si_band=%ld",
774 (long) sip->si_band);
775 break;
776 }
777 break;
778#ifdef LINUX
779 default:
780 tprintf(", si_pid=%lu, si_uid=%lu, ",
781 (unsigned long) sip->si_pid,
782 (unsigned long) sip->si_uid);
783 if (!verbose)
784 tprintf("...");
785 else {
786 tprintf("si_value={int=%u, ptr=%#lx}",
787 sip->si_int,
788 (unsigned long) sip->si_ptr);
789 }
790#endif
Roland McGratha39c5a12002-12-17 05:10:37 +0000791
John Hughes58265892001-10-18 15:13:53 +0000792 }
793 }
794 }
795 tprintf("}");
796}
797
798#endif /* SVR4 || LINUX */
799
800#ifdef LINUX
801
Wichert Akkerman7b3346b2001-10-09 23:47:38 +0000802static void
803parse_sigset_t (const char *str, sigset_t *set)
804{
Roland McGrathc38feca2003-10-01 07:50:28 +0000805 const char *p;
Wichert Akkerman7b3346b2001-10-09 23:47:38 +0000806 unsigned int digit;
807 int i;
808
809 sigemptyset(set);
810
Roland McGrathc38feca2003-10-01 07:50:28 +0000811 p = strchr(str, '\n');
812 if (p == NULL)
813 p = strchr(str, '\0');
814 for (i = 0; p-- > str; i += 4) {
815 if (*p >= '0' && *p <= '9')
816 digit = *p - '0';
817 else if (*p >= 'a' && *p <= 'f')
Roland McGrath92f1d6d2004-08-31 07:03:20 +0000818 digit = *p - 'a' + 10;
Roland McGrathc38feca2003-10-01 07:50:28 +0000819 else if (*p >= 'A' && *p <= 'F')
Roland McGrath92f1d6d2004-08-31 07:03:20 +0000820 digit = *p - 'A' + 10;
Wichert Akkerman7b3346b2001-10-09 23:47:38 +0000821 else
Roland McGrathc38feca2003-10-01 07:50:28 +0000822 break;
Wichert Akkerman7b3346b2001-10-09 23:47:38 +0000823 if (digit & 1)
824 sigaddset(set, i + 1);
825 if (digit & 2)
826 sigaddset(set, i + 2);
827 if (digit & 4)
828 sigaddset(set, i + 3);
829 if (digit & 8)
830 sigaddset(set, i + 4);
831 }
832}
833
834#endif
835
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000836/*
837 * Check process TCP for the disposition of signal SIG.
838 * Return 1 if the process would somehow manage to survive signal SIG,
839 * else return 0. This routine will never be called with SIGKILL.
840 */
841int
842sigishandled(tcp, sig)
843struct tcb *tcp;
844int sig;
845{
846#ifdef LINUX
847 int sfd;
848 char sname[32];
Wichert Akkermand5c2dae2001-04-12 09:10:24 +0000849 char buf[2048];
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000850 char *s;
851 int i;
Wichert Akkerman7b3346b2001-10-09 23:47:38 +0000852 sigset_t ignored, caught;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000853#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000854#ifdef SVR4
855 /*
856 * Since procfs doesn't interfere with wait I think it is safe
857 * to punt on this question. If not, the information is there.
858 */
859 return 1;
860#else /* !SVR4 */
861 switch (sig) {
862 case SIGCONT:
863 case SIGSTOP:
864 case SIGTSTP:
865 case SIGTTIN:
866 case SIGTTOU:
867 case SIGCHLD:
868 case SIGIO:
869#if defined(SIGURG) && SIGURG != SIGIO
870 case SIGURG:
871#endif
872 case SIGWINCH:
873 /* Gloria Gaynor says ... */
874 return 1;
875 default:
876 break;
877 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000878#endif /* !SVR4 */
Wichert Akkermand5c2dae2001-04-12 09:10:24 +0000879#ifdef LINUX
880
881 /* This is incredibly costly but it's worth it. */
882 /* NOTE: LinuxThreads internally uses SIGRTMIN, SIGRTMIN + 1 and
883 SIGRTMIN + 2, so we can't use the obsolete /proc/%d/stat which
884 doesn't handle real-time signals). */
885 sprintf(sname, "/proc/%d/status", tcp->pid);
886 if ((sfd = open(sname, O_RDONLY)) == -1) {
887 perror(sname);
888 return 1;
889 }
890 i = read(sfd, buf, sizeof(buf));
891 buf[i] = '\0';
892 close(sfd);
893 /*
894 * Skip the extraneous fields. We need to skip
895 * command name has any spaces in it. So be it.
896 */
Wichert Akkerman7b3346b2001-10-09 23:47:38 +0000897 s = strstr(buf, "SigIgn:\t");
Wichert Akkermand5c2dae2001-04-12 09:10:24 +0000898 if (!s)
899 {
900 fprintf(stderr, "/proc/pid/status format error\n");
901 return 1;
902 }
Wichert Akkerman7b3346b2001-10-09 23:47:38 +0000903 parse_sigset_t(s + 8, &ignored);
Wichert Akkermand5c2dae2001-04-12 09:10:24 +0000904
Wichert Akkerman7b3346b2001-10-09 23:47:38 +0000905 s = strstr(buf, "SigCgt:\t");
906 if (!s)
907 {
908 fprintf(stderr, "/proc/pid/status format error\n");
909 return 1;
910 }
911 parse_sigset_t(s + 8, &caught);
Wichert Akkermand5c2dae2001-04-12 09:10:24 +0000912
913#ifdef DEBUG
Wichert Akkerman7b3346b2001-10-09 23:47:38 +0000914 fprintf(stderr, "sigs: %016qx %016qx (sig=%d)\n",
915 *(long long *) &ignored, *(long long *) &caught, sig);
Wichert Akkermand5c2dae2001-04-12 09:10:24 +0000916#endif
Wichert Akkerman7b3346b2001-10-09 23:47:38 +0000917 if (sigismember(&ignored, sig) || sigismember(&caught, sig))
Wichert Akkermand5c2dae2001-04-12 09:10:24 +0000918 return 1;
919#endif /* LINUX */
920
921#ifdef SUNOS4
922 void (*u_signal)();
923
924 if (upeek(tcp->pid, uoff(u_signal[0]) + sig*sizeof(u_signal),
925 (long *) &u_signal) < 0) {
926 return 0;
927 }
928 if (u_signal != SIG_DFL)
929 return 1;
930#endif /* SUNOS4 */
931
932 return 0;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000933}
934
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000935#if defined(SUNOS4) || defined(FREEBSD)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000936
937int
938sys_sigvec(tcp)
939struct tcb *tcp;
940{
941 struct sigvec sv;
942 long addr;
943
944 if (entering(tcp)) {
945 printsignal(tcp->u_arg[0]);
946 tprintf(", ");
947 addr = tcp->u_arg[1];
948 } else {
949 addr = tcp->u_arg[2];
950 }
951 if (addr == 0)
952 tprintf("NULL");
953 else if (!verbose(tcp))
954 tprintf("%#lx", addr);
955 else if (umove(tcp, addr, &sv) < 0)
956 tprintf("{...}");
957 else {
958 switch ((int) sv.sv_handler) {
959 case (int) SIG_ERR:
960 tprintf("{SIG_ERR}");
961 break;
962 case (int) SIG_DFL:
963 tprintf("{SIG_DFL}");
964 break;
965 case (int) SIG_IGN:
966 if (tcp->u_arg[0] == SIGTRAP) {
967 tcp->flags |= TCB_SIGTRAPPED;
968 kill(tcp->pid, SIGSTOP);
969 }
970 tprintf("{SIG_IGN}");
971 break;
972 case (int) SIG_HOLD:
973 if (tcp->u_arg[0] == SIGTRAP) {
974 tcp->flags |= TCB_SIGTRAPPED;
975 kill(tcp->pid, SIGSTOP);
976 }
977 tprintf("SIG_HOLD");
978 break;
979 default:
980 if (tcp->u_arg[0] == SIGTRAP) {
981 tcp->flags |= TCB_SIGTRAPPED;
982 kill(tcp->pid, SIGSTOP);
983 }
984 tprintf("{%#lx, ", (unsigned long) sv.sv_handler);
Nate Sammons4a121431999-04-06 01:19:39 +0000985 printsigmask(&sv.sv_mask, 0);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000986 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000987 printflags(sigvec_flags, sv.sv_flags, "SV_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000988 tprintf("}");
989 }
990 }
991 if (entering(tcp))
992 tprintf(", ");
993 return 0;
994}
995
996int
997sys_sigpause(tcp)
998struct tcb *tcp;
999{
1000 if (entering(tcp)) { /* WTA: UD had a bug here: he forgot the braces */
Nate Sammons4a121431999-04-06 01:19:39 +00001001 sigset_t sigm;
1002 long_to_sigset(tcp->u_arg[0], &sigm);
1003 printsigmask(&sigm, 0);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001004 }
1005 return 0;
1006}
1007
1008int
1009sys_sigstack(tcp)
1010struct tcb *tcp;
1011{
1012 struct sigstack ss;
1013 long addr;
1014
1015 if (entering(tcp))
1016 addr = tcp->u_arg[0];
1017 else
1018 addr = tcp->u_arg[1];
1019 if (addr == 0)
1020 tprintf("NULL");
1021 else if (umove(tcp, addr, &ss) < 0)
1022 tprintf("%#lx", addr);
1023 else {
1024 tprintf("{ss_sp %#lx ", (unsigned long) ss.ss_sp);
1025 tprintf("ss_onstack %s}", ss.ss_onstack ? "YES" : "NO");
1026 }
1027 if (entering(tcp))
1028 tprintf(", ");
1029 return 0;
1030}
1031
1032int
1033sys_sigcleanup(tcp)
1034struct tcb *tcp;
1035{
1036 return 0;
1037}
1038
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001039#endif /* SUNOS4 || FREEBSD */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001040
1041#ifndef SVR4
1042
1043int
1044sys_sigsetmask(tcp)
1045struct tcb *tcp;
1046{
1047 if (entering(tcp)) {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001048 sigset_t sigm;
Nate Sammons4a121431999-04-06 01:19:39 +00001049 long_to_sigset(tcp->u_arg[0], &sigm);
1050 printsigmask(&sigm, 0);
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001051#ifndef USE_PROCFS
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001052 if ((tcp->u_arg[0] & sigmask(SIGTRAP))) {
1053 /* Mark attempt to block SIGTRAP */
1054 tcp->flags |= TCB_SIGTRAPPED;
1055 /* Send unblockable signal */
1056 kill(tcp->pid, SIGSTOP);
1057 }
Roland McGratha39c5a12002-12-17 05:10:37 +00001058#endif /* !USE_PROCFS */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001059 }
1060 else if (!syserror(tcp)) {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001061 sigset_t sigm;
Nate Sammons4a121431999-04-06 01:19:39 +00001062 long_to_sigset(tcp->u_rval, &sigm);
1063 tcp->auxstr = sprintsigmask("old mask ", &sigm, 0);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001064
1065 return RVAL_HEX | RVAL_STR;
1066 }
1067 return 0;
1068}
1069
Dmitry V. Levinb9fe0112006-12-13 16:59:44 +00001070#if defined(SUNOS4) || defined(FREEBSD)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001071int
1072sys_sigblock(tcp)
1073struct tcb *tcp;
1074{
1075 return sys_sigsetmask(tcp);
1076}
Dmitry V. Levinb9fe0112006-12-13 16:59:44 +00001077#endif /* SUNOS4 || FREEBSD */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001078
1079#endif /* !SVR4 */
1080
1081#ifdef HAVE_SIGACTION
1082
1083#ifdef LINUX
1084struct old_sigaction {
1085 __sighandler_t __sa_handler;
1086 unsigned long sa_mask;
1087 unsigned long sa_flags;
1088 void (*sa_restorer)(void);
1089};
Wichert Akkerman2e2553a1999-05-09 00:29:58 +00001090#define SA_HANDLER __sa_handler
1091#endif /* LINUX */
1092
Roland McGratha39c5a12002-12-17 05:10:37 +00001093#ifndef SA_HANDLER
1094#define SA_HANDLER sa_handler
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001095#endif
1096
1097int
1098sys_sigaction(tcp)
1099struct tcb *tcp;
1100{
1101 long addr;
Nate Sammons4a121431999-04-06 01:19:39 +00001102#ifdef LINUX
John Hughes1e4cb342001-03-06 09:25:46 +00001103 sigset_t sigset;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001104 struct old_sigaction sa;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001105#else
1106 struct sigaction sa;
1107#endif
1108
1109
1110 if (entering(tcp)) {
1111 printsignal(tcp->u_arg[0]);
1112 tprintf(", ");
1113 addr = tcp->u_arg[1];
1114 } else
1115 addr = tcp->u_arg[2];
1116 if (addr == 0)
1117 tprintf("NULL");
1118 else if (!verbose(tcp))
1119 tprintf("%#lx", addr);
1120 else if (umove(tcp, addr, &sa) < 0)
1121 tprintf("{...}");
1122 else {
Wichert Akkerman2e2553a1999-05-09 00:29:58 +00001123 switch ((long) sa.SA_HANDLER) {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001124 case (long) SIG_ERR:
1125 tprintf("{SIG_ERR}");
1126 break;
1127 case (long) SIG_DFL:
1128 tprintf("{SIG_DFL}");
1129 break;
1130 case (long) SIG_IGN:
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001131#ifndef USE_PROCFS
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001132 if (tcp->u_arg[0] == SIGTRAP) {
1133 tcp->flags |= TCB_SIGTRAPPED;
1134 kill(tcp->pid, SIGSTOP);
1135 }
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001136#endif /* !USE_PROCFS */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001137 tprintf("{SIG_IGN}");
1138 break;
1139 default:
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001140#ifndef USE_PROCFS
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001141 if (tcp->u_arg[0] == SIGTRAP) {
1142 tcp->flags |= TCB_SIGTRAPPED;
1143 kill(tcp->pid, SIGSTOP);
1144 }
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001145#endif /* !USE_PROCFS */
Wichert Akkerman2e2553a1999-05-09 00:29:58 +00001146 tprintf("{%#lx, ", (long) sa.SA_HANDLER);
Wichert Akkerman48214be1999-11-26 09:55:42 +00001147#ifndef LINUX
1148 printsigmask (&sa.sa_mask, 0);
1149#else
Nate Sammons4a121431999-04-06 01:19:39 +00001150 long_to_sigset(sa.sa_mask, &sigset);
1151 printsigmask(&sigset, 0);
Wichert Akkerman48214be1999-11-26 09:55:42 +00001152#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001153 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001154 printflags(sigact_flags, sa.sa_flags, "SA_???");
Roland McGrath2638cb42002-12-15 23:58:41 +00001155#ifdef SA_RESTORER
1156 if (sa.sa_flags & SA_RESTORER)
1157 tprintf(", %p", sa.sa_restorer);
1158#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001159 tprintf("}");
1160 }
1161 }
1162 if (entering(tcp))
1163 tprintf(", ");
1164#ifdef LINUX
1165 else
1166 tprintf(", %#lx", (unsigned long) sa.sa_restorer);
1167#endif
1168 return 0;
1169}
1170
1171int
1172sys_signal(tcp)
1173struct tcb *tcp;
1174{
1175 if (entering(tcp)) {
1176 printsignal(tcp->u_arg[0]);
Wichert Akkerman16a03d22000-08-10 02:14:04 +00001177 tprintf(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001178 switch (tcp->u_arg[1]) {
1179 case (int) SIG_ERR:
1180 tprintf("SIG_ERR");
1181 break;
1182 case (int) SIG_DFL:
1183 tprintf("SIG_DFL");
1184 break;
1185 case (int) SIG_IGN:
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001186#ifndef USE_PROCFS
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001187 if (tcp->u_arg[0] == SIGTRAP) {
1188 tcp->flags |= TCB_SIGTRAPPED;
1189 kill(tcp->pid, SIGSTOP);
1190 }
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001191#endif /* !USE_PROCFS */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001192 tprintf("SIG_IGN");
1193 break;
1194 default:
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001195#ifndef USE_PROCFS
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001196 if (tcp->u_arg[0] == SIGTRAP) {
1197 tcp->flags |= TCB_SIGTRAPPED;
1198 kill(tcp->pid, SIGSTOP);
1199 }
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001200#endif /* !USE_PROCFS */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001201 tprintf("%#lx", tcp->u_arg[1]);
1202 }
Wichert Akkerman16a03d22000-08-10 02:14:04 +00001203 return 0;
1204 }
1205 else {
1206 switch (tcp->u_rval) {
1207 case (int) SIG_ERR:
1208 tcp->auxstr = "SIG_ERR"; break;
1209 case (int) SIG_DFL:
1210 tcp->auxstr = "SIG_DFL"; break;
1211 case (int) SIG_IGN:
1212 tcp->auxstr = "SIG_IGN"; break;
1213 default:
1214 tcp->auxstr = NULL;
1215 }
1216 return RVAL_HEX | RVAL_STR;
1217 }
1218}
1219
Dmitry V. Levinb9fe0112006-12-13 16:59:44 +00001220#ifdef SVR4
Wichert Akkerman16a03d22000-08-10 02:14:04 +00001221int
1222sys_sighold(tcp)
1223struct tcb *tcp;
1224{
1225 if (entering(tcp)) {
1226 printsignal(tcp->u_arg[0]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001227 }
1228 return 0;
1229}
Dmitry V. Levinb9fe0112006-12-13 16:59:44 +00001230#endif /* SVR4 */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001231
1232#endif /* HAVE_SIGACTION */
1233
1234#ifdef LINUX
1235
1236int
1237sys_sigreturn(tcp)
1238struct tcb *tcp;
1239{
Roland McGrath0f87c492003-06-03 23:29:04 +00001240#ifdef ARM
1241 struct pt_regs regs;
1242 struct sigcontext_struct sc;
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +00001243
Roland McGrath0f87c492003-06-03 23:29:04 +00001244 if (entering(tcp)) {
1245 tcp->u_arg[0] = 0;
1246
1247 if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (void *)&regs) == -1)
1248 return 0;
1249
1250 if (umove(tcp, regs.ARM_sp, &sc) < 0)
1251 return 0;
1252
1253 tcp->u_arg[0] = 1;
1254 tcp->u_arg[1] = sc.oldmask;
1255 } else {
1256 sigset_t sigm;
1257 long_to_sigset(tcp->u_arg[1], &sigm);
1258 tcp->u_rval = tcp->u_error = 0;
1259 if (tcp->u_arg[0] == 0)
1260 return 0;
1261 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1262 return RVAL_NONE | RVAL_STR;
1263 }
1264 return 0;
1265#elif defined(S390) || defined(S390X)
1266 long usp;
1267 struct sigcontext_struct sc;
1268
1269 if (entering(tcp)) {
1270 tcp->u_arg[0] = 0;
1271 if (upeek(tcp->pid,PT_GPR15,&usp)<0)
1272 return 0;
1273 if (umove(tcp, usp+__SIGNAL_FRAMESIZE, &sc) < 0)
1274 return 0;
1275 tcp->u_arg[0] = 1;
1276 memcpy(&tcp->u_arg[1],&sc.oldmask[0],sizeof(sigset_t));
1277 } else {
1278 tcp->u_rval = tcp->u_error = 0;
1279 if (tcp->u_arg[0] == 0)
1280 return 0;
1281 tcp->auxstr = sprintsigmask("mask now ",(sigset_t *)&tcp->u_arg[1],0);
1282 return RVAL_NONE | RVAL_STR;
1283 }
1284 return 0;
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +00001285#else
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001286#ifdef I386
1287 long esp;
1288 struct sigcontext_struct sc;
1289
1290 if (entering(tcp)) {
1291 tcp->u_arg[0] = 0;
1292 if (upeek(tcp->pid, 4*UESP, &esp) < 0)
1293 return 0;
1294 if (umove(tcp, esp, &sc) < 0)
1295 return 0;
1296 tcp->u_arg[0] = 1;
1297 tcp->u_arg[1] = sc.oldmask;
1298 }
1299 else {
1300 sigset_t sigm;
Nate Sammons4a121431999-04-06 01:19:39 +00001301 long_to_sigset(tcp->u_arg[1], &sigm);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001302 tcp->u_rval = tcp->u_error = 0;
1303 if (tcp->u_arg[0] == 0)
1304 return 0;
Nate Sammons4a121431999-04-06 01:19:39 +00001305 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001306 return RVAL_NONE | RVAL_STR;
1307 }
1308 return 0;
1309#else /* !I386 */
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001310#ifdef IA64
1311 struct sigcontext sc;
1312 long sp;
1313
1314 if (entering(tcp)) {
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001315 /* offset of sigcontext in the kernel's sigframe structure: */
1316# define SIGFRAME_SC_OFFSET 0x90
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001317 tcp->u_arg[0] = 0;
1318 if (upeek(tcp->pid, PT_R12, &sp) < 0)
1319 return 0;
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001320 if (umove(tcp, sp + 16 + SIGFRAME_SC_OFFSET, &sc) < 0)
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001321 return 0;
1322 tcp->u_arg[0] = 1;
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001323 memcpy(tcp->u_arg + 1, &sc.sc_mask, sizeof(sc.sc_mask));
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001324 }
1325 else {
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001326 sigset_t sigm;
1327
1328 memcpy(&sigm, tcp->u_arg + 1, sizeof (sigm));
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001329 tcp->u_rval = tcp->u_error = 0;
1330 if (tcp->u_arg[0] == 0)
1331 return 0;
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001332 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001333 return RVAL_NONE | RVAL_STR;
1334 }
1335 return 0;
1336#else /* !IA64 */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001337#ifdef POWERPC
Roland McGrath0f87c492003-06-03 23:29:04 +00001338 long esp;
1339 struct sigcontext_struct sc;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001340
Roland McGrath0f87c492003-06-03 23:29:04 +00001341 if (entering(tcp)) {
1342 tcp->u_arg[0] = 0;
1343 if (upeek(tcp->pid, sizeof(unsigned long)*PT_R1, &esp) < 0)
1344 return 0;
1345 if (umove(tcp, esp, &sc) < 0)
1346 return 0;
1347 tcp->u_arg[0] = 1;
1348 tcp->u_arg[1] = sc.oldmask;
1349 }
1350 else {
1351 sigset_t sigm;
1352 long_to_sigset(tcp->u_arg[1], &sigm);
1353 tcp->u_rval = tcp->u_error = 0;
1354 if (tcp->u_arg[0] == 0)
1355 return 0;
1356 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1357 return RVAL_NONE | RVAL_STR;
1358 }
1359 return 0;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001360#else /* !POWERPC */
1361#ifdef M68K
1362 long usp;
Wichert Akkerman2e2553a1999-05-09 00:29:58 +00001363 struct sigcontext sc;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001364
1365 if (entering(tcp)) {
Roland McGrath0f87c492003-06-03 23:29:04 +00001366 tcp->u_arg[0] = 0;
1367 if (upeek(tcp->pid, 4*PT_USP, &usp) < 0)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001368 return 0;
Roland McGrath0f87c492003-06-03 23:29:04 +00001369 if (umove(tcp, usp, &sc) < 0)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001370 return 0;
Roland McGrath0f87c492003-06-03 23:29:04 +00001371 tcp->u_arg[0] = 1;
1372 tcp->u_arg[1] = sc.sc_mask;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001373 }
1374 else {
Roland McGrath0f87c492003-06-03 23:29:04 +00001375 sigset_t sigm;
1376 long_to_sigset(tcp->u_arg[1], &sigm);
1377 tcp->u_rval = tcp->u_error = 0;
1378 if (tcp->u_arg[0] == 0)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001379 return 0;
Roland McGrath0f87c492003-06-03 23:29:04 +00001380 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1381 return RVAL_NONE | RVAL_STR;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001382 }
1383 return 0;
1384#else /* !M68K */
1385#ifdef ALPHA
1386 long fp;
1387 struct sigcontext_struct sc;
1388
1389 if (entering(tcp)) {
Roland McGrath0f87c492003-06-03 23:29:04 +00001390 tcp->u_arg[0] = 0;
1391 if (upeek(tcp->pid, REG_FP, &fp) < 0)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001392 return 0;
Roland McGrath0f87c492003-06-03 23:29:04 +00001393 if (umove(tcp, fp, &sc) < 0)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001394 return 0;
Roland McGrath0f87c492003-06-03 23:29:04 +00001395 tcp->u_arg[0] = 1;
1396 tcp->u_arg[1] = sc.sc_mask;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001397 }
1398 else {
Roland McGrath0f87c492003-06-03 23:29:04 +00001399 sigset_t sigm;
1400 long_to_sigset(tcp->u_arg[1], &sigm);
1401 tcp->u_rval = tcp->u_error = 0;
1402 if (tcp->u_arg[0] == 0)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001403 return 0;
Roland McGrath0f87c492003-06-03 23:29:04 +00001404 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1405 return RVAL_NONE | RVAL_STR;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001406 }
1407 return 0;
1408#else
Roland McGrath6d1a65c2004-07-12 07:44:08 +00001409#if defined (SPARC) || defined (SPARC64)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001410 long i1;
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001411 struct regs regs;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001412 m_siginfo_t si;
1413
1414 if(ptrace(PTRACE_GETREGS, tcp->pid, (char *)&regs, 0) < 0) {
Roland McGrath0f87c492003-06-03 23:29:04 +00001415 perror("sigreturn: PTRACE_GETREGS ");
1416 return 0;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001417 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001418 if(entering(tcp)) {
1419 tcp->u_arg[0] = 0;
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001420 i1 = regs.r_o1;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001421 if(umove(tcp, i1, &si) < 0) {
1422 perror("sigreturn: umove ");
1423 return 0;
1424 }
1425 tcp->u_arg[0] = 1;
1426 tcp->u_arg[1] = si.si_mask;
1427 } else {
1428 sigset_t sigm;
Nate Sammons4a121431999-04-06 01:19:39 +00001429 long_to_sigset(tcp->u_arg[1], &sigm);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001430 tcp->u_rval = tcp->u_error = 0;
1431 if(tcp->u_arg[0] == 0)
1432 return 0;
Nate Sammons4a121431999-04-06 01:19:39 +00001433 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001434 return RVAL_NONE | RVAL_STR;
1435 }
1436 return 0;
Roland McGratha39c5a12002-12-17 05:10:37 +00001437#else
Roland McGrath542c2c62008-05-20 01:11:56 +00001438#if defined (LINUX_MIPSN32) || defined (LINUX_MIPSN64)
1439 /* This decodes rt_sigreturn. The 64-bit ABIs do not have
1440 sigreturn. */
1441 long sp;
1442 struct ucontext uc;
1443
1444 if(entering(tcp)) {
1445 tcp->u_arg[0] = 0;
1446 if (upeek(tcp->pid, REG_SP, &sp) < 0)
1447 return 0;
1448 /* There are six words followed by a 128-byte siginfo. */
1449 sp = sp + 6 * 4 + 128;
1450 if (umove(tcp, sp, &uc) < 0)
1451 return 0;
1452 tcp->u_arg[0] = 1;
1453 tcp->u_arg[1] = *(long *) &uc.uc_sigmask;
1454 } else {
1455 sigset_t sigm;
1456 long_to_sigset(tcp->u_arg[1], &sigm);
1457 tcp->u_rval = tcp->u_error = 0;
1458 if(tcp->u_arg[0] == 0)
1459 return 0;
1460 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
1461 return RVAL_NONE | RVAL_STR;
1462 }
1463 return 0;
1464#else
Wichert Akkermanf90da011999-10-31 21:15:38 +00001465#ifdef MIPS
1466 long sp;
Roland McGrath576b7842007-11-04 00:00:00 +00001467 struct pt_regs regs;
1468 m_siginfo_t si;
Wichert Akkermanf90da011999-10-31 21:15:38 +00001469
Roland McGrath576b7842007-11-04 00:00:00 +00001470 if(ptrace(PTRACE_GETREGS, tcp->pid, (char *)&regs, 0) < 0) {
1471 perror("sigreturn: PTRACE_GETREGS ");
1472 return 0;
1473 }
Wichert Akkermanf90da011999-10-31 21:15:38 +00001474 if(entering(tcp)) {
1475 tcp->u_arg[0] = 0;
Roland McGrath576b7842007-11-04 00:00:00 +00001476 sp = regs.regs[29];
1477 if (umove(tcp, sp, &si) < 0)
Wichert Akkermanf90da011999-10-31 21:15:38 +00001478 tcp->u_arg[0] = 1;
Roland McGrath576b7842007-11-04 00:00:00 +00001479 tcp->u_arg[1] = si.si_mask;
Wichert Akkermanf90da011999-10-31 21:15:38 +00001480 } else {
Roland McGrath576b7842007-11-04 00:00:00 +00001481 sigset_t sigm;
1482 long_to_sigset(tcp->u_arg[1], &sigm);
Wichert Akkermanf90da011999-10-31 21:15:38 +00001483 tcp->u_rval = tcp->u_error = 0;
1484 if(tcp->u_arg[0] == 0)
Roland McGrath576b7842007-11-04 00:00:00 +00001485 return 0;
1486 tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
Wichert Akkermanf90da011999-10-31 21:15:38 +00001487 return RVAL_NONE | RVAL_STR;
1488 }
1489 return 0;
Wichert Akkermanc1652e22001-03-27 12:17:16 +00001490#else
Michal Ludvig0e035502002-09-23 15:41:01 +00001491#warning No sys_sigreturn() for this architecture
1492#warning (no problem, just a reminder :-)
Wichert Akkermanc1652e22001-03-27 12:17:16 +00001493 return 0;
Wichert Akkermanf90da011999-10-31 21:15:38 +00001494#endif /* MIPS */
Roland McGrath542c2c62008-05-20 01:11:56 +00001495#endif /* LINUX_MIPSN32 || LINUX_MIPSN64 */
Roland McGrath6d1a65c2004-07-12 07:44:08 +00001496#endif /* SPARC || SPARC64 */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001497#endif /* ALPHA */
1498#endif /* !M68K */
1499#endif /* !POWERPC */
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001500#endif /* !IA64 */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001501#endif /* !I386 */
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +00001502#endif /* S390 */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001503}
1504
1505int
1506sys_siggetmask(tcp)
1507struct tcb *tcp;
1508{
1509 if (exiting(tcp)) {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001510 sigset_t sigm;
Nate Sammons4a121431999-04-06 01:19:39 +00001511 long_to_sigset(tcp->u_rval, &sigm);
1512 tcp->auxstr = sprintsigmask("mask ", &sigm, 0);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001513 }
1514 return RVAL_HEX | RVAL_STR;
1515}
1516
1517int
1518sys_sigsuspend(tcp)
1519struct tcb *tcp;
1520{
1521 if (entering(tcp)) {
1522 sigset_t sigm;
Nate Sammons4a121431999-04-06 01:19:39 +00001523 long_to_sigset(tcp->u_arg[2], &sigm);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001524#if 0
1525 /* first two are not really arguments, but print them anyway */
1526 /* nevermind, they are an anachronism now, too bad... */
1527 tprintf("%d, %#x, ", tcp->u_arg[0], tcp->u_arg[1]);
1528#endif
Nate Sammons4a121431999-04-06 01:19:39 +00001529 printsigmask(&sigm, 0);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001530 }
1531 return 0;
1532}
1533
1534#endif /* LINUX */
1535
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001536#if defined(SVR4) || defined(FREEBSD)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001537
1538int
1539sys_sigsuspend(tcp)
1540struct tcb *tcp;
1541{
1542 sigset_t sigset;
1543
1544 if (entering(tcp)) {
1545 if (umove(tcp, tcp->u_arg[0], &sigset) < 0)
1546 tprintf("[?]");
1547 else
Wichert Akkerman46956571999-11-26 10:12:59 +00001548 printsigmask(&sigset, 0);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001549 }
1550 return 0;
1551}
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001552#ifndef FREEBSD
Roland McGrathd9f816f2004-09-04 03:39:20 +00001553static const struct xlat ucontext_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001554 { UC_SIGMASK, "UC_SIGMASK" },
1555 { UC_STACK, "UC_STACK" },
1556 { UC_CPU, "UC_CPU" },
1557#ifdef UC_FPU
1558 { UC_FPU, "UC_FPU" },
1559#endif
1560#ifdef UC_INTR
1561 { UC_INTR, "UC_INTR" },
1562#endif
1563 { 0, NULL },
1564};
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001565#endif /* !FREEBSD */
1566#endif /* SVR4 || FREEBSD */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001567
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001568#if defined SVR4 || defined LINUX || defined FREEBSD
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001569#if defined LINUX && !defined SS_ONSTACK
1570#define SS_ONSTACK 1
1571#define SS_DISABLE 2
1572#if __GLIBC_MINOR__ == 0
1573typedef struct
1574{
1575 __ptr_t ss_sp;
1576 int ss_flags;
1577 size_t ss_size;
1578} stack_t;
1579#endif
1580#endif
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001581#ifdef FREEBSD
1582#define stack_t struct sigaltstack
1583#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001584
Roland McGrathd9f816f2004-09-04 03:39:20 +00001585static const struct xlat sigaltstack_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001586 { SS_ONSTACK, "SS_ONSTACK" },
1587 { SS_DISABLE, "SS_DISABLE" },
1588 { 0, NULL },
1589};
1590#endif
1591
1592#ifdef SVR4
1593static void
1594printcontext(tcp, ucp)
1595struct tcb *tcp;
1596ucontext_t *ucp;
1597{
1598 tprintf("{");
1599 if (!abbrev(tcp)) {
1600 tprintf("uc_flags=");
Roland McGrathb2dee132005-06-01 19:02:36 +00001601 printflags(ucontext_flags, ucp->uc_flags, "UC_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001602 tprintf(", uc_link=%#lx, ", (unsigned long) ucp->uc_link);
1603 }
1604 tprintf("uc_sigmask=");
John Hughes70c5e7a2001-05-15 15:09:14 +00001605 printsigmask(&ucp->uc_sigmask, 0);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001606 if (!abbrev(tcp)) {
1607 tprintf(", uc_stack={ss_sp=%#lx, ss_size=%d, ss_flags=",
1608 (unsigned long) ucp->uc_stack.ss_sp,
1609 ucp->uc_stack.ss_size);
Roland McGrathb2dee132005-06-01 19:02:36 +00001610 printflags(sigaltstack_flags, ucp->uc_stack.ss_flags, "SS_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001611 tprintf("}");
1612 }
1613 tprintf(", ...}");
1614}
1615
1616int
1617sys_getcontext(tcp)
1618struct tcb *tcp;
1619{
1620 ucontext_t uc;
1621
Wichert Akkerman16a03d22000-08-10 02:14:04 +00001622 if (exiting(tcp)) {
1623 if (tcp->u_error)
1624 tprintf("%#lx", tcp->u_arg[0]);
1625 else if (!tcp->u_arg[0])
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001626 tprintf("NULL");
1627 else if (umove(tcp, tcp->u_arg[0], &uc) < 0)
1628 tprintf("{...}");
1629 else
1630 printcontext(tcp, &uc);
1631 }
1632 return 0;
1633}
1634
1635int
1636sys_setcontext(tcp)
1637struct tcb *tcp;
1638{
1639 ucontext_t uc;
1640
1641 if (entering(tcp)) {
1642 if (!tcp->u_arg[0])
1643 tprintf("NULL");
1644 else if (umove(tcp, tcp->u_arg[0], &uc) < 0)
1645 tprintf("{...}");
1646 else
1647 printcontext(tcp, &uc);
1648 }
1649 else {
1650 tcp->u_rval = tcp->u_error = 0;
1651 if (tcp->u_arg[0] == 0)
1652 return 0;
1653 return RVAL_NONE;
1654 }
1655 return 0;
1656}
1657
1658#endif /* SVR4 */
1659
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001660#if defined(LINUX) || defined(FREEBSD)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001661
1662static int
1663print_stack_t(tcp, addr)
1664struct tcb *tcp;
1665unsigned long addr;
1666{
1667 stack_t ss;
1668 if (umove(tcp, addr, &ss) < 0)
1669 return -1;
1670 tprintf("{ss_sp=%#lx, ss_flags=", (unsigned long) ss.ss_sp);
Roland McGrathb2dee132005-06-01 19:02:36 +00001671 printflags(sigaltstack_flags, ss.ss_flags, "SS_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001672 tprintf(", ss_size=%lu}", (unsigned long) ss.ss_size);
1673 return 0;
1674}
1675
1676int
1677sys_sigaltstack(tcp)
1678 struct tcb *tcp;
1679{
1680 if (entering(tcp)) {
1681 if (tcp->u_arg[0] == 0)
1682 tprintf("NULL");
1683 else if (print_stack_t(tcp, tcp->u_arg[0]) < 0)
1684 return -1;
1685 }
1686 else {
1687 tprintf(", ");
1688 if (tcp->u_arg[1] == 0)
1689 tprintf("NULL");
1690 else if (print_stack_t(tcp, tcp->u_arg[1]) < 0)
1691 return -1;
1692 }
1693 return 0;
1694}
1695#endif
1696
1697#ifdef HAVE_SIGACTION
1698
1699int
1700sys_sigprocmask(tcp)
1701struct tcb *tcp;
1702{
1703#ifdef ALPHA
1704 if (entering(tcp)) {
1705 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
1706 tprintf(", ");
Nate Sammons4a121431999-04-06 01:19:39 +00001707 printsigmask(tcp->u_arg[1], 0);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001708 }
1709 else if (!syserror(tcp)) {
Nate Sammons4a121431999-04-06 01:19:39 +00001710 tcp->auxstr = sprintsigmask("old mask ", tcp->u_rval, 0);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001711 return RVAL_HEX | RVAL_STR;
1712 }
1713#else /* !ALPHA */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001714 if (entering(tcp)) {
1715#ifdef SVR4
1716 if (tcp->u_arg[0] == 0)
1717 tprintf("0");
1718 else
1719#endif /* SVR4 */
1720 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
1721 tprintf(", ");
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +00001722 print_sigset(tcp, tcp->u_arg[1], 0);
1723 tprintf(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001724 }
1725 else {
1726 if (!tcp->u_arg[2])
1727 tprintf("NULL");
1728 else if (syserror(tcp))
1729 tprintf("%#lx", tcp->u_arg[2]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001730 else
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +00001731 print_sigset(tcp, tcp->u_arg[2], 0);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001732 }
1733#endif /* !ALPHA */
1734 return 0;
1735}
1736
1737#endif /* HAVE_SIGACTION */
1738
1739int
1740sys_kill(tcp)
1741struct tcb *tcp;
1742{
1743 if (entering(tcp)) {
Roland McGrath4d7ed022008-05-20 01:43:09 +00001744 /*
1745 * Sign-extend a 32-bit value when that's what it is.
1746 */
1747 long pid = tcp->u_arg[0];
1748 if (personality_wordsize[current_personality] < sizeof pid)
1749 pid = (long) (int) pid;
1750 tprintf("%ld, %s", pid, signame(tcp->u_arg[1]));
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001751 }
1752 return 0;
1753}
1754
Dmitry V. Levinb9fe0112006-12-13 16:59:44 +00001755#if defined(FREEBSD) || defined(SUNOS4)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001756int
1757sys_killpg(tcp)
1758struct tcb *tcp;
1759{
1760 return sys_kill(tcp);
1761}
Dmitry V. Levinb9fe0112006-12-13 16:59:44 +00001762#endif /* FREEBSD || SUNOS4 */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001763
Roland McGrath8ffc3522003-07-09 09:47:49 +00001764#ifdef LINUX
1765int
1766sys_tgkill(tcp)
1767 struct tcb *tcp;
1768{
1769 if (entering(tcp)) {
1770 tprintf("%ld, %ld, %s",
1771 tcp->u_arg[0], tcp->u_arg[1], signame(tcp->u_arg[2]));
1772 }
1773 return 0;
1774}
1775#endif
1776
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001777int
1778sys_sigpending(tcp)
1779struct tcb *tcp;
1780{
1781 sigset_t sigset;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001782
1783 if (exiting(tcp)) {
1784 if (syserror(tcp))
1785 tprintf("%#lx", tcp->u_arg[0]);
Nate Sammons4a121431999-04-06 01:19:39 +00001786 else if (copy_sigset(tcp, tcp->u_arg[0], &sigset) < 0)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001787 tprintf("[?]");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001788 else
Wichert Akkerman46956571999-11-26 10:12:59 +00001789 printsigmask(&sigset, 0);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001790 }
1791 return 0;
1792}
1793
Dmitry V. Levinb9fe0112006-12-13 16:59:44 +00001794#ifdef SVR4
John Hughes42162082001-10-18 14:48:26 +00001795int sys_sigwait(tcp)
1796struct tcb *tcp;
1797{
1798 sigset_t sigset;
1799
1800 if (entering(tcp)) {
1801 if (copy_sigset(tcp, tcp->u_arg[0], &sigset) < 0)
1802 tprintf("[?]");
1803 else
1804 printsigmask(&sigset, 0);
1805 }
1806 else {
1807 if (!syserror(tcp)) {
1808 tcp->auxstr = signalent[tcp->u_rval];
1809 return RVAL_DECIMAL | RVAL_STR;
1810 }
1811 }
1812 return 0;
1813}
Dmitry V. Levinb9fe0112006-12-13 16:59:44 +00001814#endif /* SVR4 */
John Hughes42162082001-10-18 14:48:26 +00001815
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001816#ifdef LINUX
1817
1818 int
1819sys_rt_sigprocmask(tcp)
1820 struct tcb *tcp;
1821{
1822 sigset_t sigset;
1823
Nate Sammons4a121431999-04-06 01:19:39 +00001824 /* Note: arg[3] is the length of the sigset. */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001825 if (entering(tcp)) {
1826 printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
1827 tprintf(", ");
1828 if (!tcp->u_arg[1])
1829 tprintf("NULL, ");
Nate Sammons4a121431999-04-06 01:19:39 +00001830 else if (copy_sigset_len(tcp, tcp->u_arg[1], &sigset, tcp->u_arg[3]) < 0)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001831 tprintf("%#lx, ", tcp->u_arg[1]);
1832 else {
Nate Sammons4a121431999-04-06 01:19:39 +00001833 printsigmask(&sigset, 1);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001834 tprintf(", ");
1835 }
1836 }
1837 else {
1838 if (!tcp->u_arg[2])
1839
1840 tprintf("NULL");
1841 else if (syserror(tcp))
1842 tprintf("%#lx", tcp->u_arg[2]);
Nate Sammons4a121431999-04-06 01:19:39 +00001843 else if (copy_sigset_len(tcp, tcp->u_arg[2], &sigset, tcp->u_arg[3]) < 0)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001844 tprintf("[?]");
1845 else
Nate Sammons4a121431999-04-06 01:19:39 +00001846 printsigmask(&sigset, 1);
Nate Sammonsdab325a1999-03-29 23:33:35 +00001847 tprintf(", %lu", tcp->u_arg[3]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001848 }
1849 return 0;
1850}
1851
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001852
1853/* Structure describing the action to be taken when a signal arrives. */
1854struct new_sigaction
1855{
1856 union
1857 {
1858 __sighandler_t __sa_handler;
1859 void (*__sa_sigaction) (int, siginfo_t *, void *);
1860 }
1861 __sigaction_handler;
1862 unsigned long sa_flags;
1863 void (*sa_restorer) (void);
1864 unsigned long int sa_mask[2];
1865};
1866
1867
1868 int
1869sys_rt_sigaction(tcp)
1870 struct tcb *tcp;
1871{
1872 struct new_sigaction sa;
1873 sigset_t sigset;
1874 long addr;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001875
1876 if (entering(tcp)) {
1877 printsignal(tcp->u_arg[0]);
1878 tprintf(", ");
1879 addr = tcp->u_arg[1];
1880 } else
1881 addr = tcp->u_arg[2];
1882 if (addr == 0)
1883 tprintf("NULL");
1884 else if (!verbose(tcp))
1885 tprintf("%#lx", addr);
1886 else if (umove(tcp, addr, &sa) < 0)
1887 tprintf("{...}");
1888 else {
1889 switch ((long) sa.__sigaction_handler.__sa_handler) {
1890 case (long) SIG_ERR:
1891 tprintf("{SIG_ERR}");
1892 break;
1893 case (long) SIG_DFL:
1894 tprintf("{SIG_DFL}");
1895 break;
1896 case (long) SIG_IGN:
1897 tprintf("{SIG_IGN}");
1898 break;
1899 default:
1900 tprintf("{%#lx, ",
1901 (long) sa.__sigaction_handler.__sa_handler);
Nate Sammons4a121431999-04-06 01:19:39 +00001902 sigemptyset(&sigset);
Wichert Akkermandacfb6e1999-06-03 14:21:07 +00001903#ifdef LINUXSPARC
1904 if (tcp->u_arg[4] <= sizeof(sigset))
1905 memcpy(&sigset, &sa.sa_mask, tcp->u_arg[4]);
1906#else
Nate Sammons4a121431999-04-06 01:19:39 +00001907 if (tcp->u_arg[3] <= sizeof(sigset))
1908 memcpy(&sigset, &sa.sa_mask, tcp->u_arg[3]);
Wichert Akkermandacfb6e1999-06-03 14:21:07 +00001909#endif
Nate Sammons4a121431999-04-06 01:19:39 +00001910 else
1911 memcpy(&sigset, &sa.sa_mask, sizeof(sigset));
1912 printsigmask(&sigset, 1);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001913 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001914 printflags(sigact_flags, sa.sa_flags, "SA_???");
Roland McGrath2638cb42002-12-15 23:58:41 +00001915#ifdef SA_RESTORER
1916 if (sa.sa_flags & SA_RESTORER)
1917 tprintf(", %p", sa.sa_restorer);
1918#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001919 tprintf("}");
1920 }
1921 }
1922 if (entering(tcp))
1923 tprintf(", ");
1924 else
Wichert Akkermandacfb6e1999-06-03 14:21:07 +00001925#ifdef LINUXSPARC
1926 tprintf(", %#lx, %lu", tcp->u_arg[3], tcp->u_arg[4]);
1927#elif defined(ALPHA)
1928 tprintf(", %lu, %#lx", tcp->u_arg[3], tcp->u_arg[4]);
1929#else
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001930 tprintf(", %lu", addr = tcp->u_arg[3]);
Wichert Akkermandacfb6e1999-06-03 14:21:07 +00001931#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001932 return 0;
1933}
1934
1935 int
1936sys_rt_sigpending(tcp)
1937 struct tcb *tcp;
1938{
1939 sigset_t sigset;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001940
1941 if (exiting(tcp)) {
1942 if (syserror(tcp))
1943 tprintf("%#lx", tcp->u_arg[0]);
Nate Sammons4a121431999-04-06 01:19:39 +00001944 else if (copy_sigset_len(tcp, tcp->u_arg[0],
1945 &sigset, tcp->u_arg[1]) < 0)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001946 tprintf("[?]");
1947 else
Wichert Akkerman46956571999-11-26 10:12:59 +00001948 printsigmask(&sigset, 1);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001949 }
1950 return 0;
1951}
1952 int
1953sys_rt_sigsuspend(tcp)
1954 struct tcb *tcp;
1955{
1956 if (entering(tcp)) {
1957 sigset_t sigm;
Nate Sammons4a121431999-04-06 01:19:39 +00001958 if (copy_sigset_len(tcp, tcp->u_arg[0], &sigm, tcp->u_arg[1]) < 0)
1959 tprintf("[?]");
1960 else
1961 printsigmask(&sigm, 1);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001962 }
1963 return 0;
1964}
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001965 int
1966sys_rt_sigqueueinfo(tcp)
1967 struct tcb *tcp;
1968{
1969 if (entering(tcp)) {
1970 siginfo_t si;
1971 tprintf("%lu, ", tcp->u_arg[0]);
1972 printsignal(tcp->u_arg[1]);
1973 tprintf(", ");
1974 if (umove(tcp, tcp->u_arg[2], &si) < 0)
1975 tprintf("%#lx", tcp->u_arg[2]);
1976 else
John Hughes58265892001-10-18 15:13:53 +00001977 printsiginfo(&si, verbose (tcp));
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001978 }
1979 return 0;
1980}
1981
1982int sys_rt_sigtimedwait(tcp)
1983 struct tcb *tcp;
1984{
1985 if (entering(tcp)) {
1986 sigset_t sigset;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001987
Roland McGratha39c5a12002-12-17 05:10:37 +00001988 if (copy_sigset_len(tcp, tcp->u_arg[0],
Nate Sammons4a121431999-04-06 01:19:39 +00001989 &sigset, tcp->u_arg[3]) < 0)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001990 tprintf("[?]");
1991 else
Wichert Akkerman46956571999-11-26 10:12:59 +00001992 printsigmask(&sigset, 1);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001993 tprintf(", ");
1994 }
1995 else {
1996 if (syserror(tcp))
1997 tprintf("%#lx", tcp->u_arg[0]);
1998 else {
1999 siginfo_t si;
2000 if (umove(tcp, tcp->u_arg[1], &si) < 0)
2001 tprintf("%#lx", tcp->u_arg[1]);
2002 else
John Hughes58265892001-10-18 15:13:53 +00002003 printsiginfo(&si, verbose (tcp));
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00002004 /* XXX For now */
2005 tprintf(", %#lx", tcp->u_arg[2]);
2006 tprintf(", %d", (int) tcp->u_arg[3]);
2007 }
2008 }
2009 return 0;
2010};
2011
Roland McGrath79dcd7a2006-01-12 22:34:50 +00002012int
2013sys_restart_syscall(tcp)
2014struct tcb *tcp;
2015{
2016 if (entering(tcp))
2017 tprintf("<... resuming interrupted call ...>");
2018 return 0;
2019}
2020
Roland McGrathf46ccd32007-08-02 01:15:59 +00002021int
2022sys_signalfd(tcp)
2023struct tcb *tcp;
2024{
2025 if (entering(tcp)) {
2026 tprintf("%ld, ", tcp->u_arg[0]);
2027 print_sigset(tcp, tcp->u_arg[1], 1);
2028 tprintf("%lu", tcp->u_arg[2]);
2029 }
2030 return 0;
2031}
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00002032#endif /* LINUX */