* defs.h: Declare new function printsiginfo_at(tcp, addr).
* process.c (sys_waitid): Use printsiginfo_at().
(sys_ptrace): Likewise.
* signal.c: (printsiginfo_at): Implement this new function.
(sys_rt_sigsuspend): Use printsiginfo_at().
(sys_rt_sigtimedwait): Likewise.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
extern void sprint_timespec(char *, struct tcb *, long);
#ifdef HAVE_SIGINFO_T
extern void printsiginfo(siginfo_t *, int);
+extern void printsiginfo_at(struct tcb *tcp, long addr);
#endif
extern void printfd(struct tcb *, int);
extern void printsock(struct tcb *, long, int);
int
sys_waitid(struct tcb *tcp)
{
- siginfo_t si;
-
if (entering(tcp)) {
printxval(waitid_types, tcp->u_arg[0], "P_???");
tprintf(", %ld, ", tcp->u_arg[1]);
}
else {
/* siginfo */
- if (!tcp->u_arg[2])
- tprints("NULL");
- else if (syserror(tcp))
- tprintf("%#lx", tcp->u_arg[2]);
- else if (umove(tcp, tcp->u_arg[2], &si) < 0)
- tprints("{???}");
- else
- printsiginfo(&si, verbose(tcp));
+ printsiginfo_at(tcp, tcp->u_arg[2]);
/* options */
tprints(", ");
printflags(wait4_options, tcp->u_arg[3], "W???");
#endif
#ifdef PTRACE_SETSIGINFO
case PTRACE_SETSIGINFO: {
- siginfo_t si;
- if (!tcp->u_arg[3])
- tprints("NULL");
- else if (syserror(tcp))
- tprintf("%#lx", tcp->u_arg[3]);
- else if (umove(tcp, tcp->u_arg[3], &si) < 0)
- tprints("{???}");
- else
- printsiginfo(&si, verbose(tcp));
+ printsiginfo_at(tcp, tcp->u_arg[3]);
break;
}
#endif
#endif
#ifdef PTRACE_GETSIGINFO
case PTRACE_GETSIGINFO: {
- siginfo_t si;
- if (!tcp->u_arg[3])
- tprints("NULL");
- else if (syserror(tcp))
- tprintf("%#lx", tcp->u_arg[3]);
- else if (umove(tcp, tcp->u_arg[3], &si) < 0)
- tprints("{???}");
- else
- printsiginfo(&si, verbose(tcp));
+ printsiginfo_at(tcp, tcp->u_arg[3]);
break;
}
#endif
tprints("}");
}
+void
+printsiginfo_at(struct tcb *tcp, long addr)
+{
+ siginfo_t si;
+ if (!addr) {
+ tprints("NULL");
+ return;
+ }
+ if (syserror(tcp)) {
+ tprintf("%#lx", addr);
+ return;
+ }
+ if (umove(tcp, addr, &si) < 0) {
+ tprints("{???}");
+ return;
+ }
+ printsiginfo(&si, verbose(tcp));
+}
+
int
sys_sigsetmask(struct tcb *tcp)
{
tprintf("%#lx", addr);
goto after_sa;
}
-#if SUPPORTED_PERSONALITIES > 1
-#if SIZEOF_LONG > 4
+#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
if (current_wordsize != sizeof(sa.sa_flags) && current_wordsize == 4) {
struct new_sigaction32 sa32;
r = umove(tcp, addr, &sa32);
sa.sa_mask[0] = sa32.sa_mask[0] + ((long)(sa32.sa_mask[1]) << 32);
}
} else
-#endif
#endif
{
r = umove(tcp, addr, &sa);
static void
print_sigqueueinfo(struct tcb *tcp, int sig, unsigned long uinfo)
{
- siginfo_t si;
-
printsignal(sig);
tprints(", ");
- if (umove(tcp, uinfo, &si) < 0)
- tprintf("%#lx", uinfo);
- else
- printsiginfo(&si, verbose(tcp));
+ printsiginfo_at(tcp, uinfo);
}
int
}
else if (tcp->u_arg[1] != 0) {
/* syscall exit, and u_arg[1] wasn't NULL */
- if (syserror(tcp))
- tprintf("%#lx, ", tcp->u_arg[1]);
- else {
- siginfo_t si;
- if (umove(tcp, tcp->u_arg[1], &si) < 0)
- tprintf("%#lx, ", tcp->u_arg[1]);
- else {
- printsiginfo(&si, verbose(tcp));
- tprints(", ");
- }
- }
+ printsiginfo_at(tcp, tcp->u_arg[1]);
+ tprints(", ");
}
else {
/* syscall exit, and u_arg[1] was NULL */