summaryrefslogtreecommitdiffstats
path: root/login-utils/sulogin.c
diff options
context:
space:
mode:
authorWerner Fink2014-05-08 12:09:25 +0200
committerKarel Zak2014-05-13 10:40:11 +0200
commitb9c7390948c7850db2bee82ad64624930962cc14 (patch)
treee6e8cf6729d78631287612d80101bfe99e0617be /login-utils/sulogin.c
parentagetty: better support of the special system consoles on S390 (diff)
downloadkernel-qcow2-util-linux-b9c7390948c7850db2bee82ad64624930962cc14.tar.gz
kernel-qcow2-util-linux-b9c7390948c7850db2bee82ad64624930962cc14.tar.xz
kernel-qcow2-util-linux-b9c7390948c7850db2bee82ad64624930962cc14.zip
agetty: beside virtual consoles support xvc and hvc device lines as well
For this approach do not use the ioctl TIOCMGET anymore as this is for real serial lines only. But switch over to use the ioctl KDGKBMODE as this is unique to the virtual console lines only. Signed-off-by: Werner Fink <werner@suse.de>
Diffstat (limited to 'login-utils/sulogin.c')
-rw-r--r--login-utils/sulogin.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c
index 147e6338f..222d40ee8 100644
--- a/login-utils/sulogin.c
+++ b/login-utils/sulogin.c
@@ -49,6 +49,11 @@
# include <selinux/get_context_list.h>
#endif
+#ifdef __linux__
+# include <sys/kd.h>
+# include <sys/param.h>
+#endif
+
#include "c.h"
#include "closestream.h"
#include "nls.h"
@@ -142,10 +147,14 @@ static void tcinit(struct console *con)
return;
}
- /* Handle serial lines here */
- if (ioctl(fd, TIOCMGET, (char *) &mode) == 0) {
+ /* Handle lines other than virtual consoles here */
+#if defined(KDGKBMODE)
+ if (ioctl(fd, KDGKBMODE, &mode) < 0)
+#endif
+ {
speed_t ispeed, ospeed;
struct winsize ws;
+ errno = 0;
/* this is a modem line */
con->flags |= CON_SERIAL;
@@ -191,9 +200,7 @@ static void tcinit(struct console *con)
goto setattr;
}
#if defined(IUTF8) && defined(KDGKBMODE)
- /* Detect mode of current keyboard setup, e.g. for UTF-8 */
- if (ioctl(fd, KDGKBMODE, &mode) < 0)
- mode = K_RAW;
+ /* Handle mode of current keyboard setup, e.g. for UTF-8 */
switch(mode) {
case K_UNICODE:
setlocale(LC_CTYPE, "C.UTF-8");