Proposal: POSIX process group API reform

Simon Marlow marlowsd at
Wed May 11 11:11:55 CEST 2011

On 04/05/2011 14:18, Favonia wrote:
> I am proposing a POSIX process group API change in order to
> (1) make ProcessGroupID a newtype of CPid, and
> (2) make it possible to query the process group of an existing process.
> The motivation is that currently there is no way to query a process
> group of an existing process, but it seems needed for a proper
> implementation for ticket #3994. Also it seems nice if the compiler
> can do distinguish ProcessGroupID from ProcessID, just like Fd from
> CInt.

We should not make ProcessGroupID a newtype, because execpt for Fd, none 
of the other types in this family are newtypes.  If we want to make them 
all newtypes, that should be done in one pass with a separate proposal.

I suggest retaining more backwards compatibility:

   - do not change setProcessGroupID yet: the functionality
     is already provided by joinProcessGroup.  Instead just
     deprecate it.

   - instead of changing createProcessGroup, add

       newProcessGroup :: IO ProcessGroupID
       newProcessGroupFor :: ProcessId -> IO ProcessGroupID

     and deprecate createProcessGroup.

   - Sometime later, change setProcessGroupID to the new version
     and undeprecate it.

> PS: Sorry but the patch to the package base is not fully tested, as I
> have not figured out the correct way to compile package base (even
> without the patch). However the patch to the package unix should work
> independently of the patch to the package base.

If you make patches, I'll test and commit at the end of the discussion 


More information about the Libraries mailing list