From 69a5227098b87b048a90ceb1ca7b169c02ba151e Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 20 May 2021 13:03:31 -0400 Subject: 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()). --- ctx.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ctx.h') diff --git a/ctx.h b/ctx.h index 35eee76..7af4060 100644 --- a/ctx.h +++ b/ctx.h @@ -24,6 +24,7 @@ #include "bftw.h" #include "trie.h" #include +#include /** * 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; }; /** -- cgit v1.2.3