We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 32d34bc + f968177 commit 9afe8a3Copy full SHA for 9afe8a3
1 file changed
Modules/_posixsubprocess.c
@@ -14,6 +14,9 @@
14
#ifdef HAVE_SYS_SYSCALL_H
15
#include <sys/syscall.h>
16
#endif
17
+#if defined(HAVE_SYS_RESOURCE_H)
18
+#include <sys/resource.h>
19
+#endif
20
#ifdef HAVE_DIRENT_H
21
#include <dirent.h>
22
@@ -174,6 +177,13 @@ safe_get_max_fd(void)
174
177
if (local_max_fd >= 0)
175
178
return local_max_fd;
176
179
180
+#if defined(HAVE_SYS_RESOURCE_H) && defined(__OpenBSD__)
181
+ struct rlimit rl;
182
+ /* Not on the POSIX async signal safe functions list but likely
183
+ * safe. TODO - Someone should audit OpenBSD to make sure. */
184
+ if (getrlimit(RLIMIT_NOFILE, &rl) >= 0)
185
+ return (long) rl.rlim_max;
186
187
#ifdef _SC_OPEN_MAX
188
local_max_fd = sysconf(_SC_OPEN_MAX);
189
if (local_max_fd == -1)
0 commit comments