August 20, 2014 [Issue 13338] New: Wrong declaration of epoll_event in core.sys.linux.epoll.d | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13338 Issue ID: 13338 Summary: Wrong declaration of epoll_event in core.sys.linux.epoll.d Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: critical Priority: P1 Component: DMD Assignee: nobody@puremagic.com Reporter: netmindms@gmail.com In core.sys.linux.epoll.d, struct epoll_event is declared as follows. struct epoll_event { uint events; epoll_data_t data; }; But C declaration is packed in epoll.h as follows. struct epoll_event { uint32_t events; /* Epoll events */ epoll_data_t data; /* User data variable */ } __attribute__ ((__packed__)); So, I think the declaration must be modified in D as follows. extern(C) align(1) struct epoll_event { align(1): uint events; /* Epoll events */ epoll_data_t data; /* User data variable */ } Because of this mismatch in alignment between C and D, epoll_wait in D reports abnormal event user data.(especially u64). I confirmed this malfunction on code test. -- |
Copyright © 1999-2021 by the D Language Foundation