forge
Explore
Log in

Don't you dare go Hollow

Building with systemd on musl libc systems

Browse files at this commit

4c9df7eb5b5eadbdb7e42e035147e1c2acb0a7daVal PackettParent: 6e8fd15
  • fix
    • building with systemd on musl libc systems
Show full message
fix: building with systemd on musl libc systems

This mostly affects postmarketOS as we're the ones pushing musl+systemd
the most currently.
src/utils/spawning.rsmodified+13 -0
@@ -211,8 +211,21 @@ mod systemd {
211211 use super::*;
212212
213213 pub fn do_spawn(command: &OsStr, mut process: Command) -> Option<Child> {
214+ #[cfg(target_env = "gnu")]
214215 use libc::close_range;
215216
217+ #[cfg(not(target_env = "gnu"))] // musl
218+ pub fn close_range(first: libc::c_uint, last: libc::c_uint, flags: libc::c_uint) -> i64 {
219+ unsafe {
220+ libc::syscall(
221+ libc::SYS_close_range,
222+ first as usize,
223+ last as usize,
224+ flags as usize,
225+ )
226+ }
227+ }
228+
216229 // When running as a systemd session, we want to put children into their own transient
217230 // scopes in order to separate them from the niri process. This is helpful for
218231 // example to prevent the OOM killer from taking down niri together with a