diff options
author | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-12-03 14:04:03 +0000 |
---|---|---|
committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-12-03 14:04:03 +0000 |
commit | d5c32667ad11ff38dc46be527266297b38a341d1 (patch) | |
tree | b3ce68f179d97e6e25e5c8e7ace845c4a561322b /libc/signal/sigaction.c | |
parent | 329ef3196b396a70eecd5a4789845d368b488ab7 (diff) | |
download | uClibc-alpine-d5c32667ad11ff38dc46be527266297b38a341d1.tar.bz2 uClibc-alpine-d5c32667ad11ff38dc46be527266297b38a341d1.tar.xz |
Synch with trunk @ 24242
Step 18: some more synch: hidden_proto, size reduction
and signal handling changes.
Diffstat (limited to 'libc/signal/sigaction.c')
-rw-r--r-- | libc/signal/sigaction.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/libc/signal/sigaction.c b/libc/signal/sigaction.c index 221951eeb..f430070e6 100644 --- a/libc/signal/sigaction.c +++ b/libc/signal/sigaction.c @@ -43,25 +43,32 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { int result; struct kernel_sigaction kact, koact; + enum { + /* We try hard to actually have them equal, + * but just for paranoid reasons, be safe */ + SIGSET_MIN_SIZE = sizeof(kact.sa_mask) < sizeof(act->sa_mask) + ? sizeof(kact.sa_mask) : sizeof(act->sa_mask) + }; if (act) { kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); + memcpy (&kact.sa_mask, &act->sa_mask, SIGSET_MIN_SIZE); kact.sa_flags = act->sa_flags; # ifdef HAVE_SA_RESTORER kact.sa_restorer = act->sa_restorer; # endif } - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ + /* NB: kernel (as of 2.6.25) will return EINVAL + * if sizeof(kact.sa_mask) does not match kernel's sizeof(sigset_t) */ result = __syscall_rt_sigaction(sig, - act ? __ptrvalue (&kact) : NULL, - oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); + act ? __ptrvalue (&kact) : NULL, + oact ? __ptrvalue (&koact) : NULL, + sizeof(kact.sa_mask)); if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); + memcpy (&oact->sa_mask, &koact.sa_mask, SIGSET_MIN_SIZE); oact->sa_flags = koact.sa_flags; # ifdef HAVE_SA_RESTORER oact->sa_restorer = koact.sa_restorer; |