diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-11-28 17:28:54 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-28 17:28:54 -0500 |
commit | 2d4c46c975eb916dc622cc729a1a8d397582a76f (patch) | |
tree | 445e819117acd2f94ffc9d7da7ed8e3e604435d0 /cli/unix_util.rs | |
parent | f526513d74d34ac254aa40ef9b73238cb21c395b (diff) |
refactor: create util folder, move nap_sym to napi/sym, move http_cache to cache folder (#16857)
Diffstat (limited to 'cli/unix_util.rs')
-rw-r--r-- | cli/unix_util.rs | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/cli/unix_util.rs b/cli/unix_util.rs deleted file mode 100644 index f282f6cfe..000000000 --- a/cli/unix_util.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. - -/// Raise soft file descriptor limit to hard file descriptor limit. -/// This is the difference between `ulimit -n` and `ulimit -n -H`. -pub fn raise_fd_limit() { - #[cfg(unix)] - // TODO(bartlomieju): - #[allow(clippy::undocumented_unsafe_blocks)] - unsafe { - let mut limits = libc::rlimit { - rlim_cur: 0, - rlim_max: 0, - }; - - if 0 != libc::getrlimit(libc::RLIMIT_NOFILE, &mut limits) { - return; - } - - if limits.rlim_cur == libc::RLIM_INFINITY { - return; - } - - // No hard limit? Do a binary search for the effective soft limit. - if limits.rlim_max == libc::RLIM_INFINITY { - let mut min = limits.rlim_cur; - let mut max = 1 << 20; - - while min + 1 < max { - limits.rlim_cur = min + (max - min) / 2; - match libc::setrlimit(libc::RLIMIT_NOFILE, &limits) { - 0 => min = limits.rlim_cur, - _ => max = limits.rlim_cur, - } - } - - return; - } - - // Raise the soft limit to the hard limit. - if limits.rlim_cur < limits.rlim_max { - limits.rlim_cur = limits.rlim_max; - libc::setrlimit(libc::RLIMIT_NOFILE, &limits); - } - } -} |