-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Open
Description
Proposal Details
I have code which opens both files and directories as files to perform various actions such as fetching and comparing generations (I need to upstream to linux once I write tests) or other metadata with SyscallConn.
Trying to use #67002 to make it less conservative with some TOCTOU edge cases prove challenging since *os.Root does not provide needed SyscallConn to fetch the generation of directories and more architecturally the current codepath is to open everything as a *os.File and then use statx to decide what to do next.
package os
// AsRoot open the File as a Root if it is a directory otherwise it errors.
// The Root is returned with a new lifetime such that each need to be closed independently.
func (*File) AsRoot() (*Root, error)
// AsFile opens the Root as a File.
// The File is returned with a new lifetime such that each need to be closed independently.
func (*Root) AsFile() (*File, error)lVlayhemseptemhill
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Incoming