|fork/exec
|
CLIENT(C)
- tidy up stale sockets etc.
- acquire lock
- create listening socket
|
- fork/daemonise
+ attempt to connect, and read greeting
+ |failure? \success?
+ | \
+ tidy up stale /run entries continue from send_fds, below
+ acquire lock
+ |
+ retry attempt to connect, and read greeting
+ |failure? \success?
+ | \
+ create listening socket release lock
+ | \
+ fork/daemonise continue from send_fds, below
| `------------------.
| WATCHER(C) &&
|
- make "fake" initial call socketpair
- |
- fork/exec
- | `------.
- | SCRIPT (setup)
- | |
- | script initialisation
- | |
- | identify fds from envirnment
- | open syslog
- | |
- | dzemonize
- | ,...../ |
- waitpid |
- | fork for initial service
- | |child |parent
- | | |
- | | SCRIPT [server] &&
- | | |
- | | ** accept / event loop **
- | | / \ \ \
- | | accepted? \ \ \idle timeout?
- | | | \ \ \
- | | fork child \ \ \
- | | _________/ watch | |watch stderr eof?
- | |/ stderr| | |
- | SCRIPT [monitor] | | |
- | | log msg | |
- | send greeting | | |
- read greeting | | | |
- | | exit
- release lock |
- | |
+ make "fake" initial call socketpair
+ | C prefork-interp
+ fork/exec + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ | `------. Perl, application
+ | + SCRIPT (setup)
+ | + |
+ | + script initialisation
+ | + | Perl, application
+ | + + + +| + + + + + + + + + + + + + + + + + + + + + + + +
+ | + | Perl, prefork-interp
+ | + identify fds from envirnment
+ | + open syslog
+ | + |
+ | + dzemonize
+ | ,...../ |
+ waitpid + |
+ | + fork for initial service
+ | + |child |parent
+ | + | |
+ | + | SCRIPT [server] &&
+ | + | |
+ | + | ** accept / event loop **
+ | + | / \ \ \
+ | + | accepted? \ \ \idle timeout?
+ | + | | \ \ \
+ | + | fork child \ \ \
+ | + | _________/ watch | |watch stderr eof?
+ | + |/ stderr| | |
+ | + SCRIPT [monitor] | | |
+ | + | log msg | |
+ | + setpgrpt & | | |
+ | + | | | |
+ | + send greeting | | |
+ read greeting | exit
+ | + |
+ release lock | from read greeting success, above
+ | ________ | ________/
+ | / + |
send fds.... |
- | receive fds
- | |
- | fork for executor
- | | \
- | | \child
- | | \
- | | setpgrp &
- | | execute service
- | | |
- | wait for read |
- | (select) |
- | | | |
- | | exits
- | | kernel closes execterm
- | | ,......./|
- | execterm? |
- | | zombie
- | | ,....../
- | waitpid
- | |
- | send exit status
- read exit status
-
+ | + receive fds
+ | + |
+ | + fork for executor
+ | + p |parent \child Perl, prefork-interp
+ | + | + + + + \+ + + + + + + + + + + + + + + +
+ | + | + execute service Perl, application
+ | + | + |
+ | +wait for read + |
+ | + (select) + |
+ | + | | + |
+ | + | + exits
+ | + | + kernel closes execterm
+ | + | ,.........../|
+ | + execterm? + |
+ | + | + zombie
+ | + | ,........../
+ | + waitpid +
+ | + | +
+ | ,..,..send status +
+ read status + +
+ + +
Or, if client is killed
- | | |
- | wait for read |
- | (select) |
- | | | |
- exits | |
- | | |
- kernel closes | |
- \....| |
- call? |
- | |
- kill whole pgrp... |
- | killled
- | zombie
- | ,....../
+ | | |
+ | wait for read |
+ | (select) |
+ | | | |
+ exits | |
+ | | |
+ kernel closes | |
+ \....| |
+ call? |
+ | |
+ kill whole pgrp... |
+ | killled
+ | zombie
+ | ,..... ./
waitpid
|
send exit status