]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/core/busname.h
Merge pull request #57 from pwithnall/wip/pwithnall/udev-virtualbox-rules
[thirdparty/systemd.git] / src / core / busname.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6 This file is part of systemd.
7
8 Copyright 2013 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 typedef struct BusName BusName;
25 typedef struct BusNamePolicy BusNamePolicy;
26
27
28 typedef enum BusNameState {
29 BUSNAME_DEAD,
30 BUSNAME_MAKING,
31 BUSNAME_REGISTERED,
32 BUSNAME_LISTENING,
33 BUSNAME_RUNNING,
34 BUSNAME_SIGTERM,
35 BUSNAME_SIGKILL,
36 BUSNAME_FAILED,
37 _BUSNAME_STATE_MAX,
38 _BUSNAME_STATE_INVALID = -1
39 } BusNameState;
40
41 typedef enum BusNameResult {
42 BUSNAME_SUCCESS,
43 BUSNAME_FAILURE_RESOURCES,
44 BUSNAME_FAILURE_TIMEOUT,
45 BUSNAME_FAILURE_EXIT_CODE,
46 BUSNAME_FAILURE_SIGNAL,
47 BUSNAME_FAILURE_CORE_DUMP,
48 BUSNAME_FAILURE_SERVICE_FAILED_PERMANENT,
49 _BUSNAME_RESULT_MAX,
50 _BUSNAME_RESULT_INVALID = -1
51 } BusNameResult;
52
53 struct BusName {
54 Unit meta;
55
56 char *name;
57 int starter_fd;
58
59 bool activating;
60 bool accept_fd;
61
62 UnitRef service;
63
64 BusNameState state, deserialized_state;
65 BusNameResult result;
66
67 usec_t timeout_usec;
68
69 sd_event_source *starter_event_source;
70 sd_event_source *timer_event_source;
71
72 pid_t control_pid;
73
74 LIST_HEAD(BusNamePolicy, policy);
75 BusPolicyAccess policy_world;
76 };
77
78 extern const UnitVTable busname_vtable;
79
80 const char* busname_state_to_string(BusNameState i) _const_;
81 BusNameState busname_state_from_string(const char *s) _pure_;
82
83 const char* busname_result_to_string(BusNameResult i) _const_;
84 BusNameResult busname_result_from_string(const char *s) _pure_;