Skip to content

Commit

Permalink
runtime: change sigset_all and sigset_none into constants on OpenBSD
Browse files Browse the repository at this point in the history
OpenBSD's sigprocmask system call passes the signal mask by value
rather than reference, so vars are unnecessary.  Additionally,
declaring "var sigset_all = ^sigset_none" means sigset_all won't be
initialized until runtime_init is called, but the first call to
newosproc happens before then.

I've witnessed Go processes on OpenBSD crash from receiving SIGWINCH
on the newly created OS thread before it finished initializing.

Change-Id: I16995e7e466d5e7e50bcaa7d9490173789a0b4cc
Reviewed-on: https://go-review.googlesource.com/6440
Reviewed-by: Mikio Hara <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
  • Loading branch information
mdempsky authored and cixtor committed Mar 2, 2015
1 parent fcc164d commit 5324cf2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/runtime/os1_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ const (
_CLOCK_MONOTONIC = 3
)

var sigset_none = uint32(0)
var sigset_all = ^sigset_none
const (
sigset_none = uint32(0)
sigset_all = ^uint32(0)
)

// From OpenBSD's <sys/sysctl.h>
const (
Expand Down

0 comments on commit 5324cf2

Please sign in to comment.