mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 14:26:00 +00:00
preload: set PR_SET_CHILD_SUBREAPER so double-forked Xwayland is not orphaned to init (#1716)
This commit is contained in:
1 parent
0a0bbb68d1
commit
c43a493ad8
1 file changed
+24
@@ -0,0 +1,24 @@
|
||||
/* tools/linuxfs/preload/subreaper.c
|
||||
*
|
||||
* Mark every process that loads libblsession.so as a child subreaper.
|
||||
*
|
||||
* wlroots starts Xwayland with a double fork: gamescope -> middle process
|
||||
* (exits immediately) -> Xwayland. With no subreaper in the tree, Xwayland
|
||||
* is reparented to pid 1 and becomes an orphan. On some vendor kernels
|
||||
* (observed on Meizu / Flyme 12) an orphan reaper SIGKILLs it in that window,
|
||||
* which makes gamescope wait forever in wlserver_init() and the UI hangs on
|
||||
* "Starting display and audio".
|
||||
*
|
||||
* With PR_SET_CHILD_SUBREAPER the reparent target becomes the nearest marked
|
||||
* ancestor instead of init, so the orphan event never happens.
|
||||
*
|
||||
* Harmless for processes that do not fork, and cheap (one syscall at load).
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/prctl.h>
|
||||
|
||||
__attribute__((constructor))
|
||||
static void bl_session_set_subreaper(void)
|
||||
{
|
||||
(void)prctl(PR_SET_CHILD_SUBREAPER, 1);
|
||||
}
|
||||
Reference in new issue
Block a user