Skip to content

Commit 26df6d1

Browse files
hycgregkh
authored andcommitted
tty: Add EXTPROC support for LINEMODE
This patch is against the 2.6.34 source. Paraphrased from the 1989 BSD patch by David Borman @ cray.com: These are the changes needed for the kernel to support LINEMODE in the server. There is a new bit in the termios local flag word, EXTPROC. When this bit is set, several aspects of the terminal driver are disabled. Input line editing, character echo, and mapping of signals are all disabled. This allows the telnetd to turn off these functions when in linemode, but still keep track of what state the user wants the terminal to be in. New ioctl: TIOCSIG Generate a signal to processes in the current process group of the pty. There is a new mode for packet driver, the TIOCPKT_IOCTL bit. When packet mode is turned on in the pty, and the EXTPROC bit is set, then whenever the state of the pty is changed, the next read on the master side of the pty will have the TIOCPKT_IOCTL bit set. This allows the process on the server side of the pty to know when the state of the terminal has changed; it can then issue the appropriate ioctl to retrieve the new state. Since the original BSD patches accompanied the source code for telnet I've left that reference here, but obviously the feature is useful for any remote terminal protocol, including ssh. The corresponding feature has existed in the BSD tty driver since 1989. For historical reference, a good copy of the relevant files can be found here: http://anonsvn.mit.edu/viewvc/krb5/trunk/src/appl/telnet/?pathrev=17741 Signed-off-by: Howard Chu <hyc@symas.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent a3c8ed6 commit 26df6d1

39 files changed

Lines changed: 101 additions & 10 deletions

File tree

‎arch/alpha/include/asm/ioctls.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
# define TIOCPKT_START 8
8181
# define TIOCPKT_NOSTOP 16
8282
# define TIOCPKT_DOSTOP 32
83+
# define TIOCPKT_IOCTL 64
8384

8485

8586
#define TIOCNOTTY 0x5422
@@ -91,6 +92,7 @@
9192
#define TIOCGSID 0x5429 /* Return the session ID of FD */
9293
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
9394
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
95+
#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
9496

9597
#define TIOCSERCONFIG 0x5453
9698
#define TIOCSERGWILD 0x5454

‎arch/alpha/include/asm/termbits.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ struct ktermios {
180180
#define FLUSHO 0x00800000
181181
#define PENDIN 0x20000000
182182
#define IEXTEN 0x00000400
183+
#define EXTPROC 0x10000000
183184

184185
/* Values for the ACTION argument to `tcflow'. */
185186
#define TCOOFF 0

‎arch/arm/include/asm/ioctls.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#define TCSETSF2 _IOW('T',0x2D, struct termios2)
5353
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
5454
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
55+
#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
5556

5657
#define TIOCGRS485 0x542E
5758
#define TIOCSRS485 0x542F
@@ -81,6 +82,7 @@
8182
#define TIOCPKT_START 8
8283
#define TIOCPKT_NOSTOP 16
8384
#define TIOCPKT_DOSTOP 32
85+
#define TIOCPKT_IOCTL 64
8486

8587
#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
8688

‎arch/arm/include/asm/termbits.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ struct ktermios {
177177
#define FLUSHO 0010000
178178
#define PENDIN 0040000
179179
#define IEXTEN 0100000
180+
#define EXTPROC 0200000
180181

181182
/* tcflow() and TCXONC use these */
182183
#define TCOOFF 0

‎arch/avr32/include/asm/ioctls.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#define TCSETSF2 _IOW('T',0x2D, struct termios2)
5454
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
5555
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
56+
#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
5657

5758
#define TIOCGRS485 0x542E
5859
#define TIOCSRS485 0x542F
@@ -82,6 +83,7 @@
8283
#define TIOCPKT_START 8
8384
#define TIOCPKT_NOSTOP 16
8485
#define TIOCPKT_DOSTOP 32
86+
#define TIOCPKT_IOCTL 64
8587

8688
#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
8789

‎arch/avr32/include/asm/termbits.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ struct ktermios {
175175
#define FLUSHO 0010000
176176
#define PENDIN 0040000
177177
#define IEXTEN 0100000
178+
#define EXTPROC 0200000
178179

179180
/* tcflow() and TCXONC use these */
180181
#define TCOOFF 0

‎arch/cris/include/asm/ioctls.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#define TCSETSF2 _IOW('T',0x2D, struct termios2)
5555
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
5656
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
57+
#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
5758

5859
#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
5960
#define FIOCLEX 0x5451
@@ -85,6 +86,7 @@
8586
#define TIOCPKT_START 8
8687
#define TIOCPKT_NOSTOP 16
8788
#define TIOCPKT_DOSTOP 32
89+
#define TIOCPKT_IOCTL 64
8890

8991
#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
9092

‎arch/cris/include/asm/termbits.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ struct ktermios {
214214
#define FLUSHO 0010000
215215
#define PENDIN 0040000
216216
#define IEXTEN 0100000
217+
#define EXTPROC 0200000
217218

218219
/* tcflow() and TCXONC use these */
219220
#define TCOOFF 0

‎arch/frv/include/asm/ioctls.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#define TCSETSF2 _IOW('T',0x2D, struct termios2)
5454
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
5555
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
56+
#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
5657

5758
#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
5859
#define FIOCLEX 0x5451
@@ -79,6 +80,7 @@
7980
#define TIOCPKT_START 8
8081
#define TIOCPKT_NOSTOP 16
8182
#define TIOCPKT_DOSTOP 32
83+
#define TIOCPKT_IOCTL 64
8284

8385
#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
8486

‎arch/frv/include/asm/termbits.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ struct ktermios {
180180
#define FLUSHO 0010000
181181
#define PENDIN 0040000
182182
#define IEXTEN 0100000
183+
#define EXTPROC 0200000
183184

184185

185186
/* tcflow() and TCXONC use these */

0 commit comments

Comments
 (0)