learning_go/pkg/mod/github.com/ceph/go-ceph@v0.35.0/cephfs/file_fd.go
a.pivkin c5bc4da2c3 sdf
2025-09-08 07:26:27 +03:00

18 lines
537 B
Go

//go:build ceph_preview
package cephfs
// Fd returns the integer open file descriptor in cephfs.
// NOTE: It doesn't make sense to consume the returned integer fd anywhere
// outside CephFS and is recommended not to do so given the undefined behaviour.
// Also, as seen with the Go standard library, the fd is only valid as long as
// the corresponding File object is intact in the sense that an fd from a closed
// File object is invalid.
func (f *File) Fd() int {
if f == nil || f.mount == nil {
return -1
}
return int(f.fd)
}