On Sun, Mar 11, 2012 at 7:25 AM, Vincent Bernat <bernat@debian.org> wrote:
> OoO En cette nuit nuageuse du mercredi 07 mars 2012, vers 00:21,
> Fernando Lemos <fernandotcl@gmail.com> disait :
>
>>> To give one particular example: systemd uses Linux-specific features to
>>> accurately track all the processes started by a service, which allows
>>> accurate monitoring and shutdown of processes which could otherwise
>>> disassociate themselves from their parent processes via the usual
>>> daemonizing trick. POSIX doesn't provide features that allow this in
>>> general, but Linux does. (Quite possibly other OSes provide those
>>> features too, but not in a standardized way.)
>
>> By the way, upstart uses ptrace for this:
>
>> http://netsplit.com/2007/12/07/how-to-and-why-supervise-forking-processes/
>
>> It's an interesting trick, and probably more portable too.
>
> Maybe we could have an intermediate goal to patch any daemon to add an
> option to not fork on start. If any daemon can be started without
> forking, it seems easy to start/stop them without cgroups. This would
> allow to generate a sysvinit script from systemd service description. I
> don't know any daemon that does not have a flag to not fork on
> start. The number of daemons to patch may be low.
>
> This will not be as clean as using cgroups, but it won't be worst than
> the actual situation.
I don't quite understand the problem you're trying to solve. Both
upstart and systemd already handle cases where the daemon doesn't have
the option of not forking.
Regards,