diff --git a/src/common/networking/networking_linux.c b/src/common/networking/networking_linux.c index 074d4f528..caf19accc 100644 --- a/src/common/networking/networking_linux.c +++ b/src/common/networking/networking_linux.c @@ -22,7 +22,7 @@ static const char* tryNonThreadingFastPath(FFNetworkingState* state) if (!state->tfo) { - #ifdef __linux__ + #if __linux__ || __GNU__ // Linux doesn't support sendto() on unconnected sockets FF_DEBUG("TCP Fast Open disabled, skipping"); return "TCP Fast Open disabled"; @@ -34,7 +34,7 @@ static const char* tryNonThreadingFastPath(FFNetworkingState* state) #ifndef __APPLE__ // On macOS, TCP_FASTOPEN doesn't seem to be needed // Set TCP Fast Open - #ifdef __linux__ + #if __linux__ || __GNU__ int flag = 5; // the queue length of pending packets #else int flag = 1; // enable TCP Fast Open @@ -50,7 +50,7 @@ static const char* tryNonThreadingFastPath(FFNetworkingState* state) FF_DEBUG("Failed to set TCP_FASTOPEN option: %s", strerror(errno)); return "setsockopt(TCP_FASTOPEN) failed"; } else { - #ifdef __linux__ + #if __linux__ || __GNU__ FF_DEBUG("Successfully set TCP_FASTOPEN option, queue length: %d", flag); #elif defined(__APPLE__) FF_DEBUG("Successfully set TCP_FASTOPEN_FORCE_ENABLE option"); diff --git a/src/detection/displayserver/linux/wayland/wayland.c b/src/detection/displayserver/linux/wayland/wayland.c index f64d18632..843bab93a 100644 --- a/src/detection/displayserver/linux/wayland/wayland.c +++ b/src/detection/displayserver/linux/wayland/wayland.c @@ -26,9 +26,9 @@ static bool waylandDetectWM(int fd, FFDisplayServerResult* result) { -#if __linux__ || (__FreeBSD__ && !__DragonFly__) +#if __linux__ || __GNU__ || (__FreeBSD__ && !__DragonFly__) -#if __linux +#if __linux__ || __GNU__ struct ucred ucred = {}; socklen_t len = sizeof(ucred); if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == -1 || ucred.pid <= 0) diff --git a/src/detection/os/os_linux.c b/src/detection/os/os_linux.c index 9b5ef3690..376bf8d34 100644 --- a/src/detection/os/os_linux.c +++ b/src/detection/os/os_linux.c @@ -370,7 +370,7 @@ void ffDetectOSImpl(FFOSResult* os) { detectOS(os); - #ifdef __linux__ + #if __linux__ || __GNU__ if(ffStrbufEqualS(&os->id, "ubuntu")) getUbuntuFlavour(os); else if(ffStrbufEqualS(&os->id, "debian")) diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index 7d739ca7a..0f50b0452 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -240,7 +240,7 @@ static void getTerminalFromEnv(FFTerminalResult* result) } #endif - #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) + #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__GNU__) //Konsole else if( getenv("KONSOLE_VERSION") != NULL @@ -333,7 +333,7 @@ static void setTerminalInfoDetails(FFTerminalResult* result) else if(ffStrbufEqualS(&result->processName, "com.termux")) ffStrbufInitStatic(&result->prettyName, "Termux"); - #elif defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) + #elif defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__GNU__) else if(ffStrbufStartsWithS(&result->processName, "gnome-terminal")) ffStrbufInitStatic(&result->prettyName, "GNOME Terminal"); diff --git a/src/detection/users/users_linux.c b/src/detection/users/users_linux.c index 99e27627c..acf860d77 100644 --- a/src/detection/users/users_linux.c +++ b/src/detection/users/users_linux.c @@ -10,7 +10,7 @@ #define setutxent setutent #define getutxent getutent #endif -#ifdef __linux__ +#if __linux__ || __GNU__ #include #include #endif @@ -40,7 +40,7 @@ next: ffStrbufInitS(&user->hostName, n->ut_host); ffStrbufInitS(&user->sessionName, n->ut_line); ffStrbufInit(&user->clientIp); - #ifdef __linux__ + #if __linux__ || __GNU__ bool isIpv6 = false; for (int i = 1; i < 4; ++i) { if (n->ut_addr_v6[i] != 0) { diff --git a/src/options/general.c b/src/options/general.c index 72f79798b..128d91799 100644 --- a/src/options/general.c +++ b/src/options/general.c @@ -30,7 +30,7 @@ const char* ffOptionsParseGeneralJsonConfig(FFOptionsGeneral* options, yyjson_va else if (unsafe_yyjson_equals_str(key, "detectVersion")) options->detectVersion = yyjson_get_bool(val); - #if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) + #if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(__GNU__) else if (unsafe_yyjson_equals_str(key, "playerName")) ffStrbufSetJsonVal(&options->playerName, val); else if (unsafe_yyjson_equals_str(key, "dsForceDrm")) @@ -73,7 +73,7 @@ bool ffOptionsParseGeneralCommandLine(FFOptionsGeneral* options, const char* key else if(ffStrEqualsIgnCase(key, "--detect-version")) options->detectVersion = ffOptionParseBoolean(value); - #if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) + #if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(__GNU__) else if(ffStrEqualsIgnCase(key, "--player-name")) ffOptionParseString(key, value, &options->playerName); else if(ffStrEqualsIgnCase(key, "--ds-force-drm")) @@ -102,7 +102,7 @@ void ffOptionsInitGeneral(FFOptionsGeneral* options) options->multithreading = true; options->detectVersion = true; - #if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) + #if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(__GNU__) ffStrbufInit(&options->playerName); options->dsForceDrm = FF_DS_FORCE_DRM_TYPE_FALSE; #elif defined(_WIN32) @@ -112,7 +112,7 @@ void ffOptionsInitGeneral(FFOptionsGeneral* options) void ffOptionsDestroyGeneral(FF_MAYBE_UNUSED FFOptionsGeneral* options) { - #if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) + #if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(__GNU__) ffStrbufDestroy(&options->playerName); #endif } @@ -127,7 +127,7 @@ void ffOptionsGenerateGeneralJsonConfig(FFOptionsGeneral* options, yyjson_mut_do yyjson_mut_obj_add_bool(doc, obj, "detectVersion", options->detectVersion); - #if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) + #if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(__GNU__) yyjson_mut_obj_add_strbuf(doc, obj, "playerName", &options->playerName); diff --git a/src/util/smbiosHelper.c b/src/util/smbiosHelper.c index 87569515f..593527a72 100644 --- a/src/util/smbiosHelper.c +++ b/src/util/smbiosHelper.c @@ -52,7 +52,7 @@ const FFSmbiosHeader* ffSmbiosNextEntry(const FFSmbiosHeader* header) return (const FFSmbiosHeader*) (p + 1); } -#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__) || defined(__OpenBSD__) || defined(__GNU__) #include #include #include @@ -143,7 +143,7 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable() { FF_DEBUG("Initializing SMBIOS buffer"); ffStrbufInit(&buffer); - #if !__HAIKU__ && !__OpenBSD__ && !__DragonFly__ + #if !__HAIKU__ && !__OpenBSD__ && !__DragonFly__ && !__GNU__ #ifdef __linux__ FF_DEBUG("Using Linux implementation - trying /sys/firmware/dmi/tables/DMI"); if (!ffAppendFileBuffer("/sys/firmware/dmi/tables/DMI", &buffer))