From e062e44f1cdb4f803df54b05fbb9f0ae520cb96a Mon Sep 17 00:00:00 2001 From: Diederik de Groot Date: Tue, 9 Jan 2018 15:23:23 +0100 Subject: [PATCH 1/2] Fix compilation on DragonFlyBSD --- source/eventcore/drivers/posix/kqueue.d | 2 ++ source/eventcore/drivers/posix/sockets.d | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/source/eventcore/drivers/posix/kqueue.d b/source/eventcore/drivers/posix/kqueue.d index cf1aec4..e4c3ac6 100644 --- a/source/eventcore/drivers/posix/kqueue.d +++ b/source/eventcore/drivers/posix/kqueue.d @@ -8,6 +8,7 @@ module eventcore.drivers.posix.kqueue; @safe: /*@nogc:*/ nothrow: version (FreeBSD) enum have_kqueue = true; +else version (DragonFlyBSD) enum have_kqueue = true; else version (OSX) enum have_kqueue = true; else enum have_kqueue = false; @@ -21,6 +22,7 @@ import core.sys.posix.sys.time : timespec, time_t; version (OSX) import core.sys.darwin.sys.event; else version (FreeBSD) import core.sys.freebsd.sys.event; +else version (DragonFlyBSD) import core.sys.dragonflybsd.sys.event; else static assert(false, "Kqueue not supported on this OS."); diff --git a/source/eventcore/drivers/posix/sockets.d b/source/eventcore/drivers/posix/sockets.d index 489df3c..daba7ae 100644 --- a/source/eventcore/drivers/posix/sockets.d +++ b/source/eventcore/drivers/posix/sockets.d @@ -25,6 +25,7 @@ version (Posix) { { version (linux) enum O_CLOEXEC = 0x80000; else version (FreeBSD) enum O_CLOEXEC = 0x100000; + else version (DragonFlyBSD) enum O_CLOEXEC = 0x0020000; else version (NetBSD) enum O_CLOEXEC = 0x400000; else version (OpenBSD) enum O_CLOEXEC = 0x10000; else version (OSX) enum O_CLOEXEC = 0x1000000; @@ -57,6 +58,12 @@ version(FreeBSD) { enum IP_MULTICAST_LOOP = 11; } else import core.sys.freebsd.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP; } +version(DragonFlyBSD) { + static if (__VERSION__ < 2077) { + enum IP_ADD_MEMBERSHIP = 12; + enum IP_MULTICAST_LOOP = 11; + } else import core.sys.dragonflybsd.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP; +} version (Solaris) { enum IP_ADD_MEMBERSHIP = 0x13; enum IP_MULTICAST_LOOP = 0x12; From 41312a589ebb445ef6675f58e01fc6950bb7e396 Mon Sep 17 00:00:00 2001 From: Diederik de Groot Date: Thu, 11 Jan 2018 10:40:37 +0100 Subject: [PATCH 2/2] Remove static compiler __VERSION check. "import core.sys.dragonflybsd.netinet.in_" will work, when compiler support is there. [See](https://github.com/vibe-d/vibe.d/pull/2028#discussion_r161077152) --- source/eventcore/drivers/posix/sockets.d | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source/eventcore/drivers/posix/sockets.d b/source/eventcore/drivers/posix/sockets.d index daba7ae..c3d4413 100644 --- a/source/eventcore/drivers/posix/sockets.d +++ b/source/eventcore/drivers/posix/sockets.d @@ -59,10 +59,7 @@ version(FreeBSD) { } else import core.sys.freebsd.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP; } version(DragonFlyBSD) { - static if (__VERSION__ < 2077) { - enum IP_ADD_MEMBERSHIP = 12; - enum IP_MULTICAST_LOOP = 11; - } else import core.sys.dragonflybsd.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP; + import core.sys.dragonflybsd.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP; } version (Solaris) { enum IP_ADD_MEMBERSHIP = 0x13;