]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/machine/machine.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 This file is part of systemd.
7 Copyright 2013 Lennart Poettering
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23 typedef struct Machine Machine
;
24 typedef enum KillWho KillWho
;
28 #include "operation.h"
30 typedef enum MachineState
{
31 MACHINE_OPENING
, /* Machine is being registered */
32 MACHINE_RUNNING
, /* Machine is running */
33 MACHINE_CLOSING
, /* Machine is terminating */
35 _MACHINE_STATE_INVALID
= -1
38 typedef enum MachineClass
{
43 _MACHINE_CLASS_INVALID
= -1
50 _KILL_WHO_INVALID
= -1
70 dual_timestamp timestamp
;
76 sd_bus_message
*create_message
;
81 LIST_HEAD(Operation
, operations
);
83 LIST_FIELDS(Machine
, gc_queue
);
86 Machine
* machine_new(Manager
*manager
, MachineClass
class, const char *name
);
87 void machine_free(Machine
*m
);
88 bool machine_check_gc(Machine
*m
, bool drop_not_started
);
89 void machine_add_to_gc_queue(Machine
*m
);
90 int machine_start(Machine
*m
, sd_bus_message
*properties
, sd_bus_error
*error
);
91 int machine_stop(Machine
*m
);
92 int machine_finalize(Machine
*m
);
93 int machine_save(Machine
*m
);
94 int machine_load(Machine
*m
);
95 int machine_kill(Machine
*m
, KillWho who
, int signo
);
97 void machine_release_unit(Machine
*m
);
99 MachineState
machine_get_state(Machine
*u
);
101 const char* machine_class_to_string(MachineClass t
) _const_
;
102 MachineClass
machine_class_from_string(const char *s
) _pure_
;
104 const char* machine_state_to_string(MachineState t
) _const_
;
105 MachineState
machine_state_from_string(const char *s
) _pure_
;
107 const char *kill_who_to_string(KillWho k
) _const_
;
108 KillWho
kill_who_from_string(const char *s
) _pure_
;
110 int machine_openpt(Machine
*m
, int flags
);
111 int machine_open_terminal(Machine
*m
, const char *path
, int mode
);
113 int machine_get_uid_shift(Machine
*m
, uid_t
*ret
);