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.
9 // supportsCloseOnExec reports whether the platform supports the
11 var supportsCloseOnExec
bool
14 // Seems like kern.osreldate is veiled on latest OS X. We use
15 // kern.osrelease instead.
16 osver
, err
:= syscall
.Sysctl("kern.osrelease")
26 // The O_CLOEXEC flag was introduced in OS X 10.7 (Darwin
27 // 11.0.0). See http://support.apple.com/kb/HT1633.
28 if i
> 2 || i
== 2 && osver
[0] >= '1' && osver
[1] >= '1' {
29 supportsCloseOnExec
= true