diff mbox

Use SIG_BLOCK instead of numeric constant

Message ID 20181216200436.23E9551D3C@mx12.valuehost.ru
State New
Headers show

Commit Message

info@mobile-stream.com Dec. 16, 2018, 7:39 p.m. UTC
gdb on mipsel-alpine-linux-musl* (at least) fails to start without
this change because SIG_BLOCK is 1 not 0 on linux/mips (unlike most
other architectures).

---
 gdb/common/signals-state-save-restore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Marchi Dec. 18, 2018, 8:26 p.m. UTC | #1
On 2018-12-16 14:39, info@mobile-stream.com wrote:
> gdb on mipsel-alpine-linux-musl* (at least) fails to start without
> this change because SIG_BLOCK is 1 not 0 on linux/mips (unlike most
> other architectures).
> 
> ---
>  gdb/common/signals-state-save-restore.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/common/signals-state-save-restore.c
> b/gdb/common/signals-state-save-restore.c
> index 5bb66321bb..6597decbc6 100644
> --- a/gdb/common/signals-state-save-restore.c
> +++ b/gdb/common/signals-state-save-restore.c
> @@ -41,7 +41,7 @@ save_original_signals_state (bool quiet)
>    int i;
>    int res;
> 
> -  res = sigprocmask (0,  NULL, &original_signal_mask);
> +  res = sigprocmask (SIG_BLOCK,  NULL, &original_signal_mask);
>    if (res == -1)
>      perror_with_name (("sigprocmask"));

There was a discussion about this last year:

   https://sourceware.org/ml/gdb-patches/2017-03/threads.html#00426

A bug was filed against the POSIX standard here:

   http://austingroupbugs.net/view.php?id=1132#c4124

... and the way it was clarified goes with GDB's interpretation.  So I 
guess musl's implementation will have to change to match.

Simon
Rich Felker Dec. 19, 2018, 1:11 a.m. UTC | #2
On Tue, Dec 18, 2018 at 03:26:04PM -0500, Simon Marchi wrote:
> On 2018-12-16 14:39, info@mobile-stream.com wrote:
> >gdb on mipsel-alpine-linux-musl* (at least) fails to start without
> >this change because SIG_BLOCK is 1 not 0 on linux/mips (unlike most
> >other architectures).
> >
> >---
> > gdb/common/signals-state-save-restore.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/gdb/common/signals-state-save-restore.c
> >b/gdb/common/signals-state-save-restore.c
> >index 5bb66321bb..6597decbc6 100644
> >--- a/gdb/common/signals-state-save-restore.c
> >+++ b/gdb/common/signals-state-save-restore.c
> >@@ -41,7 +41,7 @@ save_original_signals_state (bool quiet)
> >   int i;
> >   int res;
> >
> >-  res = sigprocmask (0,  NULL, &original_signal_mask);
> >+  res = sigprocmask (SIG_BLOCK,  NULL, &original_signal_mask);
> >   if (res == -1)
> >     perror_with_name (("sigprocmask"));
> 
> There was a discussion about this last year:
> 
>   https://sourceware.org/ml/gdb-patches/2017-03/threads.html#00426
> 
> A bug was filed against the POSIX standard here:
> 
>   http://austingroupbugs.net/view.php?id=1132#c4124
> 
> .... and the way it was clarified goes with GDB's interpretation.
> So I guess musl's implementation will have to change to match.

Thank you for the CC. I'm fixing it now to conform with the resolution
of #1132.

Rich
diff mbox

Patch

diff --git a/gdb/common/signals-state-save-restore.c b/gdb/common/signals-state-save-restore.c
index 5bb66321bb..6597decbc6 100644
--- a/gdb/common/signals-state-save-restore.c
+++ b/gdb/common/signals-state-save-restore.c
@@ -41,7 +41,7 @@  save_original_signals_state (bool quiet)
   int i;
   int res;
 
-  res = sigprocmask (0,  NULL, &original_signal_mask);
+  res = sigprocmask (SIG_BLOCK,  NULL, &original_signal_mask);
   if (res == -1)
     perror_with_name (("sigprocmask"));