Subject: Re: O_ASYNC on ttys
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 07/07/2001 14:40:10
>> I couldn't see any harm in permitting TIOCSPGRP on ttys that aren't
>> your control tty, provided they aren't anyone else's either, [...]
[Jaromir]
> This looks okay. Does revoke(2) check (and remove) the O_ASYNC flag?
I don't think revoke() explicitly clears O_ASYNC/FASYNC. However, I'm
not convinced it needs to; the flag on the file descriptor doesn't
matter - SIGIO is generated based on the TS_ASYNC flag on the tty.
[Christos]
> And you probably need to clear it when it joins a session too right?
The only place I can see that TS_ASYNC is cleared (besides userland
calling FIOASYNC or clearing O_ASYNC with F_SETFL) is ttyclose().
If a non-session tty has ASYNC set on it and it then, without being
ttyclose()d, becomes a session control terminal via TIOCSCTTY (which
appears to be the only way to set t_session to other than nil), it will
presently retain its ASYNC character...but TIOCSCTTY will bash t_pgrp,
so you're probably right. (The only other place I can see t_pgrp being
set non-nil is TIOCSPGRP. I wonder if that should clear TS_ASYNC too.)
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B