Subject: Re: F_SETOWN/TIOCGPGRP/FIOSETOWN handling
To: Jaromir Dolecek <jdolecek@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 09/13/2003 19:33:42
On Sat, Sep 13, 2003 at 07:59:04PM +0200, Jaromir Dolecek wrote:
> While looking at kern/22042 I realized SETOWN handling is
> a bit suboptimal.

I started looking at this a few months ago - then got waylaid by sysinst.

I would keep TIOCSPGRP and F_SETOWN/FIOSETOWN completely separate.
It is actually necessary to be able to do F_SETOWN (and O_ASYNC) on tty
devices that are not controlling terminals.

You also need to keep a 'hold count' on the pgrp while the device is open
(and maybe hasn't tried to signal a non-existant group) - otherwise it is
possible to leave a device 'primed' to signal a group and not generate
the signal until after the group has been deleted and re-created.

You also need to do checks that the process doing the request is allowed
to signal the specified process (group).
IIRC one of the compat ioctls lets the signal sent be changed from SIGIO.
(So you also need to trawl the compat code...)

I did wonder whether the existing kevent mechanism can easily be expanded
to do the p{g}signal?

	David

-- 
David Laight: david@l8s.co.uk