2002-03-26 21:54:40

by Sapan J . Bhatia

[permalink] [raw]
Subject: [PATCH] POLL_OUT in ttys, misc bug fix

Hello,

While fixing a flow control bug that truncated output to a terminal in
User Mode Linux, I noticed that the tty drivers only send POLL_IN on new
data being available but not POLL_OUT when the device is ready for new
data.

This patch fixes the bug in the line discipline and the pty driver.

Also, there's another minor bug in n_tty.c where write_chan returns
on a (retvalue < 0) unconditionally. This is a problem, since the type of
IO (BLOCKING / NON_BLOCKING) is stored in the tty, and if the console driver
returns a -EAGAIN (eg. in UML on getting an EAGAIN from the host kernel),
write_chan returns even in the case of a blocking write, which is wrong
since the process doesn't expect it.

Regards,
Sapan


Attachments:
(No filename) (719.00 B)
tty_bugs.diff (2.41 kB)
tty_patch.diff
Download all attachments

2002-04-04 21:01:23

by Marcelo Tosatti

[permalink] [raw]
Subject: Re: [PATCH] POLL_OUT in ttys, misc bug fix


Sapan,

Have you actually tested the SIGIO POLL_OUT changes with an userspace app?

Thanks

On Wed, 27 Mar 2002, Sapan J . Bhatia wrote:

> Hello,
>
> While fixing a flow control bug that truncated output to a terminal in
> User Mode Linux, I noticed that the tty drivers only send POLL_IN on new
> data being available but not POLL_OUT when the device is ready for new
> data.
>
> This patch fixes the bug in the line discipline and the pty driver.
>
> Also, there's another minor bug in n_tty.c where write_chan returns
> on a (retvalue < 0) unconditionally. This is a problem, since the type of
> IO (BLOCKING / NON_BLOCKING) is stored in the tty, and if the console driver
> returns a -EAGAIN (eg. in UML on getting an EAGAIN from the host kernel),
> write_chan returns even in the case of a blocking write, which is wrong
> since the process doesn't expect it.
>
> Regards,
> Sapan
>
>

2002-04-06 13:51:12

by Sapan J . Bhatia

[permalink] [raw]
Subject: Re: [PATCH] POLL_OUT in ttys, misc bug fix

Hi Marcelo!

Yes, I have been testing them with userspace applications (most notably
User Mode Linux).

The following program's output gets truncated on a pty running on a normal
kernel, but works fine when the patch is applied:
http://www.corewars.org/pollout.c

Also, the version I'd sent you earlier did not have a fix for serial.c, which
exhibits the same problems. I've posted another version earlier today which
includes this as well as a minor change to the second bug fix.
Please use the new version instead of the earlier one.

Cheers,
Sapan


On Thu, Apr 04, 2002 at 04:56:22PM -0300, Marcelo Tosatti wrote:
//
// Sapan,
//
// Have you actually tested the SIGIO POLL_OUT changes with an userspace app?
//
// Thanks
//