Skip to content

Commit 06a8f6b

Browse files
committed
add support for musl targets
1 parent ca76a70 commit 06a8f6b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/system/mod.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,17 @@ fn close_range(min_fd: c_uint, max_fd: c_uint) -> io::Result<()> {
120120
// - any errors while closing a specific fd will be effectively ignored
121121
// - if the provided range or flags are invalid, that will be reported
122122
// as an error but will not cause undefined behaviour
123-
cerr(unsafe { libc::close_range(min_fd, max_fd, 0) })?;
123+
unsafe {
124+
#[cfg(not(all(target_os = "linux", target_env = "musl")))]
125+
cerr(libc::close_range(min_fd, max_fd, 0))?;
126+
#[cfg(all(target_os = "linux", target_env = "musl"))]
127+
cerr(libc::syscall(
128+
libc::SYS_close_range,
129+
min_fd,
130+
max_fd,
131+
0 as c_uint,
132+
))?;
133+
}
124134
}
125135

126136
Ok(())

0 commit comments

Comments
 (0)