-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os: enable file creation w/ close-on-exec on darwin, freebsd #7187
Labels
Milestone
Comments
> I don't understand what change you are proposing. Something like the following. --- a/src/pkg/syscall/zerrors_freebsd_amd64.go +++ b/src/pkg/syscall/zerrors_freebsd_amd64.go + O_CLOEXEC = 0x100000 --- a/src/pkg/os/file_unix.go +++ b/src/pkg/os/file_unix.go +// supportsCloseOnExec reports whether the platform supports the +// O_CLOEXEC flag. +var supportsCloseOnExec bool + - if syscall.O_CLOEXEC == 0 || runtime.GOOS == "darwin" { // O_CLOEXEC not supported + if !supportsCloseOnExec { --- /dev/null +++ b/src/pkg/os/sys_freebsd.go +package os + +import "syscall" + +func init() { + // The O_CLOEXEC flag was introduced in FreeBSD 8.3. + if osrel, err := syscall.SysctlUint32("kern.osreldate"); err == nil { + // See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html. + if osrel >= 803000 { + supportsCloseOnExec = true + } + } +} |
> the way we handle SOCK_CLOEXEC? Not sure whether such simple fallback works well, but will have a look at kernel code tomorrow. Hm, probably kernel just ignores unsupported flags because, ./zerrors_darwin_386.go: O_CLOEXEC = 0x1000000 ./zerrors_darwin_amd64.go: O_CLOEXEC = 0x1000000 but if syscall.O_CLOEXEC == 0 || runtime.GOOS == "darwin" { // O_CLOEXEC not supported sigh. According to https://code.google.com/p/go-wiki/wiki/DashboardBuilders, OS X 10.6 which includes BSD subsystem comes from FreeBSD shows us no error until now. |
Confirmed, unlike IPC stuff such as socket or mmap, O_CLOEXEC is just ignored, sigh. See fallocf in 8/9-STABLE or finstall in 10-STABLE. http://svnweb.freebsd.org/base?view=revision&revision=220241 |
This issue was closed by revision be8aa4b. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: