From 6286c7980dade6e5d2fe19cc138d9ff9ae221efe Mon Sep 17 00:00:00 2001 From: Radu Racariu Date: Tue, 12 Feb 2019 19:47:37 +0200 Subject: [PATCH 1/2] [PosixEventDriverEvents] Use Linux definitions from druntime This doesn't duplicate the definitions form `core.sys.linux.sys.eventfd` and will pickup any platform specifics for better portability. Fixes https://github.com/vibe-d/eventcore/issues/102 --- source/eventcore/drivers/posix/events.d | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/eventcore/drivers/posix/events.d b/source/eventcore/drivers/posix/events.d index ba51c7b..d93c352 100644 --- a/source/eventcore/drivers/posix/events.d +++ b/source/eventcore/drivers/posix/events.d @@ -8,9 +8,7 @@ import eventcore.internal.utils : nogc_assert, mallocT, freeT; version (linux) { - nothrow @nogc extern (C) int eventfd(uint initval, int flags); - enum EFD_NONBLOCK = 0x800; - enum EFD_CLOEXEC = 0x80000; + import core.sys.linux.sys.eventfd : eventfd, EFD_NONBLOCK, EFD_CLOEXEC; } version (Posix) { import core.sys.posix.unistd : close, read, write; From 07b09e86927b1495f39565aefe097c1c5e6dcf2c Mon Sep 17 00:00:00 2001 From: Radu Racariu Date: Tue, 12 Feb 2019 19:55:32 +0200 Subject: [PATCH 2/2] fix @safe --- source/eventcore/drivers/posix/events.d | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/eventcore/drivers/posix/events.d b/source/eventcore/drivers/posix/events.d index d93c352..ce2cf7b 100644 --- a/source/eventcore/drivers/posix/events.d +++ b/source/eventcore/drivers/posix/events.d @@ -8,7 +8,8 @@ import eventcore.internal.utils : nogc_assert, mallocT, freeT; version (linux) { - import core.sys.linux.sys.eventfd : eventfd, EFD_NONBLOCK, EFD_CLOEXEC; + nothrow @nogc extern (C) int eventfd(uint initval, int flags); + import core.sys.linux.sys.eventfd : EFD_NONBLOCK, EFD_CLOEXEC; } version (Posix) { import core.sys.posix.unistd : close, read, write;