compositor: Use sigaction to trap SIGINT
signalfd interacts badly with gdb's signal trapping - when hitting ctrl-c in a debugger attached to weston, weston will receive the signal. This results in weston exiting cleanly when the intent was to use gdb to interfere with its operation. Trapping SIGINT was introduced in commit 50dc6989 which ensured we would call wl_display_terminate() on SIGINT or SIGTERM to clean up our socket. Killing weston with SIGINT is quite common for several developers, so it's important to preserve this clean shutdown behaviour, so we can't naively stop trapping SIGINT entirely. Instead, use the sigaction() function to trap SIGINT, and have the SIGINT handler send weston SIGUSR2 (SIGUSR1 is already used by xwayland). SIGUSR2 can be trapped in the proper wayland way via wl_event_loop_add_signal(). This way we can properly break our event loop and clean up on SIGINT, but we can also have gdb intercept SIGINT. There are other ways around this, but I'm hoping this one allows people to continue using ctrl-c to stop weston, and doesn't require additional project specific gdb knowledge. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Loading
Please register or sign in to comment