Source file
src/runtime/os_openbsd_syscall.go
1
2
3
4
5
6
7 package runtime
8
9 import (
10 "internal/abi"
11 "internal/goarch"
12 "unsafe"
13 )
14
15
16 func tfork(param *tforkt, psize uintptr, mm *m, gg *g, fn uintptr) int32
17
18
19
20 func newosproc(mp *m) {
21 stk := unsafe.Pointer(mp.g0.stack.hi)
22 if false {
23 print("newosproc stk=", stk, " m=", mp, " g=", mp.g0, " id=", mp.id, " ostk=", &mp, "\n")
24 }
25
26
27
28 param := tforkt{
29 tf_tcb: unsafe.Pointer(&mp.tls[0]),
30 tf_tid: nil,
31 tf_stack: uintptr(stk) - goarch.PtrSize,
32 }
33
34 var oset sigset
35 sigprocmask(_SIG_SETMASK, &sigset_all, &oset)
36 ret := tfork(¶m, unsafe.Sizeof(param), mp, mp.g0, abi.FuncPCABI0(mstart))
37 sigprocmask(_SIG_SETMASK, &oset, nil)
38
39 if ret < 0 {
40 print("runtime: failed to create new OS thread (have ", mcount()-1, " already; errno=", -ret, ")\n")
41 if ret == -_EAGAIN {
42 println("runtime: may need to increase max user processes (ulimit -p)")
43 }
44 throw("runtime.newosproc")
45 }
46 }
47
View as plain text