Files
wazero/internal/platform/open_file_js.go
Crypt Keeper 36bf277534 sysfs: requires all methods to return syscall.Errno (#1264)
This forces all syscall functions, notably filesystem, to return numeric
codes as opposed to mapping in two different areas. The result of this
change is better consolidation in call sites of `sysfs.FS`, while
further refactoring is needed to address consolidation of file errors.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-03-22 07:47:57 +01:00

20 lines
390 B
Go

package platform
import (
"io/fs"
"os"
"syscall"
)
// See the comments on the same constants in open_file_windows.go
const (
O_DIRECTORY = 1 << 29
O_NOFOLLOW = 1 << 30
)
func OpenFile(path string, flag int, perm fs.FileMode) (File, syscall.Errno) {
flag &= ^(O_DIRECTORY | O_NOFOLLOW) // erase placeholders
f, err := os.OpenFile(path, flag, perm)
return f, UnwrapOSError(err)
}