diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/analyze/analyze.c | 2 | ||||
-rw-r--r-- | src/journal/journalctl.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/sd-dhcp-client.c | 9 | ||||
-rw-r--r-- | src/resolve/resolved-resolv-conf.c | 6 | ||||
-rw-r--r-- | src/systemctl/systemctl.c | 116 | ||||
-rw-r--r-- | src/systemd/sd-bus-vtable.h | 54 | ||||
-rw-r--r-- | src/test/test-stat-util.c | 4 | ||||
-rw-r--r-- | src/udev/udev-builtin-net_id.c | 3 | ||||
-rw-r--r-- | src/update-done/update-done.c | 2 |
9 files changed, 129 insertions, 69 deletions
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index a9402fdb28..ac0470b20d 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -1362,7 +1362,7 @@ static void help(void) { " blame Print list of running units ordered by time to init\n" " critical-chain Print a tree of the time critical chain of units\n" " plot Output SVG graphic showing service initialization\n" - " dot Output dependency graph in dot(1) format\n" + " dot Output dependency graph in man:dot(1) format\n" " set-log-level LEVEL Set logging threshold for manager\n" " set-log-target TARGET Set logging target for manager\n" " dump Output state serialization of service manager\n" diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 22133c51eb..d785b32f1c 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -912,7 +912,7 @@ static int generate_new_id128(void) { SD_ID128_FORMAT_STR "\n\n" "As UUID:\n" "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n\n" - "As sd-id128(3) macro:\n" + "As man:sd-id128(3) macro:\n" "#define MESSAGE_XYZ SD_ID128_MAKE(", SD_ID128_FORMAT_VAL(id), SD_ID128_FORMAT_VAL(id)); diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index b4bf75a3dc..7c0317640f 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -825,6 +825,15 @@ static int client_send_request(sd_dhcp_client *client) { return r; } + if (client->vendor_class_identifier) { + r = dhcp_option_append(&request->dhcp, optlen, &optoffset, 0, + SD_DHCP_OPTION_VENDOR_CLASS_IDENTIFIER, + strlen(client->vendor_class_identifier), + client->vendor_class_identifier); + if (r < 0) + return r; + } + r = dhcp_option_append(&request->dhcp, optlen, &optoffset, 0, SD_DHCP_OPTION_END, 0, NULL); if (r < 0) diff --git a/src/resolve/resolved-resolv-conf.c b/src/resolve/resolved-resolv-conf.c index 13f08f8a6c..3c62550872 100644 --- a/src/resolve/resolved-resolv-conf.c +++ b/src/resolve/resolved-resolv-conf.c @@ -203,13 +203,13 @@ static void write_resolv_conf_search( static int write_resolv_conf_contents(FILE *f, OrderedSet *dns, OrderedSet *domains) { Iterator i; - fputs("# This file is managed by systemd-resolved(8). Do not edit.\n#\n" + fputs("# This file is managed by man:systemd-resolved(8). Do not edit.\n#\n" "# This is a dynamic resolv.conf file for connecting local clients directly to\n" "# all known DNS servers.\n#\n" "# Third party programs must not access this file directly, but only through the\n" - "# symlink at /etc/resolv.conf. To manage resolv.conf(5) in a different way,\n" + "# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,\n" "# replace this symlink by a static file or a different symlink.\n#\n" - "# See systemd-resolved.service(8) for details about the supported modes of\n" + "# See man:systemd-resolved.service(8) for details about the supported modes of\n" "# operation for /etc/resolv.conf.\n\n", f); if (ordered_set_isempty(dns)) diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 60f8bc3df5..c2af46d4ee 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -3482,6 +3482,8 @@ static int set_exit_code(uint8_t code) { static int start_special(int argc, char *argv[], void *userdata) { enum action a; int r; + bool termination_action; /* an action that terminates the manager, + * can be performed also by signal. */ assert(argv); @@ -3521,40 +3523,43 @@ static int start_special(int argc, char *argv[], void *userdata) { return r; } - if (arg_force >= 2 && - IN_SET(a, - ACTION_HALT, - ACTION_POWEROFF, - ACTION_REBOOT)) + termination_action = IN_SET(a, + ACTION_HALT, + ACTION_POWEROFF, + ACTION_REBOOT); + if (termination_action && arg_force >= 2) return halt_now(a); if (arg_force >= 1 && - IN_SET(a, - ACTION_HALT, - ACTION_POWEROFF, - ACTION_REBOOT, - ACTION_KEXEC, - ACTION_EXIT)) - return trivial_method(argc, argv, userdata); + (termination_action || IN_SET(a, ACTION_KEXEC, ACTION_EXIT))) + r = trivial_method(argc, argv, userdata); + else { + /* First try logind, to allow authentication with polkit */ + if (IN_SET(a, + ACTION_POWEROFF, + ACTION_REBOOT, + ACTION_SUSPEND, + ACTION_HIBERNATE, + ACTION_HYBRID_SLEEP)) { + + r = logind_reboot(a); + if (r >= 0) + return r; + if (IN_SET(r, -EOPNOTSUPP, -EINPROGRESS)) + /* requested operation is not supported or already in progress */ + return r; - /* First try logind, to allow authentication with polkit */ - if (IN_SET(a, - ACTION_POWEROFF, - ACTION_REBOOT, - ACTION_SUSPEND, - ACTION_HIBERNATE, - ACTION_HYBRID_SLEEP)) { - r = logind_reboot(a); - if (r >= 0) - return r; - if (IN_SET(r, -EOPNOTSUPP, -EINPROGRESS)) - /* requested operation is not supported or already in progress */ - return r; + /* On all other errors, try low-level operation */ + } - /* On all other errors, try low-level operation */ + r = start_unit(argc, argv, userdata); } - return start_unit(argc, argv, userdata); + if (termination_action && arg_force < 2 && + IN_SET(r, -ENOENT, -ETIMEDOUT)) + log_notice("It is possible to perform action directly, see discussion of --force --force in man:systemctl(1)."); + + return r; } static int start_system_special(int argc, char *argv[], void *userdata) { @@ -6806,29 +6811,54 @@ static int find_paths_to_edit(sd_bus *bus, char **names, char ***paths) { return r; STRV_FOREACH(name, names) { - _cleanup_free_ char *path = NULL, *new_path = NULL, *tmp_path = NULL; + _cleanup_free_ char *path = NULL, *new_path = NULL, *tmp_path = NULL, *tmp_name = NULL; + const char *unit_name; r = unit_find_paths(bus, *name, &lp, &path, NULL); if (r < 0) return r; - else if (!arg_force) { - if (r == 0) { - log_error("Run 'systemctl edit --force %s' to create a new unit.", *name); - return -ENOENT; - } else if (!path) { - // FIXME: support units with path==NULL (no FragmentPath) - log_error("No fragment exists for %s.", *name); + + if (r == 0) { + assert(!path); + + if (!arg_force) { + log_error("Run 'systemctl edit%s --force %s' to create a new unit.", + arg_scope == UNIT_FILE_GLOBAL ? " --global" : + arg_scope == UNIT_FILE_USER ? " --user" : "", + *name); return -ENOENT; } - } - if (path) { + /* Create a new unit from scratch */ + unit_name = *name; + r = unit_file_create_new(&lp, unit_name, + arg_full ? NULL : ".d/override.conf", + &new_path, &tmp_path); + } else { + assert(path); + + unit_name = basename(path); + /* We follow unit aliases, but we need to propagate the instance */ + if (unit_name_is_valid(*name, UNIT_NAME_INSTANCE) && + unit_name_is_valid(unit_name, UNIT_NAME_TEMPLATE)) { + _cleanup_free_ char *instance = NULL; + + r = unit_name_to_instance(*name, &instance); + if (r < 0) + return r; + + r = unit_name_replace_instance(unit_name, instance, &tmp_name); + if (r < 0) + return r; + + unit_name = tmp_name; + } + if (arg_full) - r = unit_file_create_copy(&lp, basename(path), path, &new_path, &tmp_path); + r = unit_file_create_copy(&lp, unit_name, path, &new_path, &tmp_path); else - r = unit_file_create_new(&lp, basename(path), ".d/override.conf", &new_path, &tmp_path); - } else - r = unit_file_create_new(&lp, *name, NULL, &new_path, &tmp_path); + r = unit_file_create_new(&lp, unit_name, ".d/override.conf", &new_path, &tmp_path); + } if (r < 0) return r; @@ -7540,7 +7570,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) { case ARG_STATE: { if (isempty(optarg)) { - log_error("--signal requires arguments."); + log_error("--state requires arguments."); return -EINVAL; } @@ -7549,7 +7579,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) { r = extract_first_word(&p, &s, ",", 0); if (r < 0) - return log_error_errno(r, "Failed to parse signal: %s", optarg); + return log_error_errno(r, "Failed to parse state: %s", optarg); if (r == 0) break; diff --git a/src/systemd/sd-bus-vtable.h b/src/systemd/sd-bus-vtable.h index e8f84eb545..3563a2b126 100644 --- a/src/systemd/sd-bus-vtable.h +++ b/src/systemd/sd-bus-vtable.h @@ -86,18 +86,26 @@ struct sd_bus_vtable { { \ .type = _SD_BUS_VTABLE_START, \ .flags = _flags, \ - .x.start.element_size = sizeof(sd_bus_vtable), \ + .x = { \ + .start = { \ + .element_size = sizeof(sd_bus_vtable) \ + }, \ + }, \ } #define SD_BUS_METHOD_WITH_OFFSET(_member, _signature, _result, _handler, _offset, _flags) \ { \ .type = _SD_BUS_VTABLE_METHOD, \ .flags = _flags, \ - .x.method.member = _member, \ - .x.method.signature = _signature, \ - .x.method.result = _result, \ - .x.method.handler = _handler, \ - .x.method.offset = _offset, \ + .x = { \ + .method = { \ + .member = _member, \ + .signature = _signature, \ + .result = _result, \ + .handler = _handler, \ + .offset = _offset, \ + }, \ + }, \ } #define SD_BUS_METHOD(_member, _signature, _result, _handler, _flags) \ SD_BUS_METHOD_WITH_OFFSET(_member, _signature, _result, _handler, 0, _flags) @@ -106,29 +114,41 @@ struct sd_bus_vtable { { \ .type = _SD_BUS_VTABLE_SIGNAL, \ .flags = _flags, \ - .x.signal.member = _member, \ - .x.signal.signature = _signature, \ + .x = { \ + .signal = { \ + .member = _member, \ + .signature = _signature, \ + }, \ + }, \ } #define SD_BUS_PROPERTY(_member, _signature, _get, _offset, _flags) \ { \ .type = _SD_BUS_VTABLE_PROPERTY, \ .flags = _flags, \ - .x.property.member = _member, \ - .x.property.signature = _signature, \ - .x.property.get = _get, \ - .x.property.offset = _offset, \ + .x = { \ + .property = { \ + .member = _member, \ + .signature = _signature, \ + .get = _get, \ + .offset = _offset, \ + }, \ + }, \ } #define SD_BUS_WRITABLE_PROPERTY(_member, _signature, _get, _set, _offset, _flags) \ { \ .type = _SD_BUS_VTABLE_WRITABLE_PROPERTY, \ .flags = _flags, \ - .x.property.member = _member, \ - .x.property.signature = _signature, \ - .x.property.get = _get, \ - .x.property.set = _set, \ - .x.property.offset = _offset, \ + .x = { \ + .property = { \ + .member = _member, \ + .signature = _signature, \ + .get = _get, \ + .set = _set, \ + .offset = _offset, \ + }, \ + }, \ } #define SD_BUS_VTABLE_END \ diff --git a/src/test/test-stat-util.c b/src/test/test-stat-util.c index 28ca6bc317..3ff2aadea4 100644 --- a/src/test/test-stat-util.c +++ b/src/test/test-stat-util.c @@ -82,7 +82,9 @@ static void test_path_check_fstype(void) { } static void test_path_is_temporary_fs(void) { - assert_se(path_is_temporary_fs("/run") > 0); + /* run might not be a mount point in build chroots */ + if (path_is_mount_point("/run", NULL, AT_SYMLINK_FOLLOW) > 0) + assert_se(path_is_temporary_fs("/run") > 0); assert_se(path_is_temporary_fs("/proc") == 0); assert_se(path_is_temporary_fs("/i-dont-exist") == -ENOENT); } diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index b5a88c667c..bd7b789cad 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -426,11 +426,10 @@ static int names_bcma(struct udev_device *dev, struct netnames *names) { static int names_ccw(struct udev_device *dev, struct netnames *names) { struct udev_device *cdev; - const char *bus_id; + const char *bus_id, *subsys; size_t bus_id_len; size_t bus_id_start; int rc; - char *subsys; assert(dev); assert(names); diff --git a/src/update-done/update-done.c b/src/update-done/update-done.c index 48c2a3fff4..d466e1b759 100644 --- a/src/update-done/update-done.c +++ b/src/update-done/update-done.c @@ -26,7 +26,7 @@ #define MESSAGE \ "# This file was created by systemd-update-done. Its only \n" \ "# purpose is to hold a timestamp of the time this directory\n" \ - "# was updated. See systemd-update-done.service(8).\n" + "# was updated. See man:systemd-update-done.service(8).\n" static int apply_timestamp(const char *path, struct timespec *ts) { struct timespec twice[2] = { |