serenity/Ports/quake3/patches/0003-Engine-Add-sys-select.h-include-for-Serenity.patch

77 lines
2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jesse Buhagiar <jooster669@gmail.com>
Date: Fri, 25 Mar 2022 09:40:41 +1100
Subject: [PATCH] Engine: Add `<sys/select.h>` include for Serenity
QuakeIII makes extensive use of the `select()` syscall for its' netcode.
It seems that Linux has this in a header that isn't `<sys/select.h>`
like us, which results in an implicit declaration error.
---
code/qcommon/net_ip.c | 7 +++++++
code/sys/con_tty.c | 4 ++++
code/sys/sys_unix.c | 4 ++++
3 files changed, 15 insertions(+)
diff --git a/code/qcommon/net_ip.c b/code/qcommon/net_ip.c
index bcccda2..ea940f5 100644
--- a/code/qcommon/net_ip.c
+++ b/code/qcommon/net_ip.c
@@ -81,6 +81,10 @@ static qboolean winsockInitialized = qfalse;
# include <sys/filio.h>
# endif
+#ifdef __serenity__
+#include <sys/select.h>
+#endif
+
typedef int SOCKET;
# define INVALID_SOCKET -1
# define SOCKET_ERROR -1
@@ -996,6 +1000,7 @@ NET_JoinMulticast
Join an ipv6 multicast group
====================
*/
+#ifndef __serenity__
void NET_JoinMulticast6(void)
{
int err;
@@ -1059,6 +1064,8 @@ void NET_LeaveMulticast6()
}
}
+#endif
+
/*
====================
NET_OpenSocks
diff --git a/code/sys/con_tty.c b/code/sys/con_tty.c
index 58f178a..74e1c60 100644
--- a/code/sys/con_tty.c
+++ b/code/sys/con_tty.c
@@ -34,6 +34,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <fcntl.h>
#include <sys/time.h>
+#ifdef __serenity__
+#include <sys/select.h>
+#endif
+
/*
=============================================================
tty console routines
diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c
index e0c6323..05f311b 100644
--- a/code/sys/sys_unix.c
+++ b/code/sys/sys_unix.c
@@ -39,6 +39,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <fenv.h>
#include <sys/wait.h>
+#ifdef __serenity__
+#include <sys/select.h>
+#endif
+
qboolean stdinIsATTY;
// Used to determine where to store user-specific files