epoll: correct mapping [backport] (#20058)
* epoll: correct mapping `epoll_data` is a union and `epoll_event` is packed on `amd64` * names
This commit is contained in:
parent
f443bece06
commit
f2e4407306
1 changed files with 14 additions and 5 deletions
|
|
@ -33,12 +33,21 @@ const
|
|||
EPOLL_CTL_DEL* = 2 # Remove a file descriptor from the interface.
|
||||
EPOLL_CTL_MOD* = 3 # Change file descriptor epoll_event structure.
|
||||
|
||||
# https://github.com/torvalds/linux/blob/ff6992735ade75aae3e35d16b17da1008d753d28/include/uapi/linux/eventpoll.h#L77
|
||||
when defined(linux) and defined(amd64):
|
||||
{.pragma: epollPacked, packed.}
|
||||
else:
|
||||
{.pragma: epollPacked.}
|
||||
|
||||
type
|
||||
EpollData* {.importc: "union epoll_data",
|
||||
header: "<sys/epoll.h>", pure, final.} = object # TODO: This is actually a union.
|
||||
EpollData* {.importc: "epoll_data_t",
|
||||
header: "<sys/epoll.h>", pure, final, union.} = object
|
||||
`ptr`* {.importc: "ptr".}: pointer
|
||||
fd* {.importc: "fd".}: cint
|
||||
u32* {.importc: "u32".}: uint32
|
||||
u64* {.importc: "u64".}: uint64
|
||||
|
||||
EpollEvent* {.importc: "struct epoll_event", header: "<sys/epoll.h>", pure, final.} = object
|
||||
EpollEvent* {.importc: "struct epoll_event", header: "<sys/epoll.h>", pure, final, epollPacked.} = object
|
||||
events*: uint32 # Epoll events
|
||||
data*: EpollData # User data variable
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue