From f7afdbbb986bed7022976612a740027697ce93ec Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Tue, 4 Jul 2017 16:59:46 +0200 Subject: [PATCH] Prep v232: Apply missing updates from upstream --- Makefile-man.am | 5 + man/elogind-mount.xml | 295 ---------------------- src/basic/cgroup-util.c | 4 +- src/basic/cgroup-util.h | 2 + src/basic/parse-util.c | 17 +- src/core/cgroup.h | 1 + src/libelogind/sd-bus/bus-common-errors.c | 1 + src/libelogind/sd-bus/bus-track.c | 2 +- src/libelogind/sd-event/sd-event.c | 1 + src/login/elogind.c | 2 +- src/login/logind-session-dbus.c | 1 - src/login/logind-utmp.c | 3 +- src/login/logind.c | 4 +- src/mount/mount-tool.c | 10 +- src/shared/acl-util.c | 2 +- src/systemd/sd-bus.h | 10 +- src/systemd/sd-id128.h | 2 +- src/systemd/sd-messages.h | 1 + 18 files changed, 51 insertions(+), 312 deletions(-) delete mode 100644 man/elogind-mount.xml diff --git a/Makefile-man.am b/Makefile-man.am index 895b64bf0..cd82c4819 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -54,6 +54,7 @@ MANPAGES_ALIAS += \ man/sd_event_source_unrefp.3 \ man/sd_id128_from_string.3 \ man/sd_id128_get_boot.3 \ + man/sd_id128_get_invocation.3 \ man/sd_machine_get_ifindices.3 \ man/sd_notifyf.3 \ man/sd_pid_notify.3 \ @@ -82,6 +83,7 @@ man/sd_event_source_set_io_fd.3: man/sd_event_add_io.3 man/sd_event_source_unrefp.3: man/sd_event_source_unref.3 man/sd_id128_from_string.3: man/sd_id128_to_string.3 man/sd_id128_get_boot.3: man/sd_id128_get_machine.3 +man/sd_id128_get_invocation.3: man/sd_id128_get_machine.3 man/sd_machine_get_ifindices.3: man/sd_machine_get_class.3 man/sd_notifyf.3: man/sd_notify.3 man/sd_pid_notify.3: man/sd_notify.3 @@ -156,6 +158,9 @@ man/sd_id128_from_string.html: man/sd_id128_to_string.html man/sd_id128_get_boot.html: man/sd_id128_get_machine.html $(html-alias) +man/sd_id128_get_invocation.html: man/sd_id128_get_machine.html + $(html-alias) + man/sd_machine_get_ifindices.html: man/sd_machine_get_class.html $(html-alias) diff --git a/man/elogind-mount.xml b/man/elogind-mount.xml deleted file mode 100644 index a691e3867..000000000 --- a/man/elogind-mount.xml +++ /dev/null @@ -1,295 +0,0 @@ - - - - - - - - - elogind-mount - elogind - - - - Developer - Lennart - Poettering - lennart@poettering.net - - - - - - elogind-mount - 1 - - - - elogind-mount - Establish a mount or auto-mount point transiently - - - - - elogind-mount - OPTIONS - WHAT - WHERE - - - elogind-mount - OPTIONS - - - - - - Description - - elogind-mount may be used to create and start a transient .mount or - .automount unit of the file system WHAT on the mount point - WHERE. - - In many ways, elogind-mount is similar to the lower-level - mount8 command, however instead - of executing the mount operation directly and immediately, elogind-mount schedules it through - the service manager job queue, so that it may pull in further dependencies (such as parent mounts, or a file system - checker to execute a priori), and may make use of the auto-mounting logic. - - The command takes either one or two arguments. If only one argument is specified it should refer to a block - device containing a file system (e.g. /dev/sdb1), which is then probed for a label and other - metadata, and is mounted to a directory whose name is generated from the label. In this mode the block device must - exist at the time of invocation of the command, so that it may be probed. If the device is found to be a removable - block device (e.g. a USB stick) an automount point instead of a regular mount point is created (i.e. the - option is implied, see below). - - If two arguments are specified the first indicates the mount source (the WHAT) and - the second indicates the path to mount it on (the WHERE). In this mode no probing of the - source is attempted, and a backing device node doesn't have to exist yet. However, if this mode is combined with - , device node probing for additional metadata is enabled, and – much like in the - single-argument case discussed above – the specified device has to exist at the time of invocation of the - command. - - Use the command to show a terse table of all local, known block devices with file - systems that may be mounted with this command. - - - - Options - - The following options are understood: - - - - - - - - Do not synchronously wait for the requested operation to finish. If this is not specified, the job will - be verified, enqueued and elogind-mount will wait until the mount or automount unit's - start-up is completed. By passing this argument, it is only verified and enqueued. - - - - - - - - - - - Suppresses additional informational output while running. - - - - - - Enable probing of the mount source. This switch is implied if a single argument is specified on - the command line. If passed, additional metadata is read from the device to enhance the unit to create. For - example, a descriptive string for the transient units is generated from the file system label and device - model. Moreover if a removable block device (e.g. USB stick) is detected an automount unit instead of a regular - mount unit is created, with a short idle time-out, in order to ensure the file-system is placed in a clean - state quickly after each access. - - - - - - - Specifies the file system type to mount (e.g. vfat, ext4, - …). If omitted (or set to auto) the file system is determined automatically. - - - - - - - Additional mount options for the mount point. - - - - - - Takes a boolean argument, defaults to on. Controls whether to run a file system check - immediately before the mount operation. In the automount case (see below) the - check will be run the moment the first access to the device is made, which might slightly delay the - access. - - - - - - Provide a description for the mount or automount unit. See Description= in - elogind.unit5. - - - - - - - - Sets a unit property for the mount unit that is created. This takes an assignment in the same - format as systemctl1's - set-property command. - - - - - - - Takes a boolean argument. Controls whether to create an automount point or a regular mount - point. If true an automount point is created that is backed by the actual file system at the time of first - access. If false a plain mount point is created that is backed by the actual file system immediately. Automount - points have the benefit that the file system stays unmounted and hence in clean state until it is first - accessed. In automount mode the switch (see below) may be used to ensure - the mount point is unmounted automatically after the last access and an idle period passed. - - If this switch is not specified it defaults to false. If not specified and is - used (or only a single argument passed, which implies , see above), and the file - system block device is detected to be removable, it is set to true, in order to increase the chance that the - file system is in a fully clean state if the device is unplugged abruptly. - - - - - - Equivalent to . - - - - - - Takes a time value that controls the idle timeout in automount mode. If set to - infinity (the default) no automatic unmounts are done. Otherwise the file system backing the - automount point is detached after the last access and the idle timeout passed. See - elogind.time7 for details on - the time syntax supported. This option has no effect if only a regular mount is established, and automounting - is not used. - - Note that if is used (or only a single argument passed, which implies - , see above), and the file system block device is detected to be removable, - is implied. - - - - - - Similar to , but applies additional properties to the automount - unit created, instead of the mount unit. - - - - - - Takes a boolean argument, defaults to off. This option only has an effect in automount mode, - and controls whether the automount unit shall be bound to the backing device's lifetime. If enabled, the - automount point will be removed automatically when the backing device vanishes. If disabled the automount point - stays around, and subsequent accesses will block until backing device is replugged. This option has no effect - in case of non-device mounts, such as network or virtual file system mounts. - - Note that if is used (or only a single argument passed, which implies - , see above), and the file system block device is detected to be removable, this - option is implied. - - - - - - Instead of establishing a mount or automount point, print a terse list of block devices - containing file systems that may be mounted with elogind-mount, along with useful metadata - such as labels, etc. - - - - - - - - - - - - - - - Exit status - - On success, 0 is returned, a non-zero failure - code otherwise. - - - - The udev Database - - If is used, elogind-mount honours a couple of additional udev - properties of block devices: - - - - SYSTEMD_MOUNT_OPTIONS= - - The mount options to use, if is not used. - - - - SYSTEMD_MOUNT_WHERE= - - The file system path to place the mount point at, instead of the automatically generated - one. - - - - - - See Also - - elogind1, - mount8, - systemctl1, - elogind.unit5, - elogind.mount5, - elogind.automount5, - elogind-run1 - - - - diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 424c2b69b..16e299a7e 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -2331,6 +2331,8 @@ static int cg_update_unified(void) { #if 0 /// UNNEEDED by elogind if (F_TYPE_EQUAL(fs.f_type, CGROUP2_SUPER_MAGIC)) + unified_cache = CGROUP_UNIFIED_ALL; + else if (F_TYPE_EQUAL(fs.f_type, TMPFS_MAGIC)) { #else /* elogind can not support the unified hierarchy as a controller, * so always assume a classical hierarchy. @@ -2339,8 +2341,6 @@ static int cg_update_unified(void) { * add such a support. */ if (F_TYPE_EQUAL(fs.f_type, TMPFS_MAGIC)) { #endif // 0 - unified_cache = CGROUP_UNIFIED_ALL; - else if (F_TYPE_EQUAL(fs.f_type, TMPFS_MAGIC)) { if (statfs("/sys/fs/cgroup/systemd/", &fs) < 0) return -errno; diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h index 5a6d41635..327a525bf 100644 --- a/src/basic/cgroup-util.h +++ b/src/basic/cgroup-util.h @@ -63,10 +63,12 @@ typedef enum CGroupMask { #define CGROUP_WEIGHT_MIN UINT64_C(1) #define CGROUP_WEIGHT_MAX UINT64_C(10000) #define CGROUP_WEIGHT_DEFAULT UINT64_C(100) +#endif // 0 #define CGROUP_LIMIT_MIN UINT64_C(0) #define CGROUP_LIMIT_MAX ((uint64_t) -1) +#if 0 /// UNNEEDED by elogind static inline bool CGROUP_WEIGHT_IS_OK(uint64_t x) { return x == CGROUP_WEIGHT_INVALID || diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c index 757e5b412..bfdf48322 100644 --- a/src/basic/parse-util.c +++ b/src/basic/parse-util.c @@ -558,10 +558,25 @@ int parse_percent_unbounded(const char *p) { } int parse_percent(const char *p) { - int v = parse_percent_unbounded(p); + int v; + v = parse_percent_unbounded(p); if (v > 100) return -ERANGE; return v; } + +int parse_nice(const char *p, int *ret) { + int n, r; + + r = safe_atoi(p, &n); + if (r < 0) + return r; + + if (!nice_is_valid(n)) + return -ERANGE; + + *ret = n; + return 0; +} diff --git a/src/core/cgroup.h b/src/core/cgroup.h index 3bcf68681..dd8e436b9 100644 --- a/src/core/cgroup.h +++ b/src/core/cgroup.h @@ -102,6 +102,7 @@ struct CGroupContext { uint64_t memory_low; uint64_t memory_high; uint64_t memory_max; + uint64_t memory_swap_max; /* For legacy hierarchies */ uint64_t cpu_shares; diff --git a/src/libelogind/sd-bus/bus-common-errors.c b/src/libelogind/sd-bus/bus-common-errors.c index 7a3449059..ed3f5fa38 100644 --- a/src/libelogind/sd-bus/bus-common-errors.c +++ b/src/libelogind/sd-bus/bus-common-errors.c @@ -28,6 +28,7 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_common_errors[] = { #if 0 /// UNNEEDED by elogind SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_UNIT, ENOENT), SD_BUS_ERROR_MAP(BUS_ERROR_NO_UNIT_FOR_PID, ESRCH), + SD_BUS_ERROR_MAP(BUS_ERROR_NO_UNIT_FOR_INVOCATION_ID, ENOENT), SD_BUS_ERROR_MAP(BUS_ERROR_UNIT_EXISTS, EEXIST), SD_BUS_ERROR_MAP(BUS_ERROR_LOAD_FAILED, EIO), SD_BUS_ERROR_MAP(BUS_ERROR_JOB_FAILED, EREMOTEIO), diff --git a/src/libelogind/sd-bus/bus-track.c b/src/libelogind/sd-bus/bus-track.c index 35dd563b1..3f3a494fc 100644 --- a/src/libelogind/sd-bus/bus-track.c +++ b/src/libelogind/sd-bus/bus-track.c @@ -427,7 +427,6 @@ void bus_track_dispatch(sd_bus_track *track) { sd_bus_track_unref(track); } -#if 0 /// UNNEEDED by elogind void bus_track_close(sd_bus_track *track) { struct track_item *i; @@ -456,6 +455,7 @@ void bus_track_close(sd_bus_track *track) { bus_track_dispatch(track); } +#if 0 /// UNNEEDED by elogind _public_ void *sd_bus_track_get_userdata(sd_bus_track *track) { assert_return(track, NULL); diff --git a/src/libelogind/sd-event/sd-event.c b/src/libelogind/sd-event/sd-event.c index cfd5a5545..c3673f08a 100644 --- a/src/libelogind/sd-event/sd-event.c +++ b/src/libelogind/sd-event/sd-event.c @@ -732,6 +732,7 @@ static void event_unmask_signal_data(sd_event *e, struct signal_data *d, int sig /* If all the mask is all-zero we can get rid of the structure */ hashmap_remove(e->signal_data, &d->priority); + assert(!d->current); safe_close(d->fd); free(d); return; diff --git a/src/login/elogind.c b/src/login/elogind.c index 5ff9ed7f2..5da9ae6a2 100644 --- a/src/login/elogind.c +++ b/src/login/elogind.c @@ -145,7 +145,7 @@ int elogind_setup_cgroups_agent(Manager *m) { if (!MANAGER_IS_SYSTEM(m)) return 0; - if (cg_unified() > 0) /* We don't need this anymore on the unified hierarchy */ + if (cg_unified(SYSTEMD_CGROUP_CONTROLLER) > 0) /* We don't need this anymore on the unified hierarchy */ return 0; if (m->cgroups_agent_fd < 0) { diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c index 7b45f7830..a39486527 100644 --- a/src/login/logind-session-dbus.c +++ b/src/login/logind-session-dbus.c @@ -775,7 +775,6 @@ int session_send_create_reply(Session *s, sd_bus_error *error) { #if 1 /// Additionally elogind saves the user state file user_save(s->user); #endif // 1 - p = session_bus_path(s); if (!p) return -ENOMEM; diff --git a/src/login/logind-utmp.c b/src/login/logind-utmp.c index 917aa72aa..4fcc25a1e 100644 --- a/src/login/logind-utmp.c +++ b/src/login/logind-utmp.c @@ -74,7 +74,7 @@ bool logind_wall_tty_filter(const char *tty, void *userdata) { static int warn_wall(Manager *m, usec_t n) { char date[FORMAT_TIMESTAMP_MAX] = {}; _cleanup_free_ char *l = NULL; - bool left; + usec_t left; int r; assert(m); @@ -148,7 +148,6 @@ int manager_setup_wall_message_timer(Manager *m) { if (!m->enable_wall_messages) return 0; #endif // 1 - n = now(CLOCK_REALTIME); elapse = m->scheduled_shutdown_timeout; diff --git a/src/login/logind.c b/src/login/logind.c index 774fd69dd..2efa78c19 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -73,7 +73,7 @@ static void manager_reset_config(Manager *m) { m->idle_action = HANDLE_IGNORE; m->runtime_dir_size = physical_memory_scale(10U, 100U); /* 10% */ - m->user_tasks_max = system_tasks_max_scale(33U, 100U); /* 33% */ + m->user_tasks_max = system_tasks_max_scale(DEFAULT_USER_TASKS_MAX_PERCENTAGE, 100U); /* 33% */ m->sessions_max = 8192; m->inhibitors_max = 8192; @@ -1046,7 +1046,7 @@ static int manager_parse_config_file(Manager *m) { #if 0 /// elogind parses its own config file assert(m); - return config_parse_many(PKGSYSCONFDIR "/logind.conf", + return config_parse_many_nulstr(PKGSYSCONFDIR "/logind.conf", CONF_PATHS_NULSTR("systemd/logind.conf.d"), "Login\0", config_item_perf_lookup, logind_gperf_lookup, diff --git a/src/mount/mount-tool.c b/src/mount/mount-tool.c index ae1a0b75e..84cacba57 100644 --- a/src/mount/mount-tool.c +++ b/src/mount/mount-tool.c @@ -319,9 +319,11 @@ static int parse_argv(int argc, char *argv[]) { static int transient_unit_set_properties(sd_bus_message *m, char **properties) { int r; - r = sd_bus_message_append(m, "(sv)", "Description", "s", arg_description); - if (r < 0) - return r; + if (!isempty(arg_description)) { + r = sd_bus_message_append(m, "(sv)", "Description", "s", arg_description); + if (r < 0) + return r; + } if (arg_bind_device && is_device_path(arg_mount_what)) { _cleanup_free_ char *device_unit = NULL; @@ -725,7 +727,7 @@ static int acquire_description(struct udev_device *d) { else if (model) arg_description = strdup(model); else - return NULL; + return 0; if (!arg_description) return log_oom(); diff --git a/src/shared/acl-util.c b/src/shared/acl-util.c index b99ecbba5..2963f9fc4 100644 --- a/src/shared/acl-util.c +++ b/src/shared/acl-util.c @@ -163,7 +163,7 @@ int add_base_acls_if_needed(acl_t *acl_p, const char *path) { int acl_search_groups(const char *path, char ***ret_groups) { _cleanup_strv_free_ char **g = NULL; - _cleanup_(acl_freep) acl_t acl = NULL; + _cleanup_(acl_free) acl_t acl = NULL; bool ret = false; acl_entry_t entry; int r; diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h index ae5cba51b..8df67b76b 100644 --- a/src/systemd/sd-bus.h +++ b/src/systemd/sd-bus.h @@ -153,6 +153,8 @@ int sd_bus_set_allow_interactive_authorization(sd_bus *bus, int b); #if 0 /// UNNEEDED by elogind int sd_bus_get_allow_interactive_authorization(sd_bus *bus); #endif // 0 +int sd_bus_set_exit_on_disconnect(sd_bus *bus, int b); +int sd_bus_get_exit_on_disconnect(sd_bus *bus); int sd_bus_start(sd_bus *ret); @@ -506,8 +508,14 @@ int sd_bus_track_remove_sender(sd_bus_track *track, sd_bus_message *m); int sd_bus_track_add_name(sd_bus_track *track, const char *name); int sd_bus_track_remove_name(sd_bus_track *track, const char *name); +int sd_bus_track_set_recursive(sd_bus_track *track, int b); +int sd_bus_track_get_recursive(sd_bus_track *track); + unsigned sd_bus_track_count(sd_bus_track *track); -const char* sd_bus_track_contains(sd_bus_track *track, const char *names); +int sd_bus_track_count_sender(sd_bus_track *track, sd_bus_message *m); +int sd_bus_track_count_name(sd_bus_track *track, const char *name); + +const char* sd_bus_track_contains(sd_bus_track *track, const char *name); const char* sd_bus_track_first(sd_bus_track *track); const char* sd_bus_track_next(sd_bus_track *track); diff --git a/src/systemd/sd-id128.h b/src/systemd/sd-id128.h index 4dff0b9b8..ee011b186 100644 --- a/src/systemd/sd-id128.h +++ b/src/systemd/sd-id128.h @@ -45,8 +45,8 @@ int sd_id128_from_string(const char *s, sd_id128_t *ret); int sd_id128_randomize(sd_id128_t *ret); int sd_id128_get_machine(sd_id128_t *ret); - int sd_id128_get_boot(sd_id128_t *ret); +int sd_id128_get_invocation(sd_id128_t *ret); #define SD_ID128_MAKE(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) \ ((const sd_id128_t) { .bytes = { 0x##v0, 0x##v1, 0x##v2, 0x##v3, 0x##v4, 0x##v5, 0x##v6, 0x##v7, \ diff --git a/src/systemd/sd-messages.h b/src/systemd/sd-messages.h index 3c44d6302..79246ae06 100644 --- a/src/systemd/sd-messages.h +++ b/src/systemd/sd-messages.h @@ -40,6 +40,7 @@ _SD_BEGIN_DECLARATIONS; #define SD_MESSAGE_JOURNAL_USAGE SD_ID128_MAKE(ec,38,7f,57,7b,84,4b,8f,a9,48,f3,3c,ad,9a,75,e6) #define SD_MESSAGE_COREDUMP SD_ID128_MAKE(fc,2e,22,bc,6e,e6,47,b6,b9,07,29,ab,34,a2,50,b1) +#define SD_MESSAGE_TRUNCATED_CORE SD_ID128_MAKE(5a,ad,d8,e9,54,dc,4b,1a,8c,95,4d,63,fd,9e,11,37) #define SD_MESSAGE_SESSION_START SD_ID128_MAKE(8d,45,62,0c,1a,43,48,db,b1,74,10,da,57,c6,0c,66) #define SD_MESSAGE_SESSION_STOP SD_ID128_MAKE(33,54,93,94,24,b4,45,6d,98,02,ca,83,33,ed,42,4a) -- 2.30.2