| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,6 +14,9 @@ | |||
| 14 | 14 | #ifdef HAVE_SYS_SYSCALL_H | |
| 15 | 15 | #include <sys/syscall.h> | |
| 16 | 16 | #endif | |
| 17 | + #if defined(HAVE_SYS_RESOURCE_H) | ||
| 18 | + #include <sys/resource.h> | ||
| 19 | + #endif | ||
| 17 | 20 | #ifdef HAVE_DIRENT_H | |
| 18 | 21 | #include <dirent.h> | |
| 19 | 22 | #endif | |
@@ -174,6 +177,13 @@ safe_get_max_fd(void) | |||
| 174 | 177 | if (local_max_fd >= 0) | |
| 175 | 178 | return local_max_fd; | |
| 176 | 179 | #endif | |
| 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 | + #endif | ||
| 177 | 187 | #ifdef _SC_OPEN_MAX | |
| 178 | 188 | local_max_fd = sysconf(_SC_OPEN_MAX); | |
| 179 | 189 | if (local_max_fd == -1) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments