diff options
| author | Laytan Laats <laytanlaats@hotmail.com> | 2026-01-11 20:13:43 +0100 |
|---|---|---|
| committer | Laytan Laats <laytanlaats@hotmail.com> | 2026-01-11 20:21:25 +0100 |
| commit | 26d47f23f71dbeec3c10c3e4c7ed6b5e0f462b5e (patch) | |
| tree | d9b8be7523749230a62f452157a802f533d8f416 /core/sys/linux | |
| parent | 872fe3ff73b4673ac3e393da6a69b98ae5c4dcf2 (diff) | |
linux: implement eventfd syscall
Diffstat (limited to 'core/sys/linux')
| -rw-r--r-- | core/sys/linux/bits.odin | 6 | ||||
| -rw-r--r-- | core/sys/linux/sys.odin | 5 | ||||
| -rw-r--r-- | core/sys/linux/types.odin | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/core/sys/linux/bits.odin b/core/sys/linux/bits.odin index 213d6c26f..59383638d 100644 --- a/core/sys/linux/bits.odin +++ b/core/sys/linux/bits.odin @@ -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, +} diff --git a/core/sys/linux/sys.odin b/core/sys/linux/sys.odin index faeda6f43..b10759595 100644 --- a/core/sys/linux/sys.odin +++ b/core/sys/linux/sys.odin @@ -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 diff --git a/core/sys/linux/types.odin b/core/sys/linux/types.odin index 0910f11ec..de4417beb 100644 --- a/core/sys/linux/types.odin +++ b/core/sys/linux/types.odin @@ -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] |