mirror of
https://github.com/logos-storage/nim-chronos.git
synced 2026-01-07 16:03:09 +00:00
fix EpollEvent memory layout (#411)
* fix EpollEvent memory layout on x86_64, `EpollEvent` is packed - the upstream version is correct here * copy-paste upstream instead * Adjust lines to be 80 characters per line. --------- Co-authored-by: cheatfate <eugene.kabanov@status.im>
This commit is contained in:
parent
0a6f5854a7
commit
3d80ea9fc7
@ -1001,13 +1001,22 @@ elif defined(linux):
|
|||||||
EPOLL_CTL_DEL* = 2
|
EPOLL_CTL_DEL* = 2
|
||||||
EPOLL_CTL_MOD* = 3
|
EPOLL_CTL_MOD* = 3
|
||||||
|
|
||||||
|
# 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
|
type
|
||||||
EpollData* {.importc: "union epoll_data",
|
EpollData* {.importc: "epoll_data_t",
|
||||||
header: "<sys/epoll.h>", pure, final.} = object
|
header: "<sys/epoll.h>", pure, final, union.} = object
|
||||||
|
`ptr`* {.importc: "ptr".}: pointer
|
||||||
|
fd* {.importc: "fd".}: cint
|
||||||
|
u32* {.importc: "u32".}: uint32
|
||||||
u64* {.importc: "u64".}: uint64
|
u64* {.importc: "u64".}: uint64
|
||||||
|
|
||||||
EpollEvent* {.importc: "struct epoll_event", header: "<sys/epoll.h>",
|
EpollEvent* {.importc: "struct epoll_event",
|
||||||
pure, final.} = object
|
header: "<sys/epoll.h>", pure, final, epollPacked.} = object
|
||||||
events*: uint32 # Epoll events
|
events*: uint32 # Epoll events
|
||||||
data*: EpollData # User data variable
|
data*: EpollData # User data variable
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user