Move verify_vc_kbmode() to terminal-util.c as vt_verify_kbmode()

This commit is contained in:
Balint Reczey
2019-04-24 18:01:40 +02:00
parent 1fa3ba9096
commit bb5ac84d79
3 changed files with 21 additions and 20 deletions
+17
View File
@@ -1249,6 +1249,23 @@ int vt_default_utf8(void) {
return parse_boolean(b);
}
int vt_verify_kbmode(int fd) {
int curr_mode;
/*
* Make sure we only adjust consoles in K_XLATE or K_UNICODE mode.
* Otherwise we would (likely) interfere with X11's processing of the
* key events.
*
* http://lists.freedesktop.org/archives/systemd-devel/2013-February/008573.html
*/
if (ioctl(fd, KDGKBMODE, &curr_mode) < 0)
return -errno;
return IN_SET(curr_mode, K_XLATE, K_UNICODE) ? 0 : -EBUSY;
}
int vt_reset_keyboard(int fd) {
int kb;
+1
View File
@@ -155,6 +155,7 @@ int openpt_in_namespace(pid_t pid, int flags);
int open_terminal_in_namespace(pid_t pid, const char *name, int mode);
int vt_default_utf8(void);
int vt_verify_kbmode(int fd);
int vt_reset_keyboard(int fd);
int vt_restore(int fd);
int vt_release(int fd, bool restore_vt);