From c7f7bbbf03415e1805e503846627f2e08423c360 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 15 Feb 2013 12:18:33 -0500 Subject: runtime: fix build on linux In addition to the compile failure fixed in signal*.c, preserving the signal mask led to very strange crashes. Testing shows that looking for SIG_IGN is all that matters to get along with nohup, so reintroduce sigset_zero instead of trying to preserve the signal mask. TBR=iant CC=golang-dev https://golang.org/cl/7323067 --- src/pkg/runtime/thread_linux.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/pkg/runtime/thread_linux.c') diff --git a/src/pkg/runtime/thread_linux.c b/src/pkg/runtime/thread_linux.c index 604b98e57f..1a7eb7240c 100644 --- a/src/pkg/runtime/thread_linux.c +++ b/src/pkg/runtime/thread_linux.c @@ -13,6 +13,7 @@ int32 runtime·open(uint8*, int32, int32); int32 runtime·close(int32); int32 runtime·read(int32, void*, int32); +static Sigset sigset_none; static Sigset sigset_all = { ~(uint32)0, ~(uint32)0 }; // Linux futex. @@ -148,8 +149,6 @@ runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void)) // Disable signals during clone, so that the new thread starts // with signals disabled. It will enable them in minit. runtime·rtsigprocmask(SIG_SETMASK, &sigset_all, &oset, sizeof oset); - mp->sigset = runtime·mal(sizeof(Sigset)); - *(Sigset*)mp->sigset = oset; ret = runtime·clone(flags, stk, mp, gp, fn); runtime·rtsigprocmask(SIG_SETMASK, &oset, nil, sizeof oset); @@ -178,8 +177,7 @@ runtime·minit(void) // Initialize signal handling. m->gsignal = runtime·malg(32*1024); // OS X wants >=8K, Linux >=2K runtime·signalstack((byte*)m->gsignal->stackguard - StackGuard, 32*1024); - if(m->sigset != nil) - runtime·rtsigprocmask(SIG_SETMASK, m->sigset, nil, sizeof *m->sigset); + runtime·rtsigprocmask(SIG_SETMASK, &sigset_none, nil, sizeof(Sigset)); } void -- cgit v1.3