Mercurial > hg > CbC > CbC_gcc
comparison libgo/misc/cgo/test/issue18146.go @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
5 // +build !windows | 5 // +build !windows |
6 | 6 |
7 // Issue 18146: pthread_create failure during syscall.Exec. | 7 // Issue 18146: pthread_create failure during syscall.Exec. |
8 | 8 |
9 package cgotest | 9 package cgotest |
10 | |
11 import "C" | |
12 | 10 |
13 import ( | 11 import ( |
14 "bytes" | 12 "bytes" |
15 "crypto/md5" | 13 "crypto/md5" |
16 "os" | 14 "os" |
44 var nproc int | 42 var nproc int |
45 setNproc := true | 43 setNproc := true |
46 switch runtime.GOOS { | 44 switch runtime.GOOS { |
47 default: | 45 default: |
48 setNproc = false | 46 setNproc = false |
47 case "aix": | |
48 nproc = 9 | |
49 case "linux": | 49 case "linux": |
50 nproc = 6 | 50 nproc = 6 |
51 case "darwin", "dragonfly", "freebsd", "netbsd", "openbsd": | 51 case "darwin", "dragonfly", "freebsd", "netbsd", "openbsd": |
52 nproc = 7 | 52 nproc = 7 |
53 case "aix": | |
54 nproc = 9 | |
55 } | 53 } |
56 if setNproc { | 54 if setNproc { |
57 var rlim syscall.Rlimit | 55 var rlim syscall.Rlimit |
58 if syscall.Getrlimit(nproc, &rlim) == nil { | 56 if syscall.Getrlimit(nproc, &rlim) == nil { |
59 max := int(rlim.Cur) / (threads + 5) | 57 max := int(rlim.Cur) / (threads + 5) |