diff options
| author | Laytan <laytanlaats@hotmail.com> | 2025-03-22 12:59:32 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-22 12:59:32 +0100 |
| commit | 7ffbb68fff2df61798c130751dfebe323e8638f9 (patch) | |
| tree | 18617234124e9d8f9edf4bf92a8a2c3a32b20e14 | |
| parent | e4bc9677af62c74bb23f4c00d82d2a685ce64e50 (diff) | |
| parent | 17a01dcebf71ffdd85557e80aa8de33a31f9a825 (diff) | |
Merge pull request #4955 from wisonye/master
Fixed #4892: 'EPoll_Event.events' should be bit set.
| -rw-r--r-- | core/sys/linux/bits.odin | 38 | ||||
| -rw-r--r-- | core/sys/linux/types.odin | 2 |
2 files changed, 23 insertions, 17 deletions
diff --git a/core/sys/linux/bits.odin b/core/sys/linux/bits.odin index 4493ea767..53660dc8f 100644 --- a/core/sys/linux/bits.odin +++ b/core/sys/linux/bits.odin @@ -1,5 +1,10 @@ package linux +import "base:intrinsics" + +@(private) +log2 :: intrinsics.constant_log2 + /* Represents an error returned by most of syscalls @@ -1839,22 +1844,23 @@ EPoll_Flags_Bits :: enum { } EPoll_Event_Kind :: enum u32 { - IN = 0x001, - PRI = 0x002, - OUT = 0x004, - RDNORM = 0x040, - RDBAND = 0x080, - WRNORM = 0x100, - WRBAND = 0x200, - MSG = 0x400, - ERR = 0x008, - HUP = 0x010, - RDHUP = 0x2000, - EXCLUSIVE = 1<<28, - WAKEUP = 1<<29, - ONESHOT = 1<<30, - ET = 1<<31, -} + IN = log2(0x001), + PRI = log2(0x002), + OUT = log2(0x004), + RDNORM = log2(0x040), + RDBAND = log2(0x080), + WRNORM = log2(0x100), + WRBAND = log2(0x200), + MSG = log2(0x400), + ERR = log2(0x008), + HUP = log2(0x010), + RDHUP = log2(0x2000), + EXCLUSIVE = log2(1<<28), + WAKEUP = log2(1<<29), + ONESHOT = log2(1<<30), + ET = log2(1<<31), +} +EPoll_Event_Set :: bit_set[EPoll_Event_Kind; u32] EPoll_Ctl_Opcode :: enum i32 { ADD = 1, diff --git a/core/sys/linux/types.odin b/core/sys/linux/types.odin index dcc72f72b..8f2284f56 100644 --- a/core/sys/linux/types.odin +++ b/core/sys/linux/types.odin @@ -1450,7 +1450,7 @@ EPoll_Data :: struct #raw_union { } EPoll_Event :: struct #packed { - events: EPoll_Event_Kind, + events: EPoll_Event_Set, data: EPoll_Data, } |