machinectl.c revision 89fec31893bd71292de5ab88cd73816148165b2f
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering This file is part of systemd.
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering Copyright 2013 Lennart Poettering
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering systemd is free software; you can redistribute it and/or modify it
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering under the terms of the GNU Lesser General Public License as published by
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering (at your option) any later version.
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering systemd is distributed in the hope that it will be useful, but
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering Lesser General Public License for more details.
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering You should have received a copy of the GNU Lesser General Public License
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic bool arg_all = false;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic bool arg_full = false;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic bool arg_no_pager = false;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic bool arg_legend = true;
bb99a35a873c35e80b0b47fe045081022660374dLennart Poetteringstatic BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
03e334a1c7dc8c20c38902aa039440763acc9b17Lennart Poetteringstatic bool arg_read_only = false;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic bool arg_mkdir = false;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic bool arg_quiet = false;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic bool arg_ask_password = true;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic OutputMode arg_output = OUTPUT_SHORT;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic bool arg_force = false;
a5344d2c3b0f14e954ce1c0ef905c5b44bc5bf0aLennart Poetteringstatic ImportVerify arg_verify = IMPORT_VERIFY_SIGNATURE;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic const char* arg_dkr_index_url = NULL;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic void pager_open_if_enabled(void) {
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poetteringstatic void polkit_agent_open_if_enabled(void) {
5ffa8c818120e35c89becd938d160235c069dd12Zbigniew Jędrzejewski-Szmek /* Open the polkit agent as a child process if necessary */
1ae464e09376853c52075ec4d8a6bfc4b4036d0cThomas Hindoe Paaboel Andersen if (arg_transport != BUS_TRANSPORT_LOCAL)
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic OutputFlags get_output_flags(void) {
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering (!on_tty() || pager_have()) * OUTPUT_FULL_WIDTH |
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poetteringstatic int compare_machine_info(const void *a, const void *b) {
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering const MachineInfo *x = a, *y = b;
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poetteringstatic int list_machines(int argc, char *argv[], void *userdata) {
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering size_t max_name = strlen("MACHINE"), max_class = strlen("CLASS"), max_service = strlen("SERVICE");
25d042e81516246b1ebf706a57c47ac19abb0b8aLennart Poettering _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering _cleanup_free_ MachineInfo *machines = NULL;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering const char *name, *class, *service, *object;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering size_t n_machines = 0, n_allocated = 0, j;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering "org.freedesktop.machine1",
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering "org.freedesktop.machine1.Manager",
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering "ListMachines",
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering log_error("Could not get machines: %s", bus_error_message(&error, -r));
72f1d5a2880d103dc1c1746f5c02e192e054705eLennart Poettering r = sd_bus_message_enter_container(reply, 'a', "(ssso)");
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering while ((r = sd_bus_message_read(reply, "(ssso)", &name, &class, &service, &object)) > 0) {
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering if (!GREEDY_REALLOC(machines, n_allocated, n_machines + 1))
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering r = sd_bus_message_exit_container(reply);
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering qsort_safe(machines, n_machines, sizeof(MachineInfo), compare_machine_info);
5c0aa72a4999bdcf03fe93ed5c8213c2b4c681f0Lennart Poettering for (j = 0; j < n_machines; j++)
61c024b328d5493a334242a4d01ba923582093faZbigniew Jędrzejewski-Szmek (int) max_name, machines[j].name,
6e5abe1564070a760196b97031eca9cf5e95e8a2Zbigniew Jędrzejewski-Szmek printf("\n%zu machines listed.\n", n_machines);
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poetteringstatic int compare_image_info(const void *a, const void *b) {
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering const ImageInfo *x = a, *y = b;
1ae464e09376853c52075ec4d8a6bfc4b4036d0cThomas Hindoe Paaboel Andersen return strcmp(x->name, y->name);
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic int list_images(int argc, char *argv[], void *userdata) {
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering size_t max_name = strlen("NAME"), max_type = strlen("TYPE"), max_size = strlen("USAGE"), max_crtime = strlen("CREATED"), max_mtime = strlen("MODIFIED");
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
5c0aa72a4999bdcf03fe93ed5c8213c2b4c681f0Lennart Poettering "org.freedesktop.machine1",
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering "org.freedesktop.machine1.Manager",
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering log_error("Could not get images: %s", bus_error_message(&error, -r));
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "(ssbttto)");
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering while ((r = sd_bus_message_read(reply, "(ssbttto)", &name, &type, &read_only, &crtime, &mtime, &size, &object)) > 0) {
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering char buf[MAX(FORMAT_TIMESTAMP_MAX, FORMAT_BYTES_MAX)];
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering if (!GREEDY_REALLOC(images, n_allocated, n_images + 1))
ee55db41442ad8055f5a84a339b1e0e22bc037c4Lennart Poettering l = strlen(strna(format_timestamp(buf, sizeof(buf), crtime)));
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering l = strlen(strna(format_timestamp(buf, sizeof(buf), mtime)));
5c0aa72a4999bdcf03fe93ed5c8213c2b4c681f0Lennart Poettering l = strlen(strna(format_bytes(buf, sizeof(buf), size)));
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering r = sd_bus_message_exit_container(reply);
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering qsort_safe(images, n_images, sizeof(ImageInfo), compare_image_info);
73843b52585d42cc1a970a1c664818ece6942e9eLennart Poettering printf("%-*s %-*s %-3s %-*s %-*s %-*s\n",
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering for (j = 0; j < n_images; j++) {
73843b52585d42cc1a970a1c664818ece6942e9eLennart Poettering char crtime_buf[FORMAT_TIMESTAMP_MAX], mtime_buf[FORMAT_TIMESTAMP_MAX], size_buf[FORMAT_BYTES_MAX];
0dad12c190b7493955cd60d2a1625199b1709f69Lennart Poettering printf("%-*s %-*s %s%-3s%s %-*s %-*s %-*s\n",
87b0284327e34a4b96c22085fa2cdb3219294991Zbigniew Jędrzejewski-Szmek (int) max_name, images[j].name,
61c024b328d5493a334242a4d01ba923582093faZbigniew Jędrzejewski-Szmek (int) max_type, images[j].type,
5c0aa72a4999bdcf03fe93ed5c8213c2b4c681f0Lennart Poettering images[j].read_only ? ansi_highlight_red() : "", yes_no(images[j].read_only), images[j].read_only ? ansi_highlight_off() : "",
0dad12c190b7493955cd60d2a1625199b1709f69Lennart Poettering (int) max_size, strna(format_bytes(size_buf, sizeof(size_buf), images[j].size)),
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering (int) max_crtime, strna(format_timestamp(crtime_buf, sizeof(crtime_buf), images[j].crtime)),
73843b52585d42cc1a970a1c664818ece6942e9eLennart Poettering (int) max_mtime, strna(format_timestamp(mtime_buf, sizeof(mtime_buf), images[j].mtime)));
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering printf("\n%zu images listed.\n", n_images);
0dad12c190b7493955cd60d2a1625199b1709f69Lennart Poetteringstatic int show_unit_cgroup(sd_bus *bus, const char *unit, pid_t leader) {
0dad12c190b7493955cd60d2a1625199b1709f69Lennart Poettering _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
0dad12c190b7493955cd60d2a1625199b1709f69Lennart Poettering _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
0dad12c190b7493955cd60d2a1625199b1709f69Lennart Poettering if (arg_transport == BUS_TRANSPORT_REMOTE)
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering endswith(unit, ".scope") ? "org.freedesktop.systemd1.Scope" :
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering endswith(unit, ".slice") ? "org.freedesktop.systemd1.Slice" : "org.freedesktop.systemd1.Service",
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering "ControlGroup",
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering log_error("Failed to query ControlGroup: %s", bus_error_message(&error, -r));
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering r = sd_bus_message_read(reply, "s", &cgroup);
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering if (cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, cgroup, false) != 0 && leader <= 0)
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering show_cgroup_and_extra(SYSTEMD_CGROUP_CONTROLLER, cgroup, "\t\t ", c, false, &leader, leader > 0, get_output_flags());
5c0aa72a4999bdcf03fe93ed5c8213c2b4c681f0Lennart Poetteringstatic int print_addresses(sd_bus *bus, const char *name, int ifi, const char *prefix, const char *prefix2) {
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering "org.freedesktop.machine1",
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering "org.freedesktop.machine1.Manager",
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering "GetMachineAddresses",
6e5abe1564070a760196b97031eca9cf5e95e8a2Zbigniew Jędrzejewski-Szmek r = sd_bus_message_enter_container(reply, 'a', "(iay)");
61c024b328d5493a334242a4d01ba923582093faZbigniew Jędrzejewski-Szmek while ((r = sd_bus_message_enter_container(reply, 'r', "iay")) > 0) {
fe6521272ba203ec8f0d5a94f0729960b3f90525Lennart Poettering char buffer[MAX(INET6_ADDRSTRLEN, INET_ADDRSTRLEN)];
fe6521272ba203ec8f0d5a94f0729960b3f90525Lennart Poettering r = sd_bus_message_read(reply, "i", &family);
61c024b328d5493a334242a4d01ba923582093faZbigniew Jędrzejewski-Szmek r = sd_bus_message_read_array(reply, 'y', &a, &sz);
86b9b8e70d54e79db3ff4f67bbd5280ecfc82537Lennart Poettering fputs(inet_ntop(family, a, buffer, sizeof(buffer)), stdout);
fe6521272ba203ec8f0d5a94f0729960b3f90525Lennart Poettering r = sd_bus_message_exit_container(reply);
fe6521272ba203ec8f0d5a94f0729960b3f90525Lennart Poettering r = sd_bus_message_exit_container(reply);
fe6521272ba203ec8f0d5a94f0729960b3f90525Lennart Poetteringstatic int print_os_release(sd_bus *bus, const char *name, const char *prefix) {
553acb7b6b8d4f16a4747b1f978e8b7888fbfb2cZbigniew Jędrzejewski-Szmek _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
61c024b328d5493a334242a4d01ba923582093faZbigniew Jędrzejewski-Szmek const char *k, *v, *pretty = NULL;
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering "org.freedesktop.machine1",
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering "org.freedesktop.machine1.Manager",
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering "GetMachineOSRelease",
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering r = sd_bus_message_enter_container(reply, 'a', "{ss}");
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering while ((r = sd_bus_message_read(reply, "{ss}", &k, &v)) > 0) {
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering r = sd_bus_message_exit_container(reply);
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poetteringstatic void machine_status_info_clear(MachineStatusInfo *info) {
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poetteringstatic void print_machine_status_info(sd_bus *bus, MachineStatusInfo *i) {
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], *s1;
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering if (!sd_id128_equal(i->id, SD_ID128_NULL))
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering printf("(" SD_ID128_FORMAT_STR ")\n", SD_ID128_FORMAT_VAL(i->id));
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering s1 = format_timestamp_relative(since1, sizeof(since1), i->timestamp.realtime);
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering s2 = format_timestamp(since2, sizeof(since2), i->timestamp.realtime);
1ae464e09376853c52075ec4d8a6bfc4b4036d0cThomas Hindoe Paaboel Andersen _cleanup_free_ char *t = NULL;
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering printf("\t Leader: %u", (unsigned) i->leader);
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering } else if (i->class)
3ed08c446cfaaae2b234fdfeb0c34ab6b4748c3eLennart Poettering printf("\t Root: %s\n", i->root_directory);
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering for (c = 0; c < i->n_netif; c++) {
if (ifi < 0)
ifi = 0;
if (i->unit) {
i->unit,
NULL);
static int map_netif(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata) {
size_t l;
return -EBADMSG;
if (!i->netif)
return -ENOMEM;
path,
map,
&info);
if (*new_line)
*new_line = true;
if (*new_line)
*new_line = true;
r = sd_bus_call_method(
bus,
"/org/freedesktop/machine1",
&error,
&reply,
return bus_log_parse_error(r);
if (properties)
typedef struct ImageStatusInfo {
char *name;
char *path;
char *type;
int read_only;
if (info) {
assert(i);
if (i->name) {
if (i->type)
if (i->path)
else if (s2)
else if (s2)
s4 = i->usage_exclusive != i->usage ? format_bytes(bs_exclusive, sizeof(bs_exclusive), i->usage_exclusive) : NULL;
else if (s3)
s4 = i->limit_exclusive != i->limit ? format_bytes(bs_exclusive, sizeof(bs_exclusive), i->limit_exclusive) : NULL;
else if (s3)
path,
map,
&info);
if (*new_line)
*new_line = true;
typedef struct PoolStatusInfo {
char *path;
if (info) {
if (i->path)
"/org/freedesktop/machine1",
map,
&info);
if (*new_line)
*new_line = true;
if (properties)
r = sd_bus_call_method(
bus,
"/org/freedesktop/machine1",
&error,
&reply,
return bus_log_parse_error(r);
if (properties)
if (!arg_kill_who)
r = sd_bus_call_method(
bus,
"/org/freedesktop/machine1",
&error,
NULL,
r = sd_bus_call_method(
bus,
"/org/freedesktop/machine1",
&error,
NULL,
bool copy_from;
if (!abs_host_path)
return log_oom();
r = sd_bus_call_method(
bus,
"/org/freedesktop/machine1",
&error,
NULL,
r = sd_bus_call_method(
bus,
"/org/freedesktop/machine1",
&error,
NULL,
assert(m);
if (*forward) {
static int process_forward(sd_event *event, PTYForward **forward, int master, bool ignore_vhangup, const char *name) {
char last_char = 0;
bool machine_died;
int ret = 0, r;
if (machine_died)
return ret;
return -EINVAL;
return -EOPNOTSUPP;
"path='/org/freedesktop/machine1',",
r = sd_bus_call_method(
bus,
"/org/freedesktop/machine1",
&error,
&reply,
return bus_log_parse_error(r);
return -EOPNOTSUPP;
return log_oom();
if (arg_uid)
else if (machine) {
const char *at;
if (at) {
"path='/org/freedesktop/machine1',",
bus,
"/org/freedesktop/machine1",
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_parse_error(r);
r = sd_bus_call_method(
bus,
"/org/freedesktop/machine1",
&error,
NULL,
r = sd_bus_call_method(
bus,
"/org/freedesktop/machine1",
&error,
NULL,
r = sd_bus_call_method(
bus,
"/org/freedesktop/machine1",
&error,
NULL,
return -EINVAL;
r = sd_bus_call_method(
bus,
"/org/freedesktop/machine1",
&error,
NULL,
return -EINVAL;
return log_oom();
return log_oom();
const char *object;
r = sd_bus_call_method(
bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
&error,
&reply,
return bus_log_parse_error(r);
return log_oom();
int carries_install_info = 0;
bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
method);
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
r = sd_bus_message_close_container(m);
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_parse_error(r);
r = sd_bus_call_method(
bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
&error,
NULL,
NULL);
unsigned priority;
assert(m);
assert(m);
static int transfer_signal_handler(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
assert(s);
if (!arg_quiet)
log_info("Continuing download in the background. Use \"machinectl cancel-transfer %" PRIu32 "\" to abort transfer.", PTR_TO_UINT32(userdata));
assert(m);
r = sd_bus_add_match(
bus,
"path='/org/freedesktop/import1'",
r = sd_bus_add_match(
bus,
return bus_log_parse_error(r);
if (!arg_quiet)
else if (path)
if (!local) {
return -EINVAL;
return log_oom();
return -EINVAL;
if (path) {
if (fd < 0)
bus,
"/org/freedesktop/import1",
return bus_log_create_error(r);
return bus_log_create_error(r);
else if (path)
if (!local) {
return -EINVAL;
return log_oom();
return -EINVAL;
if (path) {
if (fd < 0)
bus,
"/org/freedesktop/import1",
return bus_log_create_error(r);
return bus_log_create_error(r);
static void determine_compression_from_filename(const char *p) {
if (arg_format)
return -EINVAL;
if (path) {
if (fd < 0)
bus,
"/org/freedesktop/import1",
return bus_log_create_error(r);
return bus_log_create_error(r);
return -EINVAL;
if (path) {
if (fd < 0)
bus,
"/org/freedesktop/import1",
return bus_log_create_error(r);
return bus_log_create_error(r);
return -EINVAL;
local = l;
if (local) {
return log_oom();
return -EINVAL;
bus,
"/org/freedesktop/import1",
return bus_log_create_error(r);
return bus_log_create_error(r);
return -EINVAL;
local = l;
if (local) {
return log_oom();
return -EINVAL;
bus,
"/org/freedesktop/import1",
return bus_log_create_error(r);
return bus_log_create_error(r);
return -EINVAL;
if (tag) {
tag++;
return -EINVAL;
return -EINVAL;
if (local)
local++;
if (local) {
return -EINVAL;
bus,
"/org/freedesktop/import1",
return bus_log_create_error(r);
tag,
return bus_log_create_error(r);
typedef struct TransferInfo {
const char *type;
const char *remote;
const char *local;
double progress;
} TransferInfo;
static int compare_transfer_info(const void *a, const void *b) {
const TransferInfo *x = a, *y = b;
double progress;
r = sd_bus_call_method(
bus,
"/org/freedesktop/import1",
&error,
&reply,
NULL);
return bus_log_parse_error(r);
while ((r = sd_bus_message_read(reply, "(usssdo)", &id, &type, &remote, &local, &progress, &object)) > 0) {
size_t l;
return log_oom();
if (l > max_type)
max_type = l;
if (l > max_remote)
max_remote = l;
if (l > max_local)
max_local = l;
n_transfers ++;
return bus_log_parse_error(r);
return bus_log_parse_error(r);
if (arg_legend)
for (j = 0; j < n_transfers; j++)
if (arg_legend)
r = sd_bus_call_method(
bus,
"/org/freedesktop/import1",
&error,
NULL,
r = sd_bus_call_method(
bus,
"/org/freedesktop/machine1",
&error,
NULL,
r = sd_bus_call_method(
bus,
"/org/freedesktop/machine1",
&error,
NULL,
" show [NAME...] Show properties of one or more VMs/containers\n"
" terminate NAME... Terminate one or more VMs/containers\n"
case ARG_VERSION:
return log_oom();
arg_all = true;
arg_all = true;
arg_full = true;
return -EINVAL;
if (arg_output < 0) {
return -EINVAL;
case ARG_NO_PAGER:
arg_no_pager = true;
case ARG_NO_LEGEND:
arg_legend = false;
case ARG_KILL_WHO:
if (arg_signal < 0) {
return -EINVAL;
case ARG_NO_ASK_PASSWORD:
arg_ask_password = false;
case ARG_READ_ONLY:
arg_read_only = true;
case ARG_MKDIR:
arg_mkdir = true;
arg_quiet = true;
case ARG_VERIFY:
if (arg_verify < 0) {
return -EINVAL;
case ARG_FORCE:
arg_force = true;
case ARG_DKR_INDEX_URL:
return -EINVAL;
case ARG_FORMAT:
return -EINVAL;
case ARG_UID:
case ARG_SETENV:
return -EINVAL;
return log_oom();
return -EINVAL;
log_open();
goto finish;
goto finish;
pager_close();