* [COMMITTED PATCH] Make sysdeps/generic/internal-signals.h less stubby.
@ 2018-04-04 16:45 Zack Weinberg
2018-04-04 17:42 ` Adhemerval Zanella
0 siblings, 1 reply; 3+ messages in thread
From: Zack Weinberg @ 2018-04-04 16:45 UTC (permalink / raw)
To: libc-alpha
Three of the functions defined by internal-signals.h were not actually
fulfilling their contracts when the sysdeps/generic version of that
file was used. Also, the Linux version included several more headers
than the generic version, which is the root cause of a build failure
on Hurd (already addressed in another way, but I think it is proper to
make the headers match).
In principle, __libc_signal_block_all, __libc_signal_block_app, and
__libc_signal_restore_set could be defined in non-system-dependent
code, leaving only __is_internal_signal and __clear_internal_signal to
be defined by a sysdeps header, but the Linux version of
internal-signals.h wants to inline a raw rt_sigprocmask syscall, and I
don't feel like messing with that today.
Tested with cross build to i686-gnu, committed.
* sysdeps/generic/internal-signals.h: Include signal.h,
sigsetops.h, and stdbool.h.
(__libc_signal_block_all): Actually block all signals.
(__libc_signal_block_app): Likewise.
(__libc_signal_restore_set): Actually restore the signal mask.
---
ChangeLog | 8 ++++++++
sysdeps/generic/internal-signals.h | 15 ++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 663e80c195..43e0d6b95f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-04-04 Zack Weinberg <zackw@panix.com>
+
+ * sysdeps/generic/internal-signals.h: Include signal.h,
+ sigsetops.h, and stdbool.h.
+ (__libc_signal_block_all): Actually block all signals.
+ (__libc_signal_block_app): Likewise.
+ (__libc_signal_restore_set): Actually restore the signal mask.
+
2018-04-04 Florian Weimer <fweimer@redhat.com>
inet: Actually build and run tst-deadline.
diff --git a/sysdeps/generic/internal-signals.h b/sysdeps/generic/internal-signals.h
index 17ed48c5bf..5282cffce0 100644
--- a/sysdeps/generic/internal-signals.h
+++ b/sysdeps/generic/internal-signals.h
@@ -19,6 +19,10 @@
#ifndef __INTERNAL_SIGNALS_H
# define __INTERNAL_SIGNALS_H
+#include <signal.h>
+#include <sigsetops.h>
+#include <stdbool.h>
+
static inline bool
__is_internal_signal (int sig)
{
@@ -33,20 +37,25 @@ __clear_internal_signals (sigset_t *set)
static inline int
__libc_signal_block_all (sigset_t *set)
{
- return 0;
+ sigset_t allset;
+ __sigfillset (&allset);
+ return __sigprocmask (SIG_BLOCK, &allset, set);
}
static inline int
__libc_signal_block_app (sigset_t *set)
{
- return 0;
+ sigset_t allset;
+ __sigfillset (&allset);
+ __clear_internal_signals (&allset);
+ return __sigprocmask (SIG_BLOCK, &allset, set);
}
/* Restore current process signal mask. */
static inline int
__libc_signal_restore_set (const sigset_t *set)
{
- return 0;
+ return __sigprocmask (SIG_SETMASK, set, NULL);
}
--
2.16.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [COMMITTED PATCH] Make sysdeps/generic/internal-signals.h less stubby.
2018-04-04 16:45 [COMMITTED PATCH] Make sysdeps/generic/internal-signals.h less stubby Zack Weinberg
@ 2018-04-04 17:42 ` Adhemerval Zanella
2018-04-04 17:49 ` Zack Weinberg
0 siblings, 1 reply; 3+ messages in thread
From: Adhemerval Zanella @ 2018-04-04 17:42 UTC (permalink / raw)
To: libc-alpha
On 04/04/2018 13:45, Zack Weinberg wrote:
> Three of the functions defined by internal-signals.h were not actually
> fulfilling their contracts when the sysdeps/generic version of that
> file was used. Also, the Linux version included several more headers
> than the generic version, which is the root cause of a build failure
> on Hurd (already addressed in another way, but I think it is proper to
> make the headers match).
>
> In principle, __libc_signal_block_all, __libc_signal_block_app, and
> __libc_signal_restore_set could be defined in non-system-dependent
> code, leaving only __is_internal_signal and __clear_internal_signal to
> be defined by a sysdeps header, but the Linux version of
> internal-signals.h wants to inline a raw rt_sigprocmask syscall, and I
> don't feel like messing with that today.
Thanks for catching it. If I remember correctly, I used an inlined
rt_sigprocmask for Linux because both sigprocmask and pthread_sigmask
filter both SIGCANCEL and SIGSETXID. We could use it for
__libc_signal_block_app, but __libc_signal_block_all and
__libc_signal_restore_set would require a new symbol.
>
> Tested with cross build to i686-gnu, committed.
>
> * sysdeps/generic/internal-signals.h: Include signal.h,
> sigsetops.h, and stdbool.h.
> (__libc_signal_block_all): Actually block all signals.
> (__libc_signal_block_app): Likewise.
> (__libc_signal_restore_set): Actually restore the signal mask.
> ---
> ChangeLog | 8 ++++++++
> sysdeps/generic/internal-signals.h | 15 ++++++++++++---
> 2 files changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 663e80c195..43e0d6b95f 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,11 @@
> +2018-04-04 Zack Weinberg <zackw@panix.com>
> +
> + * sysdeps/generic/internal-signals.h: Include signal.h,
> + sigsetops.h, and stdbool.h.
> + (__libc_signal_block_all): Actually block all signals.
> + (__libc_signal_block_app): Likewise.
> + (__libc_signal_restore_set): Actually restore the signal mask.
> +
> 2018-04-04 Florian Weimer <fweimer@redhat.com>
>
> inet: Actually build and run tst-deadline.
> diff --git a/sysdeps/generic/internal-signals.h b/sysdeps/generic/internal-signals.h
> index 17ed48c5bf..5282cffce0 100644
> --- a/sysdeps/generic/internal-signals.h
> +++ b/sysdeps/generic/internal-signals.h
> @@ -19,6 +19,10 @@
> #ifndef __INTERNAL_SIGNALS_H
> # define __INTERNAL_SIGNALS_H
>
> +#include <signal.h>
> +#include <sigsetops.h>
> +#include <stdbool.h>
> +
> static inline bool
> __is_internal_signal (int sig)
> {
> @@ -33,20 +37,25 @@ __clear_internal_signals (sigset_t *set)
> static inline int
> __libc_signal_block_all (sigset_t *set)
> {
> - return 0;
> + sigset_t allset;
> + __sigfillset (&allset);
> + return __sigprocmask (SIG_BLOCK, &allset, set);
> }
>
> static inline int
> __libc_signal_block_app (sigset_t *set)
> {
> - return 0;
> + sigset_t allset;
> + __sigfillset (&allset);
> + __clear_internal_signals (&allset);
> + return __sigprocmask (SIG_BLOCK, &allset, set);
> }
>
> /* Restore current process signal mask. */
> static inline int
> __libc_signal_restore_set (const sigset_t *set)
> {
> - return 0;
> + return __sigprocmask (SIG_SETMASK, set, NULL);
> }
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [COMMITTED PATCH] Make sysdeps/generic/internal-signals.h less stubby.
2018-04-04 17:42 ` Adhemerval Zanella
@ 2018-04-04 17:49 ` Zack Weinberg
0 siblings, 0 replies; 3+ messages in thread
From: Zack Weinberg @ 2018-04-04 17:49 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: GNU C Library
On Wed, Apr 4, 2018 at 1:42 PM, Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
> On 04/04/2018 13:45, Zack Weinberg wrote:
>> Three of the functions defined by internal-signals.h were not actually
>> fulfilling their contracts when the sysdeps/generic version of that
>> file was used. Also, the Linux version included several more headers
>> than the generic version, which is the root cause of a build failure
>> on Hurd (already addressed in another way, but I think it is proper to
>> make the headers match).
>>
>> In principle, __libc_signal_block_all, __libc_signal_block_app, and
>> __libc_signal_restore_set could be defined in non-system-dependent
>> code, leaving only __is_internal_signal and __clear_internal_signal to
>> be defined by a sysdeps header, but the Linux version of
>> internal-signals.h wants to inline a raw rt_sigprocmask syscall, and I
>> don't feel like messing with that today.
>
> Thanks for catching it. If I remember correctly, I used an inlined
> rt_sigprocmask for Linux because both sigprocmask and pthread_sigmask
> filter both SIGCANCEL and SIGSETXID. We could use it for
> __libc_signal_block_app, but __libc_signal_block_all and
> __libc_signal_restore_set would require a new symbol.
Yeah, that's what I thought was going on. I think it's fine the way
it is at least for now.
zw
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-04 17:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04 16:45 [COMMITTED PATCH] Make sysdeps/generic/internal-signals.h less stubby Zack Weinberg
2018-04-04 17:42 ` Adhemerval Zanella
2018-04-04 17:49 ` Zack Weinberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).