[mutter/wip/wayland-work: 34/42] Stop messing with process groups and standard streams



commit fea6e8926bd4bf7606b849ff5b5a0893ce74f317
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Wed Aug 21 10:42:46 2013 +0200

    Stop messing with process groups and standard streams
    
    We can be launched by gnome-session now, which implies:
    1) gdb must attached from outside (and the Ctrl-C problem is gone)
    2) stdin is /dev/null already
    3) stdout is the journal, not the terminal
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706421

 src/wayland/meta-wayland.c  |   20 --------------------
 src/wayland/meta-xwayland.c |    8 ++------
 2 files changed, 2 insertions(+), 26 deletions(-)
---
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 9ae31ec..0902571 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -1695,8 +1695,6 @@ meta_wayland_init (void)
   if (compositor->drm_fd >= 0)
     {
       GError *error;
-      char path[PATH_MAX];
-      int fd;
 
       /* Running on bare metal, let's initalize DRM master and VT handling */
       compositor->tty = meta_tty_new ();
@@ -1713,24 +1711,6 @@ meta_wayland_init (void)
          g_error ("Failed to become DRM master: %s", error->message);
          g_error_free (error);
        }
-
-      /* Open a log in the home directory. This is necessary because otherwise
-        all background processes (such as gnome-session and children) get SIGTTOU
-        trying to write to the terminal.
-
-        Then close (</dev/null) stdin, so we don't get SIGTTIN or other crazy stuff.
-      */
-      snprintf(path, PATH_MAX, "%s/gnome-wayland.log", g_get_user_cache_dir ());
-      fd = open (path, O_WRONLY | O_APPEND | O_CREAT | O_TRUNC, 0600);
-      if (fd < 0)
-       fd = open ("/dev/null", O_WRONLY | O_NOCTTY, 0600);
-
-      dup2 (fd, STDOUT_FILENO);
-      dup2 (fd, STDERR_FILENO);
-      close (fd);
-
-      fd = open ("/dev/null", O_WRONLY | O_NOCTTY, 0600);
-      dup2 (fd, STDIN_FILENO);
     }
 
   meta_monitor_manager_initialize ();
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 3b3c699..49cc51d 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -269,7 +269,7 @@ bind_to_unix_socket (int display)
 }
 
 static void
-uncloexec_and_setpgid (gpointer user_data)
+uncloexec (gpointer user_data)
 {
   int fd = GPOINTER_TO_INT (user_data);
 
@@ -278,10 +278,6 @@ uncloexec_and_setpgid (gpointer user_data)
   int flags = fcntl (fd, F_GETFD);
   if (flags != -1)
     fcntl (fd, F_SETFD, flags & ~FD_CLOEXEC);
-
-  /* Put this process in a background process group, so that Ctrl-C
-     goes to mutter only */
-  setpgid (0, 0);
 }
 
 static void
@@ -401,7 +397,7 @@ meta_xwayland_start (MetaWaylandCompositor *compositor)
                      G_SPAWN_DO_NOT_REAP_CHILD |
                      G_SPAWN_STDOUT_TO_DEV_NULL |
                      G_SPAWN_STDERR_TO_DEV_NULL,
-                     uncloexec_and_setpgid,
+                     uncloexec,
                      GINT_TO_POINTER (sp[1]),
                      &pid,
                      &error))


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