machinectl.c revision d8f52ed25a9edce75fda5251c977b7898e33887e
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering This file is part of systemd.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Copyright 2013 Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is free software; you can redistribute it and/or modify it
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering under the terms of the GNU Lesser General Public License as published by
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering (at your option) any later version.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is distributed in the hope that it will be useful, but
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Lesser General Public License for more details.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering You should have received a copy of the GNU Lesser General Public License
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poetteringstatic bool arg_all = false;
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poetteringstatic bool arg_full = false;
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poetteringstatic bool arg_no_pager = false;
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poetteringstatic bool arg_legend = true;
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poetteringstatic BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poetteringstatic bool arg_read_only = false;
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poetteringstatic bool arg_mkdir = false;
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poetteringstatic bool arg_quiet = false;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic void pager_open_if_enabled(void) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Cache result before we open the pager */
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poetteringstatic int list_machines(int argc, char *argv[], void *userdata) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
9df3ba6c6cb65eecec06f39dfe85a3596cedac4eTom Gundersen _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering const char *name, *class, *service, *object;
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering unsigned k = 0;
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering "org.freedesktop.machine1",
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering "org.freedesktop.machine1.Manager",
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering "ListMachines",
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering log_error("Could not get machines: %s", bus_error_message(&error, -r));
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering printf("%-32s %-9s %-16s\n", "MACHINE", "CONTAINER", "SERVICE");
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "(ssso)");
3e684349c2cead2e6fd2f816c34eb17daba23a49Lennart Poettering while ((r = sd_bus_message_read(reply, "(ssso)", &name, &class, &service, &object)) > 0) {
3e684349c2cead2e6fd2f816c34eb17daba23a49Lennart Poettering printf("%-32s %-9s %-16s\n", name, class, service);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering r = sd_bus_message_exit_container(reply);
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersentypedef struct ImageInfo {
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poetteringstatic int compare_image_info(const void *a, const void *b) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering const ImageInfo *x = a, *y = b;
87f5a19343acf8ba697acc5a62bdb1a2b8c9eda3Lennart Poetteringstatic int list_images(int argc, char *argv[], void *userdata) {
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering size_t max_name = strlen("NAME"), max_type = strlen("TYPE"), max_size = strlen("SIZE"), max_crtime = strlen("CREATED"), max_mtime = strlen("MODIFIED");
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering "org.freedesktop.machine1",
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering "org.freedesktop.machine1.Manager",
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering log_error("Could not get images: %s", bus_error_message(&error, -r));
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "(ssbttto)");
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering while ((r = sd_bus_message_read(reply, "(ssbttto)", &name, &type, &read_only, &crtime, &mtime, &size, &object)) > 0) {
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering char buf[MAX(FORMAT_TIMESTAMP_MAX, FORMAT_BYTES_MAX)];
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering if (!GREEDY_REALLOC(images, n_allocated, n_images + 1))
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering l = strlen(strna(format_timestamp(buf, sizeof(buf), crtime)));
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering l = strlen(strna(format_timestamp(buf, sizeof(buf), mtime)));
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering l = strlen(strna(format_bytes(buf, sizeof(buf), size)));
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering r = sd_bus_message_exit_container(reply);
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering qsort_safe(images, n_images, sizeof(ImageInfo), compare_image_info);
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering printf("%-*s %-*s %-3s %-*s %-*s %-*s\n",
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen for (j = 0; j < n_images; j++) {
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen char crtime_buf[FORMAT_TIMESTAMP_MAX], mtime_buf[FORMAT_TIMESTAMP_MAX], size_buf[FORMAT_BYTES_MAX];
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering printf("%-*s %-*s %s%-3s%s %-*s %-*s %-*s\n",
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering images[j].read_only ? ansi_highlight_red() : "", yes_no(images[j].read_only), images[j].read_only ? ansi_highlight_off() : "",
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering (int) max_size, strna(format_bytes(size_buf, sizeof(size_buf), images[j].size)),
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering (int) max_crtime, strna(format_timestamp(crtime_buf, sizeof(crtime_buf), images[j].crtime)),
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering (int) max_mtime, strna(format_timestamp(mtime_buf, sizeof(mtime_buf), images[j].mtime)));
b64513580ce627578351b76a502455e7bc62cae4Lennart Poettering printf("\n%zu images listed.\n", n_images);
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poetteringstatic int show_unit_cgroup(sd_bus *bus, const char *unit, pid_t leader) {
b64513580ce627578351b76a502455e7bc62cae4Lennart Poettering _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
84129d46cd6e95e142973da93aede4c7433c9600Lennart Poettering if (arg_transport == BUS_TRANSPORT_REMOTE)
efd46a696d31097c38f653b36921e00c4df62319Lennart Poettering endswith(unit, ".scope") ? "org.freedesktop.systemd1.Scope" : "org.freedesktop.systemd1.Service",
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen "ControlGroup",
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen log_error("Failed to query ControlGroup: %s", bus_error_message(&error, -r));
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering r = sd_bus_message_read(reply, "s", &cgroup);
84129d46cd6e95e142973da93aede4c7433c9600Lennart Poettering if (cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, cgroup, false) != 0 && leader <= 0)
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering show_cgroup_and_extra(SYSTEMD_CGROUP_CONTROLLER, cgroup, "\t\t ", c, false, &leader, leader > 0, output_flags);
571370c1555d2aa697733479a50957aff024bbcbLennart Poetteringstatic int print_addresses(sd_bus *bus, const char *name, int ifi, const char *prefix, const char *prefix2) {
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering "org.freedesktop.machine1",
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering "org.freedesktop.machine1.Manager",
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering "GetMachineAddresses",
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering r = sd_bus_message_enter_container(reply, 'a', "(iay)");
b652d4a2099d1c167584dcc1d179d47c58dc38a2Lennart Poettering while ((r = sd_bus_message_enter_container(reply, 'r', "iay")) > 0) {
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering const void *a;
b64513580ce627578351b76a502455e7bc62cae4Lennart Poettering char buffer[MAX(INET6_ADDRSTRLEN, INET_ADDRSTRLEN)];
b64513580ce627578351b76a502455e7bc62cae4Lennart Poettering r = sd_bus_message_read(reply, "i", &family);
b652d4a2099d1c167584dcc1d179d47c58dc38a2Lennart Poettering r = sd_bus_message_read_array(reply, 'y', &a, &sz);
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen fputs(inet_ntop(family, a, buffer, sizeof(buffer)), stdout);
011842775f750711833526d5bba1b818713947f5Lennart Poettering r = sd_bus_message_exit_container(reply);
011842775f750711833526d5bba1b818713947f5Lennart Poetteringstatic int print_os_release(sd_bus *bus, const char *name, const char *prefix) {
cc450722a02ab9c59bca1d9a5b5012f356336a8cLennart Poettering _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
cc450722a02ab9c59bca1d9a5b5012f356336a8cLennart Poettering "org.freedesktop.machine1",
011842775f750711833526d5bba1b818713947f5Lennart Poettering "org.freedesktop.machine1.Manager",
011842775f750711833526d5bba1b818713947f5Lennart Poettering "GetMachineOSRelease",
f4461e5641d53f27d6e76e0607bdaa9c0c58c1f6Lennart Poettering r = sd_bus_message_enter_container(reply, 'a', "{ss}");
cc450722a02ab9c59bca1d9a5b5012f356336a8cLennart Poettering while ((r = sd_bus_message_read(reply, "{ss}", &k, &v)) > 0) {
f4461e5641d53f27d6e76e0607bdaa9c0c58c1f6Lennart Poettering r = sd_bus_message_exit_container(reply);
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poetteringstatic void print_machine_status_info(sd_bus *bus, MachineStatusInfo *i) {
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], *s1;
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering if (!sd_id128_equal(i->id, SD_ID128_NULL))
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering printf("(" SD_ID128_FORMAT_STR ")\n", SD_ID128_FORMAT_VAL(i->id));
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering s1 = format_timestamp_relative(since1, sizeof(since1), i->timestamp);
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering s2 = format_timestamp(since2, sizeof(since2), i->timestamp);
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering printf("\t Leader: %u", (unsigned) i->leader);
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering } else if (i->class)
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering printf("\t Root: %s\n", i->root_directory);
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering for (c = 0; c < i->n_netif; c++) {
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering "\t Address: ",
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering print_os_release(bus, i->name, "\t OS: ");
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering show_unit_cgroup(bus, i->unit, i->leader);
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poetteringstatic int map_netif(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata) {
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering const void *v;
6cb08a8930bdaca950b152b1e8b82466ed59511cLennart Poettering assert_cc(sizeof(int32_t) == sizeof(int));
6cb08a8930bdaca950b152b1e8b82466ed59511cLennart Poettering r = sd_bus_message_read_array(m, SD_BUS_TYPE_INT32, &v, &l);
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poetteringstatic int show_machine_info(const char *verb, sd_bus *bus, const char *path, bool *new_line) {
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering static const struct bus_properties_map map[] = {
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering { "Name", "s", NULL, offsetof(MachineStatusInfo, name) },
92ec902aad1ade7acbe50efd7b8ef87fbdc63af3Lennart Poettering { "Class", "s", NULL, offsetof(MachineStatusInfo, class) },
92ec902aad1ade7acbe50efd7b8ef87fbdc63af3Lennart Poettering { "Service", "s", NULL, offsetof(MachineStatusInfo, service) },
92ec902aad1ade7acbe50efd7b8ef87fbdc63af3Lennart Poettering { "Unit", "s", NULL, offsetof(MachineStatusInfo, unit) },
92ec902aad1ade7acbe50efd7b8ef87fbdc63af3Lennart Poettering { "RootDirectory", "s", NULL, offsetof(MachineStatusInfo, root_directory) },
92ec902aad1ade7acbe50efd7b8ef87fbdc63af3Lennart Poettering { "Leader", "u", NULL, offsetof(MachineStatusInfo, leader) },
92ec902aad1ade7acbe50efd7b8ef87fbdc63af3Lennart Poettering { "Timestamp", "t", NULL, offsetof(MachineStatusInfo, timestamp) },
92ec902aad1ade7acbe50efd7b8ef87fbdc63af3Lennart Poettering { "Id", "ay", bus_map_id128, offsetof(MachineStatusInfo, id) },
92ec902aad1ade7acbe50efd7b8ef87fbdc63af3Lennart Poettering { "NetworkInterfaces", "ai", map_netif, 0 },
1e02e182f1e06fcbe389474175de228103be39cbLennart Poettering "org.freedesktop.machine1",
b826ab586c9e0a9c0d438a75c28cf3a8ab485929Tom Gundersen return log_error_errno(r, "Could not get properties: %m");
87f5a19343acf8ba697acc5a62bdb1a2b8c9eda3Lennart Poetteringstatic int show_machine_properties(sd_bus *bus, const char *path, bool *new_line) {
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering r = bus_print_all_properties(bus, "org.freedesktop.machine1", path, arg_property, arg_all);
4b95f1798f22c1bb75295f448188560cb6ec9eceLennart Poettering log_error_errno(r, "Could not get properties: %m");
4b95f1798f22c1bb75295f448188560cb6ec9eceLennart Poetteringstatic int show_machine(int argc, char *argv[], void *userdata) {
636e813dc98ea40c58c6c85bc5e7e3c9f0904ea2Lennart Poettering _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
4b95f1798f22c1bb75295f448188560cb6ec9eceLennart Poettering _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
4b95f1798f22c1bb75295f448188560cb6ec9eceLennart Poettering /* If no argument is specified, inspect the manager
4b95f1798f22c1bb75295f448188560cb6ec9eceLennart Poettering r = show_machine_properties(bus, "/org/freedesktop/machine1", &new_line);
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering "org.freedesktop.machine1",
4b95f1798f22c1bb75295f448188560cb6ec9eceLennart Poettering "org.freedesktop.machine1.Manager",
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering log_error("Could not get path to machine: %s", bus_error_message(&error, -r));
4b95f1798f22c1bb75295f448188560cb6ec9eceLennart Poettering r = sd_bus_message_read(reply, "o", &path);
4b95f1798f22c1bb75295f448188560cb6ec9eceLennart Poettering r = show_machine_properties(bus, path, &new_line);
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering r = show_machine_info(argv[0], bus, path, &new_line);
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poetteringstatic void print_image_status_info(sd_bus *bus, ImageStatusInfo *i) {
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering char ts_relative[FORMAT_TIMESTAMP_RELATIVE_MAX], *s1;
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering char ts_absolute[FORMAT_TIMESTAMP_MAX], *s2;
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering char bs_exclusive[FORMAT_BYTES_MAX], *s4;
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering i->read_only ? ansi_highlight_red() : "",
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering i->read_only ? ansi_highlight_off() : "");
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering s1 = format_timestamp_relative(ts_relative, sizeof(ts_relative), i->crtime);
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering s2 = format_timestamp(ts_absolute, sizeof(ts_absolute), i->crtime);
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering s1 = format_timestamp_relative(ts_relative, sizeof(ts_relative), i->mtime);
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering s2 = format_timestamp(ts_absolute, sizeof(ts_absolute), i->mtime);
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering s3 = format_bytes(bs, sizeof(bs), i->size);
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering s4 = i->size_exclusive != i->size ? format_bytes(bs_exclusive, sizeof(bs_exclusive), i->size_exclusive) : NULL;
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering printf("\t Size: %s (exclusive: %s)\n", s3, s4);
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering s3 = format_bytes(bs, sizeof(bs), i->limit);
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering s4 = i->limit_exclusive != i->limit ? format_bytes(bs_exclusive, sizeof(bs_exclusive), i->limit_exclusive) : NULL;
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering printf("\t Limit: %s (exclusive: %s)\n", s3, s4);
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersenstatic int show_image_info(const char *verb, sd_bus *bus, const char *path, bool *new_line) {
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen static const struct bus_properties_map map[] = {
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen { "Name", "s", NULL, offsetof(ImageStatusInfo, name) },
9c5e12a4314e7192e834e1b855e5e80111e636a6Tom Gundersen { "Path", "s", NULL, offsetof(ImageStatusInfo, path) },
7586f4d172dd9c3ccc3126fc47dca9e49adec132Tom Gundersen { "Type", "s", NULL, offsetof(ImageStatusInfo, type) },
d74fb368b18f0fbd9a4fe6f15691bbea7f3c4a01Tom Gundersen { "ReadOnly", "b", NULL, offsetof(ImageStatusInfo, read_only) },
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen { "CreationTimestamp", "t", NULL, offsetof(ImageStatusInfo, crtime) },
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen { "ModificationTimestamp", "t", NULL, offsetof(ImageStatusInfo, mtime) },
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)
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,
const char *object;
r = sd_bus_call_method(
bus,
"/org/freedesktop/machine1",
&error,
&reply,
return bus_log_parse_error(r);
r = sd_bus_get_property(
bus,
&error,
&reply2,
return bus_log_parse_error(r);
char *dest, *host_path, *container_path, *host_dirname, *host_basename, *container_dirname, *container_basename, *t;
bool copy_from;
return -EINVAL;
if (child < 0)
if (child == 0) {
int containerfd;
int mntfd;
if (mntfd < 0) {
if (containerfd < 0) {
if (copy_from)
return -EIO;
return -EIO;
const char *dest;
return -EINVAL;
return -ENOTSUP;
mount_slave_created = true;
goto finish;
mount_slave_mounted = true;
goto finish;
goto finish;
mount_tmp_created = true;
goto finish;
mount_tmp_mounted = true;
if (arg_read_only)
goto finish;
goto finish;
mount_outside_created = true;
goto finish;
mount_outside_mounted = true;
mount_tmp_mounted = false;
mount_tmp_created = false;
mount_slave_mounted = false;
mount_slave_created = false;
if (child < 0) {
goto finish;
if (child == 0) {
const char *mount_inside;
int mntfd;
if (mntfd < 0) {
if (arg_mkdir)
goto finish;
r = -EIO;
goto finish;
r = -EIO;
goto finish;
if (mount_tmp_mounted)
if (mount_tmp_created)
if (mount_slave_mounted)
if (mount_slave_created)
const char *pty;
char last_char = 0;
return -ENOTSUP;
"/org/freedesktop/machine1",
return bus_log_create_error(r);
r = sd_bus_message_set_allow_interactive_authorization(m, true);
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_parse_error(r);
return ret;
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 log_oom();
const char *object;
return -EINVAL;
return log_oom();
if (!unit)
return log_oom();
bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
return bus_log_create_error(r);
r = sd_bus_message_set_allow_interactive_authorization(m, true);
return bus_log_create_error(r);
return bus_log_create_error(r);
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);
r = sd_bus_message_set_allow_interactive_authorization(m, true);
return bus_log_create_error(r);
return bus_log_create_error(r);
return -EINVAL;
return log_oom();
if (!unit)
return log_oom();
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);
m = sd_bus_message_unref(m);
bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
return bus_log_create_error(r);
r = sd_bus_message_set_allow_interactive_authorization(m, true);
return bus_log_create_error(r);
" 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;
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_READ_ONLY:
arg_read_only = true;
case ARG_MKDIR:
arg_mkdir = true;
arg_quiet = true;
return -EINVAL;
log_open();
goto finish;
goto finish;
pager_close();