mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-14 08:22:25 -04:00
xwayland: Introduce xwayland_spawn_func_t
Spawning subprocesses is finicky, and the correct way to do it depends on the current process state which we have no control of. Signal masks, handlers, limits, scheduling and open file descriptors are a few examples of things that inadvertently get inherited and cause issues for either the parent or the child. We introduced a temporary workaround against common issues by clearing signal masks and signal handlers known to cause issues for Xwayland, but this was only a bandaid. Introduce xwayland_spawn_func_t, which allows the compositor to specify an implementation of a process spawner that will be used to launch Xwayland whenever needed. This spawner can then do any cleanup and accounting as the compositor sees fit. The spawner takes 4 arguments: The path to Xwayland, the arguments we have constructed for Xwayland, the environment variables that must be set for Xwayland, and the file descriptors that must have CLOEXEC cleared after fork but before exec to be correctly inherited by Xwayland. A default implementation is provided both for convenience and as a sample for implementers to look at.
This commit is contained in:
parent
ba7ac3efe5
commit
57f8cf9cd4
4 changed files with 68 additions and 76 deletions
|
|
@ -14,16 +14,24 @@
|
|||
#include <time.h>
|
||||
#include <wayland-server-core.h>
|
||||
|
||||
/**
|
||||
* Xwayland spawn function. pathname and args are compatible with the execv
|
||||
* family of functions. envp is a NULL terminated list of enironment variables
|
||||
* that must be added before exec, while uncloexec is a -1 terminated list of
|
||||
* file descriptors that must have CLOEXEC unset after fork but before exec.
|
||||
*/
|
||||
typedef bool (*xwayland_spawn_func_t)(char *pathname, char *args[], char *envp[], int uncloexec[]);
|
||||
|
||||
struct wlr_xwayland_server_options {
|
||||
bool lazy;
|
||||
bool enable_wm;
|
||||
bool no_touch_pointer_emulation;
|
||||
bool force_xrandr_emulation;
|
||||
int terminate_delay; // in seconds, 0 to terminate immediately
|
||||
xwayland_spawn_func_t spawn_handler;
|
||||
};
|
||||
|
||||
struct wlr_xwayland_server {
|
||||
pid_t pid;
|
||||
struct wl_client *client;
|
||||
struct wl_event_source *pipe_source;
|
||||
int wm_fd[2], wl_fd[2];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue