Re: Init : someone could comment this ?

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

 



On Mon, 07.01.08 10:44, Enrico Scholz (enrico.scholz@xxxxxxxxxxxxxxxxxxxxxxxxx) wrote:

> 
> Casey Dahlin <cjdahlin@xxxxxxxx> writes:
> 
> >>> A shell which emulates POSIX process handling in-process and uses
> >>> direct builtin function calls for commands like sed [...] Pipes and
> >>> the like would also have to be emulated
> >>
> >> For what do you need 'sed' or pipes to start/stop a daemon?
> >>
> > It appears at least 13 times in our current init system.
> 
> I think, nobody doubts that current initsystem is the worst one of
> the major linux distributions.  By changing paradigm from forking to
> non-forking daemon you can avoid all the complicated 'stop' code;
> e.g. 'start' will be
> 
> | pid = fork();
> | if (pid==0) { /* ... */ execve(...); }
> 
> and 'stop' be
> 
> | kill(pid, SIGTERM); /* wait for timeout/sigchld */ kill(pid, SIGKILL);

This is not as simple as it might appear. Well behaving daemons don't
detach before initialization is complete. This fact is implicitly used
by SysV init to make sure that daemons which depend on each other
(like in "Avahi needs D-Bus") to start in order, one after the
other, but only after the predependencies have started up completely.

There have been several ideas how signalling of startup completion
could be handled in a better way. Some suggest that waiting for D-Bus
name to appear might be a good solution. Scott Remnant had the idea to
run "raise(SIGSTOP)" in the daemon after initialization
completed. Then, the parent process will be signalled via SIGCHLD and
as soon as it is it will kill(child, SIGCONT) and know that the next
daemon can be started. 

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux