Commit f59dc111 authored by Tomohito Esaki's avatar Tomohito Esaki

weston: Add set up SIGUSR1 blocking early using pthread_sigmask()

Xwayland block SIGUSR1 signal for handling this signal. However, if some
weston plugins creates additional threads before xwayland is loaded,
this signal get delivered these threads and causes weston quit.
Therefore, we should set up SIGUSR1 blocking early so that these threads
can inherit the setting when created.
Signed-off-by: Tomohito Esaki's avatarTomohito Esaki <etom@igel.co.jp>
parent b1fb00db
......@@ -187,11 +187,13 @@ weston_LDFLAGS = -export-dynamic
weston_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON \
-DMODULEDIR='"$(moduledir)"' \
-DXSERVER_PATH='"@XSERVER_PATH@"'
weston_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBINPUT_BACKEND_CFLAGS)
weston_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBINPUT_BACKEND_CFLAGS) \
$(PTHREAD_CFLAGS)
weston_LDADD = libshared.la libweston-@LIBWESTON_MAJOR@.la \
$(COMPOSITOR_LIBS) \
$(DL_LIBS) $(LIBINPUT_BACKEND_LIBS) \
$(CLOCK_GETRES_LIBS) \
$(PTHREAD_LIBS) \
-lm
weston_SOURCES = \
......
......@@ -2531,6 +2531,8 @@ int main(int argc, char *argv[])
struct weston_seat *seat;
struct wet_compositor wet = { 0 };
int require_input;
sigset_t mask;
int32_t wait_for_debugger = 0;
struct wl_protocol_logger *protologger = NULL;
......@@ -2601,6 +2603,14 @@ int main(int argc, char *argv[])
if (!signals[0] || !signals[1] || !signals[2] || !signals[3])
goto out_signals;
/* Xwayland uses SIGUSR1 for communicating with weston. Since some
weston plugins may create additional threads, set up any necessary
signal blocking early so that these threads can inherit the settings
when created. */
sigemptyset(&mask);
sigaddset(&mask, SIGUSR1);
pthread_sigmask(SIG_BLOCK, &mask, NULL);
if (load_configuration(&config, noconfig, config_file) < 0)
goto out_signals;
wet.config = config;
......
......@@ -91,6 +91,9 @@ AC_ARG_VAR([WESTON_SHELL_CLIENT],
PKG_PROG_PKG_CONFIG()
# Check pthread
AX_PTHREAD
# Check for dlsym instead of dlopen because ASAN hijacks the latter
WESTON_SEARCH_LIBS([DL], [dl], [dlsym])
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment