diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b252ec66..c7509807c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,24 @@ if(CCACHE_PROGRAM) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") endif() +if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS") +# check if we have the (saner) emulation of epoll here +# it's basically linux epoll but with a sane method of +# dealing with closed file handles that still exist in the +# epoll set +# +# Note that the zombie of Oracle Solaris 2.11.x will NOT have +# this, the header check is the only method we have to distinguish +# them. -rick the svr4 guy + INCLUDE(CheckIncludeFiles) + CHECK_INCLUDE_FILES(sys/epoll.h SOLARIS_HAVE_EPOLL) + if (SOLARIS_HAVE_EPOLL) + message("Using fast emulation of Linux epoll(5) on Solaris.") + else() + message("Falling back to poll(2) based event loop.") + endif() +endif() + if(WIN32) set(CMAKE_CXX_STANDARD 17) ENABLE_LANGUAGE(RC) diff --git a/llarp/ev/ev.cpp b/llarp/ev/ev.cpp index 8e51ff213..ebd8fed56 100644 --- a/llarp/ev/ev.cpp +++ b/llarp/ev/ev.cpp @@ -6,7 +6,7 @@ #include // apparently current Solaris will emulate epoll. -#if __linux__ || __sun__ +#if __linux__ || SOLARIS_HAVE_EPOLL #include #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \ || (__APPLE__ && __MACH__) diff --git a/vendor/libtuntap-master/tuntap-unix-sunos.c b/vendor/libtuntap-master/tuntap-unix-sunos.c index 56664806b..809c85322 100644 --- a/vendor/libtuntap-master/tuntap-unix-sunos.c +++ b/vendor/libtuntap-master/tuntap-unix-sunos.c @@ -12,6 +12,9 @@ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * solaris port of libtuntap (c)2019 rick v + * all rights reserved, see LICENSE in top-level folder (../../LICENSE) */ #include