diff --git a/.gitmodules b/.gitmodules index 6be16956c..a3798e704 100644 --- a/.gitmodules +++ b/.gitmodules @@ -109,3 +109,6 @@ [submodule "externals/wepoll"] path = externals/wepoll url = https://github.com/piscisaureus/wepoll.git +[submodule "externals/epoll-shim"] + path = externals/epoll-shim + url = https://github.com/jiixyj/epoll-shim.git diff --git a/CMakeLists.txt b/CMakeLists.txt index c180cc061..877a9c6da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -246,6 +246,7 @@ find_package(pugixml 1.14 CONFIG) find_package(libusb 1.0.27 MODULE) if (APPLE) find_package(date 3.0.1 CONFIG) + find_package(epoll-shim 3.14 CONFIG) endif() list(POP_BACK CMAKE_MODULE_PATH) @@ -1175,7 +1176,7 @@ if (APPLE) endif() # Replacement for std::chrono::time_zone - target_link_libraries(shadps4 PRIVATE date::date-tz) + target_link_libraries(shadps4 PRIVATE date::date-tz epoll-shim) endif() if (ENABLE_QT_GUI) diff --git a/externals/epoll-shim b/externals/epoll-shim new file mode 160000 index 000000000..18159584b --- /dev/null +++ b/externals/epoll-shim @@ -0,0 +1 @@ +Subproject commit 18159584bb3d17e601b9315a7398ace018251bdc diff --git a/src/core/libraries/network/net_epoll.h b/src/core/libraries/network/net_epoll.h index bd2117058..fdf2f00fb 100644 --- a/src/core/libraries/network/net_epoll.h +++ b/src/core/libraries/network/net_epoll.h @@ -14,16 +14,15 @@ #include #endif -#ifdef __linux__ +#if defined(__linux__) || defined(__APPLE__) #include -#define epoll_close close #endif namespace Libraries::Net { #ifdef _WIN32 using epoll_handle = HANDLE; -#elif defined(__linux__) +#else using epoll_handle = int; #endif @@ -42,7 +41,11 @@ struct Epoll { void Destroy() noexcept { events.clear(); + #ifdef _WIN32 epoll_close(epoll_fd); + #else + close(epoll_fd); + #endif epoll_fd = -1; name = nullptr; destroyed = true;