2008-08-19 Roland McGrath <roland@redhat.com>

* signal.c (sys_sigaction, sys_rt_sigaction): Don't omit the rest of
	the struct after sa_handler is a known constant.  Some sa_flags bits
	have meaning even for SIG_IGN/SIG_DFL.
This commit is contained in:
Roland McGrath
2008-08-20 01:59:40 +00:00
parent ab971652ac
commit 5f20681a25

View File

@ -1120,23 +1120,20 @@ struct tcb *tcp;
else if (umove(tcp, addr, &sa) < 0) else if (umove(tcp, addr, &sa) < 0)
tprintf("{...}"); tprintf("{...}");
else { else {
switch ((long) sa.SA_HANDLER) { if (sa.SA_HANDLER == SIG_ERR)
case (long) SIG_ERR: tprintf("{SIG_ERR, ");
tprintf("{SIG_ERR}"); else if (sa.SA_HANDLER == SIG_DFL)
break; tprintf("{SIG_DFL, ");
case (long) SIG_DFL: else if (sa.SA_HANDLER == SIG_DFL) {
tprintf("{SIG_DFL}");
break;
case (long) SIG_IGN:
#ifndef USE_PROCFS #ifndef USE_PROCFS
if (tcp->u_arg[0] == SIGTRAP) { if (tcp->u_arg[0] == SIGTRAP) {
tcp->flags |= TCB_SIGTRAPPED; tcp->flags |= TCB_SIGTRAPPED;
kill(tcp->pid, SIGSTOP); kill(tcp->pid, SIGSTOP);
} }
#endif /* !USE_PROCFS */ #endif /* !USE_PROCFS */
tprintf("{SIG_IGN}"); tprintf("{SIG_IGN, ");
break; }
default: else {
#ifndef USE_PROCFS #ifndef USE_PROCFS
if (tcp->u_arg[0] == SIGTRAP) { if (tcp->u_arg[0] == SIGTRAP) {
tcp->flags |= TCB_SIGTRAPPED; tcp->flags |= TCB_SIGTRAPPED;
@ -1865,7 +1862,7 @@ struct new_sigaction
}; };
int int
sys_rt_sigaction(tcp) sys_rt_sigaction(tcp)
struct tcb *tcp; struct tcb *tcp;
{ {
@ -1886,38 +1883,33 @@ sys_rt_sigaction(tcp)
else if (umove(tcp, addr, &sa) < 0) else if (umove(tcp, addr, &sa) < 0)
tprintf("{...}"); tprintf("{...}");
else { else {
switch ((long) sa.__sigaction_handler.__sa_handler) { if (sa.__sigaction_handler.__sa_handler == SIG_ERR)
case (long) SIG_ERR: tprintf("{SIG_ERR, ");
tprintf("{SIG_ERR}"); else if (sa.__sigaction_handler.__sa_handler == SIG_DFL)
break; tprintf("{SIG_DFL, ");
case (long) SIG_DFL: else if (sa.__sigaction_handler.__sa_handler == SIG_DFL)
tprintf("{SIG_DFL}"); tprintf("{SIG_IGN, ");
break; else
case (long) SIG_IGN: tprintf("{%#lx, ",
tprintf("{SIG_IGN}"); (long) sa.__sigaction_handler.__sa_handler);
break; sigemptyset(&sigset);
default:
tprintf("{%#lx, ",
(long) sa.__sigaction_handler.__sa_handler);
sigemptyset(&sigset);
#ifdef LINUXSPARC #ifdef LINUXSPARC
if (tcp->u_arg[4] <= sizeof(sigset)) if (tcp->u_arg[4] <= sizeof(sigset))
memcpy(&sigset, &sa.sa_mask, tcp->u_arg[4]); memcpy(&sigset, &sa.sa_mask, tcp->u_arg[4]);
#else #else
if (tcp->u_arg[3] <= sizeof(sigset)) if (tcp->u_arg[3] <= sizeof(sigset))
memcpy(&sigset, &sa.sa_mask, tcp->u_arg[3]); memcpy(&sigset, &sa.sa_mask, tcp->u_arg[3]);
#endif #endif
else else
memcpy(&sigset, &sa.sa_mask, sizeof(sigset)); memcpy(&sigset, &sa.sa_mask, sizeof(sigset));
printsigmask(&sigset, 1); printsigmask(&sigset, 1);
tprintf(", "); tprintf(", ");
printflags(sigact_flags, sa.sa_flags, "SA_???"); printflags(sigact_flags, sa.sa_flags, "SA_???");
#ifdef SA_RESTORER #ifdef SA_RESTORER
if (sa.sa_flags & SA_RESTORER) if (sa.sa_flags & SA_RESTORER)
tprintf(", %p", sa.sa_restorer); tprintf(", %p", sa.sa_restorer);
#endif #endif
tprintf("}"); tprintf("}");
}
} }
if (entering(tcp)) if (entering(tcp))
tprintf(", "); tprintf(", ");