Files
wazero/internal/platform/sync_linux.go
Crypt Keeper e77f24fe31 sysfs: drops os.File special casing for fs.FS to pass wasi-testsuite (#1174)
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>
2023-03-01 13:28:57 +08:00

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
}