summaryrefslogtreecommitdiffstats
path: root/tools (unfollow)
Commit message (Collapse)AuthorFilesLines
2018-02-13manager: avoid infinite loop for unexpected waitid() error (#8168)Alan Jenkins1-5/+4
I think if we log the error as being _ignored_, we should also consider the event as handled and clear it. This was the behaviour prior to 575b300b (PR #7968). I don't think we particularly wanted to change behaviour and keep retrying. Sometimes that's useful, other times you cause more problems by filling the logs. Plus a nearby typo fix.
2018-02-13l10n: update POTFILES.in (#8163)AsciiWolf1-0/+1
2018-02-12tmpfiles: age root-owned read-only files, by default (#7917)itsbill1-6/+0
[zj: The note in NEWS was added in 82c8e3e6503a40684cf265842bb1c26a8f7681b5 and released as part of systemd-237.]
2018-02-10socket-util: drop getnameinfo_pretty()Yu Watanabe3-68/+0
2018-02-09Revert "Periodically call sd_journal_process in journalctl" (#8147)Zbigniew Jędrzejewski-Szmek1-28/+0
This reverts commit 992149c07e3ecfbfe4067641e92a6923e7aacda4. https://github.com/systemd/systemd/pull/8144#issuecomment-364464627 $ (set -o pipefail; sudo ./build/journalctl --no-pager | wc -l; echo $?) Failed to process inotify events: Bad file descriptor 1025 1
2018-02-09basic/socket-util: drop use of NI_IDN_USE_STD3_ASCII_RULESZbigniew Jędrzejewski-Szmek1-1/+1
The only use of socknameinfo_pretty() is in src/journal-remote/journal-remote.c, to determine the output filename. Replaces #8120.
2018-02-09fd-util: move certain fds above fd #2 (#8129)Lennart Poettering9-14/+89
This adds some paranoia code that moves some of the fds we allocate for longer periods of times to fds > 2 if they are allocated below this boundary. This is a paranoid safety thing, in order to avoid that external code might end up erroneously use our fds under the assumption they were valid stdin/stdout/stderr. Think: some app closes stdin/stdout/stderr and then invokes 'fprintf(stderr, …' which causes writes on our fds. This both adds the helper to do the moving as well as ports over a number of users to this new logic. Since we don't want to litter all our code with invocations of this I tried to strictly focus on fds we keep open for long periods of times only and only in code that is frequently loaded into foreign programs (under the assumptions that in our own codebase we are smart enough to always keep stdin/stdout/stderr allocated to avoid this pitfall). Specifically this means all code used by NSS and our sd-xyz API: 1. our logging APIs 2. sd-event 3. sd-bus 4. sd-resolve 5. sd-netlink This changed was inspired by this: https://github.com/systemd/systemd/issues/8075#issuecomment-363689755 This shows that apparently IRL there are programs that do close stdin/stdout/stderr, and we should accomodate for that. Note that this won't fix any bugs, this just makes sure that buggy programs are less likely to interfere with out own code.
2018-02-09Suspend on lid close based on power status. (#8016)Simon Fowler8-14/+53
This change adds support for controlling the suspend-on-lid-close behaviour based on the power status as well as whether the machine is docked or has an external monitor. For backwards compatibility the new configuration file variable is ignored completely by default, and must be set explicitly before being considered in any decisions.
2018-02-09service: relax PID file symlink chain checks a bit (#8133)Lennart Poettering1-2/+13
Let's read the PID file after all if there's a potentially unsafe symlink chain in place. But if we do, then refuse taking the PID if its outside of the cgroup. Fixes: #8085
2018-02-09man:systemd.service(5): fix description of specifiers in command lines (#8146)Oleander Reis1-3/+1
Command lines now accept specifiers within the first argument. see issues #3061, #679 and pr #4835
2018-02-09analyze: slight simplificationZbigniew Jędrzejewski-Szmek1-12/+13
2018-02-09analyze: remove implicit conversions of numbers to booleansZbigniew Jędrzejewski-Szmek1-14/+14
2018-02-09man: make Notes section in systemd.geneator(5) toplevelZbigniew Jędrzejewski-Szmek1-147/+120
This is mostly a indentation change and rewrapping.
2018-02-09man: document unit load pathsZbigniew Jędrzejewski-Szmek2-48/+149
So far we didn't document control, transient, dbus config, or generator paths. But those paths are visible to users, and they need to understand why systemd loads units from those paths, and how the precedence hierarchy looks. The whole thing is a bit messy, since the list of paths is quite long. I made the tables a bit shorter by combining rows for the alternatives where $XDG_* is set and the fallback. In various places, tags are split like <element param="blah"> this. This is necessary to keep everyting in one logical XML line so that docbook renders the table properly. Replaces #8050.
2018-02-09shared/path-lookup: rename user control dirs to "user.control"Zbigniew Jędrzejewski-Szmek1-2/+2
$ diff -u <(old/systemd-analyze --user unit-paths) <(new/systemd-analyze --user unit-paths)|colordiff --- /proc/self/fd/14 2018-02-08 14:36:34.190046129 +0100 +++ /proc/self/fd/15 2018-02-08 14:36:34.190046129 +0100 @@ -1,5 +1,5 @@ -/home/zbyszek/.config/systemd/system.control -/run/user/1000/systemd/system.control +/home/zbyszek/.config/systemd/user.control +/run/user/1000/systemd/user.control /run/user/1000/systemd/transient ... Strictly speaking, online upgrades of user instances through daemon-reexec will be broken. We can get away with this since a) reexecs of the user instance are not commonly done, at least package upgrade scripts don't do this afawk. b) cgroups aren't delegateable on cgroupsv1 there's little reason to use "systemctl set-property" for --user mode
2018-02-09shared/path-lookup: rearrange paths in --global mode to match --user modeZbigniew Jędrzejewski-Szmek2-2/+34
It's not good if the paths are in different order. With --user, we expect more paths, but it must be a strict superset, and the order for the ones that appear in both sets must be the same. $ diff -u <(build/systemd-analyze --global unit-paths) <(build/systemd-analyze --user unit-paths)|colordiff --- /proc/self/fd/14 2018-02-08 14:11:45.425353107 +0100 +++ /proc/self/fd/15 2018-02-08 14:11:45.426353116 +0100 @@ -1,6 +1,17 @@ +/home/zbyszek/.config/systemd/system.control +/run/user/1000/systemd/system.control +/run/user/1000/systemd/transient +/run/user/1000/systemd/generator.early +/home/zbyszek/.config/systemd/user /etc/systemd/user +/run/user/1000/systemd/user /run/systemd/user +/run/user/1000/systemd/generator +/home/zbyszek/.local/share/systemd/user +/home/zbyszek/.local/share/flatpak/exports/share/systemd/user +/var/lib/flatpak/exports/share/systemd/user /usr/local/share/systemd/user /usr/share/systemd/user /usr/local/lib/systemd/user /usr/lib/systemd/user +/run/user/1000/systemd/generator.late A test is added so that we don't regress on this.
2018-02-09path-lookup: include paths from --global in --user search path tooZbigniew Jędrzejewski-Szmek1-0/+17
This doesn't matter that much, because set-property --global does not work, so at least those paths wouldn't be used automatically. It is still possible to create such snippets manually, so we better fix this.
2018-02-09path-lookup: fix confusion between persistent_control and persistent_configZbigniew Jędrzejewski-Szmek1-1/+1
persistent_config would not appear in the search path at all, hence those overrides would not work at all.
2018-02-09shell-completion: add --global and unit-pathsZbigniew Jędrzejewski-Szmek2-5/+7
2018-02-09analyze: add unit-paths verbZbigniew Jędrzejewski-Szmek2-0/+40
2018-02-09udevadm: check for oom and other style fixesZbigniew Jędrzejewski-Szmek1-11/+19
2018-02-09udevadm: allow trigger command to be synchronousMao2-8/+100
There are cases that we want to trigger and settle only specific commands. For example, let's say at boot time we want to make sure all the graphics devices are working correctly because it's critical for booting, but not the USB subsystem (we'll trigger USB events later). So we do: udevadm trigger --action="add" --subsystem-match="graphics" udevadm settle However, we cannot block the kernel from emitting kernel events from discovering USB devices. So if any of the USB kernel event was emitted before the settle command, the settle command would still wait for the entire queue to complete. And if the USB event takes a long time to be processed, the system slows down. The new `settle` option allows the `trigger` command to wait for only the triggered events, and effectively solves this problem.
2018-02-09fs-util: drop readlink_and_make_absolute_root()Yu Watanabe2-21/+0
2018-02-09fs-util: drop readlink_and_canonicalize()Yu Watanabe3-25/+1
2018-02-09core: remove unnecessary initializationYu Watanabe3-4/+4
2018-02-09udev: use "#pragma once"Yu Watanabe1-5/+2
2018-02-09sd-bus: explicitly convert int to boolYu Watanabe1-5/+5
2018-02-09sd-bus: use free_and_replace()Yu Watanabe1-14/+7
2018-02-09sd-bus: avoid potential memory leaksYu Watanabe1-7/+15
2018-02-09man: fix capability name in man:systemd-tmpfiles(8) (#8139)Lucas Werkmeister1-1/+1
CAP_ADMIN does not exist (the closest existing capability name would be CAP_SYS_ADMIN), and according to man:open(2) and man:capabilities(7), the capability required to specify O_NOATIME is actually CAP_FOWNER.
2018-02-08Periodically call sd_journal_process in journalctlPeter Portante1-0/+28
If `journalctl` take a long time to process messages, and during that time journal file rotation occurs, a `journalctl` client will keep those rotated files open until it calls `sd_journal_process()`, which typically happens as a result of calling `sd_journal_wait()` below in the "following" case. By periodically calling `sd_journal_process()` during the processing loop we shrink the window of time a client instance has open file descriptors for rotated (deleted) journal files. **Warning** This change does not appear to solve the case of a "paused" output stream. If somebody is using `journalctl | less` and pauses the output, then without a background thread periodically listening for inotify delete events and cleaning up, journal logs will eventually stop flowing in cases where a journal client with enough open files causes the "free" disk space threshold to be crossed.
2018-02-08sd-bus: cleanup ssh sessions (Closes: #8076)Shawn Landden5-2/+28
we still invoke ssh unnecessarily when there in incompatible or erreneous input The fallow-up to finish that would make the code a bit more verbose, as it would require repeating this bit: ``` r = bus_connect_transport(arg_transport, arg_host, false, &bus); if (r < 0) { log_error_errno(r, "Failed to create bus connection: %m"); goto finish; } sd_bus_set_allow_interactive_authorization(bus, arg_ask_password); ``` in every verb, after parsing. v2: add waitpid() to avoid a zombie process, switch to SIGTERM from SIGKILL v3: refactor, wait in bus_start_address()
2018-02-08machine: add some missing assertsShawn Landden1-0/+6
2018-02-08analyze: add --global optionZbigniew Jędrzejewski-Szmek2-21/+34
This is somewhat useful for 'verify', and will be used later with 'unit-paths'.
2018-02-08tree-wide: use "cannot" instead of "can not"Zbigniew Jędrzejewski-Szmek11-22/+22
This is the usual spelling, and a bit shorter.
2018-02-08networkd: vxlan require Remote= to be a non multicast address (#8117)Susant Sahani2-3/+6
Remote= must be a non multicast address. ip-link(8) says: > remote IPADDR - specifies the unicast destination IP address to > use in outgoing packets when the destination link layer address > is not known in the VXLAN device forwarding database. Closes #8088.
2018-02-08man: .service <filename> to <literal> (#8126)Faalagorn1-1/+1
Changed <filename>.service</filename> to <literal>.service</literal> to match style in other manual pages: man 5 systemd.socket, device, mount, automount, swap, target path, timer, slice and scope.
2018-02-08journal: avoid code that relies on LOG_KERN == 0 (#8110)Alan Jenkins1-2/+2
LOG_FAC() is the general way to extract the logging facility (when it has been combined with the logging priority). LOG_FACMASK can be used to mask off the priority so you only have the logging facility bits... but to get the logging facility e.g. LOG_USER, you also have to bitshift it as well. (The priority is in the low bits, and so only requires masking). ((priority & LOG_FACMASK) == LOG_KERN) happens to work only because LOG_KERN is 0, and hence has the same value with or without the bitshift. Code that relies on weird assumptions like this could make it harder to realize how the logging values are treated.
2018-02-07man: "reboot" to "power off" in poweroff.target (#8124)Faalagorn1-1/+1
Changed "reboot" to "power off" in poweroff.target description. It was most likely copied and pasted from the reboot.target below, compare with e.g. halt.target
2018-02-07core: use id unit when retrieving unit file state (#8038)Franck Bui1-1/+1
Previous code was using the basename(id->fragment_path) which returned incorrect result if the unit was an instance. For example, assuming that no instances of "template" have been created so far: $ systemctl enable template@1 Created symlink from /etc/systemd/system/multi-user.target.wants/template@1.service to /usr/lib/systemd/system/template@.service. $ systemctl is-enabled template@3.service disabled $ systemctl status template@3.service ● template@3.service - openQA Worker #3 Loaded: loaded (/usr/lib/systemd/system/template@.service; enabled; vendor preset: disabled) [...] Here the unit file states reported by "status" and "is-enabled" were different.
2018-02-07process-util: use raw_getpid() in getpid_cache() internally (#8115)Lennart Poettering1-2/+2
We have the raw_getpid() definition in place anyway, and it's certainly beneficial to expose the same semantics on pre glibc 2.24 and after it too, hence always bypass glibc for this, and always cache things on our side. Fixes: #8113
2018-02-06core: Avoid empty directory warning when we are bind-mounting a file (#8069)Andrei Gherzan1-1/+1
2018-02-06Add more file triggers to handle more aspects of systemd (#8090)Neal Gompa (ニール・ゴンパ)2-9/+90
For quite a while now, there have been file triggers to handle automatically setting up service units in upstream systemd. However, most of the actions being done by these macros upon files can be set up as RPM file triggers. In fact, in Mageia, we had been doing this for most of these. In particular, we have file triggers in place for sysusers, tmpfiles, hwdb, and the journal. This change adds Lua versions of the original file triggers used in Mageia, based on the existing Lua-based file triggers for service units. In addition, we can also have useful file triggers for udev rules, sysctl directives, and binfmt directives. These are based on the other existing file triggers.
2018-02-06nss-mymachines: add work-around to silence gcc warningYu Watanabe1-0/+2
This is similar to 3c3d384ae93700ef08545b078c37065fdb98eee7 and a workaround for the following warning. ``` In file included from ../src/basic/in-addr-util.h:28, from ../src/nss-mymachines/nss-mymachines.c:31: ../src/nss-mymachines/nss-mymachines.c: In function '_nss_mymachines_getgrnam_r': ../src/nss-mymachines/nss-mymachines.c:653:32: warning: argument to 'sizeof' in 'memset' call is the same pointer type 'char *' as the destination; expected 'char' or an explicit length [-Wsizeof-pointer-memaccess] memzero(buffer, sizeof(char*)); ^~~~ ../src/basic/util.h:118:39: note: in definition of macro 'memzero' #define memzero(x,l) (memset((x), 0, (l))) ^ ../src/nss-mymachines/nss-mymachines.c: In function '_nss_mymachines_getgrgid_r': ../src/nss-mymachines/nss-mymachines.c:730:32: warning: argument to 'sizeof' in 'memset' call is the same pointer type 'char *' as the destination; expected 'char' or an explicit length [-Wsizeof-pointer-memaccess] memzero(buffer, sizeof(char*)); ^~~~ ../src/basic/util.h:118:39: note: in definition of macro 'memzero' #define memzero(x,l) (memset((x), 0, (l))) ^ ```
2018-02-06networkd: fix dhcp6_prefixes_compare_func()Yu Watanabe1-1/+1
Found by the following warning by gcc. ``` ../src/network/networkd-manager.c: In function 'dhcp6_prefixes_compare_func': ../src/network/networkd-manager.c:1383:16: warning: 'memcmp' reading 16 bytes from a region of size 8 [-Wstringop-overflow=] return memcmp(&a, &b, sizeof(*a)); ^ ```
2018-02-06core/execute: make arguments constant if possibleYu Watanabe3-42/+41
Also make functions static if possible.
2018-02-06core: make ExecRuntime be manager managed objectYu Watanabe9-168/+384
Before this, each ExecRuntime object is owned by a unit. However, it may be shared with other units which enable JoinsNamespaceOf=. Thus, by the serialization/deserialization process, its sharing information, more specifically, reference counter is lost, and causes issue #7790. This makes ExecRuntime objects be managed by manager, and changes the serialization/deserialization process. Fixes #7790.
2018-02-05journal: include kmsg lines from the systemd process which exec()d us (#8078)Alan Jenkins1-6/+8
Let the journal capture messages emitted by systemd, before it ran exec("/usr/lib/systemd/systemd-journald"). Usually such messages will only appear with `systemd.log_level=debug`. kmsg lines written after the exec() will be ignored as before. In other words, we are avoiding reading our own lines, which start "systemd-journald[100]: " assuming we are PID 100. But now we will start allowing ourself to read lines which start "systemd[100]: ", or any other prefix which is not "systemd-journald[100]: ". So this can't help you see messages when we fail to exec() journald :). But, it makes it easier to see what the pre-exec() messages look like in the successful case. Comparing messages like this can be useful when debugging. Noticing weird omissions of messages, otoh, makes me anxious.
2018-02-05hwdb: fix mute microphone button on TravelMate P645-S (#8105)CuBiC1-1/+2
2018-02-05nss-systemd: add work-around to silence gcc warningZbigniew Jędrzejewski-Szmek1-0/+2
In file included from ../src/basic/fs-util.h:32, from ../src/nss-systemd/nss-systemd.c:28: ../src/nss-systemd/nss-systemd.c: In function '_nss_systemd_getgrnam_r': ../src/nss-systemd/nss-systemd.c:416:32: warning: argument to 'sizeof' in 'memset' call is the same pointer type 'char *' as the destination; expected 'char' or an explicit length [-Wsizeof-pointer-memaccess] memzero(buffer, sizeof(char*)); ^~~~ ../src/basic/util.h:118:39: note: in definition of macro 'memzero' #define memzero(x,l) (memset((x), 0, (l))) ^ gcc is trying to be helpful, and it's not far from being right. It _looks_ like sizeof(char*) is an error, but in this case we're really leaving a space empty for a pointer, and our calculation is correct. Since this is a short file, let's just use simplest option and turn off the warning above the two functions that trigger it.