diff options
author | Michael Stapelberg <stapelberg@debian.org> | 2014-06-19 09:22:53 +0200 |
---|---|---|
committer | Michael Stapelberg <stapelberg@debian.org> | 2014-06-19 09:22:53 +0200 |
commit | 8a39ee361feb9bf46d728ff1ba4f07ca1d9610b1 (patch) | |
tree | 4449f2036cccf162e8417cc5841a35815b3e7ac5 /src/pkg/runtime/os_darwin.c | |
parent | c8bf49ef8a92e2337b69c14b9b88396efe498600 (diff) | |
download | golang-upstream/1.3.tar.gz |
Imported Upstream version 1.3upstream/1.3
Diffstat (limited to 'src/pkg/runtime/os_darwin.c')
-rw-r--r-- | src/pkg/runtime/os_darwin.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/pkg/runtime/os_darwin.c b/src/pkg/runtime/os_darwin.c index 9eb1b4626..33a2df958 100644 --- a/src/pkg/runtime/os_darwin.c +++ b/src/pkg/runtime/os_darwin.c @@ -59,6 +59,7 @@ runtime·osinit(void) void runtime·get_random_data(byte **rnd, int32 *rnd_len) { + #pragma dataflag NOPTR static byte urandom_data[HashRandomBytes]; int32 fd; fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0); @@ -434,9 +435,12 @@ runtime·mach_semrelease(uint32 sem) void runtime·sigpanic(void) { + if(!runtime·canpanic(g)) + runtime·throw("unexpected signal during runtime execution"); + switch(g->sig) { case SIGBUS: - if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000) { + if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000 || g->paniconfault) { if(g->sigpc == 0) runtime·panicstring("call of nil func value"); runtime·panicstring("invalid memory address or nil pointer dereference"); @@ -444,7 +448,7 @@ runtime·sigpanic(void) runtime·printf("unexpected fault address %p\n", g->sigcode1); runtime·throw("fault"); case SIGSEGV: - if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode0 == SEGV_ACCERR) && g->sigcode1 < 0x1000) { + if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode0 == SEGV_ACCERR) && g->sigcode1 < 0x1000 || g->paniconfault) { if(g->sigpc == 0) runtime·panicstring("call of nil func value"); runtime·panicstring("invalid memory address or nil pointer dereference"); @@ -517,3 +521,9 @@ runtime·signalstack(byte *p, int32 n) st.ss_flags = SS_DISABLE; runtime·sigaltstack(&st, nil); } + +void +runtime·unblocksignals(void) +{ + runtime·sigprocmask(SIG_SETMASK, &sigset_none, nil); +} |