Commit 556dd0bf authored by Joel Sing's avatar Joel Sing

runtime: fix sigaction struct on freebsd

Fix the sa_mask member of the sigaction struct - on FreeBSD this is
declared as a sigset_t, which is an array of four unsigned ints.
Replace the current int64 with Sigset from defs_freebsd_GOARCH, which
has the correct definition.

Unbreaks the FreeBSD builds.

R=golang-dev, dave, minux.ma
CC=golang-dev
https://golang.org/cl/7333047
parent 23093f86
...@@ -15,7 +15,7 @@ typedef struct sigaction { ...@@ -15,7 +15,7 @@ typedef struct sigaction {
void (*__sa_sigaction)(int32, Siginfo*, void *); void (*__sa_sigaction)(int32, Siginfo*, void *);
} __sigaction_u; /* signal handler */ } __sigaction_u; /* signal handler */
int32 sa_flags; /* see signal options below */ int32 sa_flags; /* see signal options below */
int64 sa_mask; /* signal mask to apply */ Sigset sa_mask; /* signal mask to apply */
} Sigaction; } Sigaction;
void void
...@@ -141,7 +141,10 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart) ...@@ -141,7 +141,10 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
sa.sa_flags = SA_SIGINFO|SA_ONSTACK; sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart) if(restart)
sa.sa_flags |= SA_RESTART; sa.sa_flags |= SA_RESTART;
sa.sa_mask = ~0ULL; sa.sa_mask.__bits[0] = ~(uint32)0;
sa.sa_mask.__bits[1] = ~(uint32)0;
sa.sa_mask.__bits[2] = ~(uint32)0;
sa.sa_mask.__bits[3] = ~(uint32)0;
if (fn == runtime·sighandler) if (fn == runtime·sighandler)
fn = (void*)runtime·sigtramp; fn = (void*)runtime·sigtramp;
sa.__sigaction_u.__sa_sigaction = (void*)fn; sa.__sigaction_u.__sa_sigaction = (void*)fn;
......
...@@ -15,7 +15,7 @@ typedef struct sigaction { ...@@ -15,7 +15,7 @@ typedef struct sigaction {
void (*__sa_sigaction)(int32, Siginfo*, void *); void (*__sa_sigaction)(int32, Siginfo*, void *);
} __sigaction_u; /* signal handler */ } __sigaction_u; /* signal handler */
int32 sa_flags; /* see signal options below */ int32 sa_flags; /* see signal options below */
int64 sa_mask; /* signal mask to apply */ Sigset sa_mask; /* signal mask to apply */
} Sigaction; } Sigaction;
void void
...@@ -149,7 +149,10 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart) ...@@ -149,7 +149,10 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
sa.sa_flags = SA_SIGINFO|SA_ONSTACK; sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart) if(restart)
sa.sa_flags |= SA_RESTART; sa.sa_flags |= SA_RESTART;
sa.sa_mask = ~0ULL; sa.sa_mask.__bits[0] = ~(uint32)0;
sa.sa_mask.__bits[1] = ~(uint32)0;
sa.sa_mask.__bits[2] = ~(uint32)0;
sa.sa_mask.__bits[3] = ~(uint32)0;
if (fn == runtime·sighandler) if (fn == runtime·sighandler)
fn = (void*)runtime·sigtramp; fn = (void*)runtime·sigtramp;
sa.__sigaction_u.__sa_sigaction = (void*)fn; sa.__sigaction_u.__sa_sigaction = (void*)fn;
......
...@@ -55,7 +55,7 @@ typedef struct sigaction { ...@@ -55,7 +55,7 @@ typedef struct sigaction {
void (*__sa_sigaction)(int32, Siginfo*, void *); void (*__sa_sigaction)(int32, Siginfo*, void *);
} __sigaction_u; /* signal handler */ } __sigaction_u; /* signal handler */
int32 sa_flags; /* see signal options below */ int32 sa_flags; /* see signal options below */
int64 sa_mask; /* signal mask to apply */ Sigset sa_mask; /* signal mask to apply */
} Sigaction; } Sigaction;
void void
...@@ -164,7 +164,10 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart) ...@@ -164,7 +164,10 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
sa.sa_flags = SA_SIGINFO|SA_ONSTACK; sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart) if(restart)
sa.sa_flags |= SA_RESTART; sa.sa_flags |= SA_RESTART;
sa.sa_mask = ~0ULL; sa.sa_mask.__bits[0] = ~(uint32)0;
sa.sa_mask.__bits[1] = ~(uint32)0;
sa.sa_mask.__bits[2] = ~(uint32)0;
sa.sa_mask.__bits[3] = ~(uint32)0;
if (fn == runtime·sighandler) if (fn == runtime·sighandler)
fn = (void*)runtime·sigtramp; fn = (void*)runtime·sigtramp;
sa.__sigaction_u.__sa_sigaction = (void*)fn; sa.__sigaction_u.__sa_sigaction = (void*)fn;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment