src/os: implement os.File.Fd() method

This commits adds a OS-specific `Fd()` function for `file_anyos.go` and
`file_other.go`, which returns a uintptr to the underlying file
descriptor.
This commit is contained in:
ZauberNerd
2022-03-04 15:44:55 +00:00
committed by Ron Evans
parent 4a98db4c86
commit 486b99961d
3 changed files with 19 additions and 1 deletions
+4
View File
@@ -118,6 +118,10 @@ func (f unixFileHandle) Close() error {
return handleSyscallError(syscall.Close(syscallFd(f)))
}
func (f unixFileHandle) Fd() uintptr {
return uintptr(f)
}
// Chmod changes the mode of the named file to mode.
// If the file is a symbolic link, it changes the mode of the link's target.
// If there is an error, it will be of type *PathError.