serenity/Ports/make/patches/0002-Stub-getdtablesize-for-serenity.patch

42 lines
900 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andreas Kling <kling@serenityos.org>
Date: Tue, 15 Dec 2020 01:06:18 +0100
Subject: [PATCH] Stub getdtablesize() for serenity
---
lib/getdtablesize.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c
index 0fe7092..a14d697 100644
--- a/lib/getdtablesize.c
+++ b/lib/getdtablesize.c
@@ -20,6 +20,10 @@
/* Specification. */
#include <unistd.h>
+#ifdef __serenity__
+# include <sys/select.h>
+#endif
+
#if defined _WIN32 && ! defined __CYGWIN__
# include <stdio.h>
@@ -109,6 +113,9 @@ getdtablesize (void)
int
getdtablesize (void)
{
+#ifdef __serenity__
+ return FD_SETSIZE;
+#else
struct rlimit lim;
if (getrlimit (RLIMIT_NOFILE, &lim) == 0
@@ -119,6 +126,7 @@ getdtablesize (void)
return lim.rlim_cur;
return INT_MAX;
+#endif
}
#endif