summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* tree-wide: use IN_SET macro (#6977)Yu Watanabe2017-12-08
|
* test-sizeof: add pid_t and gid_tZbigniew Jędrzejewski-Szmek2017-10-04
| | | | C.f. #6975.
* test-copy: fix operation when test-copy is too smallZbigniew Jędrzejewski-Szmek2017-10-04
| | | | Fixes #6981.
* meson: generate ENABLE_* names automaticallyZbigniew Jędrzejewski-Szmek2017-10-03
| | | | | After previous changes, the naming of configuration options and internal defines is consistent.
* build-sys: s/HAVE_SMACK/ENABLE_SMACK/Zbigniew Jędrzejewski-Szmek2017-12-08
| | | | Same justification as for HAVE_UTMP.
* build-sys: s/HAVE_IMA/ENABLE_IMA/Zbigniew Jędrzejewski-Szmek2017-12-07
| | | | Same justification as for HAVE_UTMP.
* build-sys: require all defines under #if to be presentZbigniew Jędrzejewski-Szmek2017-10-03
| | | | This should help to catch any errors with typos and HAVE/ENABLE mismatches.
* Apply updates from upstreamSven Eden2017-12-07
|
* build-sys: use #if Y instead of #ifdef Y everywhereZbigniew Jędrzejewski-Szmek2017-11-23
| | | | | | | | | | | | | | | The advantage is that is the name is mispellt, cpp will warn us. $ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/" $ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;' $ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g' $ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g' + manual changes to meson.build squash! build-sys: use #if Y instead of #ifdef Y everywhere v2: - fix incorrect setting of HAVE_LIBIDN2
* Revert "tree-wide: use pid_is_valid() at more places"Alan Jenkins2017-10-03
| | | | | | | | | | | This reverts commit ee043777be58251e7441b4f04594e9e3792d7fb2. It broke almost everywhere it touched. The places that handn't been converted, were mostly followed by special handling for the invalid PID `0`. That explains why they tested for `pid < 0` instead of `pid <= 0`. I think that one was the first commit I reviewed, heh.
* meson: check for sys/auxv.hZbigniew Jędrzejewski-Szmek2017-10-03
| | | | | This check was present in configure.ac, but was never added under meson. The code under HAVE_SYS_AUX_H has been dead ever since :(.
* build-sys: change all HAVE_DECL_ macros to HAVE_Zbigniew Jędrzejewski-Szmek2017-11-22
| | | | | | | This is a legacy of autotools, where one detection routine used a different prefix then the others. $ git grep -e HAVE_DECL_ -l|xargs sed -i s/HAVE_DECL_/HAVE_/g
* path-util: some updates to path_make_relative()Lennart Poettering2017-11-22
| | | | | | | | | | Don't miscount number of "../" to generate, if we "." is included in an input path. Also, refuse if we encounter "../" since we can't possibly follow that up properly, without file system access. Some other modernizations.
* core: chown() StateDirectory= and friends recursively when starting a serviceLennart Poettering2017-11-22
| | | | | | | This is particularly useful when used in conjunction with DynamicUser=1, where the UID might change for every invocation, but is useful in other cases too, for example, when these directories are shared between systems where the UID assignments differ slightly.
* tree-wide: use `!IN_SET(..)` for `a != b && a != c && …`Andreas Rammhold2017-09-29
| | | | | | The included cocci was used to generate the changes. Thanks to @flo-wer for pointing this case out.
* tree-wide: use IN_SET where possibleAndreas Rammhold2017-09-29
| | | | | In addition to the changes from #6933 this handles cases that could be matched with the included cocci file.
* sd-bus: drop bloom fieldsLennart Poettering2017-09-29
| | | | These fields are unused since kdbus support has been removed.
* sd-bus: drop match cookie conceptLennart Poettering2017-09-29
| | | | | | THe match cookie was used by kdbus to identify matches we install uniquely. But given that kdbus is gone, the cookie serves no process anymore, let's kill it.
* sd-bus: when showing brief message info show error name in debug out put tooLennart Poettering2017-09-29
| | | | | | | When debug logging is enabled we show brief information about every bus message we send or receieve. Pretty much all information is shown, except for the error name if a message is an error (interestingly we do print the error text however). Fix that, and add the error name as well.
* mount-util: add fusectl to list of API VFSLennart Poettering2017-09-29
|
* dissect: split list of discard-supporting fs out into mount-util.cLennart Poettering2017-11-22
| | | | | | | Let's manage the list of file systems that do a specific thing at one place, following similar naming. No functional changes.
* dissect: automatically mark partitions read-only that have a read-only file ↵Lennart Poettering2017-11-22
| | | | | | | system Specifically, squashfs and iso9660 are always read-only, hence make sure we never even think about mounting them writable.
* meson: move library version defines to the top (#6939)Zbigniew Jędrzejewski-Szmek2017-09-28
|
* meson: bump release to 235Lennart Poettering2017-09-28
|
* libelogind: use IN_SET macroYu Watanabe2017-11-22
|
* cgroup: IN_SET() FTW!Lennart Poettering2017-09-26
|
* cgroup: after determining that a cgroup is empty, asynchronously dispatch thisLennart Poettering2017-11-22
| | | | | | | | | | | | | This makes sure that if we learn via inotify or another event source that a cgroup is empty, and we checked that this is indeed the case (as we might get spurious notifications through inotify, as the inotify logic through the "cgroups.event" is pretty unspecific and might be trigger for a variety of reasons), then we'll enqueue a defer event for it, at a priority lower than SIGCHLD handling, so that we know for sure that if there's waitid() data for a process we used it before considering the cgroup empty notification. Fixes: #6608
* core: rename cgroup_queue → cgroup_realize_queueLennart Poettering2017-11-22
| | | | | | | | | We are about to add second cgroup-related queue, called "cgroup_empty_queue", hence let's rename "cgroup_queue" to "cgroup_realize_queue" (as that is its purpose) to minimize confusion about the two queues. Just a rename, no functional changes.
* core/cgroup: add a helper macro for a common pattern (#6926)Zbigniew Jędrzejewski-Szmek2017-11-22
|
* fs-util: propagate EEXIST error in symlink_idempotent() as EEXISTLennart Poettering2017-11-22
| | | | | We really shouldn't silently translate the error code here for no reason.
* log: add a mode where we open the log fds for every single log messageLennart Poettering2017-11-22
| | | | | | This we can then make use in execute.c to make error logging a bit less special when preparing for process execution, as we can still log but don't have any fds open continously.
* log: let's make use of the fact that our functions return the negative error ↵Lennart Poettering2017-09-25
| | | | code for log_oom() too
* swap: adjust swap.c in a similar way to what we just did to mount.cLennart Poettering2017-09-25
| | | | | | Also drop the redundant states and make all similar changes too. Thankfully the swap.c state engine is much simpler than mount.c's, hence this should be easier to digest.
* mount: rework mount state engineLennart Poettering2017-09-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the mount unit state engine in the following ways: 1. The MOUNT_MOUNTING_SIGTERM and MOUNT_MOUNTING_SIGKILL are removed. They have been pretty much equivalent to MOUNT_UNMOUNTING_SIGTERM and MOUNT_UNMOUNTING_SIGKILL in what they do, and the outcome has been the same as well: the unit is stopped. Hence, let's simplify things a bit, and merge them. Note that we keep MOUNT_REMOUNTING_{SIGTERM|SIGKILL} however, as those states have a different outcome: the unit remains started. 2. mount_enter_signal() will now honour the SendSIGKILL= option of the mount unit if it was set. This was previously done already when we entered the signal states through a timeout, and was simply missing here. 3. A new helper function mount_enter_dead_or_mounted() is added that places the mount unit in either MOUNT_DEAD or MOUNT_MOUNTED, depending on what the kernel thinks about the mount's state. This function is called at various places now, wherever we finished an operation, and want to make sure our own state reflects again what the kernel thinks. Previously we had very similar code in a number of places and in other places didn't recheck the kernel state. Let's do that with the same logic and function at all relevant places now. 4. Rework mount_stop(): never forget about running control processes. Instead: when we have a start (i.e. a /bin/mount) process running, and are asked to stop, then enter the kill states for it, so that it gets cleaned up. This fixes #6048. Moreover, when we have a reload process running convert the possible states into the relevant unmounting states, so that we can properly execute the requested operation. Fixes #6048
* set: add new helper set_make() which is like set_new() + multiple set_put() ↵Lennart Poettering2017-11-22
| | | | in vararg
* basic/log: fix return value from log_struct_iovec_internal()Zbigniew Jędrzejewski-Szmek2017-09-26
| | | | | This returned value so far wasn't used anywhere, so there's no change in behaviour.
* string-util: use size_t for strjoina macro (#6914)Jonathan Lebon2017-09-25
| | | | `strlen` returns a `size_t` and `alloca` expects a `size_t`.
* shared/bus-util: format uid==-1 and gid==-1 as [not set]Zbigniew Jędrzejewski-Szmek2017-09-25
| | | | | | | | | | | | | | | | $ systemctl show elogind-journald -p UID,GID UID=4294967295 GID=4294967295 ↓ $ systemctl show elogind-journald -p UID,GID UID=[not set] GID=[not set] Just seeing the number is very misleading. Fixes #6511.
* basic/cap-list: report empty capability set as ""Zbigniew Jędrzejewski-Szmek2017-09-25
| | | | | | | | | | | | | | $ systemctl show elogind-journald -p CapabilityBoundingSet,AmbientCapabilities CapabilityBoundingSet=cap_chown cap_dac_override cap_dac_read_search cap_fowner cap_setgid ... AmbientCapabilities=(null) ↓ $ systemctl show elogind-journald -p CapabilityBoundingSet,AmbientCapabilities CapabilityBoundingSet=cap_chown cap_dac_override cap_dac_read_search cap_fowner cap_setgid ... AmbientCapabilities= Partially fixes #6511. Add some basic tests for the printing function.
* fileio: return 0 from read_one_line_file on successZbigniew Jędrzejewski-Szmek2017-11-22
| | | | Fixup for f4b51a2d09. Suggested by Evgeny Vereshchagin.
* fileio: initialize errno to zero before we do fread()Lennart Poettering2017-09-22
| | | | | if there was something in the read buffer already errno might not be set on error, let's detect that case.
* fileio: try to read one byte too much in read_full_stream()Lennart Poettering2017-09-22
| | | | | | | | Let's read one byte more than the file size we read from stat() on the first fread() invocation. That way, the first read() will already be short and indicate eof to fread(). This is a minor optimization, and replaces #3908.
* fileio: move fsync() logic into write_string_stream_ts()Lennart Poettering2017-09-22
| | | | | | That way, write_string_stream_ts() becomes more powerful, and we can remove duplicate code from write_string_file_atomic() and write_string_file_ts().
* fileio: make write_string_stream() accept flags parameterLennart Poettering2017-09-22
| | | | | | Let's make write_string_stream() and write_string_file() more alike, and pass the same flag set so that we can remove a number of boolean parameters.
* fileio: support writing atomic files with timestampLennart Poettering2017-09-22
| | | | | Let's make sure "ts" is taken into account when writing atomic files, too.
* cgroup: rework which files we chown() on delegationLennart Poettering2017-09-22
| | | | | | | | | | | | | | | | On cgroupsv2 we should also chown()/chmod() the subtree_control file, so that children can use controllers the way they like. On cgroupsv1 we should also chown()/chmod() cgroups.clone_children, as not setting this for new cgroups makes little sense, and hence delegated clients should be able to write to it. Note that error handling for both cases is different. subtree_control matters so we check for errors, but the clone_children/tasks stuff doesn't really, as it's legacy stuff. Hence we only log errors and proceed. Fixes: #6216
* cgroup-util: downgrade log messages from library code to LOG_DEBUGLennart Poettering2017-11-21
| | | | | | | These errors don't really matter, that's why we log and proceed in the current code. However, we currently log at LOG_WARNING, but we really shouldn't given that this is library code. Hence downgrade this to LOG_DEBUG.
* core: whenever a unit terminates, log its consumed resources to the journalLennart Poettering2017-09-21
| | | | | | | | | | | | This adds a new recognizable log message for each unit invocation that contains structured information about consumed resources of the unit as a whole after it terminated. This is particular useful for apps that want to figure out what the resource consumption of a unit given a specific invocation ID was. The log message is only generated for units that have at least one XyzAccounting= property turned on, and currently only covers IP traffic and CPU time metrics.
* io-util: add new IOVEC_INIT/IOVEC_MAKE macrosLennart Poettering2017-09-21
| | | | | | | | | | | | | | | | | | | | | | This adds IOVEC_INIT() and IOVEC_MAKE() for initializing iovec structures from a pointer and a size. On top of these IOVEC_INIT_STRING() and IOVEC_MAKE_STRING() are added which take a string and automatically determine the size of the string using strlen(). This patch removes the old IOVEC_SET_STRING() macro, given that IOVEC_MAKE_STRING() is now useful for similar purposes. Note that the old IOVEC_SET_STRING() invocations were two characters shorter than the new ones using IOVEC_MAKE_STRING(), but I think the new syntax is more readable and more generic as it simply resolves to a C99 literal structure initialization. Moreover, we can use very similar syntax now for initializing strings and pointer+size iovec entries. We canalso use the new macros to initialize function parameters on-the-fly or array definitions. And given that we shouldn't have so many ways to do the same stuff, let's just settle on the new macros. (This also converts some code to use _cleanup_ where dynamically allocated strings were using IOVEC_SET_STRING() before, to modernize things a bit)
* cgroup: refuse to return accounting data if accounting isn't turned onLennart Poettering2017-11-21
| | | | | | | | | | We used to be a bit sloppy on this, and handed out accounting data even for units where accounting wasn't explicitly enabled. Let's be stricter here, so that we know the accounting data is actually fully valid. This is necessary, as the accounting data is no longer stored exclusively in cgroupfs, but is partly maintained external of that, and flushed during unit starts. We should hence only expose accounting data we really know is fully current.