aboutsummaryrefslogtreecommitdiff
path: root/src/os/file_unix.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/file_unix.go')
-rw-r--r--src/os/file_unix.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/os/file_unix.go b/src/os/file_unix.go
index 5446dd5003..e0f16d809d 100644
--- a/src/os/file_unix.go
+++ b/src/os/file_unix.go
@@ -62,8 +62,13 @@ type file struct {
}
// Fd returns the integer Unix file descriptor referencing the open file.
-// The file descriptor is valid only until f.Close is called or f is garbage collected.
-// On Unix systems this will cause the SetDeadline methods to stop working.
+// If f is closed, the file descriptor becomes invalid.
+// If f is garbage collected, a finalizer may close the file descriptor,
+// making it invalid; see runtime.SetFinalizer for more information on when
+// a finalizer might be run. On Unix systems this will cause the SetDeadline
+// methods to stop working.
+//
+// As an alternative, see the f.SyscallConn method.
func (f *File) Fd() uintptr {
if f == nil {
return ^(uintptr(0))
@@ -129,7 +134,7 @@ func newFile(fd uintptr, name string, kind newFileKind) *File {
// used with kqueue.
if kind == kindOpenFile {
switch runtime.GOOS {
- case "darwin", "dragonfly", "freebsd", "netbsd", "openbsd":
+ case "darwin", "ios", "dragonfly", "freebsd", "netbsd", "openbsd":
var st syscall.Stat_t
err := ignoringEINTR(func() error {
return syscall.Fstat(fdi, &st)
@@ -150,7 +155,7 @@ func newFile(fd uintptr, name string, kind newFileKind) *File {
// on Darwin, kqueue does not work properly with fifos:
// closing the last writer does not cause a kqueue event
// for any readers. See issue #24164.
- if runtime.GOOS == "darwin" && typ == syscall.S_IFIFO {
+ if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && typ == syscall.S_IFIFO {
pollable = false
}
}