summaryrefslogtreecommitdiffstats
path: root/ctx.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2021-05-20 13:03:31 -0400
committerTavian Barnes <tavianator@tavianator.com>2021-05-20 16:33:17 -0400
commit69a5227098b87b048a90ceb1ca7b169c02ba151e (patch)
tree088c97c93c4f36c0d128a817dfc372704033f14a /ctx.h
parentb08424dd960c2241ce14a61c0241c90f612cd6b4 (diff)
downloadbfs-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.h6
1 files changed, 6 insertions, 0 deletions
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 <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;
};
/**