Re: Question about TTY_DO_WRITE_WAKEUP

From: Alan Cox
Date: Thu Nov 20 2008 - 11:47:51 EST


> > 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 ?

Because it should only be set again if a wakeup is needed. If the fasync
list for the tty is now empty it should stay clear.

> 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.

It is nothing to do with the driver. The line discipline sets it - or
rather should set it. If you have a case where you get an EAGAIN or short
write and the line discipline is not setting it then that is what needs
fixing not the drivers.

> 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.

Correct.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/