emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why setsid for subprocesses?


From: Daniel Colascione
Subject: Why setsid for subprocesses?
Date: Mon, 02 Jan 2012 10:00:49 -0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0

I noticed that we call setsid during process creation, falling back to
setpgrp/setpgid on older systems. Why setsid and not just setpgrp?

The reason I ask is that I'm hacking posix_spawn [1] support into
Emacs, and posix_spawn doesn't provide a way for the child to become a
session leader. The best it can do is setpgrp.

My hunch is that we don't actually need setsid, but just use it as an
extra check to make sure child processes don't try to join process
groups outside Emacs' purview. Is this hunch right? If so, nothing
should go wrong if our children stop being session leaders, yes? Or
does being a session leader affect the pty handling in a way that's
slipping my mind?

Thanks.

[1] posix_spawn provides a moderate performance boost for OS X and a
HUGE performance boost for Cygwin [2]:
http://pubs.opengroup.org/onlinepubs/009695399/functions/posix_spawn.html

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]