wayland: don't use fork() and SIGCHLD to spawn processes

It is a very bad idea in a glib program (especially one heavily
using glib child watching facilities, like gnome-shell) to handle
SIGCHLD. While we're there, let's also use g_spawn_async, which
solves some malloc-after-fork problems and makes the code generally
cleaner.

https://bugzilla.gnome.org/show_bug.cgi?id=705816
This commit is contained in:
Giovanni Campagna
2013-08-12 09:46:07 +02:00
parent 152d896f75
commit 3803fd9511
4 changed files with 80 additions and 84 deletions

View File

@ -368,9 +368,6 @@ signal_handler (int signum)
case SIGTERM:
write (signal_pipe_fds[1], "T", 1);
break;
case SIGCHLD:
write (signal_pipe_fds[1], "C", 1);
break;
default:
break;
}
@ -407,11 +404,6 @@ on_signal (GIOChannel *source,
case 'T': /* SIGTERM */
meta_quit (META_EXIT_SUCCESS);
break;
#ifdef HAVE_WAYLAND
case 'C': /* SIGCHLD */
meta_wayland_handle_sig_child ();
break;
#endif
default:
g_warning ("Spurious character '%c' read from signal pipe", signal);
}
@ -460,13 +452,6 @@ meta_init (void)
g_printerr ("Failed to register SIGTERM handler: %s\n",
g_strerror (errno));
if (meta_is_wayland_compositor ())
{
if (sigaction (SIGCHLD, &act, NULL) < 0)
g_printerr ("Failed to register SIGCHLD handler: %s\n",
g_strerror (errno));
}
if (g_getenv ("MUTTER_VERBOSE"))
meta_set_verbose (TRUE);
if (g_getenv ("MUTTER_DEBUG"))