From: Russ Cox Date: Wed, 29 Sep 2010 00:50:00 +0000 (-0400) Subject: runtime: fix build X-Git-Tag: weekly.2010-09-29~20 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=81041369b29b5f8910b559819512c57d3d86e034;p=gostls13.git runtime: fix build On systems where the mmap succeeds (e.g., sysctl -w vm.mmap_min_addr=0) it changes the signal code delivered for a nil fault from ``page not mapped'' to ``invalid permissions for page.'' TBR=r CC=golang-dev https://golang.org/cl/2294041 --- diff --git a/src/pkg/runtime/darwin/thread.c b/src/pkg/runtime/darwin/thread.c index 6f64c08738..f4dd180122 100644 --- a/src/pkg/runtime/darwin/thread.c +++ b/src/pkg/runtime/darwin/thread.c @@ -456,7 +456,7 @@ sigpanic(void) printf("unexpected fault address %p\n", g->sigcode1); throw("fault"); case SIGSEGV: - if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000) + if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode0 == SEGV_ACCERR) && g->sigcode1 < 0x1000) panicstring("invalid memory address or nil pointer dereference"); printf("unexpected fault address %p\n", g->sigcode1); throw("fault"); diff --git a/src/pkg/runtime/freebsd/thread.c b/src/pkg/runtime/freebsd/thread.c index c9c058c5ae..27f8aa5ff5 100644 --- a/src/pkg/runtime/freebsd/thread.c +++ b/src/pkg/runtime/freebsd/thread.c @@ -182,7 +182,7 @@ sigpanic(void) printf("unexpected fault address %p\n", g->sigcode1); throw("fault"); case SIGSEGV: - if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000) + if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode0 == SEGV_ACCERR) && g->sigcode1 < 0x1000) panicstring("invalid memory address or nil pointer dereference"); printf("unexpected fault address %p\n", g->sigcode1); throw("fault"); diff --git a/src/pkg/runtime/linux/thread.c b/src/pkg/runtime/linux/thread.c index 47bf3428f7..f31838ea50 100644 --- a/src/pkg/runtime/linux/thread.c +++ b/src/pkg/runtime/linux/thread.c @@ -168,7 +168,7 @@ unlock(Lock *l) } void -destroylock(Lock *l) +destroylock(Lock*) { } @@ -282,7 +282,7 @@ sigpanic(void) printf("unexpected fault address %p\n", g->sigcode1); throw("fault"); case SIGSEGV: - if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000) + if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode0 == SEGV_ACCERR) && g->sigcode1 < 0x1000) panicstring("invalid memory address or nil pointer dereference"); printf("unexpected fault address %p\n", g->sigcode1); throw("fault");