diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2015-11-01 11:55:35 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2015-11-01 11:55:35 +0100 |
commit | 3c237122a91c0a782183c63e9c277ab97837b9cf (patch) | |
tree | 8d48ea190a778eaedaa182b7a58abae43a157345 /sysdeps | |
parent | 0cb5361e21196dcc2bd8a1763af5c6f0cf82ca5f (diff) | |
parent | c7c777b3d43d490c2012f6b8e6a61c455479fbbc (diff) |
Merge branch 'master-glibc' into master-glibc-2.21
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/generic/killpg.c | 27 | ||||
-rw-r--r-- | sysdeps/generic/raise.c | 12 | ||||
-rw-r--r-- | sysdeps/generic/sigaddset.c | 35 | ||||
-rw-r--r-- | sysdeps/generic/sigdelset.c | 35 | ||||
-rw-r--r-- | sysdeps/generic/sigemptyset.c | 29 | ||||
-rw-r--r-- | sysdeps/generic/sigfillset.c | 29 | ||||
-rw-r--r-- | sysdeps/generic/siginterrupt.c | 36 | ||||
-rw-r--r-- | sysdeps/generic/sigismember.c | 36 | ||||
-rw-r--r-- | sysdeps/generic/signal.c | 44 | ||||
-rw-r--r-- | sysdeps/generic/sigwait.c | 34 | ||||
-rw-r--r-- | sysdeps/mach/hurd/pt-sigstate.c | 12 | ||||
-rw-r--r-- | sysdeps/mach/i386/bits/spin-lock-inline.h (renamed from sysdeps/i386/bits/spin-lock-inline.h) | 0 | ||||
-rw-r--r-- | sysdeps/mach/i386/bits/spin-lock.h (renamed from sysdeps/i386/bits/spin-lock.h) | 0 |
13 files changed, 18 insertions, 311 deletions
diff --git a/sysdeps/generic/killpg.c b/sysdeps/generic/killpg.c deleted file mode 100644 index 7f7ed87..0000000 --- a/sysdeps/generic/killpg.c +++ /dev/null @@ -1,27 +0,0 @@ -/* killpg.c - Generic killpg implementation. - Copyright (C) 2008 Free Software Foundation, Inc. - Written by Neal H. Walfield <neal@gnu.org>. - - This file is part of the GNU Hurd. - - The GNU Hurd is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - as published by the Free Software Foundation; either version 3 of - the License, or (at your option) any later version. - - The GNU Hurd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/>. */ - -#include "sig-internal.h" - -int -killpg (pid_t pid, int sig) -{ - return kill (-pid, sig); -} diff --git a/sysdeps/generic/raise.c b/sysdeps/generic/raise.c index 410f557..15348ce 100644 --- a/sysdeps/generic/raise.c +++ b/sysdeps/generic/raise.c @@ -18,8 +18,10 @@ License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "sig-internal.h" +#include <pthread.h> +#pragma weak pthread_kill +#pragma weak pthread_self int raise (int signo) { @@ -27,9 +29,11 @@ raise (int signo) "the effect of the raise() function shall be equivalent to calling: pthread_kill(pthread_self(), sig);" */ -debug (0, ""); - int err = pthread_kill (pthread_self (), signo); -debug (0, ""); + int err; + if (pthread_kill) + err = pthread_kill (pthread_self (), signo); + else + err = __kill (__getpid (), signo); if (err) { errno = err; diff --git a/sysdeps/generic/sigaddset.c b/sysdeps/generic/sigaddset.c deleted file mode 100644 index 14edb71..0000000 --- a/sysdeps/generic/sigaddset.c +++ /dev/null @@ -1,35 +0,0 @@ -/* sigaddset.c - Generic sigaddset implementation. - Copyright (C) 2008 Free Software Foundation, Inc. - Written by Neal H. Walfield <neal@gnu.org>. - - This file is part of the GNU Hurd. - - The GNU Hurd is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - as published by the Free Software Foundation; either version 3 of - the License, or (at your option) any later version. - - The GNU Hurd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/>. */ - -#include "sig-internal.h" - -int -sigaddset (sigset_t *sigset, int signo) -{ - if (signo <= 0 || signo >= NSIG) - { - errno = EINVAL; - return -1; - } - - *sigset |= sigmask (signo); - return 0; -} - diff --git a/sysdeps/generic/sigdelset.c b/sysdeps/generic/sigdelset.c deleted file mode 100644 index 5456467..0000000 --- a/sysdeps/generic/sigdelset.c +++ /dev/null @@ -1,35 +0,0 @@ -/* sigdelset.c - Generic sigdelset implementation. - Copyright (C) 2008 Free Software Foundation, Inc. - Written by Neal H. Walfield <neal@gnu.org>. - - This file is part of the GNU Hurd. - - The GNU Hurd is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - as published by the Free Software Foundation; either version 3 of - the License, or (at your option) any later version. - - The GNU Hurd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/>. */ - -#include "sig-internal.h" - -int -sigdelset (sigset_t *sigset, int signo) -{ - if (signo <= 0 || signo >= NSIG) - { - errno = EINVAL; - return -1; - } - - *sigset &= ~sigmask (signo); - return 0; -} - diff --git a/sysdeps/generic/sigemptyset.c b/sysdeps/generic/sigemptyset.c deleted file mode 100644 index 690c15b..0000000 --- a/sysdeps/generic/sigemptyset.c +++ /dev/null @@ -1,29 +0,0 @@ -/* sigemptyset.c - Generic sigemptyset implementation. - Copyright (C) 2008 Free Software Foundation, Inc. - Written by Neal H. Walfield <neal@gnu.org>. - - This file is part of the GNU Hurd. - - The GNU Hurd is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - as published by the Free Software Foundation; either version 3 of - the License, or (at your option) any later version. - - The GNU Hurd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/>. */ - -#include <signal.h> - -int -sigemptyset (sigset_t *sigset) -{ - *sigset = 0; - return 0; -} - diff --git a/sysdeps/generic/sigfillset.c b/sysdeps/generic/sigfillset.c deleted file mode 100644 index f0ac078..0000000 --- a/sysdeps/generic/sigfillset.c +++ /dev/null @@ -1,29 +0,0 @@ -/* sigfillset.c - Generic sigfillset implementation. - Copyright (C) 2008 Free Software Foundation, Inc. - Written by Neal H. Walfield <neal@gnu.org>. - - This file is part of the GNU Hurd. - - The GNU Hurd is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - as published by the Free Software Foundation; either version 3 of - the License, or (at your option) any later version. - - The GNU Hurd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/>. */ - -#include <signal.h> - -int -sigfillset (sigset_t *sigset) -{ - *sigset = (1ULL << (NSIG - 1)) - 1; - return 0; -} - diff --git a/sysdeps/generic/siginterrupt.c b/sysdeps/generic/siginterrupt.c deleted file mode 100644 index 0899efb..0000000 --- a/sysdeps/generic/siginterrupt.c +++ /dev/null @@ -1,36 +0,0 @@ -/* siginterrupt.c - Generic siginterrupt implementation. - Copyright (C) 2008 Free Software Foundation, Inc. - Written by Neal H. Walfield <neal@gnu.org>. - - This file is part of the GNU Hurd. - - The GNU Hurd is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - as published by the Free Software Foundation; either version 3 of - the License, or (at your option) any later version. - - The GNU Hurd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/>. */ - -#include "sig-internal.h" - -int -siginterrupt (int sig, int flag) -{ - int ret; - struct sigaction act; - - sigaction (sig, NULL, &act); - if (flag) - act.sa_flags &= ~SA_RESTART; - else - act.sa_flags |= SA_RESTART; - ret = sigaction(sig, &act, NULL); - return ret; -} diff --git a/sysdeps/generic/sigismember.c b/sysdeps/generic/sigismember.c deleted file mode 100644 index b3d65c9..0000000 --- a/sysdeps/generic/sigismember.c +++ /dev/null @@ -1,36 +0,0 @@ -/* sigismember.c - Generic sigismember implementation. - Copyright (C) 2008 Free Software Foundation, Inc. - Written by Neal H. Walfield <neal@gnu.org>. - - This file is part of the GNU Hurd. - - The GNU Hurd is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - as published by the Free Software Foundation; either version 3 of - the License, or (at your option) any later version. - - The GNU Hurd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/>. */ - -#include "sig-internal.h" - -int -sigismember (const sigset_t *sigset, int signo) -{ - if (signo <= 0 || signo >= NSIG) - { - errno = EINVAL; - return -1; - } - - if (*sigset & sigmask (signo)) - return 1; - else - return 0; -} diff --git a/sysdeps/generic/signal.c b/sysdeps/generic/signal.c deleted file mode 100644 index 7555d0a..0000000 --- a/sysdeps/generic/signal.c +++ /dev/null @@ -1,44 +0,0 @@ -/* signal.c - Generic signal implementation. - Copyright (C) 2008 Free Software Foundation, Inc. - Written by Neal H. Walfield <neal@gnu.org>. - - This file is part of the GNU Hurd. - - The GNU Hurd is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - as published by the Free Software Foundation; either version 3 of - the License, or (at your option) any later version. - - The GNU Hurd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/>. */ - -#include "sig-internal.h" - -void (*signal (int sig, void (*handler)(int)))(int) -{ - struct sigaction sa; - - sa.sa_handler = handler; - sa.sa_flags = SA_RESTART; - - if (sigemptyset (&sa.sa_mask) < 0 - || sigaddset (&sa.sa_mask, sig) < 0) - return SIG_ERR; - - struct sigaction osa; - if (sigaction (sig, &sa, &osa) < 0) - return SIG_ERR; - - return osa.sa_handler; -} - -void (*bsd_signal (int sig, void (*func)(int)))(int) -{ - return signal (sig, func); -} diff --git a/sysdeps/generic/sigwait.c b/sysdeps/generic/sigwait.c deleted file mode 100644 index 7d10bf8..0000000 --- a/sysdeps/generic/sigwait.c +++ /dev/null @@ -1,34 +0,0 @@ -/* sigwait.c - Generic sigwait implementation. - Copyright (C) 2008 Free Software Foundation, Inc. - Written by Neal H. Walfield <neal@gnu.org>. - - This file is part of the GNU Hurd. - - The GNU Hurd is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - as published by the Free Software Foundation; either version 3 of - the License, or (at your option) any later version. - - The GNU Hurd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/>. */ - -#include "sig-internal.h" - -int -sigwait (const sigset_t *restrict set, int *restrict signo) -{ - siginfo_t info; - - if (sigwaitinfo (set, &info) < 0) - return -1; - - *signo = info.si_signo; - return 0; -} - diff --git a/sysdeps/mach/hurd/pt-sigstate.c b/sysdeps/mach/hurd/pt-sigstate.c index 68c79c5..2af3e39 100644 --- a/sysdeps/mach/hurd/pt-sigstate.c +++ b/sysdeps/mach/hurd/pt-sigstate.c @@ -21,6 +21,7 @@ #include <assert.h> #include <signal.h> #include <hurd/signal.h> +#include <hurd/msg.h> #include <pt-internal.h> @@ -31,11 +32,12 @@ __pthread_sigstate (struct __pthread *thread, int how, { error_t err = 0; struct hurd_sigstate *ss; + sigset_t pending; ss = _hurd_thread_sigstate (thread->kernel_thread); assert (ss); - __pthread_spin_lock (&ss->lock); + _hurd_sigstate_lock (ss); if (oset) *oset = ss->blocked; @@ -63,7 +65,13 @@ __pthread_sigstate (struct __pthread *thread, int how, if (! err && clear_pending) __sigemptyset (&ss->pending); - __pthread_spin_unlock (&ss->lock); + pending = _hurd_sigstate_pending (ss) & ~ss->blocked; + _hurd_sigstate_unlock (ss); + + if (! err && pending) + /* Send a message to the signal thread so it + will wake up and check for pending signals. */ + __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ()); return err; } diff --git a/sysdeps/i386/bits/spin-lock-inline.h b/sysdeps/mach/i386/bits/spin-lock-inline.h index e5ed3de..e5ed3de 100644 --- a/sysdeps/i386/bits/spin-lock-inline.h +++ b/sysdeps/mach/i386/bits/spin-lock-inline.h diff --git a/sysdeps/i386/bits/spin-lock.h b/sysdeps/mach/i386/bits/spin-lock.h index 5ae81e1..5ae81e1 100644 --- a/sysdeps/i386/bits/spin-lock.h +++ b/sysdeps/mach/i386/bits/spin-lock.h |