mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
fix: building with systemd on musl libc systems
This mostly affects postmarketOS as we're the ones pushing musl+systemd the most currently.
This commit is contained in:
committed by
Ivan Molodetskikh
parent
6e8fd15339
commit
4c9df7eb5b
@@ -211,8 +211,21 @@ mod systemd {
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
pub fn do_spawn(command: &OsStr, mut process: Command) -> Option<Child> {
|
pub fn do_spawn(command: &OsStr, mut process: Command) -> Option<Child> {
|
||||||
|
#[cfg(target_env = "gnu")]
|
||||||
use libc::close_range;
|
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
|
// 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
|
// 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
|
// example to prevent the OOM killer from taking down niri together with a
|
||||||
|
|||||||
Reference in New Issue
Block a user