1
0
mirror of https://github.com/golang/go synced 2024-11-19 17:54:48 -07:00

runtime: fix struct Sigaction for Linux/ARM

if we were to use sizeof(sa.sa_mask) instead of 8 as the last argument
        to rt_sigaction, we would have already fixed this bug, so also updated
        Linux/386 and Linux/amd64 files to use that; also test the return value
        of rt_sigaction.

R=dave, rsc
CC=golang-dev
https://golang.org/cl/6297087
This commit is contained in:
Shenghou Ma 2012-06-20 01:17:03 +08:00
parent a5aa91b9a2
commit d4c4f4d2c4
5 changed files with 8 additions and 5 deletions

View File

@ -143,6 +143,6 @@ struct Sigaction {
void *sa_handler;
uint32 sa_flags;
void *sa_restorer;
uint32 sa_mask;
uint64 sa_mask;
};
#pragma pack off

View File

@ -10,7 +10,7 @@ int32 runtime·futex(uint32*, int32, uint32, Timespec*, uint32*, uint32);
int32 runtime·clone(int32, void*, M*, G*, void(*)(void));
struct Sigaction;
void runtime·rt_sigaction(uintptr, struct Sigaction*, void*, uintptr);
int32 runtime·rt_sigaction(uintptr, struct Sigaction*, void*, uintptr);
void runtime·setsig(int32, void(*)(int32, Siginfo*, void*, G*), bool);
void runtime·sighandler(int32 sig, Siginfo *info, void *context, G *gp);

View File

@ -129,7 +129,8 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
if(fn == runtime·sighandler)
fn = (void*)runtime·sigtramp;
sa.k_sa_handler = fn;
runtime·rt_sigaction(i, &sa, nil, 8);
if(runtime·rt_sigaction(i, &sa, nil, sizeof(sa.sa_mask)) != 0)
runtime·throw("rt_sigaction failure");
}
#define AT_NULL 0

View File

@ -139,5 +139,6 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
if(fn == runtime·sighandler)
fn = (void*)runtime·sigtramp;
sa.sa_handler = fn;
runtime·rt_sigaction(i, &sa, nil, 8);
if(runtime·rt_sigaction(i, &sa, nil, sizeof(sa.sa_mask)) != 0)
runtime·throw("rt_sigaction failure");
}

View File

@ -139,7 +139,8 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
if(fn == runtime·sighandler)
fn = (void*)runtime·sigtramp;
sa.sa_handler = fn;
runtime·rt_sigaction(i, &sa, nil, 8);
if(runtime·rt_sigaction(i, &sa, nil, sizeof(sa.sa_mask)) != 0)
runtime·throw("rt_sigaction failure");
}
#define AT_NULL 0