Skip to content

Commit 74e0732

Browse files
committed
Common (GNU): more __GNU__ tests
1 parent e9104c3 commit 74e0732

7 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/common/networking/networking_linux.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static const char* tryNonThreadingFastPath(FFNetworkingState* state)
2222

2323
if (!state->tfo)
2424
{
25-
#ifdef __linux__
25+
#if __linux__ || __GNU__
2626
// Linux doesn't support sendto() on unconnected sockets
2727
FF_DEBUG("TCP Fast Open disabled, skipping");
2828
return "TCP Fast Open disabled";
@@ -34,7 +34,7 @@ static const char* tryNonThreadingFastPath(FFNetworkingState* state)
3434

3535
#ifndef __APPLE__ // On macOS, TCP_FASTOPEN doesn't seem to be needed
3636
// Set TCP Fast Open
37-
#ifdef __linux__
37+
#if __linux__ || __GNU__
3838
int flag = 5; // the queue length of pending packets
3939
#else
4040
int flag = 1; // enable TCP Fast Open
@@ -50,7 +50,7 @@ static const char* tryNonThreadingFastPath(FFNetworkingState* state)
5050
FF_DEBUG("Failed to set TCP_FASTOPEN option: %s", strerror(errno));
5151
return "setsockopt(TCP_FASTOPEN) failed";
5252
} else {
53-
#ifdef __linux__
53+
#if __linux__ || __GNU__
5454
FF_DEBUG("Successfully set TCP_FASTOPEN option, queue length: %d", flag);
5555
#elif defined(__APPLE__)
5656
FF_DEBUG("Successfully set TCP_FASTOPEN_FORCE_ENABLE option");

src/detection/displayserver/linux/wayland/wayland.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626

2727
static bool waylandDetectWM(int fd, FFDisplayServerResult* result)
2828
{
29-
#if __linux__ || (__FreeBSD__ && !__DragonFly__)
29+
#if __linux__ || __GNU__ || (__FreeBSD__ && !__DragonFly__)
3030

31-
#if __linux
31+
#if __linux__ || __GNU__
3232
struct ucred ucred = {};
3333
socklen_t len = sizeof(ucred);
3434
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == -1 || ucred.pid <= 0)

src/detection/os/os_linux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ void ffDetectOSImpl(FFOSResult* os)
370370
{
371371
detectOS(os);
372372

373-
#ifdef __linux__
373+
#if __linux__ || __GNU__
374374
if(ffStrbufEqualS(&os->id, "ubuntu"))
375375
getUbuntuFlavour(os);
376376
else if(ffStrbufEqualS(&os->id, "debian"))

src/detection/terminalshell/terminalshell_linux.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ static void getTerminalFromEnv(FFTerminalResult* result)
240240
}
241241
#endif
242242

243-
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
243+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__GNU__)
244244
//Konsole
245245
else if(
246246
getenv("KONSOLE_VERSION") != NULL
@@ -333,7 +333,7 @@ static void setTerminalInfoDetails(FFTerminalResult* result)
333333
else if(ffStrbufEqualS(&result->processName, "com.termux"))
334334
ffStrbufInitStatic(&result->prettyName, "Termux");
335335

336-
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
336+
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__GNU__)
337337

338338
else if(ffStrbufStartsWithS(&result->processName, "gnome-terminal"))
339339
ffStrbufInitStatic(&result->prettyName, "GNOME Terminal");

src/detection/users/users_linux.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define setutxent setutent
1111
#define getutxent getutent
1212
#endif
13-
#ifdef __linux__
13+
#if __linux__ || __GNU__
1414
#include <netinet/in.h>
1515
#include <arpa/inet.h>
1616
#endif
@@ -40,7 +40,7 @@ const char* ffDetectUsers(FFUsersOptions* options, FFlist* users)
4040
ffStrbufInitS(&user->hostName, n->ut_host);
4141
ffStrbufInitS(&user->sessionName, n->ut_line);
4242
ffStrbufInit(&user->clientIp);
43-
#ifdef __linux__
43+
#if __linux__ || __GNU__
4444
bool isIpv6 = false;
4545
for (int i = 1; i < 4; ++i) {
4646
if (n->ut_addr_v6[i] != 0) {

src/options/general.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const char* ffOptionsParseGeneralJsonConfig(FFOptionsGeneral* options, yyjson_va
3030
else if (unsafe_yyjson_equals_str(key, "detectVersion"))
3131
options->detectVersion = yyjson_get_bool(val);
3232

33-
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
33+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(__GNU__)
3434
else if (unsafe_yyjson_equals_str(key, "playerName"))
3535
ffStrbufSetJsonVal(&options->playerName, val);
3636
else if (unsafe_yyjson_equals_str(key, "dsForceDrm"))
@@ -73,7 +73,7 @@ bool ffOptionsParseGeneralCommandLine(FFOptionsGeneral* options, const char* key
7373
else if(ffStrEqualsIgnCase(key, "--detect-version"))
7474
options->detectVersion = ffOptionParseBoolean(value);
7575

76-
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
76+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(__GNU__)
7777
else if(ffStrEqualsIgnCase(key, "--player-name"))
7878
ffOptionParseString(key, value, &options->playerName);
7979
else if(ffStrEqualsIgnCase(key, "--ds-force-drm"))
@@ -102,7 +102,7 @@ void ffOptionsInitGeneral(FFOptionsGeneral* options)
102102
options->multithreading = true;
103103
options->detectVersion = true;
104104

105-
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
105+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(__GNU__)
106106
ffStrbufInit(&options->playerName);
107107
options->dsForceDrm = FF_DS_FORCE_DRM_TYPE_FALSE;
108108
#elif defined(_WIN32)
@@ -112,7 +112,7 @@ void ffOptionsInitGeneral(FFOptionsGeneral* options)
112112

113113
void ffOptionsDestroyGeneral(FF_MAYBE_UNUSED FFOptionsGeneral* options)
114114
{
115-
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
115+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(__GNU__)
116116
ffStrbufDestroy(&options->playerName);
117117
#endif
118118
}
@@ -127,7 +127,7 @@ void ffOptionsGenerateGeneralJsonConfig(FFOptionsGeneral* options, yyjson_mut_do
127127

128128
yyjson_mut_obj_add_bool(doc, obj, "detectVersion", options->detectVersion);
129129

130-
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
130+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(__GNU__)
131131

132132
yyjson_mut_obj_add_strbuf(doc, obj, "playerName", &options->playerName);
133133

src/util/smbiosHelper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const FFSmbiosHeader* ffSmbiosNextEntry(const FFSmbiosHeader* header)
5252
return (const FFSmbiosHeader*) (p + 1);
5353
}
5454

55-
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__) || defined(__OpenBSD__)
55+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__) || defined(__OpenBSD__) || defined(__GNU__)
5656
#include <fcntl.h>
5757
#include <sys/stat.h>
5858
#include <sys/types.h>
@@ -143,7 +143,7 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
143143
{
144144
FF_DEBUG("Initializing SMBIOS buffer");
145145
ffStrbufInit(&buffer);
146-
#if !__HAIKU__ && !__OpenBSD__ && !__DragonFly__
146+
#if !__HAIKU__ && !__OpenBSD__ && !__DragonFly__ && !__GNU__
147147
#ifdef __linux__
148148
FF_DEBUG("Using Linux implementation - trying /sys/firmware/dmi/tables/DMI");
149149
if (!ffAppendFileBuffer("/sys/firmware/dmi/tables/DMI", &buffer))

0 commit comments

Comments
 (0)