Skip to content

Commit

Permalink
set fd limit when starting, up to threshold=65535
Browse files Browse the repository at this point in the history
  • Loading branch information
zephyrchien committed May 22, 2022
1 parent 2b8c0bd commit 4c4b9ca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "realm"
version = "2.3.3"
version = "2.3.4"
authors = ["zhboner <[email protected]>"]
edition = "2021"

Expand Down
3 changes: 2 additions & 1 deletion src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ fn handle_matches(matches: ArgMatches) -> CmdInput {
#[cfg(all(unix, not(target_os = "android")))]
{
use realm_syscall::{get_nofile_limit, set_nofile_limit};
const THRESHOLD: u64 = 65535;

let nofile = matches.value_of("nofile").map_or_else(
|| get_nofile_limit().map_or(None, |(_, hard)| Some(hard)),
|| get_nofile_limit().map_or(None, |(_, hard)| Some(if hard > THRESHOLD { THRESHOLD } else { hard })),
|nofile| Some(nofile.parse().unwrap()),
);

Expand Down

0 comments on commit 4c4b9ca

Please sign in to comment.