[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] getdtablesize: support systems without getrlimit like WASI
From: |
Yuta Saito |
Subject: |
[PATCH] getdtablesize: support systems without getrlimit like WASI |
Date: |
Sat, 4 May 2024 13:59:44 +0000 |
* lib/getdtablesize.c (getdtablesize): Return INT_MAX if getrlimit
is not available. This is the case for WASI, WebAssembly System
Interface.
* m4/getdtablesize.m4 (gl_PREREQ_GETDTABLESIZE): Check for getrlimit.
---
ChangeLog | 8 ++++++++
lib/getdtablesize.c | 2 ++
m4/getdtablesize.m4 | 6 ++++--
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 96b29b7fc4..1ef678a316 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-05-04 Yuta Saito <kateinoigakukun@gmail.com>
+
+ getdtablesize: support systems without getrlimit like WASI
+ * lib/getdtablesize.c (getdtablesize): Return INT_MAX if getrlimit
+ is not available. This is the case for WASI, WebAssembly System
+ Interface.
+ * m4/getdtablesize.m4 (gl_PREREQ_GETDTABLESIZE): Check for getrlimit.
+
2024-05-03 Collin Funk <collin.funk1@gmail.com>
gnulib-tool.py: Fix an undefined function name.
diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c
index 762c100b38..fca937a39a 100644
--- a/lib/getdtablesize.c
+++ b/lib/getdtablesize.c
@@ -109,6 +109,7 @@ getdtablesize (void)
int
getdtablesize (void)
{
+# if HAVE_GETRLIMIT
struct rlimit lim;
if (getrlimit (RLIMIT_NOFILE, &lim) == 0
@@ -117,6 +118,7 @@ getdtablesize (void)
&& lim.rlim_cur != RLIM_SAVED_CUR
&& lim.rlim_cur != RLIM_SAVED_MAX)
return lim.rlim_cur;
+# endif
return INT_MAX;
}
diff --git a/m4/getdtablesize.m4 b/m4/getdtablesize.m4
index aaefe9b298..7059eb933e 100644
--- a/m4/getdtablesize.m4
+++ b/m4/getdtablesize.m4
@@ -1,5 +1,5 @@
# getdtablesize.m4
-# serial 8
+# serial 9
dnl Copyright (C) 2008-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -61,4 +61,6 @@ AC_DEFUN([gl_FUNC_GETDTABLESIZE],
])
# Prerequisites of lib/getdtablesize.c.
-AC_DEFUN([gl_PREREQ_GETDTABLESIZE], [:])
+AC_DEFUN([gl_PREREQ_GETDTABLESIZE], [
+ AC_CHECK_FUNCS_ONCE([getrlimit])
+])
--
2.43.2
- [PATCH] getdtablesize: support systems without getrlimit like WASI,
Yuta Saito <=