Skip to content

Commit

Permalink
Fix build with musl
Browse files Browse the repository at this point in the history
  • Loading branch information
losynix committed Aug 20, 2024
1 parent 7ba9d30 commit 717e0f4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions usbsas-sandbox/src/fswriter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ pub fn seccomp(fd_in_file: RawFd, comm_in: RawFd, comm_out: RawFd) -> Result<()>
Syscall::ioctl,
&[
Comparator::new(0, Cmp::Eq, 1, None),
#[cfg(target_env = "musl")]
Comparator::new(1, Cmp::Eq, libc::TCGETS as u64, None),
#[cfg(not(target_env = "musl"))]
Comparator::new(1, Cmp::Eq, libc::TCGETS, None),
],
)?;
Expand All @@ -32,6 +35,9 @@ pub fn seccomp(fd_in_file: RawFd, comm_in: RawFd, comm_out: RawFd) -> Result<()>
Syscall::ioctl,
&[
Comparator::new(0, Cmp::Eq, 2, None),
#[cfg(target_env = "musl")]
Comparator::new(1, Cmp::Eq, libc::TCGETS as u64, None),
#[cfg(not(target_env = "musl"))]
Comparator::new(1, Cmp::Eq, libc::TCGETS, None),
],
)?;
Expand All @@ -41,6 +47,9 @@ pub fn seccomp(fd_in_file: RawFd, comm_in: RawFd, comm_out: RawFd) -> Result<()>
Syscall::ioctl,
&[
Comparator::new(0, Cmp::Eq, 2, None),
#[cfg(target_env = "musl")]
Comparator::new(1, Cmp::Eq, libc::TIOCGWINSZ as u64, None),
#[cfg(not(target_env = "musl"))]
Comparator::new(1, Cmp::Eq, libc::TIOCGWINSZ, None),
],
)?;
Expand Down
9 changes: 9 additions & 0 deletions usbsas-sandbox/src/imager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ pub fn seccomp(fds_read: Vec<RawFd>, fds_write: Vec<RawFd>) -> Result<()> {
Syscall::ioctl,
&[
Comparator::new(0, Cmp::Eq, 1, None),
#[cfg(target_env = "musl")]
Comparator::new(1, Cmp::Eq, libc::TCGETS as u64, None),
#[cfg(not(target_env = "musl"))]
Comparator::new(1, Cmp::Eq, libc::TCGETS, None),
],
)?;
Expand All @@ -24,6 +27,9 @@ pub fn seccomp(fds_read: Vec<RawFd>, fds_write: Vec<RawFd>) -> Result<()> {
Syscall::ioctl,
&[
Comparator::new(0, Cmp::Eq, 2, None),
#[cfg(target_env = "musl")]
Comparator::new(1, Cmp::Eq, libc::TCGETS as u64, None),
#[cfg(not(target_env = "musl"))]
Comparator::new(1, Cmp::Eq, libc::TCGETS, None),
],
)?;
Expand All @@ -33,6 +39,9 @@ pub fn seccomp(fds_read: Vec<RawFd>, fds_write: Vec<RawFd>) -> Result<()> {
Syscall::ioctl,
&[
Comparator::new(0, Cmp::Eq, 2, None),
#[cfg(target_env = "musl")]
Comparator::new(1, Cmp::Eq, libc::TIOCGWINSZ as u64, None),
#[cfg(not(target_env = "musl"))]
Comparator::new(1, Cmp::Eq, libc::TIOCGWINSZ, None),
],
)?;
Expand Down
3 changes: 3 additions & 0 deletions usbsas-sandbox/src/seccomp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ pub(crate) fn new_context_with_common_rules(
Syscall::ioctl,
&[
Comparator::new(0, Cmp::Eq, 2, None),
#[cfg(target_env = "musl")]
Comparator::new(1, Cmp::Eq, libc::TCGETS as u64, None),
#[cfg(not(target_env = "musl"))]
Comparator::new(1, Cmp::Eq, libc::TCGETS, None),
],
)?;
Expand Down

0 comments on commit 717e0f4

Please sign in to comment.