Files
DroidDeck/tools/linuxfs/preload/subreaper.c
T
Kurt Himebauch eabcfc7b74 chore: consistent code branding (#2800)
* chore: consistent code branding

* fix: carry legacy overrides, queues and live sync rows across the rename

* fix: keep queued legacy overrides on a failed rename and separate merged queue entries
2026-11-17 23:31:26 -05:00

25 lines
921 B
C

/* tools/linuxfs/preload/subreaper.c
*
* Mark every process that loads libddsession.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 dd_session_set_subreaper(void)
{
(void)prctl(PR_SET_CHILD_SUBREAPER, 1);
}