diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-11-06 10:03:43 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-11-06 10:07:50 -0500 |
commit | 816574513e0e163aff9f183721697f157eb158fa (patch) | |
tree | 3cde4d557838a9af08803e5314350f81276129af /src/eval.c | |
parent | 5fb1ed2d9803bfa5eefdc49ae232f9ea4afff018 (diff) | |
download | bfs-816574513e0e163aff9f183721697f157eb158fa.tar.xz |
bfstd: Expose rlim_cmp()
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 33 |
1 files changed, 0 insertions, 33 deletions
@@ -1427,39 +1427,6 @@ done: return state.action; } -/** Check if an rlimit value is infinite. */ -static bool rlim_isinf(rlim_t r) { - // Consider RLIM_{INFINITY,SAVED_{CUR,MAX}} all equally infinite - if (r == RLIM_INFINITY) { - return true; - } - -#ifdef RLIM_SAVED_CUR - if (r == RLIM_SAVED_CUR) { - return true; - } -#endif - -#ifdef RLIM_SAVED_MAX - if (r == RLIM_SAVED_MAX) { - return true; - } -#endif - - return false; -} - -/** Compare two rlimit values, accounting for RLIM_INFINITY etc. */ -static int rlim_cmp(rlim_t a, rlim_t b) { - bool a_inf = rlim_isinf(a); - bool b_inf = rlim_isinf(b); - if (a_inf || b_inf) { - return a_inf - b_inf; - } - - return (a > b) - (a < b); -} - /** Raise RLIMIT_NOFILE if possible, and return the new limit. */ static int raise_fdlimit(const struct bfs_ctx *ctx) { rlim_t target = 64 << 10; |