diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2011-06-21 17:43:31 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2011-06-21 17:43:31 -0400 |
commit | d4af320178ec0502d98104b3d57fb4925ee12992 (patch) | |
tree | 9de662ecbcb47eb0293b245440169f63731547f2 | |
parent | 27da538ab525c8f72e0d8aaa84f9cdc25c7c9248 (diff) |
meego-tablet-shell: Use central sigchild handler
-rw-r--r-- | compositor/meego-tablet-shell.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/compositor/meego-tablet-shell.c b/compositor/meego-tablet-shell.c index e513172..75216f3 100644 --- a/compositor/meego-tablet-shell.c +++ b/compositor/meego-tablet-shell.c @@ -52,8 +52,7 @@ struct meego_tablet_shell { struct wlsc_shell shell; struct wlsc_compositor *compositor; - struct wl_event_source *sigchld_source; - pid_t pid; + struct wlsc_process process; struct wlsc_input_device *device; struct wl_client *client; @@ -92,18 +91,16 @@ struct meego_tablet_zoom { void (*done)(struct meego_tablet_zoom *zoom); }; -static int -sigchld_handler(int signal_number, void *data) + +static void +meego_tablet_shell_sigchld(struct wlsc_process *process, int status) { - struct meego_tablet_shell *shell = data; - int status; + struct meego_tablet_shell *shell = + container_of(process, struct meego_tablet_shell, process); - wait(&status); - shell->pid = 0; + shell->process.pid = 0; fprintf(stderr, "meego-ux-daemon crashed, exit code %d\n", status); - - return 1; } static void @@ -473,8 +470,10 @@ launch_ux_daemon(struct meego_tablet_shell *shell) return; } - shell->pid = fork(); - switch (shell->pid) { + shell->process.pid = fork(); + shell->process.cleanup = meego_tablet_shell_sigchld; + + switch (shell->process.pid) { case 0: /* SOCK_CLOEXEC closes both ends, so we need to unset * the flag on the client fd. */ @@ -495,6 +494,7 @@ launch_ux_daemon(struct meego_tablet_shell *shell) close(sv[1]); shell->client = wl_client_create(compositor->wl_display, sv[0]); + wlsc_watch_process(&shell->process); break; case -1: @@ -640,10 +640,6 @@ shell_init(struct wlsc_compositor *compositor) wl_display_add_global(compositor->wl_display, &shell->object, NULL); loop = wl_display_get_event_loop(compositor->wl_display); - shell->sigchld_source = - wl_event_loop_add_signal(loop, SIGCHLD, - sigchld_handler, shell); - shell->long_press_source = wl_event_loop_add_timer(loop, long_press_handler, shell); |