sys_freebsd.go 595 B

123456789101112131415161718192021222324
  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.
  4. package os
  5. import "syscall"
  6. // supportsCloseOnExec reports whether the platform supports the
  7. // O_CLOEXEC flag.
  8. var supportsCloseOnExec bool
  9. func init() {
  10. osrel, err := syscall.SysctlUint32("kern.osreldate")
  11. if err != nil {
  12. return
  13. }
  14. // The O_CLOEXEC flag was introduced in FreeBSD 8.3.
  15. // See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html.
  16. if osrel >= 803000 {
  17. supportsCloseOnExec = true
  18. }
  19. }