1
0
mirror of https://github.com/golang/go synced 2024-11-25 13:47:57 -07:00

runtime: fix netbsd sigaction struct

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6198063
This commit is contained in:
Joel Sing 2012-05-11 03:48:16 +10:00
parent a1bf5207af
commit 38445ca089
2 changed files with 18 additions and 12 deletions

View File

@ -11,10 +11,10 @@ extern void runtime·sigtramp(void);
typedef struct sigaction {
union {
void (*__sa_handler)(int32);
void (*__sa_sigaction)(int32, Siginfo*, void *);
} __sigaction_u; /* signal handler */
uint32 sa_mask; /* signal mask to apply */
void (*_sa_handler)(int32);
void (*_sa_sigaction)(int32, Siginfo*, void *);
} _sa_u; /* signal handler */
uint32 sa_mask[4]; /* signal mask to apply */
int32 sa_flags; /* see signal options below */
} Sigaction;
@ -124,9 +124,12 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart)
sa.sa_flags |= SA_RESTART;
sa.sa_mask = ~0ULL;
sa.sa_mask[0] = ~0U;
sa.sa_mask[1] = ~0U;
sa.sa_mask[2] = ~0U;
sa.sa_mask[3] = ~0U;
if (fn == runtime·sighandler)
fn = (void*)runtime·sigtramp;
sa.__sigaction_u.__sa_sigaction = (void*)fn;
sa._sa_u._sa_sigaction = (void*)fn;
runtime·sigaction(i, &sa, nil);
}

View File

@ -11,10 +11,10 @@ extern void runtime·sigtramp(void);
typedef struct sigaction {
union {
void (*__sa_handler)(int32);
void (*__sa_sigaction)(int32, Siginfo*, void *);
} __sigaction_u; /* signal handler */
uint32 sa_mask; /* signal mask to apply */
void (*_sa_handler)(int32);
void (*_sa_sigaction)(int32, Siginfo*, void *);
} _sa_u; /* signal handler */
uint32 sa_mask[4]; /* signal mask to apply */
int32 sa_flags; /* see signal options below */
} Sigaction;
@ -133,9 +133,12 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart)
sa.sa_flags |= SA_RESTART;
sa.sa_mask = ~0ULL;
sa.sa_mask[0] = ~0U;
sa.sa_mask[1] = ~0U;
sa.sa_mask[2] = ~0U;
sa.sa_mask[3] = ~0U;
if (fn == runtime·sighandler)
fn = (void*)runtime·sigtramp;
sa.__sigaction_u.__sa_sigaction = (void*)fn;
sa._sa_u._sa_sigaction = (void*)fn;
runtime·sigaction(i, &sa, nil);
}