chiark / gitweb /
cgroup: Handle error when destroying cgroup
[elogind.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 #include "unit.h"
28 #include "bus-common.h"
29
30 typedef enum BusNameState {
31         BUSNAME_DEAD,
32         BUSNAME_MAKING,
33         BUSNAME_REGISTERED,
34         BUSNAME_LISTENING,
35         BUSNAME_RUNNING,
36         BUSNAME_SIGTERM,
37         BUSNAME_SIGKILL,
38         BUSNAME_FAILED,
39         _BUSNAME_STATE_MAX,
40         _BUSNAME_STATE_INVALID = -1
41 } BusNameState;
42
43 typedef enum BusNameResult {
44         BUSNAME_SUCCESS,
45         BUSNAME_FAILURE_RESOURCES,
46         BUSNAME_FAILURE_TIMEOUT,
47         BUSNAME_FAILURE_EXIT_CODE,
48         BUSNAME_FAILURE_SIGNAL,
49         BUSNAME_FAILURE_CORE_DUMP,
50         BUSNAME_FAILURE_SERVICE_FAILED_PERMANENT,
51         _BUSNAME_RESULT_MAX,
52         _BUSNAME_RESULT_INVALID = -1
53 } BusNameResult;
54
55 typedef enum BusNamePolicyType {
56         BUSNAME_POLICY_TYPE_USER,
57         BUSNAME_POLICY_TYPE_GROUP,
58         _BUSNAME_POLICY_TYPE_MAX,
59         _BUSNAME_POLICY_TYPE_INVALID = -1
60 } BusNamePolicyType;
61
62 struct BusNamePolicy {
63         BusNamePolicyType type;
64         BusPolicyAccess access;
65
66         char *name;
67
68         LIST_FIELDS(BusNamePolicy, policy);
69 };
70
71 struct BusName {
72         Unit meta;
73
74         char *name;
75         int starter_fd;
76
77         bool activating;
78         bool accept_fd;
79
80         UnitRef service;
81
82         BusNameState state, deserialized_state;
83         BusNameResult result;
84
85         usec_t timeout_usec;
86
87         sd_event_source *starter_event_source;
88         sd_event_source *timer_event_source;
89
90         pid_t control_pid;
91
92         LIST_HEAD(BusNamePolicy, policy);
93         BusPolicyAccess policy_world;
94 };
95
96 extern const UnitVTable busname_vtable;
97
98 const char* busname_state_to_string(BusNameState i) _const_;
99 BusNameState busname_state_from_string(const char *s) _pure_;
100
101 const char* busname_result_to_string(BusNameResult i) _const_;
102 BusNameResult busname_result_from_string(const char *s) _pure_;