Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1346)

Side by Side Diff: src/pkg/os/sys_darwin.go

Issue 64510043: code review 64510043: os: handle file creation with close-on-exec flag correctly on darwin, freebsd (Closed)
Patch Set: diff -r 1a72d2295c21 https://code.google.com/p/go Created 10 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/os/file_unix.go ('k') | src/pkg/os/sys_freebsd.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
5 package os
6
7 import "syscall"
8
9 // supportsCloseOnExec reports whether the platform supports the
10 // O_CLOEXEC flag.
11 var supportsCloseOnExec bool
12
13 func init() {
14 // Seems like kern.osreldate is veiled on latest OS X. We use
15 // kern.osrelease instead.
16 osver, err := syscall.Sysctl("kern.osrelease")
17 if err != nil {
18 return
19 }
20 var i int
21 for i = range osver {
22 if osver[i] != '.' {
23 continue
24 }
25 }
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
30 }
31 }
OLDNEW
« no previous file with comments | « src/pkg/os/file_unix.go ('k') | src/pkg/os/sys_freebsd.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b