mirror of
https://github.com/tmux/tmux.git
synced 2025-12-21 14:56:05 +00:00
Move cgroup dbus requests to the child
This avoids a race where a spawned child that quickly forks will have only the parent process moved to the newly created cgroup, leaving the early children in tmux's own cgroup. It also avoids problems if the spawned process inspects or changes its own cgroup.
This commit is contained in:
21
spawn.c
21
spawn.c
@@ -382,20 +382,19 @@ spawn_pane(struct spawn_context *sc, char **cause)
|
||||
|
||||
/* In the parent process, everything is done now. */
|
||||
if (new_wp->pid != 0) {
|
||||
#if defined(HAVE_SYSTEMD) && defined(ENABLE_CGROUPS)
|
||||
/*
|
||||
* Move the child process into a new cgroup for systemd-oomd
|
||||
* isolation.
|
||||
*/
|
||||
if (systemd_move_pid_to_new_cgroup(new_wp->pid, cause) < 0) {
|
||||
log_debug("%s: moving pane to new cgroup failed: %s",
|
||||
__func__, *cause);
|
||||
free (*cause);
|
||||
}
|
||||
#endif
|
||||
goto complete;
|
||||
}
|
||||
|
||||
#if defined(HAVE_SYSTEMD) && defined(ENABLE_CGROUPS)
|
||||
/*
|
||||
* Move the child process into a new cgroup for systemd-oomd isolation.
|
||||
*/
|
||||
if (systemd_move_to_new_cgroup(cause) < 0) {
|
||||
log_debug("%s: moving pane to new cgroup failed: %s",
|
||||
__func__, *cause);
|
||||
free (*cause);
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Child process. Change to the working directory or home if that
|
||||
* fails.
|
||||
|
||||
Reference in New Issue
Block a user