D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 13338 - Wrong declaration of epoll_event in core.sys.linux.epoll.d
Summary: Wrong declaration of epoll_event in core.sys.linux.epoll.d
Status: RESOLVED DUPLICATE of issue 14702
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 critical
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-20 10:17 UTC by netmindms
Modified: 2015-07-20 14:59 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description netmindms 2014-08-20 10:17:04 UTC
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 Lars T. Kyllingstad 2015-07-20 14:59:11 UTC

*** This issue has been marked as a duplicate of issue 14702 ***