aboutsummaryrefslogtreecommitdiff
path: root/src/utils/spawning.rs
diff options
context:
space:
mode:
authorVal Packett <val@packett.cool>2025-10-30 01:29:52 -0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-10-30 07:54:54 +0300
commit4c9df7eb5b5eadbdb7e42e035147e1c2acb0a7da (patch)
tree6d3bd5cac9f907bb5b44f1ed87014b6662dce1be /src/utils/spawning.rs
parent6e8fd153395036c2daa7c214695ed9baf2409a2e (diff)
downloadniri-4c9df7eb5b5eadbdb7e42e035147e1c2acb0a7da.tar.gz
niri-4c9df7eb5b5eadbdb7e42e035147e1c2acb0a7da.tar.bz2
niri-4c9df7eb5b5eadbdb7e42e035147e1c2acb0a7da.zip
fix: building with systemd on musl libc systems
This mostly affects postmarketOS as we're the ones pushing musl+systemd the most currently.
Diffstat (limited to 'src/utils/spawning.rs')
-rw-r--r--src/utils/spawning.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utils/spawning.rs b/src/utils/spawning.rs
index 61912eae..ba7564c2 100644
--- a/src/utils/spawning.rs
+++ b/src/utils/spawning.rs
@@ -211,8 +211,21 @@ mod systemd {
use super::*;
pub fn do_spawn(command: &OsStr, mut process: Command) -> Option<Child> {
+ #[cfg(target_env = "gnu")]
use libc::close_range;
+ #[cfg(not(target_env = "gnu"))] // musl
+ pub fn close_range(first: libc::c_uint, last: libc::c_uint, flags: libc::c_uint) -> i64 {
+ unsafe {
+ libc::syscall(
+ libc::SYS_close_range,
+ first as usize,
+ last as usize,
+ flags as usize,
+ )
+ }
+ }
+
// When running as a systemd session, we want to put children into their own transient
// scopes in order to separate them from the niri process. This is helpful for
// example to prevent the OOM killer from taking down niri together with a