PR target/82112
[official-gcc.git] / libgo / go / os / sys_freebsd.go
blob273c2df1c12400d9450c86ad01500562e4c4677d
1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package os
7 import "syscall"
9 // supportsCloseOnExec reports whether the platform supports the
10 // O_CLOEXEC flag.
11 var supportsCloseOnExec bool
13 func init() {
14 osrel, err := syscall.SysctlUint32("kern.osreldate")
15 if err != nil {
16 return
18 // The O_CLOEXEC flag was introduced in FreeBSD 8.3.
19 // See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html.
20 if osrel >= 803000 {
21 supportsCloseOnExec = true