summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* basic: define HEXDIGITSDaniel Kahn Gillmor2017-06-16
| | | | | define HEXDIGITS alongside DIGITS, and use it where it's already useful. We'll use it again shortly when parsing MAC addresses.
* missing.h: add BTRFS_IOC_QUOTA_RESCAN_WAIT (#3266)Stefan Saraev2017-06-16
|
* logind: introduce LockedHint and SetLockedHint (#3238)Victor Toso2017-06-16
| | | | | Desktop environments can keep this property up to date to allow applications to easily track session's Lock status.
* locale-util: mark special_glyph() as _const_Zbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | _const_ means that the caller can assume that the function will return the same result every time (and will not modify global memory). special_glyph() meets this: even though it depends on global memory, that part of global memory is not expected to change. This allows the calls to special_glyph() to be optimized, even if -flto is not used.
* tree-wide: rename draw_special_char to special_glyphZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | | That function doesn't draw anything on it's own, just returns a string, which sometimes is more than one character. Also remove "DRAW_" prefix from character names, TREE_* and ARROW and BLACK_CIRCLE are unambigous on their own, don't draw anything, and are always used as an argument to special_glyph(). Rename "DASH" to "MDASH", as there's more than one type of dash.
* core: rework how we flush incoming traffic when a socket unit goes downLennart Poettering2017-06-16
| | | | | | | | | Previously, we'd simply close and reopen the socket file descriptors. This is problematic however, as we won't transition through the SOCKET_CHOWN state then, and thus the file ownership won't be correct for the sockets. Rework the flushing logic, and actually read any queued data from the sockets for flushing, and accept any queued messages and disconnect them.
* core: add io controller support on the unified hierarchyTejun Heo2017-06-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On the unified hierarchy, blkio controller is renamed to io and the interface is changed significantly. * blkio.weight and blkio.weight_device are consolidated into io.weight which uses the standardized weight range [1, 10000] with 100 as the default value. * blkio.throttle.{read|write}_{bps|iops}_device are consolidated into io.max. Expansion of throttling features is being worked on to support work-conserving absolute limits (io.low and io.high). * All stats are consolidated into io.stats. This patchset adds support for the new interface. As the interface has been revamped and new features are expected to be added, it seems best to treat it as a separate controller rather than trying to expand the blkio settings although we might add automatic translation if only blkio settings are specified. * io.weight handling is mostly identical to blkio.weight[_device] handling except that the weight range is different. * Both read and write bandwidth settings are consolidated into CGroupIODeviceLimit which describes all limits applicable to the device. This makes it less painful to add new limits. * "max" can be used to specify the maximum limit which is equivalent to no config for max limits and treated as such. If a given CGroupIODeviceLimit doesn't contain any non-default configs, the config struct is discarded once the no limit config is applied to cgroup. * lookup_blkio_device() is renamed to lookup_block_device(). Signed-off-by: Tejun Heo <htejun@fb.com>
* tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhereLennart Poettering2017-06-16
| | | | | | | | | | The macro determines the right length of a AF_UNIX "struct sockaddr_un" to pass to connect() or bind(). It automatically figures out if the socket refers to an abstract namespace socket, or a socket in the file system, and properly handles the full length of the path field. This macro is not only safer, but also simpler to use, than the usual offsetof() + strlen() logic.
* core: use an AF_UNIX/SOCK_DGRAM socket for cgroup agent notificationLennart Poettering2017-06-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dbus-daemon currently uses a backlog of 30 on its D-bus system bus socket. On overloaded systems this means that only 30 connections may be queued without dbus-daemon processing them before further connection attempts fail. Our cgroups-agent binary so far used D-Bus for its messaging, and hitting this limit hence may result in us losing cgroup empty messages. This patch adds a seperate cgroup agent socket of type AF_UNIX/SOCK_DGRAM. Since sockets of these types need no connection set up, no listen() backlog applies. Our cgroup-agent binary will hence simply block as long as it can't enqueue its datagram message, so that we won't lose cgroup empty messages as likely anymore. This also rearranges the ordering of the processing of SIGCHLD signals, service notification messages (sd_notify()...) and the two types of cgroup notifications (inotify for the unified hierarchy support, and agent for the classic hierarchy support). We now always process events for these in the following order: 1. service notification messages (SD_EVENT_PRIORITY_NORMAL-7) 2. SIGCHLD signals (SD_EVENT_PRIORITY_NORMAL-6) 3. cgroup inotify and cgroup agent (SD_EVENT_PRIORITY_NORMAL-5) This is because when receiving SIGCHLD we invalidate PID information, which we need to process the service notification messages which are bound to PIDs. Hence the order between the first two items. And we want to process SIGCHLD metadata to detect whether a service is gone, before using cgroup notifications, to decide when a service is gone, since the former carries more useful metadata. Related to this: https://bugs.freedesktop.org/show_bug.cgi?id=95264 https://github.com/elogind/elogind/issues/1961
* logind: enforce a limit on inhibitors we hand outLennart Poettering2017-06-16
| | | | | | | | For similar reasons as the recent addition of a limit on sessions. Note that we don't enforce a limit on inhibitors per-user currently, but there's an implicit one, since each inhibitor takes up one fd, and fds are limited via RLIMIT_NOFILE, and the limit on the number of processes per user.
* logind: expose more configuration settings as bus propertiesLennart Poettering2017-06-16
|
* logind: don't include session lists in PropertyChanged messagesLennart Poettering2017-06-16
| | | | | | | | | | | | | | | | | If we have a lot of simultaneous sessions we really shouldn't send the full list of active sessions with each PropertyChanged message for user and seat objects, as that can become quite substantial data, we probably shouldn't dump on the bus on each login and logout. Note that the global list of sessions doesn't send out changes like this either, it only supports requesting the session list with ListSessions(). If cients want to get notified about sessions coming and going they should subscribe to SessionNew and SessionRemoved signals, and clients generally do that already. This is kind of an API break, but then again the fact that this was included was never documented.
* logind: process session/inhibitor fds at higher priorityLennart Poettering2017-06-16
| | | | | | | Let's make sure we process session and inhibitor pipe fds (that signal sessions/inhibtors going away) at a higher priority than new bus calls that might create new sessions or inhibitors. This helps ensuring that the number of open sessions stays minimal.
* logind: enforce a limit on current user sessionsLennart Poettering2017-06-16
| | | | | | | | | | | We really should put limits on all resources we manage, hence add one to the number of concurrent sessions, too. This was previously unbounded, hence set a relatively high limit of 8K by default. Note that most PAM setups will actually invoke pam_elogind prefixed with "-", so that the return code of pam_elogind is ignored, and the login attempt succeeds anyway. On systems like this the session will be created but is not tracked by elogind.
* core: make unit_has_mask_realized() consider controller enable stateTejun Heo2017-06-16
| | | | | | | | | | | | | | unit_has_mask_realized() determines whether the specified unit has its cgroups set up properly given the desired target_mask; however, on the unified hierarchy, controllers need to be enabled explicitly for children and the mask of enabled controllers can deviate from target_mask. Only considering target_mask in unit_has_mask_realized() can lead to false positives and skipping enabling the requested controllers. This patch adds unit->cgroup_enabled_mask to track which controllers are enabled and updates unit_has_mask_realized() to also consider enable_mask. Signed-off-by: Tejun Heo <htejun@fb.com>
* machined: support non-btrfs file systems with "machinectl clone"Lennart Poettering2017-06-16
| | | | | | | | Fall back to a normal copy operation when the backing file system isn't btrfs, and hence doesn't support cheap snapshotting. Of course, this will be slow, but given that the execution is asynchronous now, this should be OK. Fixes: #1308
* copy: adjust directory times after writing to the directoryLennart Poettering2017-06-16
| | | | | | When recursively copying a directory tree, fix up the file times after having created all contents in it, so that our changes don't end up altering any of the directory times.
* copy: return the right error when we can't open a fileLennart Poettering2017-06-16
|
* copy: also copy AF_UNIX socketsLennart Poettering2017-06-16
| | | | | | | | We previously would fail with EOPNOTSUPP when encountering an AF_UNIX socket in the directory tree to copy. Fix that, and copy them too (even if they are dead in the result). Fixes: #2914
* parse-util: fix conversion from size_t on s390 (#3147)Lubomir Rintel2017-06-16
| | | | | | | | On s390 size_t is an unsigned long, nor an unsigned int. They both are of the same size and can be cast to each other safely, but the compiler still seems unhappy about incompatible pointers. Fixes: 7c2da2ca8
* basic/mount-util: recognize pvfs2 as network fs (#3140)Zbigniew Jędrzejewski-Szmek2017-06-16
| | | | Added to kernel 4.6.
* tree-wide: rename hidden_file to hidden_or_backup_file and optimizeZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | | | | In standard linux parlance, "hidden" usually means that the file name starts with ".", and nothing else. Rename the function to convey what the function does better to casual readers. Stop exposing hidden_file_allow_backup which is rather ugly and rewrite hidden_file to extract the suffix first. Note that hidden_file_allow_backup excluded files with "~" at the end, which is quite confusing. Let's get rid of it before it gets used in the wrong place.
* basic/dirent-util: do not call hidden_file_allow_backup from ↵Zbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | dirent_is_file_with_suffix If the file name is supposed to end in a suffix, there's not need to check the name against a list of "special" file names, which is slow. Instead, just check that the name doens't start with a period.
* path-util: Add hidden suffixes for ucf (#3131)Martin Pitt2017-06-16
| | | | | | | | | ucf is a standard Debian helper for managing configuration file upgrades which need more interaction or elaborate merging than conffiles managed by dpkg. Ignore its temporary and backup files similarly to the *.dpkg-* ones to avoid creating units for them in generators. https://bugs.debian.org/775903
* build-sys: improve compat with older kernel headersLennart Poettering2017-06-16
| | | | | | | | In 4.2 kernel headers, some netlink defines are missing that we need. missing.h already can add them in, but currently makes this dependent on a definition that these kernels already have. Change the check hence to check for the newest definition in the table, so that the whole bunch of definitions as added in on all kernels lacking this.
* elogind --user: call pam_loginuid when creating user@.service (#3120)Zbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | | | | | | This way the user service will have a loginuid, and it will be inherited by child services. This shouldn't change anything as far as elogind itself is concerned, but is nice for various services spawned from by elogind --user that expect a loginuid. pam_loginuid(8) says that it should be enabled for "..., crond and atd". user@.service should behave similarly to those two as far as audit is concerned. https://bugzilla.redhat.com/show_bug.cgi?id=1328947#c28
* nspawn: don't try to patch UIDs/GIDs of procfs and suchlikeLennart Poettering2017-06-16
|
* nspawn: make -U a tiny bit smarterLennart Poettering2017-06-16
| | | | | With this change -U will turn on user namespacing only if the kernel actually supports it and otherwise gracefully degrade to non-userns mode.
* networkd: bump MTU to 1280 for interfaces which have IPv6 enabled (#3077)Susant Sahani2017-06-16
| | | | | | | | | | | | IPv6 protocol requires a minimum MTU of 1280 bytes on the interface. This fixes #3046. Introduce helper link_ipv6_enabled() to figure out whether IPV6 is enabled. Introduce network_has_static_ipv6_addresses() to find out if any static ipv6 address configured. If IPv6 is not configured on any interface that is SLAAC, DHCPv6 and static IPv6 addresses not configured, then IPv6 will be automatically disabled for that interface, that is we write "1" to /proc/sys/net/ipv6/conf//disable_ipv6.
* tree-wide: don't assume CLOCK_BOOTIME is generally availableLennart Poettering2017-06-16
| | | | | | | | | | | | Before we invoke now(CLOCK_BOOTTIME), let's make sure we actually have that clock, since now() will otherwise hit an assert. Specifically, let's refuse CLOCK_BOOTTIME early in sd-event if the kernel doesn't actually support it. This is a follow-up for #3037, and specifically: https://github.com/elogind/elogind/pull/3037#issuecomment-210199167
* shared: move unit-specific code from bus-util.h to bus-unit-util.hLennart Poettering2017-06-16
| | | | | | | Previously we'd have generally useful sd-bus utilities in bust-util.h, intermixed with code that is specifically for writing clients for PID 1, wrapping job and unit handling. Let's split the latter out and move it into bus-unit-util.c, to make the sources a bit short and easier to grok.
* core,systemctl: add bus API to retrieve processes of a unitLennart Poettering2017-06-16
| | | | | | | | | | | | | | | This adds a new GetProcesses() bus call to the Unit object which returns an array consisting of all PIDs, their process names, as well as their full cgroup paths. This is then used by "systemctl status" to show the per-unit process tree. This has the benefit that the client-side no longer needs to access the cgroupfs directly to show the process tree of a unit. Instead, it now uses this new API, which means it also works if -H or -M are used correctly, as the information from the specific host is used, and not the one from the local system. Fixes: #2945
* logind: use type to determine graphical sessions (#3071)Michał Bartoszkiewicz2017-06-16
|
* basic: user-utils.c needs missing.h for secure_getenv (#3059)michaelolbrich2017-06-16
| | | | | | | Otherwise building may fail with: src/basic/user-util.c: In function 'get_home_dir': src/basic/user-util.c:343:9: error: implicit declaration of function 'secure_getenv' [-Werror=implicit-function-declaration]
* networkd: allow setting of multicast querier for linux bridge (#3051)Susant Sahani2017-06-16
|
* conf-parser: Set EXTRACT_RETAIN_ESCAPE when extracting words (#2917)Dan Nicholson2017-06-16
| | | | | | | | | | | | | | | | | | | | | | If you reference another unit with an escaped name, the escaped characters should remain in the extracted word. This used to work correctly prior to commit 34f253f0. The problem can be seen when units with escaped names are referenced. $ cat "/usr/lib/elogind/system/dev-disk-by\x2dlabel-eos\x2dswap.swap" [Swap] What=/dev/disk/by-label/eos-swap [Install] WantedBy=dev-disk-by\x2dlabel-eos\x2dswap.device $ systemctl enable "dev-disk-by\x2dlabel-eos\x2dswap.swap" Created symlink /etc/elogind/system/dev-disk-byx2dlabel-eosx2dswap.device.wants/dev-disk-by\x2dlabel-eos\x2dswap.swap, pointing to /usr/lib/elogind/system/dev-disk-by\x2dlabel-eos\x2dswap.swap. The wants directory should be created with the x2ds escaped with \.
* tree-wide: fall back to now(CLOCK_MONOTONIC) if CLOCK_BOOTTIME unsupported ↵Lubomir Rintel2017-06-16
| | | | | | | | | (#3037) It was added in 2.6.39, and causes an assertion to fail when running in mock hosted on 2.6.32-based RHEL-6: Assertion 'clock_gettime(map_clock_id(clock_id), &ts) == 0' failed at elogind/src/basic/time-util.c:70, function now(). Aborting.
* shared/install,systemctl,core: report offending file on installation errorZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | | | | | | | | | | | | | | Fixes #2191: $ systemctl --root=/ enable sddm Created symlink /etc/elogind/system/display-manager.service, pointing to /usr/lib/elogind/system/sddm.service. $ sudo build/systemctl --root=/ enable gdm Failed to enable unit, file /etc/elogind/system/display-manager.service already exists and is a symlink to /usr/lib/elogind/system/sddm.service. $ sudo build/systemctl --root= enable sddm $ sudo build/systemctl --root= enable gdm Failed to enable unit: File /etc/elogind/system/display-manager.service already exists and is a symlink to /usr/lib/elogind/system/sddm.service. (I tried a few different approaches to pass the error information back to the caller. Adding a new parameter to hold the error results in a gigantic patch and a lot of hassle to pass the args arounds. Adding this information to the changes array is straightforward and can be more easily extended in the future.) In case local installation is performed, the full set of errors can be reported and we do that. When running over dbus, only the first error is reported.
* tree-wide: introduce PATH_IN_SET macroZbigniew Jędrzejewski-Szmek2017-06-16
|
* systemctl/core: ignore masked units in preset-allZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | | | | | | | | With any masked unit that would that would be enabled by presets, we'd get: test@rawhide $ sudo systemctl preset-all Failed to execute operation: Unit file is masked. test@rawhide $ sudo systemctl --root=/ preset-all Operation failed: Cannot send after transport endpoint shutdown Simply ignore those units: test@rawhide $ sudo systemctl preset-all Unit xxx.service is masked, ignoring.
* sd-bus: use IN_SETZbigniew Jędrzejewski-Szmek2017-06-16
|
* core/mount-setup.c: also relabel /dev/shm for selinux (#3039)Harald Hoyer2017-06-16
| | | | | | | | daemons, which wish to transition state from the initramfs to the real root, might use /dev/shm for their state. As /dev is not relabeled across mount points, /dev/shm has to be relabled explicitly.
* sd-bus: query pid also when searching for supplementary gidsIsmo Puustinen2017-06-16
| | | | | | | If the SD_BUS_CREDS_SUPPLEMENTARY_GIDS value is requested, the pid is queried to find out the supplementary gids value from /proc/pid/status. Otherwise sd_bus_creds_get_supplementary_gids() won't work unless some other value in mask triggered fetching the pid information.
* logind: allow any user to request lingeringZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | We enable lingering for anyone who wants this. It is still disabled by default to avoid keeping long-running processes accidentally. Admins might want to customize this policy on multi-user sites.
* core: make sure we generate a nicer error when a linked unit is attempted to ↵Lennart Poettering2017-06-16
| | | | | | | | | be enabled We don't allow using config symlinks to enable units, but the error message we printed was awful. Fix that, and generate a more readable error. Fixes #3010.
* logind: reload config on SIGHUPZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | v2: - fix setting of kill_user_processes and *_ignore_inhibited settings
* tree-wide: remove useless NULLs from strjoinaZbigniew Jędrzejewski-Szmek2017-06-16
| | | | The coccinelle patch didn't work in some places, I have no idea why.
* basic/util: check return value of dup2 in fork_agent()Zbigniew Jędrzejewski-Szmek2017-06-16
| | | | CID #1304689.
* tests: override XDG_RUNTIME_DIR where we use the user runtime dirLennart Poettering2017-06-16
| | | | | | | We don#t really support systems where XDG_RUNTIME_DIR is not supported for elogind --user. Hence, let's always set our own XDG_RUNTIME_DIR for tests that involve elogind --user, so that we know it is set, and that it doesn't polute the user's actual runtime dir.
* tree-wide: add new SIGNAL_VALID() macro-like function that validates signal ↵Lennart Poettering2017-06-16
| | | | | | numbers And port all code over to use it.