summaryrefslogtreecommitdiffstats
path: root/login-utils
diff options
context:
space:
mode:
authorKarel Zak2010-08-18 09:29:59 +0200
committerKarel Zak2010-08-18 09:38:49 +0200
commitbb1eea0ee0971cf5136e346bd3a16a2fa01555da (patch)
tree1c9d1056a855d39442c5296f8402d9150b7b0ffe /login-utils
parentaggety: don't wipe CLOCAL flag (diff)
downloadkernel-qcow2-util-linux-bb1eea0ee0971cf5136e346bd3a16a2fa01555da.tar.gz
kernel-qcow2-util-linux-bb1eea0ee0971cf5136e346bd3a16a2fa01555da.tar.xz
kernel-qcow2-util-linux-bb1eea0ee0971cf5136e346bd3a16a2fa01555da.zip
agetty: add -c to reuse cflags
The agetty command resets terminal cflags setting. The -c option disables this behavior and serial setting from kernel is used. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils')
-rw-r--r--login-utils/agetty.86
-rw-r--r--login-utils/agetty.c9
2 files changed, 12 insertions, 3 deletions
diff --git a/login-utils/agetty.8 b/login-utils/agetty.8
index 53037dda5..084086fda 100644
--- a/login-utils/agetty.8
+++ b/login-utils/agetty.8
@@ -3,7 +3,7 @@
agetty \- alternative Linux getty
.SH SYNOPSIS
-.BR "agetty " [\-8ihLmnsUw]
+.BR "agetty " [\-c8ihLmnsUw]
.RI "[-f " issue_file ]
.RI "[-l " login_program ]
.RI "[-I " init ]
@@ -82,6 +82,10 @@ whatever init(8) may have set, and is inherited by login and the shell.
.fi
.ad
.TP
+\-c
+Don't reset terminal cflags (control modes). See \fItermios(3)\fP for more
+details.
+.TP
\-8
Assume that the tty is 8-bit clean, hence disable parity detection.
.TP
diff --git a/login-utils/agetty.c b/login-utils/agetty.c
index 254194816..a6e249986 100644
--- a/login-utils/agetty.c
+++ b/login-utils/agetty.c
@@ -134,6 +134,7 @@ struct options {
#define F_NOPROMPT (1<<7) /* don't ask for login name! */
#define F_LCUC (1<<8) /* Support for *LCUC stty modes */
#define F_KEEPSPEED (1<<9) /* Follow baud rate from kernel */
+#define F_KEEPCFLAGS (1<<10) /* Reuse c_cflags setup from kernel */
/* Storage for things detected while the login name was read. */
@@ -374,8 +375,11 @@ parse_args(argc, argv, op)
extern int optind; /* getopt */
int c;
- while (isascii(c = getopt(argc, argv, "8I:LH:f:hil:mst:wUn"))) {
+ while (isascii(c = getopt(argc, argv, "8cI:LH:f:hil:mst:wUn"))) {
switch (c) {
+ case 'c':
+ op->flags |= F_KEEPCFLAGS;
+ break;
case '8':
op->eightbits = 1;
break;
@@ -709,7 +713,8 @@ termio_init(tp, op)
/* flush input and output queues, important for modems! */
(void) tcflush(0, TCIOFLUSH);
- tp->c_cflag = CS8 | HUPCL | CREAD | (tp->c_cflag & CLOCAL);
+ if (!(op->flags & F_KEEPCFLAGS))
+ tp->c_cflag = CS8 | HUPCL | CREAD | (tp->c_cflag & CLOCAL);
if (!(op->flags & F_KEEPSPEED)) {
cfsetispeed(tp, op->speeds[FIRST_SPEED]);