Common (GNU): more __GNU__ tests

This commit is contained in:
Carter Li
2025-08-24 21:40:22 +08:00
parent e9104c38c6
commit 74e0732390
7 changed files with 17 additions and 17 deletions
+3 -3
View File
@@ -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");
@@ -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)
+1 -1
View File
@@ -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"))
@@ -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");
+2 -2
View File
@@ -10,7 +10,7 @@
#define setutxent setutent
#define getutxent getutent
#endif
#ifdef __linux__
#if __linux__ || __GNU__
#include <netinet/in.h>
#include <arpa/inet.h>
#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) {
+5 -5
View File
@@ -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);
+2 -2
View File
@@ -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 <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -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))