pty: BREAK for pseudoterminals
PATCH 1/1 pty: BREAK for pseudoterminals
This will greatly enhance the usefulness of QEMU virtual serial ports, because the Linux kernel interprets a break on the serial console as a SysRq, but there is currently no way to pass this signal over a pseudo-terminal. This patch will work for transmitting BREAK from master to slave through pseudo-terminal.
--- drivers/tty/pty.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/tty/pty.c +19 -0
@@ -31,6 +31,7 @@static struct tty_driver *ptm_driver;static struct tty_driver *pts_driver;static DEFINE_MUTEX (devpts_mutex); +#define BREAK_STRING '\0'#endif static void pty_close (struct tty_struct *tty,struct file *filp)
@@ -674,6 +675,23 @@ static void pty_unix98_shutdown(struct tty_struct *tty)devpts_kill_index (tty->driver_data, tty->index); } +static int pty_unix98_break_ctl (struct tty_struct *tty,int break_state) +{ +int c; +struct tty_struct *to = tty->link; + +if (break_state) { +/* Stuff the break data into the input queue of the other end */ + c =tty_insert_flip_char (to->port,BREAK_STRING ,TTY_BREAK ); +/* And shovel */ +if (c) +tty_flip_buffer_push (to->port); +else +return -ENOMEM ; + } +return 0 ; +} +static const struct tty_operations ptm_unix98_ops = { .lookup = ptm_unix98_lookup, .install = pty_unix98_install,
@@ -686,6 +704,7 @@ static const struct tty_operations ptm_unix98_ops = { .chars_in_buffer = pty_chars_in_buffer, .unthrottle = pty_unthrottle, .ioctl = pty_unix98_ioctl, + .break_ctl = pty_unix98_break_ctl, .resize = pty_resize, .shutdown = pty_unix98_shutdown, .cleanup = pty_cleanup
Signature · 1 line
1.7.12.4
Quoted 1 line · Nan Li
This will greatly enhance the usefulness of QEMU virtual serial ports, because the Linux kernel interprets a break on the serial console as a SysRq, but there is currently no way to pass this signal over a pseudo-terminal. This patch will work for transmitting BREAK from master to slave through pseudo-terminal.
pty is an IPC mechanism, not a virtualization driver.
Those programs that know they're consuming from a slave pty may not have bothered to set termios for BREAKs, and may not be prepared for NULLs in the input stream.
Regards,
Peter Hurley
Quoted 50 lines
Signed-off-by Nan Li <[email protected]>--- drivers/tty/pty.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/tty/pty.c +19
-0@@ -31,6 +31,7 @@static struct tty_driver *ptm_driver;static struct tty_driver *pts_driver;static DEFINE_MUTEX (devpts_mutex); +#define BREAK_STRING '\0'#endif static void pty_close (struct tty_struct *tty,struct file *filp)@@ -674,6 +675,23 @@ static void pty_unix98_shutdown(struct tty_struct *tty)devpts_kill_index (tty->driver_data, tty->index); } +static int pty_unix98_break_ctl (struct tty_struct *tty,int break_state) +{ +int c; +struct tty_struct *to = tty->link; + +if (break_state) { +/* Stuff the break data into the input queue of the other end */ + c =tty_insert_flip_char (to->port,BREAK_STRING ,TTY_BREAK ); +/* And shovel */ +if (c) +tty_flip_buffer_push (to->port); +else +return -ENOMEM ; + } +return 0 ; +} +static const struct tty_operations ptm_unix98_ops = { .lookup = ptm_unix98_lookup, .install = pty_unix98_install,@@ -686,6 +704,7 @@ static const struct tty_operations ptm_unix98_ops = { .chars_in_buffer = pty_chars_in_buffer, .unthrottle = pty_unthrottle, .ioctl = pty_unix98_ioctl, + .break_ctl = pty_unix98_break_ctl, .resize = pty_resize, .shutdown = pty_unix98_shutdown, .cleanup = pty_cleanup
Quoted 4 lines · On Mon, 16 Feb 2015 08:04:02 -0500 Peter Hurley <[email protected]>…
Quoted 1 line · Nan Li
This will greatly enhance the usefulness of QEMU virtual serial ports, because the Linux kernel interprets a break on the serial console as a SysRq, but there is currently no way to pass this signal over a pseudo-terminal. This patch will work for transmitting BREAK from master to slave through pseudo-terminal.
pty is an IPC mechanism, not a virtualization driver.
No, but it can be used as a TTY. Teletypes have always had the capacity to send and receive BREAK.
Quoted 3 lines
Those programs that know they're consuming from a slave pty may not have bothered to set termios for BREAKs, and may not be prepared for NULLs in the input stream.
Well, the default termios includes IGNBRK, so unless they bothered to do anything about BREAKs, they won't see any change.
Anyway, the current kernel behaviour is clearly suboptimal. Calling tcsendbreak() on a pty descriptor does nothing but reports success. There are obviously two ways to fix it: either report an error, or deliver the BREAK for real.
This patch implements the latter, adding at least one valid use case to explain why it is better than the former.
Regards,
Petr Tesarik
Quoted 53 lines
Quoted 52 lines
Signed-off-by Nan Li <[email protected]>--- drivers/tty/pty.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/tty/pty.c +7
-0@@ -31,6 +31,7 @@static struct tty_driver *ptm_driver;static struct tty_driver *pts_driver;static DEFINE_MUTEX (devpts_mutex); +#define BREAK_STRING '\0'#endif static void pty_close (struct tty_struct *tty,struct file *filp)@@ -674,6 +675,23 @@ static void pty_unix98_shutdown(struct tty_struct *tty) devpts_kill_index(tty->driver_data, tty->index); } +static int pty_unix98_break_ctl (struct tty_struct *tty,int break_state) +{ +int c; +struct tty_struct *to = tty->link; + +if (break_state) { +/* Stuff the break data into the input queue of the other end */
drivers/tty/pty.c +1
-0+ c = tty_insert_flip_char(to->port, BREAK_STRING,
TTY_BREAK);drivers/tty/pty.c +10
-0+/* And shovel */ +if (c) +tty_flip_buffer_push (to->port); +else +return -ENOMEM ; + } +return 0 ; +} +static const struct tty_operations ptm_unix98_ops = { .lookup = ptm_unix98_lookup, .install = pty_unix98_install,@@ -686,6 +704,7 @@ static const struct tty_operations ptm_unix98_ops = { .chars_in_buffer = pty_chars_in_buffer, .unthrottle = pty_unthrottle, .ioctl = pty_unix98_ioctl, + .break_ctl = pty_unix98_break_ctl, .resize = pty_resize, .shutdown = pty_unix98_shutdown, .cleanup = pty_cleanup
Hi Petr,
Quoted 10 lines · Petr Tesarik
Quoted 4 lines · On Mon, 16 Feb 2015 08:04:02 -0500 Peter Hurley <[email protected]>…
Quoted 1 line · Nan Li
This will greatly enhance the usefulness of QEMU virtual serial ports, because the Linux kernel interprets a break on the serial console as a SysRq, but there is currently no way to pass this signal over a pseudo-terminal. This patch will work for transmitting BREAK from master to slave through pseudo-terminal.
pty is an IPC mechanism, not a virtualization driver.
No, but it can be used as a TTY. Teletypes have always had the capacity to send and receive BREAK.
In some general-purpose but restricted capacity, the *slave* end _mimics_ a tty. That doesn't mean that it is suitable for every conceivable use as a tty, nor should it.
If BREAK was actually useful for real terminal i/o, the pty driver would already support this. Note the pty driver doesn't emulate modem signals either, for the same reason.
Quoted 6 lines
Quoted 3 lines
Those programs that know they're consuming from a slave pty may not have bothered to set termios for BREAKs, and may not be prepared for NULLs in the input stream.
Well, the default termios includes IGNBRK, so unless they bothered to do anything about BREAKs, they won't see any change.
Userspace programs are sloppy, especially with terminal i/o and settings. Unlikely is not the same as not possible.
Quoted 4 lines
Anyway, the current kernel behaviour is clearly suboptimal. Calling
tcsendbreak()on a pty descriptor does nothing but reports success. There are obviously two ways to fix it: either report an error, or deliver the BREAK for real.
The pty master end is even less of a tty than the slave end, but this isn't really about errno. This patch doesn't address either of your points wrt tcsendbreak() on the slave descriptor which is the actual terminal end.
Quoted 2 lines
This patch implements the latter, adding at least one valid use case to explain why it is better than the former.
I disagree that this is a valid use case for the _pty driver_.
AFAICT this is simply for convenience, as sysrq functionality is already available via sendkey.
Regards,
Peter Hurley
Quoted 54 lines
Quoted 53 lines
Quoted 52 lines
Signed-off-by Nan Li <[email protected]>--- drivers/tty/pty.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/tty/pty.c +7
-0@@ -31,6 +31,7 @@static struct tty_driver *ptm_driver;static struct tty_driver *pts_driver;static DEFINE_MUTEX (devpts_mutex); +#define BREAK_STRING '\0'#endif static void pty_close (struct tty_struct *tty,struct file *filp)@@ -674,6 +675,23 @@ static void pty_unix98_shutdown(struct tty_struct *tty) devpts_kill_index(tty->driver_data, tty->index); } +static int pty_unix98_break_ctl (struct tty_struct *tty,int break_state) +{ +int c; +struct tty_struct *to = tty->link; + +if (break_state) { +/* Stuff the break data into the input queue of the other end */
drivers/tty/pty.c +1
-0+ c = tty_insert_flip_char(to->port, BREAK_STRING,
TTY_BREAK);drivers/tty/pty.c +10
-0+/* And shovel */ +if (c) +tty_flip_buffer_push (to->port); +else +return -ENOMEM ; + } +return 0 ; +} +static const struct tty_operations ptm_unix98_ops = { .lookup = ptm_unix98_lookup, .install = pty_unix98_install,@@ -686,6 +704,7 @@ static const struct tty_operations ptm_unix98_ops = { .chars_in_buffer = pty_chars_in_buffer, .unthrottle = pty_unthrottle, .ioctl = pty_unix98_ioctl, + .break_ctl = pty_unix98_break_ctl, .resize = pty_resize, .shutdown = pty_unix98_shutdown, .cleanup = pty_cleanup
Quoted 9 lines · On Mon, 16 Feb 2015 11:24:16 -0500 Peter Hurley <[email protected]>…
Hi Petr,
Quoted 6 lines · Petr Tesarik
Quoted 3 lines · On Mon, 16 Feb 2015 08:04:02 -0500 Peter Hurley <[email protected]>…
Quoted 1 line · Nan Li
This will greatly enhance the usefulness of QEMU virtual serial ports, because the Linux kernel interprets a break on the serial console as a SysRq, but there is currently no way to pass this signal over a pseudo-terminal. This patch will work for transmitting BREAK from master to slave through pseudo-terminal.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
pty is an IPC mechanism, not a virtualization driver.
No, but it can be used as a TTY. Teletypes have always had the capacity to send and receive BREAK.
In some general-purpose but restricted capacity, the *slave* end _mimics_ a tty. That doesn't mean that it is suitable for every conceivable use as a tty, nor should it.
Unless there's some specification of what should and what should not be implemented, this question is open for discussion, methinks.
Quoted 2 lines
If BREAK was actually useful for real terminal i/o, the pty driver would already support this.
If I strictly followed this statement, no improvement would ever be possible. Or did I miss something? Are Linux PTYs a legacy subsystem that never gets any new features?
Quoted 6 lines
[...]
Quoted 2 lines
Well, the default termios includes IGNBRK, so unless they bothered to do anything about BREAKs, they won't see any change.
Userspace programs are sloppy, especially with terminal i/o and settings. Unlikely is not the same as not possible.
Sure. New features may break sloppy programs. OTOH, the obvious workaround is not using such programs together with new programs that actually use tcsendbreak() for something... until those sloppy programs are fixed. It's not like the whole system stops working once this patch is applied.
Quoted 9 lines
Quoted 4 lines
Anyway, the current kernel behaviour is clearly suboptimal. Calling
tcsendbreak()on a pty descriptor does nothing but reports success. There are obviously two ways to fix it: either report an error, or deliver the BREAK for real.The pty master end is even less of a tty than the slave end, but this isn't really about errno. This patch doesn't address either of your points wrt
tcsendbreak()on the slave descriptor which is the actual terminal end.
That's a valid point. And, indeed, the terminal end actually needs the handling of BREAK to make it useful.
Quoted 7 lines
Quoted 2 lines
This patch implements the latter, adding at least one valid use case to explain why it is better than the former.
I disagree that this is a valid use case for the
_ptydriver_.AFAICT this is simply for convenience, as sysrq functionality is already available via sendkey.
That's a completely different story. This patch (after fixing it to work with the terminal end) would allow me to set up a QEMU emulated serial port using a pty (i.e. "-chardev pty") and send a BREAK signal to it, no matter what is running in the guest.
I mean, I can run an emulated MIPS64 as a QEMU guest on an x86_64 host, and still somehow pass SysRq to it. IIUC this will never be possible with KVP.
Another use case: In my job, I'm struggling with different serial consoles (some using ipmi SoL, some using telnet to a service processor, some connected with a real RS-232 link). If I could send BREAK over a pty, I could extend ipmiconsole to translate it to the SOL message, telnet to translate it to the telnet escape, amtterm to send a corresponding message... Then I could send a BREAK to any of my systems simply by pressing 'C-A b' in screen(1) without having to think how is this particular machine connected and what the correct sequence is for that protocol.
Just my two cents,
Petr Tesarik
Quoted 17 lines · Petr Tesarik
Quoted 14 lines · On Mon, 16 Feb 2015 11:24:16 -0500 Peter Hurley <[email protected]>…
Hi Petr,
Quoted 10 lines · Petr Tesarik
Quoted 4 lines · On Mon, 16 Feb 2015 08:04:02 -0500 Peter Hurley <[email protected]>…
Quoted 1 line · Nan Li
This will greatly enhance the usefulness of QEMU virtual serial ports, because the Linux kernel interprets a break on the serial console as a SysRq, but there is currently no way to pass this signal over a pseudo-terminal. This patch will work for transmitting BREAK from master to slave through pseudo-terminal.
pty is an IPC mechanism, not a virtualization driver.
No, but it can be used as a TTY. Teletypes have always had the capacity to send and receive BREAK.
Quoted 6 lines
Quoted 3 lines
In some general-purpose but restricted capacity, the *slave* end _mimics_ a tty. That doesn't mean that it is suitable for every conceivable use as a tty, nor should it.
Unless there's some specification of what should and what should not be implemented, this question is open for discussion, methinks.
This question is open for discussion regardless of specifications. I thought that's what these emails were. :)
FWIW, here's the relevant excerpt from SUSv4 regarding tcsendbreak():
"If the terminal is not using asynchronous serial data transmission, it is implementation-defined whether tcsendbreak() sends data to generate a break condition or returns without taking any action."
Quoted 6 lines
Quoted 2 lines
If BREAK was actually useful for real terminal i/o, the pty driver would already support this.
If I strictly followed this statement, no improvement would ever be possible. Or did I miss something? Are Linux PTYs a legacy subsystem that never gets any new features?
I'm not opposed to new features, but I do think that new kernel features should only address those requirements which cannot be met in userspace (whether that's functionality or performance or whatever the requirements).
Quoted 4 lines
Quoted 4 lines
[...]
Quoted 2 lines
Well, the default termios includes IGNBRK, so unless they bothered to do anything about BREAKs, they won't see any change.
Quoted 8 lines
Quoted 2 lines
Userspace programs are sloppy, especially with terminal i/o and settings. Unlikely is not the same as not possible.
Sure. New features may break sloppy programs. OTOH, the obvious workaround is not using such programs together with new programs that actually use
tcsendbreak()for something... until those sloppy programs are fixed. It's not like the whole system stops working once this patch is applied.
Userspace breakage is not an acceptable outcome, even if the program is provably buggy (other than for security-related issues).
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Anyway, the current kernel behaviour is clearly suboptimal. Calling
tcsendbreak()on a pty descriptor does nothing but reports success. There are obviously two ways to fix it: either report an error, or deliver the BREAK for real.
Quoted 7 lines
Quoted 4 lines
The pty master end is even less of a tty than the slave end, but this isn't really about errno. This patch doesn't address either of your points wrt
tcsendbreak()on the slave descriptor which is the actual terminal end.That's a valid point. And, indeed, the terminal end actually needs the handling of BREAK to make it useful.
There's two problems with adding this to the slave end:
1. The master pty termios is not programmable, so it can't set IGNBRK.
2. It creates a security maintenance burden because the unprivileged slave pty end must not be allowed to terminate the privileged master end, such as accidentally via BRKINT.
Quoted 33 lines
Quoted 7 lines
Quoted 2 lines
This patch implements the latter, adding at least one valid use case to explain why it is better than the former.
I disagree that this is a valid use case for the
_ptydriver_.AFAICT this is simply for convenience, as sysrq functionality is already available via sendkey.
That's a completely different story. This patch (after fixing it to work with the terminal end) would allow me to set up a QEMU emulated serial port using a pty (i.e. "-chardev pty") and send a BREAK signal to it, no matter what is running in the guest.
I mean, I can run an emulated MIPS64 as a QEMU guest on an
x86_64host, and still somehow pass SysRq to it. IIUC this will never be possible with KVP.Another use case: In my job, I'm struggling with different serial consoles (some using ipmi SoL, some using telnet to a service processor, some connected with a real RS-232 link). If I could send BREAK over a pty, I could extend ipmiconsole to translate it to the SOL message, telnet to translate it to the telnet escape, amtterm to send a corresponding message... Then I could send a BREAK to any of my systems simply by pressing 'C-A b' in screen(1) without having to think how is this particular machine connected and what the correct sequence is for that protocol.
Just my two cents,
Petr Tesarik
Quoted 7 lines · Peter Hurley
Quoted 6 lines · Petr Tesarik
Quoted 4 lines · On Mon, 16 Feb 2015 11:24:16 -0500 Peter Hurley <[email protected]>…
Quoted 3 lines · Petr Tesarik
Quoted 1 line · On Mon, 16 Feb 2015 08:04:02 -0500 Peter Hurley <[email protected]>…
On 02/05/2015 02:11 PM, Nan Li wrote:
[...]
Quoted 9 lines
Quoted 7 lines
Quoted 2 lines
AFAICT this is simply for convenience, as sysrq functionality is already available via sendkey.
That's a completely different story. This patch (after fixing it to work with the terminal end) would allow me to set up a QEMU emulated serial port using a pty (i.e. "-chardev pty") and send a BREAK signal to it, no matter what is running in the guest.
Quoted 3 lines
Quoted 3 lines
I mean, I can run an emulated MIPS64 as a QEMU guest on an
x86_64host, and still somehow pass SysRq to it. IIUC this will never be possible with KVP.
Sorry about that; accidentally pressed send :/
I see this as a shortcoming of the emulation, not of the underlying IPC used. I don't see why this couldn't be done in-band with any IPC.
Quoted 9 lines
Quoted 9 lines
Another use case: In my job, I'm struggling with different serial consoles (some using ipmi SoL, some using telnet to a service processor, some connected with a real RS-232 link). If I could send BREAK over a pty, I could extend ipmiconsole to translate it to the SOL message, telnet to translate it to the telnet escape, amtterm to send a corresponding message... Then I could send a BREAK to any of my systems simply by pressing 'C-A b' in screen(1) without having to think how is this particular machine connected and what the correct sequence is for that protocol.
I need to think more on this.
Regards,
Peter Hurley
PS - it's interesting that you mention a service processor, because the hacked support for remote supervisor adapter is and has been the #1 barrier to splitting the 8250 driver. I literally have spent days trying to come up with an acceptable solution.
Quoted 8 lines · Peter Hurley
Quoted 1 line · Nan Li
This will greatly enhance the usefulness of QEMU virtual serial ports, because the Linux kernel interprets a break on the serial console as a SysRq, but there is currently no way to pass this signal over a pseudo-terminal. This patch will work for transmitting BREAK from master to slave through pseudo-terminal.
pty is an IPC mechanism, not a virtualization driver.
Those programs that know they're consuming from a slave pty may not have bothered to set termios for BREAKs, and may not be prepared for NULLs in the input stream.
I'm not even seeing how this works as advertised.
In QEMU, the *master* end is the source/sink for the guest VM, while the *slave* pty is sink/source for the host. Like this:
Host <--> slave pty <===> master pty <--> qemu <==> emulated serial port
So this patch enables the guest VM to transmit BREAK to the host. Why is that useful?
Regards,
Peter Hurley
Quoted 51 lines
Quoted 50 lines
Signed-off-by Nan Li <[email protected]>--- drivers/tty/pty.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/tty/pty.c +19
-0@@ -31,6 +31,7 @@static struct tty_driver *ptm_driver;static struct tty_driver *pts_driver;static DEFINE_MUTEX (devpts_mutex); +#define BREAK_STRING '\0'#endif static void pty_close (struct tty_struct *tty,struct file *filp)@@ -674,6 +675,23 @@ static void pty_unix98_shutdown(struct tty_struct *tty)devpts_kill_index (tty->driver_data, tty->index); } +static int pty_unix98_break_ctl (struct tty_struct *tty,int break_state) +{ +int c; +struct tty_struct *to = tty->link; + +if (break_state) { +/* Stuff the break data into the input queue of the other end */ + c =tty_insert_flip_char (to->port,BREAK_STRING ,TTY_BREAK ); +/* And shovel */ +if (c) +tty_flip_buffer_push (to->port); +else +return -ENOMEM ; + } +return 0 ; +} +static const struct tty_operations ptm_unix98_ops = { .lookup = ptm_unix98_lookup, .install = pty_unix98_install,@@ -686,6 +704,7 @@ static const struct tty_operations ptm_unix98_ops = { .chars_in_buffer = pty_chars_in_buffer, .unthrottle = pty_unthrottle, .ioctl = pty_unix98_ioctl, + .break_ctl = pty_unix98_break_ctl, .resize = pty_resize, .shutdown = pty_unix98_shutdown, .cleanup = pty_cleanup
Quoted 6 lines · On Tue, 17 Feb 2015 14:03:58 -0500 Peter Hurley <[email protected]>…
Quoted 5 lines · Peter Hurley
Quoted 1 line · Nan Li
This will greatly enhance the usefulness of QEMU virtual serial ports, because the Linux kernel interprets a break on the serial console as a SysRq, but there is currently no way to pass this signal over a pseudo-terminal. This patch will work for transmitting BREAK from master to slave through pseudo-terminal.
pty is an IPC mechanism, not a virtualization driver.
Quoted 8 lines
Quoted 3 lines
Those programs that know they're consuming from a slave pty may not have bothered to set termios for BREAKs, and may not be prepared for NULLs in the input stream.
I'm not even seeing how this works as advertised.
In QEMU, the *master* end is the source/sink for the guest VM, while the *slave* pty is sink/source for the host. Like this:
Yes, you're totally right. This patch implements break handling on the "wrong" side of the pty pair. I think you have already pointed this out in one of the previous mails, and we're waiting for a patch that implements it on the slave side.
Regards,
Petr Tesarik
Quoted 63 lines
Host <--> slave pty <===> master pty <--> qemu <==> emulated serial port
So this patch enables the guest VM to transmit BREAK to the host. Why is that useful?
Regards,
Peter HurleyQuoted 53 lines
Quoted 52 lines
Signed-off-by Nan Li <[email protected]>--- drivers/tty/pty.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/tty/pty.c +7
-0@@ -31,6 +31,7 @@static struct tty_driver *ptm_driver;static struct tty_driver *pts_driver;static DEFINE_MUTEX (devpts_mutex); +#define BREAK_STRING '\0'#endif static void pty_close (struct tty_struct *tty,struct file *filp)@@ -674,6 +675,23 @@ static void pty_unix98_shutdown(struct tty_struct *tty) devpts_kill_index(tty->driver_data, tty->index); } +static int pty_unix98_break_ctl (struct tty_struct *tty,int break_state) +{ +int c; +struct tty_struct *to = tty->link; + +if (break_state) { +/* Stuff the break data into the input queue of the other end */
drivers/tty/pty.c +1
-0+ c = tty_insert_flip_char(to->port, BREAK_STRING,
TTY_BREAK);drivers/tty/pty.c +10
-0+/* And shovel */ +if (c) +tty_flip_buffer_push (to->port); +else +return -ENOMEM ; + } +return 0 ; +} +static const struct tty_operations ptm_unix98_ops = { .lookup = ptm_unix98_lookup, .install = pty_unix98_install,@@ -686,6 +704,7 @@ static const struct tty_operations ptm_unix98_ops = { .chars_in_buffer = pty_chars_in_buffer, .unthrottle = pty_unthrottle, .ioctl = pty_unix98_ioctl, + .break_ctl = pty_unix98_break_ctl, .resize = pty_resize, .shutdown = pty_unix98_shutdown, .cleanup = pty_cleanup
Quoted 1 line · On Fri, 6 Feb 2015 03:11:29 +0800 Nan Li <[email protected]> wrote:
This will greatly enhance the usefulness of QEMU virtual serial ports, because the Linux kernel interprets a break on the serial console as a SysRq, but there is currently no way to pass this signal over a pseudo-terminal. This patch will work for transmitting BREAK from master to slave through pseudo-terminal.
Break is a signalling event not a 0 character. pty doesn't support modem or other serial signalling events. Whether some kind of virtio tty<->host interface should exist and do that I don't know, but pty does not.
Alan