diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2021-05-20 13:03:31 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2021-05-20 16:33:17 -0400 |
commit | 69a5227098b87b048a90ceb1ca7b169c02ba151e (patch) | |
tree | 088c97c93c4f36c0d128a817dfc372704033f14a /ctx.h | |
parent | b08424dd960c2241ce14a61c0241c90f612cd6b4 (diff) | |
download | bfs-69a5227098b87b048a90ceb1ca7b169c02ba151e.tar.xz |
eval: Raise RLIMIT_NOFILE if possible
This lets us keep more open FDs cached in bftw(). The limit is lowered
before running -exec commands, in case they're incompatible with a high
limit (e.g. due to select()).
Diffstat (limited to 'ctx.h')
-rw-r--r-- | ctx.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -24,6 +24,7 @@ #include "bftw.h" #include "trie.h" #include <stdbool.h> +#include <sys/resource.h> /** * Various debugging flags. @@ -117,6 +118,11 @@ struct bfs_ctx { struct trie files; /** The number of files owned by the context. */ int nfiles; + + /** The initial RLIMIT_NOFILE soft limit. */ + rlim_t nofile_soft; + /** The initial RLIMIT_NOFILE hard limit. */ + rlim_t nofile_hard; }; /** |