Re: User data of epoll event is reported abnormally by epoll_wait.

2014-08-21 Thread Etienne via Digitalmars-d
On 2014-08-20 6:01 AM, blake kim wrote: extern(C) align(1) struct epoll_event { align(1): uint events; epoll_data_t data; } Wow, that fixes my issue! I couldn't use more than 1 event in my array because of misalignment, thanks!

User data of epoll event is reported abnormally by epoll_wait.

2014-08-20 Thread blake kim via Digitalmars-d
I am a newbie on D and studying interfacing to C API. I found abnormal work of epoll_wait. I stored an arbitrary 64bit number to u64 of epoll_event and registered the event with valid fd using epoll_ctl. When the fd is activated on EPOLLIN, I found u64 value is not normal. epoll has lost

Re: User data of epoll event is reported abnormally by epoll_wait.

2014-08-20 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Wednesday, 20 August 2014 at 06:11:42 UTC, blake kim wrote: But I don't think this is right. Many C APIs need structure as argument and adjusting align each structure doesn't make sense. Is this problem a Bug of D ? Default alignment in D is pointersize (size_t) - so 8 on 64bit. But most C

Re: User data of epoll event is reported abnormally by epoll_wait.

2014-08-20 Thread blake kim via Digitalmars-d
On Wednesday, 20 August 2014 at 06:17:43 UTC, Dominikus Dittes Scherkl wrote: On Wednesday, 20 August 2014 at 06:11:42 UTC, blake kim wrote: But I don't think this is right. Many C APIs need structure as argument and adjusting align each structure doesn't make sense. Is this problem a Bug of

Re: User data of epoll event is reported abnormally by epoll_wait.

2014-08-20 Thread blake kim via Digitalmars-d
On Wednesday, 20 August 2014 at 07:02:52 UTC, blake kim wrote: On Wednesday, 20 August 2014 at 06:17:43 UTC, Dominikus Dittes Scherkl wrote: On Wednesday, 20 August 2014 at 06:11:42 UTC, blake kim wrote: But I don't think this is right. Many C APIs need structure as argument and adjusting

Re: User data of epoll event is reported abnormally by epoll_wait.

2014-08-20 Thread ketmar via Digitalmars-d
On Wed, 20 Aug 2014 10:01:05 + blake kim via Digitalmars-d digitalmars-d@puremagic.com wrote: fill bugreport, please. and submit PR if you can. signature.asc Description: PGP signature

Re: User data of epoll event is reported abnormally by epoll_wait.

2014-08-20 Thread Daniel Murphy via Digitalmars-d
blake kim wrote in message news:slmejjrekoahgbmti...@forum.dlang.org... In my investigation, this problem appears by memory align mismatch. In C, sizeof(epoll_event) is 12 but D tells this is 16.(epoll_event.sizeof) With default alignment, the D layout must match the C layout. I've fun a