[gnome-terminal/benzea/systemd-integration: 3/7] screen: Try to move new processes into a separate systemd scope



commit 3f1521c7774e2c9f548e067c3a5d3c8738ab95a7
Author: Benjamin Berg <bberg redhat com>
Date:   Mon Feb 3 14:40:15 2020 +0100

    screen: Try to move new processes into a separate systemd scope
    
    To separate child processe from the main gnome-terminal process we
    should place them into separate cgroups. Try to do so by calling the
    approprate systemd function to move the pid into a new transient scope.

 src/terminal-screen.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index dc9f8447..8b91b1fb 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -58,6 +58,7 @@
 #include "terminal-window.h"
 #include "terminal-info-bar.h"
 #include "terminal-libgsystem.h"
+#include "terminal-systemd.h"
 
 #include "eggshell.h"
 
@@ -1632,6 +1633,10 @@ spawn_result_cb (VteTerminal *terminal,
     terminal_screen_show_info_bar (screen, error, can_reexec);
   }
 
+  /* Try to move child process into a new scope.
+   * Might be nice to embed the PTY number instead of using argv[0]. */
+  terminal_start_systemd_scope (exec_data->exec_argv[0], pid, NULL, NULL, NULL, NULL, NULL);
+
   /* Retain info for reexec, if possible */
   ExecData *new_exec_data = exec_data_clone (exec_data);
   terminal_screen_clear_exec_data (screen, FALSE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]