diff -r 5c0247a6f98a Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c Fri Apr 24 12:02:53 2015 -0400 +++ b/Modules/_posixsubprocess.c Fri Apr 24 13:47:43 2015 -0700 @@ -14,6 +14,9 @@ #ifdef HAVE_SYS_SYSCALL_H #include #endif +#if defined(HAVE_SYS_RESOURCE_H) +#include +#endif #ifdef HAVE_DIRENT_H #include #endif @@ -174,6 +177,11 @@ if (local_max_fd >= 0) return local_max_fd; #endif +#if defined(HAVE_SYS_RESOURCE_H) && defined(__OpenBSD__) + struct rlimit rl; + if (getrlimit(RLIMIT_NOFILE, &rl) >= 0) + return (long) rl.rlim_max; +#endif #ifdef _SC_OPEN_MAX local_max_fd = sysconf(_SC_OPEN_MAX); if (local_max_fd == -1)