Bug 13338 – Wrong declaration of epoll_event in core.sys.linux.epoll.d
Status
RESOLVED
Resolution
DUPLICATE
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-08-20T10:17:00Z
Last change time
2015-07-20T14:59:11Z
Assigned to
nobody
Creator
netmindms
Comments
Comment #0 by netmindms — 2014-08-20T10:17:04Z
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.
Comment #1 by bugzilla — 2015-07-20T14:59:11Z
*** This issue has been marked as a duplicate of issue 14702 ***