Skip to content

Commit

Permalink
to handle musl systems
Browse files Browse the repository at this point in the history
  • Loading branch information
mitnk committed Sep 29, 2024
1 parent b035739 commit 4212a95
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 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
Expand Up @@ -2,7 +2,7 @@
edition = "2021"
build = "src/build.rs"
name = "cicada"
version = "1.0.2"
version = "1.0.3-dev"
authors = ["Hugo Wang <w@mitnk.com>"]

description = "A simple Bash-like Unix shell."
Expand Down
14 changes: 11 additions & 3 deletions src/builtins/ulimit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,23 @@ fn set_limit(limit_name: &str, value: u64, for_hard: bool) -> String {
}
}

// to support armv7-unknown-linux-gnueabihf
// to support armv7-linux-gnueabihf & 32-bit musl systems
if for_hard {
#[cfg(target_pointer_width = "32")]
#[cfg(all(target_pointer_width = "32", not(target_env = "musl")))]
{ rlp.rlim_max = value as u32; }

#[cfg(all(target_pointer_width = "32", target_env = "musl"))]
{ rlp.rlim_max = value as u64; }

#[cfg(target_pointer_width = "64")]
{ rlp.rlim_max = value; }
} else {
#[cfg(target_pointer_width = "32")]
#[cfg(all(target_pointer_width = "32", not(target_env = "musl")))]
{ rlp.rlim_cur = value as u32; }

#[cfg(all(target_pointer_width = "32", target_env = "musl"))]
{ rlp.rlim_cur = value as u64; }

#[cfg(target_pointer_width = "64")]
{ rlp.rlim_cur = value; }
}
Expand Down

0 comments on commit 4212a95

Please sign in to comment.