github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/internal/sysfs/open_file_notwindows.go (about) 1 //go:build !windows 2 3 package sysfs 4 5 import ( 6 "io/fs" 7 "os" 8 9 "github.com/wasilibs/wazerox/experimental/sys" 10 ) 11 12 // openFile is like os.OpenFile except it accepts a sys.Oflag and returns 13 // sys.Errno. A zero sys.Errno is success. 14 func openFile(path string, oflag sys.Oflag, perm fs.FileMode) (*os.File, sys.Errno) { 15 f, err := os.OpenFile(path, toOsOpenFlag(oflag), perm) 16 // Note: This does not return a sys.File because sys.FS that returns 17 // one may want to hide the real OS path. For example, this is needed for 18 // pre-opens. 19 return f, sys.UnwrapOSError(err) 20 }