4 This file is part of systemd.
6 Copyright 2013 Lennart Poettering
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 typedef struct Machine Machine
;
23 typedef struct MachineOperation MachineOperation
;
24 typedef enum KillWho KillWho
;
29 typedef enum MachineState
{
30 MACHINE_OPENING
, /* Machine is being registered */
31 MACHINE_RUNNING
, /* Machine is running */
32 MACHINE_CLOSING
, /* Machine is terminating */
34 _MACHINE_STATE_INVALID
= -1
37 typedef enum MachineClass
{
42 _MACHINE_CLASS_INVALID
= -1
49 _KILL_WHO_INVALID
= -1
52 #define MACHINE_OPERATIONS_MAX 64
54 struct MachineOperation
{
57 sd_bus_message
*message
;
59 sd_event_source
*event_source
;
60 LIST_FIELDS(MachineOperation
, operations
);
80 dual_timestamp timestamp
;
86 sd_bus_message
*create_message
;
91 LIST_FIELDS(Machine
, gc_queue
);
93 MachineOperation
*operations
;
94 unsigned n_operations
;
97 Machine
* machine_new(Manager
*manager
, MachineClass
class, const char *name
);
98 void machine_free(Machine
*m
);
99 bool machine_check_gc(Machine
*m
, bool drop_not_started
);
100 void machine_add_to_gc_queue(Machine
*m
);
101 int machine_start(Machine
*m
, sd_bus_message
*properties
, sd_bus_error
*error
);
102 int machine_stop(Machine
*m
);
103 int machine_finalize(Machine
*m
);
104 int machine_save(Machine
*m
);
105 int machine_load(Machine
*m
);
106 int machine_kill(Machine
*m
, KillWho who
, int signo
);
108 void machine_release_unit(Machine
*m
);
110 MachineState
machine_get_state(Machine
*u
);
112 MachineOperation
*machine_operation_unref(MachineOperation
*o
);
114 const char* machine_class_to_string(MachineClass t
) _const_
;
115 MachineClass
machine_class_from_string(const char *s
) _pure_
;
117 const char* machine_state_to_string(MachineState t
) _const_
;
118 MachineState
machine_state_from_string(const char *s
) _pure_
;
120 const char *kill_who_to_string(KillWho k
) _const_
;
121 KillWho
kill_who_from_string(const char *s
) _pure_
;
123 int machine_openpt(Machine
*m
, int flags
);
124 int machine_open_terminal(Machine
*m
, const char *path
, int mode
);