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
+11
View File
@@ -22,6 +22,7 @@ SYS_getpid : uintptr : 20
SYS_recvfrom : uintptr : 29
SYS_accept : uintptr : 30
SYS_fcntl : uintptr : 92
SYS_fsync : uintptr : 95
SYS_socket : uintptr : 97
SYS_connect : uintptr : 98
SYS_bind : uintptr : 104
@@ -200,6 +201,16 @@ accept_nil :: proc "contextless" (s: Fd) -> (Fd, Errno) {
accept :: proc { accept_T, accept_nil }
// Synchronize changes to a file.
//
// The fsync() system call appeared in 4.2BSD.
fsync :: proc "contextless" (fd: Fd) -> Errno {
result, _ := intrinsics.syscall_bsd(SYS_fsync,
cast(uintptr)fd)
return cast(Errno)result
}
// File control.
//
// The fcntl() system call appeared in 4.2BSD.