blob: a1e1c1530001b7204e320f30f5c858764cc460c2 [file] [log] [blame]
Scott James Remnant9709a8d2007-02-09 16:08:21 +00001/* Upstart state machine.
2 *
3 * Generate with:
4 * dot -Tpng -ostates.png states.dot
5 *
6 * Diamonds represent natural rest states in which we need to take an action
7 * to change the goal.
8 *
9 * Ovals represent ordinary states which clear themselves when the process
10 * being run, or the event that was emitted, finishes.
11 *
12 * Rectangles represent additional actions that are taken, they are not
13 * states, instead you should follow through them to the next real state.
14 *
15 * Green arrows are followed while the goal is START.
16 * Red arrows are followed while the goal is STOP.
17 *
18 * Note that from the running state, there are two read arrows leaving it;
19 * these are chosen based on whether there is a process for the job or not.
20 */
21
22digraph {
23 rankdir=LR;
24 edge [fontsize=10];
25
26 waiting [shape=diamond];
27 starting [label="starting\n(emit starting)"];
28 pre_start [label="pre-start"];
29 spawned [label="spawned\n(wait for pid)"];
30 post_start [label="post-start"];
31 emit_started [shape=rectangle,label="emit started"];
32 running [shape=diamond];
33 pre_stop [label="pre-stop"];
34 stopping [label="stopping\n(emit stopping)"];
35 killed [label="killed\n(wait for SIGCHLD)"];
36 post_stop [label="post-stop"];
37 emit_stopped [shape=rectangle,label="emit stopped"];
Scott James Remnant9709a8d2007-02-09 16:08:21 +000038
39 waiting -> starting [color=green];
Scott James Remnant9709a8d2007-02-09 16:08:21 +000040 starting -> pre_start [color=green];
Scott James Remnantd29da6f2007-10-20 00:08:52 +010041 starting -> stopping [color=red];
Scott James Remnant9709a8d2007-02-09 16:08:21 +000042 pre_start -> spawned [color=green];
43 pre_start -> stopping [color=red];
44 spawned -> post_start [color=green];
45 spawned -> stopping [color=red];
46 post_start -> emit_started -> running [color=green];
47 post_start -> stopping [color=red];
48 running -> pre_stop [color=red,label="pid > 0"];
49 running -> stopping [color=red,label="pid == 0"];
50 running -> stopping [color=green,label="respawn"];
51 pre_stop -> running [color=green];
52 pre_stop -> stopping [color=red];
53 stopping -> killed [color=green];
54 stopping -> killed [color=red];
55 killed -> post_stop [color=green];
56 killed -> post_stop [color=red];
57 post_stop -> starting [color=green];
58 post_stop -> emit_stopped [color=red];
59 emit_stopped -> waiting [color=red];
60}