]> git.ipfire.org Git - people/ms/systemd.git/blame - service.h
add first_word() call
[people/ms/systemd.git] / service.h
CommitLineData
5cb5a6ff
LP
1/*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3#ifndef fooservicehfoo
4#define fooservicehfoo
5
6typedef struct Service Service;
7
87f0e418 8#include "unit.h"
1e2e8133 9#include "ratelimit.h"
5cb5a6ff
LP
10
11typedef enum ServiceState {
12 SERVICE_DEAD,
13 SERVICE_START_PRE,
14 SERVICE_START,
15 SERVICE_START_POST,
16 SERVICE_RUNNING,
5cb5a6ff 17 SERVICE_RELOAD,
034c6ed7
LP
18 SERVICE_STOP, /* No STOP_PRE state, instead just register multiple STOP executables */
19 SERVICE_STOP_SIGTERM,
20 SERVICE_STOP_SIGKILL,
5cb5a6ff 21 SERVICE_STOP_POST,
034c6ed7
LP
22 SERVICE_FINAL_SIGTERM, /* In case the STOP_POST executable hangs, we shoot that down, too */
23 SERVICE_FINAL_SIGKILL,
5cb5a6ff 24 SERVICE_MAINTAINANCE,
034c6ed7 25 SERVICE_AUTO_RESTART,
5cb5a6ff
LP
26 _SERVICE_STATE_MAX,
27} ServiceState;
28
034c6ed7 29typedef enum ServiceRestart {
5cb5a6ff 30 SERVICE_ONCE,
034c6ed7
LP
31 SERVICE_RESTART_ON_SUCCESS,
32 SERVICE_RESTART_ALWAYS
33} ServiceRestart;
34
35typedef enum ServiceType {
36 SERVICE_FORKING,
37 SERVICE_SIMPLE
38} ServiceType;
5cb5a6ff
LP
39
40typedef enum ServiceExecCommand {
41 SERVICE_EXEC_START_PRE,
42 SERVICE_EXEC_START,
43 SERVICE_EXEC_START_POST,
5cb5a6ff 44 SERVICE_EXEC_RELOAD,
5cb5a6ff
LP
45 SERVICE_EXEC_STOP,
46 SERVICE_EXEC_STOP_POST,
47 _SERVICE_EXEC_MAX
48} ServiceExecCommand;
49
50struct Service {
51 Meta meta;
52
034c6ed7
LP
53 ServiceType type;
54 ServiceRestart restart;
55
56 /* If set we'll read the main daemon PID from this file */
57 char *pid_file;
58
59 usec_t restart_usec;
60 usec_t timeout_usec;
5cb5a6ff
LP
61
62 ExecCommand* exec_command[_SERVICE_EXEC_MAX];
63 ExecContext exec_context;
64
034c6ed7
LP
65 ServiceState state;
66
67 ExecStatus main_exec_status;
68
69 ExecCommand *control_command;
70 pid_t main_pid, control_pid;
71 bool main_pid_known:1;
5cb5a6ff 72
034c6ed7 73 bool failure:1; /* if we shut down, remember why */
acbb0225 74 Watch timer_watch;
1e2e8133
LP
75
76 RateLimit ratelimit;
5cb5a6ff
LP
77};
78
87f0e418 79const UnitVTable service_vtable;
5cb5a6ff
LP
80
81#endif