Subject: Re: Should FIOSETOWN convert pids to pgrps?
To: None <>
From: David Laight <>
List: tech-kern
Date: 03/20/2003 12:49:48
> Just an idea. Centralize all the code that does the FIOSETOWN/F_SETOWN.
> Then rename TIOCSPGRP to OTIOCSPGRP and make the new TIOCSPGRP to only
> set the process group for job control, and require FIOSETOWN/F_SETOWN
> for async i/o. What do you think?

I've dug through all the sources again (fixing some man pages on the way).

AFAICT nothing that uses tcsetpgrp() or TIOCSPGRP does async io.
Indeed there are very few things that set FIOASYNC, O_ASYNC or FASYNC.
(and one of them is ntp which doesn't like the current semantics).

So it should be possible to:
1) Pass the FIOSETOWN ioctl to the drivers, instead of converting it to
2) Convert F_SETOWN to FIOSETOWN (fcntl to ioctl)
3) Change everything except kern/tty.c to understand FIOSETOWN instead
4) Make the tty code support TIOCSPGRP and FIOSETOWN as separate
5) Use some common functions (in either kern_sig.c and/or kern_proc.c)
   to process these requests.
   I don't think they can be completely taken out of the driver code,
   because the pgid/pid is a per-device item, not a per-file item.
   (and there is no reference back from the device to the file
   structure(s) ether.)

If the code is done correctly, then the async io should grab a reference
count against the pid/pgid in order to stop the pid being reallocated
while the reference exists (only need one count per number).
This would stop signals being sent to reallocated pids.


David Laight: