Add missing flush functionality to os platforms

Platforms:
- FreeBSD
- Haiku
- Linux
- NetBSD
- OpenBSD
This commit is contained in:
Feoramund
2024-08-28 19:53:20 +02:00
committed by Laytan
parent 3ec4db212b
commit 0243647e15
6 changed files with 28 additions and 7 deletions
+5 -1
View File
@@ -366,6 +366,7 @@ foreign libc {
@(link_name="unlink") _unix_unlink :: proc(path: cstring) -> c.int ---
@(link_name="rmdir") _unix_rmdir :: proc(path: cstring) -> c.int ---
@(link_name="mkdir") _unix_mkdir :: proc(path: cstring, mode: mode_t) -> c.int ---
@(link_name="fsync") _unix_fsync :: proc(fd: Handle) -> c.int ---
@(link_name="dup") _unix_dup :: proc(fd: Handle) -> Handle ---
@(link_name="getpagesize") _unix_getpagesize :: proc() -> c.int ---
@@ -430,7 +431,10 @@ close :: proc(fd: Handle) -> Error {
}
flush :: proc(fd: Handle) -> Error {
// do nothing
result := _unix_fsync(fd)
if result == -1 {
return get_last_error()
}
return nil
}