linux: implement eventfd syscall

This commit is contained in:
Laytan Laats
2026-01-11 20:13:43 +01:00
parent 872fe3ff73
commit 26d47f23f7
3 changed files with 12 additions and 1 deletions

View File

@@ -2269,3 +2269,9 @@ Swap_Flags_Bits :: enum {
PREFER = log2(0x8000),
DISCARD = log2(0x10000),
}
Eventfd_Flags_Bits :: enum {
SEMAPHORE,
CLOEXEC = auto_cast Open_Flags_Bits.CLOEXEC,
NONBLOCK = auto_cast Open_Flags_Bits.NONBLOCK,
}

View File

@@ -3001,7 +3001,10 @@ timerfd_create :: proc "contextless" (clock_id: Clock_Id, flags: Open_Flags) ->
return errno_unwrap2(ret, Fd)
}
// TODO(flysand): eventfd
eventfd :: proc "contextless" (initval: u32, flags: Eventfd_Flags) -> (Fd, Errno) {
ret := syscall(SYS_eventfd2, initval, transmute(i32)flags)
return errno_unwrap2(ret, Fd)
}
// TODO(flysand): fallocate

View File

@@ -1748,3 +1748,5 @@ Mount_Flags :: bit_set[Mount_Flags_Bits; uint]
Umount2_Flags :: bit_set[Umount2_Flags_Bits; u32]
Swap_Flags :: bit_set[Swap_Flags_Bits; u32]
Eventfd_Flags :: bit_set[Eventfd_Flags_Bits; i32]