github.com/gaukas/wazerofs@v0.1.0/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/tetratelabs/wazero/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 }