Commit d4c4f4d2 authored by Shenghou Ma's avatar Shenghou Ma

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
parent a5aa91b9
......@@ -143,6 +143,6 @@ struct Sigaction {
void *sa_handler;
uint32 sa_flags;
void *sa_restorer;
uint32 sa_mask;
uint64 sa_mask;
};
#pragma pack off
......@@ -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);
......
......@@ -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
......
......@@ -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");
}
......@@ -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
......
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