logind: use SIGRTMIN to not conflict with xwayland
xwayland uses SIGUSR1 as startup notification. Make sure to use SIGRTMIN and SIGRTMIN+1 for VT handling. A bonus is SIGRT* signals can be queued multiple times, so we will be able to correctly track them and will no longer lose signals (which wouldn't really matter, but is confusing in logs). Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
This commit is contained in:
committed by
Bryce Harrington
parent
faec1ebdb3
commit
cd6e4777bf
+18
-10
@@ -692,14 +692,10 @@ signal_event(int fd, uint32_t mask, void *data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (sig.ssi_signo) {
|
if (sig.ssi_signo == (unsigned int)SIGRTMIN)
|
||||||
case SIGUSR1:
|
|
||||||
ioctl(wl->vt, VT_RELDISP, 1);
|
ioctl(wl->vt, VT_RELDISP, 1);
|
||||||
break;
|
else if (sig.ssi_signo == (unsigned int)SIGRTMIN + 1)
|
||||||
case SIGUSR2:
|
|
||||||
ioctl(wl->vt, VT_RELDISP, VT_ACKACQ);
|
ioctl(wl->vt, VT_RELDISP, VT_ACKACQ);
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -767,9 +763,21 @@ weston_logind_setup_vt(struct weston_logind *wl)
|
|||||||
goto err_kbmode;
|
goto err_kbmode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SIGRTMIN is used as global VT-release signal, SIGRTMIN + 1 is used
|
||||||
|
* as VT-acquire signal. Note that SIGRT* must be tested on runtime, as
|
||||||
|
* their exact values are not known at compile-time. POSIX requires 32
|
||||||
|
* of them to be available, though.
|
||||||
|
*/
|
||||||
|
if (SIGRTMIN + 1 > SIGRTMAX) {
|
||||||
|
weston_log("logind: not enough RT signals available: %u-%u\n",
|
||||||
|
SIGRTMIN, SIGRTMAX);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
sigemptyset(&mask);
|
sigemptyset(&mask);
|
||||||
sigaddset(&mask, SIGUSR1);
|
sigaddset(&mask, SIGRTMIN);
|
||||||
sigaddset(&mask, SIGUSR2);
|
sigaddset(&mask, SIGRTMIN + 1);
|
||||||
sigprocmask(SIG_BLOCK, &mask, NULL);
|
sigprocmask(SIG_BLOCK, &mask, NULL);
|
||||||
|
|
||||||
wl->sfd = signalfd(-1, &mask, SFD_NONBLOCK | SFD_CLOEXEC);
|
wl->sfd = signalfd(-1, &mask, SFD_NONBLOCK | SFD_CLOEXEC);
|
||||||
@@ -790,8 +798,8 @@ weston_logind_setup_vt(struct weston_logind *wl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mode.mode = VT_PROCESS;
|
mode.mode = VT_PROCESS;
|
||||||
mode.relsig = SIGUSR1;
|
mode.relsig = SIGRTMIN;
|
||||||
mode.acqsig = SIGUSR2;
|
mode.acqsig = SIGRTMIN + 1;
|
||||||
if (ioctl(wl->vt, VT_SETMODE, &mode) < 0) {
|
if (ioctl(wl->vt, VT_SETMODE, &mode) < 0) {
|
||||||
r = -errno;
|
r = -errno;
|
||||||
weston_log("logind: cannot take over VT: %m\n");
|
weston_log("logind: cannot take over VT: %m\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user