This adds a wazero adapter which passes wasi-testsuite 100pct on darwin, linux and windows. While the main change was adding inodes to the wasi `fd_readdir` dirents, there was a lot of incidental work needed. Most of the work was troubleshooting in nature, around windows specifically, but also wrapping of files. This backfills a lot of tests and reworked how wrapping works, particularly around windows. To accommodate this, we drop `os.File` special casing except for `sysfs.DirFS` Signed-off-by: Adrian Cole <adrian@tetrate.io>
21 lines
317 B
Go
21 lines
317 B
Go
//go:build linux
|
|
|
|
package platform
|
|
|
|
import (
|
|
"io/fs"
|
|
"syscall"
|
|
)
|
|
|
|
func fdatasync(f fs.File) (err error) {
|
|
if fd, ok := f.(fdFile); ok {
|
|
return syscall.Fdatasync(int(fd.Fd()))
|
|
}
|
|
|
|
// Attempt to sync everything, even if we only need to sync the data.
|
|
if s, ok := f.(syncFile); ok {
|
|
err = s.Sync()
|
|
}
|
|
return
|
|
}
|