lkml.org 
[lkml]   [2008]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Question about TTY_DO_WRITE_WAKEUP

On Thu, 20 Nov 2008, Alan Cox wrote:

> > But n_tty_write_wakeup is only called from tty_wakeup when this bit is already
> > set, therefore it makes no sense to set this bit in n_tty_write_wakeup again.
>
> The base code should probably really use test_and_clear_bit() when
> calling that method.

Why should you test it, clear it and set it again in n_tty_write_wakeup ?

> >
> > The flow looks to me as
> >
> > If the tty driver sets TTY_DO_WRITE_WAKEUP a SIGIO is generated on every
> > tty_wakeup.
> >
> > If it is not set then n_tty_write_wakeup is never called and a SIGIO is not
> > generated.
>
> Which isn't perfect (excess SIGIO cases) but doesn't seem incorrect. If
> you've not blocked the tty output buffer then write() has not returned a
> short write and no SIGIO is due.
>

Of course this is not incorrect, but this does not solve my problem with the
TTY_DO_WRITE_WAKEUP flag.

IMHO a SIGIO on write possible should always be generated if the user wants it,
currently it is generated when the user wants it and the tty driver enables the
TTY_DO_WRITE_WAKEUP flag. Unfortunately most drivers don't set it.

Regarding excess SIGIO cases:

Once a write fails with EAGAIN a flag can be set and only in that case a SIGIO is
generated, afterwards the bit is cleared. Maybe that is what TTY_DO_WRITE_WAKEUP
was intended for.

Thomas


\
 
 \ /
  Last update: 2008-11-20 17:43    [W:0.062 / U:0.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site