aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/os_openbsd.go
AgeCommit message (Collapse)Author
2021-01-22runtime: switch runtime to libc for openbsd/amd64Joel Sing
Use libc rather than performing direct system calls for the runtime on openbsd/amd64. Updates #36435 Change-Id: Ib708009c3743f56a3fd6cb3bc731451e4a398849 Reviewed-on: https://go-review.googlesource.com/c/go/+/270379 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-01-20runtime: convert openbsd/amd64 locking to libcJoel Sing
Switch openbsd/amd64 to locking via libc, rather than performing direct system calls. Update #36435 Change-Id: I5e92bd70ce557b78ff385577088a9775cc468ea9 Reviewed-on: https://go-review.googlesource.com/c/go/+/270378 Trust: Joel Sing <joel@sing.id.au> Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-01-19cmd/link,runtime: switch openbsd/amd64 to pthreadsJoel Sing
This switches openbsd/amd64 to thread creation via pthreads, rather than doing direct system calls. Update #36435 Change-Id: I1105d5c392aa3e4c445d99c8cb80b927712e3529 Reviewed-on: https://go-review.googlesource.com/c/go/+/250180 Trust: Joel Sing <joel@sing.id.au> Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-01-18runtime: free Windows event handles after last lock is droppedJason A. Donenfeld
Calls to lock may need to use global members of mOS that also need to be cleaned up before the thread exits. Before this commit, these resources would leak. Moving them to be cleaned up in unminit, however, would race with gstack on unix. So this creates a new helper, mdestroy, to release resources that must be destroyed only after locks are no longer required. We also move highResTimer lifetime to the same semantics, since it doesn't help to constantly acquire and release the timer object during dropm. Updates #43720. Change-Id: Ib3f598f3fda1b2bbcb608099616fa4f85bc1c289 Reviewed-on: https://go-review.googlesource.com/c/go/+/284137 Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Austin Clements <austin@google.com> Trust: Alex Brainman <alex.brainman@gmail.com> Trust: Jason A. Donenfeld <Jason@zx2c4.com>
2020-10-29runtime: add support for openbsd/mips64Joel Sing
Update #40995 Change-Id: Ie028dfd87ef8731804567a0501f1f7758e8dd203 Reviewed-on: https://go-review.googlesource.com/c/go/+/250580 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Joel Sing <joel@sing.id.au>
2020-07-08runtime: mark OpenBSD raise function nosplitIan Lance Taylor
It is called by the signal handler before switching to gsignal (sigtrampgo -> sigfwdgo -> dieFromSignal -> raise) which means that it must not split the stack. All other instances of raise are already marked nosplit. Fixes #40076 Change-Id: I4794491331af48c46d0d8ebc82d34c6483f0e6cd Reviewed-on: https://go-review.googlesource.com/c/go/+/241121 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-11-08runtime: add pipe/pipe2 on SolarisIan Lance Taylor
This adds pipe/pipe2 on Solaris as they exist on other Unix systems. They were not added previously because Solaris does not need them for netpollBreak. They are added now in preparation for using pipes in TestSignalM. Updates #35276 Change-Id: I53dfdf077430153155f0a79715af98b0972a841c Reviewed-on: https://go-review.googlesource.com/c/go/+/206077 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-26runtime: M-targeted signals for BSDsAustin Clements
For these, we split up the existing runtime.raise assembly implementation into its constituent "get thread ID" and "signal thread" parts. This lets us implement signalM and reimplement raise in pure Go. (NetBSD conveniently already had lwp_self.) We also change minit to store the procid directly, rather than depending on newosproc to do so. This is because newosproc isn't called for the bootstrap M, but we need a procid for every M. This is also simpler overall. For #10958, #24543. Change-Id: Ie5f1fcada6a33046375066bcbe054d1f784d39c0 Reviewed-on: https://go-review.googlesource.com/c/go/+/201402 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-21runtime: add netpollBreakIan Lance Taylor
The new netpollBreak function can be used to interrupt a blocking netpoll. This function is not currently used; it will be used by later CLs. Updates #27707 Change-Id: I5cb936609ba13c3c127ea1368a49194fc58c9f4d Reviewed-on: https://go-review.googlesource.com/c/go/+/171824 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-20runtime: define nonblockingPipeIan Lance Taylor
This requires defining pipe, pipe2, and setNonblock for various platforms. The new function is currently only used on AIX. It will be used by later CLs in this series. Updates #27707 Change-Id: Id2f987b66b4c66a3ef40c22484ff1d14f58e9b31 Reviewed-on: https://go-review.googlesource.com/c/go/+/171822 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-02runtime, cmd/dist, misc/cgo: enable c-archive for aix/ppc64Clément Chigot
Change-Id: Ib9a40d5596f5735a00483e2d2db965402f05671b Reviewed-on: https://go-review.googlesource.com/c/go/+/169120 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-15runtime: introduce and consistently use setNsec for timespecIan Lance Taylor
The general code for setting a timespec value sometimes used set_nsec and sometimes used a combination of set_sec and set_nsec. Standardize on a setNsec function that takes a number of nanoseconds and splits them up to set the tv_sec and tv_nsec fields. Consistently mark setNsec as go:nosplit, since it has to be that way on some systems including Darwin and GNU/Linux. Consistently use timediv on 32-bit systems to help stay within split-stack limits on processors that don't have a 64-bit division instruction. Change-Id: I6396bb7ddbef171a96876bdeaf7a1c585a6d725b Reviewed-on: https://go-review.googlesource.com/c/go/+/167389 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-26runtime: use hw.ncpuonline sysctl in getncpu on openbsdTobias Klauser
The number of CPUs reported by the hw.ncpu sysctl is twice as high as the actual number of CPUs running on OpenBSD 6.4. with hyperthreading disabled (hw.smt=0). Try hw.cpuonline first and fall back to hw.ncpu in case it fails (which is the case on older OpenBSD before 6.4). Fixes #30127 Change-Id: Id091234b8038cc9f7c40519d039fc1a05437c40d Reviewed-on: https://go-review.googlesource.com/c/161757 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2018-07-11runtime: correct new thread stack for openbsd MAP_STACKJoel Sing
OpenBSD 6.4 will require the stack pointer to be pointing at an area that is marked as MAP_STACK when entering and exiting syscalls. Adjust the stack pointer used for a new thread such that it points within the stack, not at the top of it (i.e. outside). Fixes #26142 Change-Id: I905bd8e5be3dfc325392e7ac490fb56a7c71b3aa Reviewed-on: https://go-review.googlesource.com/122735 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-02runtime: tidy OpenBSD sysctl codeAustin Clements
The OpenBSD sysctl code has been copy-pasted three times now. Abstract it. Change-Id: Ia5558927f0bc2b218b5af425dab368b5485d266c Reviewed-on: https://go-review.googlesource.com/121775 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2018-06-29runtime: remap stack spans with MAP_STACK on OpenBSDAustin Clements
OpenBSD 6.4 is going to start requiring that the SP points to memory that was mapped with MAP_STACK on system call entry, traps, and when switching to the alternate signal stack [1]. Currently, Go doesn't map any memory MAP_STACK, so the kernel quickly kills Go processes. Fix this by remapping the memory that backs stack spans with MAP_STACK, and re-remapping it without MAP_STACK when it's returned to the heap. [1] http://openbsd-archive.7691.n7.nabble.com/stack-register-checking-td338238.html Fixes #26142. Change-Id: I656eb84385a22833445d49328bb304f8cdd0e225 Reviewed-on: https://go-review.googlesource.com/121657 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2018-06-13runtime: move darwin kevent calls to libcKeith Randall
kqueue, kevent, closeonexec, setitimer, with sysctl and fcntl helpers. TODO:arm,arm64 Change-Id: I9386f377186d6ac7cb99064c524a67e0c8282eba Reviewed-on: https://go-review.googlesource.com/118561 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
2018-04-30runtime,cmd/ld: on darwin, create theads using libcKeith Randall
Replace thread creation with calls to the pthread library in libc. Update #17490 Change-Id: I1e19965c45255deb849b059231252fc6a7861d6c Reviewed-on: https://go-review.googlesource.com/108679 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-02-13runtime: remove unused memlimit functionAustin Clements
Change-Id: Id057dcc85d64e5c670710fbab6cacd4b906cf594 Reviewed-on: https://go-review.googlesource.com/93655 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-28runtime: minor simplifications to signal codeIan Lance Taylor
Change setsig, setsigstack, getsig, raise, raiseproc to take uint32 for signal number parameter, as that is the type mostly used for signal numbers. Same for dieFromSignal, sigInstallGoHandler, raisebadsignal. Remove setsig restart parameter, as it is always either true or irrelevant. Don't check the handler in setsigstack, as the only caller does that anyhow. Don't bother to convert the handler from sigtramp to sighandler in getsig, as it will never be called when the handler is sigtramp or sighandler. Don't check the return value from rt_sigaction in the GNU/Linux version of setsigstack; no other setsigstack checks it, and it never fails. Change-Id: I6bbd677e048a77eddf974dd3d017bc3c560fbd48 Reviewed-on: https://go-review.googlesource.com/29953 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-27runtime: remove sigmask type, use sigset insteadIan Lance Taylor
The OS-independent sigmask type was not pulling its weight. Replace it with the OS-dependent sigset type. This requires adding an OS-specific sigaddset function, but permits removing the OS-specific sigmaskToSigset function. Change-Id: I43307b512b0264ec291baadaea902f05ce212305 Reviewed-on: https://go-review.googlesource.com/29950 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-26runtime: unify Unix implementations of unminitIan Lance Taylor
Change-Id: I2cbb13eb85876ad05a52cbd498a9b86e7a28899c Reviewed-on: https://go-review.googlesource.com/29772 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-26runtime: merge setting new signal mask in minitIan Lance Taylor
All the variants that sets the new signal mask in minit do the same thing, so merge them. This requires an OS-specific sigdelset function; the function already exists for linux, and is now added for other OS's. Change-Id: Ie96f6f02e2cf09c43005085985a078bd9581f670 Reviewed-on: https://go-review.googlesource.com/29771 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-26runtime: unify sigtrampgoIan Lance Taylor
Combine the various versions of sigtrampgo into a single function in signal_unix.go. This requires defining a fixsigcode method on sigctxt for all operating systems; it only does something on Darwin. This also requires changing the darwin/amd64 signal handler to call sigreturn itself, rather than relying on sigtrampgo to call sigreturn for it. We can then drop the Darwin sigreturn function, as it is no longer used. Change-Id: I5a0b9d2d2c141957e151b41e694efeb20e4b4b9a Reviewed-on: https://go-review.googlesource.com/29761 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-26runtime: unify handling of alternate signal stackIan Lance Taylor
Change all Unix systems to use stackt for the alternate signal stack (some were using sigaltstackt). Add OS-specific setSignalstackSP function to handle different types for ss_sp field, and unify all OS-specific signalstack functions into one. Unify handling of alternate signal stack in OS-specific minit and sigtrampgo functions via new functions minitSignalstack and setGsignalStack. Change-Id: Idc316dc69b1dd725717acdf61a1cd8b9f33ed174 Reviewed-on: https://go-review.googlesource.com/29757 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-24runtime: unify some signal handling functionsIan Lance Taylor
Unify the OS-specific versions of msigsave, msigrestore, sigblock, updatesigmask, and unblocksig into single versions in signal_unix.go. To do this, make sigprocmask work the same way on all systems, which required adding a definition of sigprocmask for linux and openbsd. Also add a single OS-specific function sigmaskToSigset. Change-Id: I7cbf75131dddb57eeefe648ef845b0791404f785 Reviewed-on: https://go-review.googlesource.com/29689 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-06runtime: fetch physical page size from the OSAustin Clements
Currently the physical page size assumed by the runtime is hard-coded. On Linux the runtime at least fetches the OS page size during init and sanity checks against the hard-coded value, but they may still differ. On other OSes we wouldn't even notice. Add support on all OSes to fetch the actual OS physical page size during runtime init and lift the sanity check of PhysPageSize from the Linux init code to general malloc init. Currently this is the only use of the retrieved page size, but we'll add more shortly. Updates #12480 and #10180. Change-Id: I065f2834bc97c71d3208edc17fd990ec9058b6da Reviewed-on: https://go-review.googlesource.com/25050 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rick Hudson <rlh@golang.org>
2016-06-29runtime: better error message for newosproc failureIan Lance Taylor
If creating a new thread fails with EAGAIN, point the user at ulimit. Fixes #15476. Change-Id: Ib36519614b5c72776ea7f218a0c62df1dd91a8ea Reviewed-on: https://go-review.googlesource.com/24570 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-06os: rename remaining four os1_*.go files to os_*.goBrad Fitzpatrick
Change-Id: Ice9c234960adc7857c8370b777a0b18e29d59281 Reviewed-on: https://go-review.googlesource.com/22853 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06runtime: delete empty filesBrad Fitzpatrick
I meant to delete these in CL 22850, actually. Change-Id: I0c286efd2b9f1caf0221aa88e3bcc03649c89517 Reviewed-on: https://go-review.googlesource.com/22851 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06runtime: merge the last four os-vs-os1 files togetherBrad Fitzpatrick
Change-Id: Ib0ba691c4657fe18a4659753e70d97c623cb9c1d Reviewed-on: https://go-review.googlesource.com/22850 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-01all: make copyright headers consistent with one space after periodBrad Fitzpatrick
This is a subset of https://golang.org/cl/20022 with only the copyright header lines, so the next CL will be smaller and more reviewable. Go policy has been single space after periods in comments for some time. The copyright header template at: https://golang.org/doc/contribute.html#copyright also uses a single space. Make them all consistent. Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0 Reviewed-on: https://go-review.googlesource.com/20111 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-11-24runtime: use a proper type, sigset, for m.sigmaskElias Naur
Replace the cross platform but unsafe [4]uintptr type with a OS specific type, sigset. Most OSes already define sigset, and this change defines a suitable sigset for the OSes that don't (darwin, openbsd). The OSes that don't use m.sigmask (windows, plan9, nacl) now defines sigset as the empty type, struct{}. The gain is strongly typed access to m.sigmask, saving a dynamic size sanity check and unsafe.Pointer casting. Also, some storage is saved for each M, since [4]uinptr was conservative for most OSes. The cost is that OSes that don't need m.sigmask has to define sigset. completes ./all.bash with GOOS linux, on amd64 completes ./make.bash with GOOSes openbsd, android, plan9, windows, darwin, solaris, netbsd, freebsd, dragonfly, all amd64. With GOOS=nacl ./make.bash failed with a seemingly unrelated error. [Replay of CL 16942 by Elias Naur.] Change-Id: I98f144d626033ae5318576115ed635415ac71b2c Reviewed-on: https://go-review.googlesource.com/17033 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Russ Cox <rsc@golang.org>
2015-11-18Revert "runtime: use a proper type, sigset, for m.sigmask"Russ Cox
This reverts commit 7db77271e423604c3b58b4c4da60ddc3c3eecc0d. Change-Id: I6d8855eb05ca331025dc49a5533c6da4d1fa4e84 Reviewed-on: https://go-review.googlesource.com/17030 Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-17runtime: use a proper type, sigset, for m.sigmaskElias Naur
Replace the cross platform but unsafe [4]uintptr type with a OS specific type, sigset. Most OSes already define sigset, and this change defines a suitable sigset for the OSes that don't (darwin, openbsd). The OSes that don't use m.sigmask (windows, plan9, nacl) now defines sigset as the empty type, struct{}. The gain is strongly typed access to m.sigmask, saving a dynamic size sanity check and unsafe.Pointer casting. Also, some storage is saved for each M, since [4]uinptr was conservative for most OSes. The cost is that OSes that don't need m.sigmask has to define sigset. completes ./all.bash with GOOS linux, on amd64 completes ./make.bash with GOOSes openbsd, android, plan9, windows, darwin, solaris, netbsd, freebsd, dragonfly, all amd64. With GOOS=nacl ./make.bash failed with a seemingly unrelated error. R=go1.7 Change-Id: Ib460379f063eb83d393e1c5efe7333a643c1595e Reviewed-on: https://go-review.googlesource.com/16942 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-11-13runtime: move m's OS-specific semaphore fields into mOSMatthew Dempsky
Allows removing fields that aren't relevant to a particular OS or changing their types to match the underlying OS system calls they'll be used for. Change-Id: I5cea89ee77b4e7b985bff41337e561887c3272ff Reviewed-on: https://go-review.googlesource.com/16176 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com>
2015-10-22runtime: split plan9 and solaris's m fields into new embedded mOS typeMatthew Dempsky
Reduces the size of m by ~8% on linux/amd64 (1040 bytes -> 960 bytes). There are also windows-specific fields, but they're currently referenced in OS-independent source files (but only when GOOS=="windows"). Change-Id: I13e1471ff585ccced1271f74209f8ed6df14c202 Reviewed-on: https://go-review.googlesource.com/16173 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-10-02runtime: drop sigfwd from signal forwarding unsupported platformsMikio Hara
This change splits signal_unix.go into signal_unix.go and signal2_unix.go and removes the fake symbol sigfwd from signal forwarding unsupported platforms for clarification purpose. Change-Id: I205eab5cf1930fda8a68659b35cfa9f3a0e67ca6 Reviewed-on: https://go-review.googlesource.com/12062 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-26runtime: signal forwarding for darwin/amd64David Crawshaw
Follows the linux signal forwarding semantics from http://golang.org/cl/8712, sharing the implementation of sigfwdgo. Forwarding for 386, arm, and arm64 will follow. Change-Id: I6bf30d563d19da39b6aec6900c7fe12d82ed4f62 Reviewed-on: https://go-review.googlesource.com/9302 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-25runtime: simplify OpenBSD semaphoresMatthew Dempsky
OpenBSD's thrsleep system call includes an "abort" parameter, which specifies a memory address to be tested after being registered on the sleep channel (i.e., capable of being woken up by thrwakeup). By passing a pointer to waitsemacount for this parameter, we avoid race conditions without needing a lock. Instead we just need to use atomicload, cas, and xadd to mutate the semaphore count. Change-Id: If9f2ab7cfd682da217f9912783cadea7e72283a8 Reviewed-on: https://go-review.googlesource.com/5563 Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Reviewed-by: Joel Sing <jsing@google.com>
2015-01-14runtime: log all thread stack traces during GODEBUG=crash on Linux and OS XRuss Cox
Normally, a panic/throw only shows the thread stack for the current thread and all paused goroutines. Goroutines running on other threads, or other threads running on their system stacks, are opaque. Change that when GODEBUG=crash, by passing a SIGQUIT around to all the threads when GODEBUG=crash. If this works out reasonably well, we might make the SIGQUIT relay part of the standard panic/throw death, perhaps eliding idle m's. Change-Id: If7dd354f7f3a6e326d17c254afcf4f7681af2f8b Reviewed-on: https://go-review.googlesource.com/2811 Reviewed-by: Rick Hudson <rlh@golang.org>
2014-11-14[dev.cc] runtime: convert openbsd/amd64 port to GoJoel Sing
LGTM=rsc R=rsc, bradfitz CC=golang-codereviews https://golang.org/cl/171660043
2014-09-16runtime: remove duplicated Go constantsRuss Cox
The C header files are the single point of truth: every C enum constant Foo is available to Go as _Foo. Remove or redirect duplicate Go declarations so they cannot be out of sync. Eventually we will need to put constants in Go, but for now having them be out of sync with C is too risky. These predate the build support for auto-generating Go constants from the C definitions. LGTM=iant R=iant CC=golang-codereviews https://golang.org/cl/141510043
2014-09-08build: move package sources from src/pkg to srcRuss Cox
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.