summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* machined: change check_gc to may_gc everywheregc-cleanupZbigniew Jędrzejewski-Szmek2018-02-153-9/+9
|
* logind: change check_gc to may_gc everywhereZbigniew Jędrzejewski-Szmek2018-02-157-26/+26
|
* pid1: also show gc status for jobs like we do for unitsZbigniew Jędrzejewski-Szmek2018-02-151-2/+4
|
* pid1: rename job_check_gc to job_may_gcZbigniew Jędrzejewski-Szmek2018-02-153-12/+13
| | | | | | | The reasoning is the same as for unit_can_gc. v2: - rename can_gc to may_gc
* pid1: properly remove references to the unit from gc queue during final cleanupZbigniew Jędrzejewski-Szmek2018-02-151-21/+21
| | | | | | | | | | | | | | | When various references to the unit were dropped during cleanup in unit_free(), add_to_gc_queue() could be called on this unit. If the unit was previously in the gc queue (at the time when unit_free() was called on it), this wouldn't matter, because it'd have in_gc_queue still set even though it was already removed from the queue. But if it wasn't set, then the unit could be added to the queue. Then after unit_free() would deallocate the unit, we would be left with a dangling pointer in gc_queue. A unit could be added to the gc queue in two places called from unit_free(): in the job_install calls, and in unit_ref_unset(). The first was OK, because it was above the LIST_REMOVE(gc_queue,...) call, but the second was not, because it was after that. Move the all LIST_REMOVE() calls down.
* pid1: free basic unit information at the very end, before freeing the unitZbigniew Jędrzejewski-Szmek2018-02-151-16/+16
| | | | | | | | | | We would free stuff like the names of the unit first, and then recurse into other structures to remove the unit from there. Technically this was OK, since the code did not access the name, but this makes debugging harder. And if any log messages are added in any of those functions, they are likely to access u->id and such other basic information about the unit. So let's move the removal of this "basic" information towards the end of unit_free().
* pid1: fix collection of cycles of units which reference one anotherZbigniew Jędrzejewski-Szmek2018-02-152-4/+19
| | | | | | | | | | | A .socket will reference a .service unit, by registering a UnitRef with the .service unit. If this .service unit has the .socket unit listed in Wants or Sockets or such, a cycle will be created. We would not free this cycle properly, because we treated any unit with non-empty refs as uncollectable. To solve this issue, treats refs with UnitRef in u->refs_by_target similarly to the refs in u->dependencies, and check if the "other" unit is known to be needed. If it is not needed, do not treat the reference from it as preventing the unit we are looking at from being freed.
* pid1: include the source unit in UnitRefZbigniew Jędrzejewski-Szmek2018-02-156-30/+30
| | | | | | | | | | | | No functional change. The source unit manages the reference. It allocates the UnitRef structure and registers it in the target unit, and then the reference must be destroyed before the source unit is destroyed. Thus, is should be OK to include the pointer to the source unit, it should be live as long as the reference exists. v2: - rename refs to refs_by_target
* pid1: rename unit_check_gc to unit_may_gcZbigniew Jędrzejewski-Szmek2018-02-159-45/+53
| | | | | | | | "check" is unclear: what is true, what is false? Let's rename to "can_gc" and revert the return value ("positive" values are easier to grok). v2: - rename from unit_can_gc to unit_may_gc
* analyze: fix typo in error messageZbigniew Jędrzejewski-Szmek2018-02-131-1/+1
|
* test-strv: add a simple test for strv_free_free()Zbigniew Jędrzejewski-Szmek2018-02-131-0/+12
|
* tmpfiles: age root-owned read-only files, by default (#7917)itsbill2018-02-121-6/+0
| | | | [zj: The note in NEWS was added in 82c8e3e6503a40684cf265842bb1c26a8f7681b5 and released as part of systemd-237.]
* Merge pull request #8143 from yuwata/drop-unused-funcYu Watanabe2018-02-106-114/+1
|\ | | | | Drop several unused functions
| * socket-util: drop getnameinfo_pretty()Yu Watanabe2018-02-103-68/+0
| |
| * fs-util: drop readlink_and_make_absolute_root()Yu Watanabe2018-02-092-21/+0
| |
| * fs-util: drop readlink_and_canonicalize()Yu Watanabe2018-02-093-25/+1
| |
* | Revert "Periodically call sd_journal_process in journalctl" (#8147)Zbigniew Jędrzejewski-Szmek2018-02-091-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
* | basic/socket-util: drop use of NI_IDN_USE_STD3_ASCII_RULESZbigniew Jędrzejewski-Szmek2018-02-091-1/+1
| | | | | | | | | | | | | | The only use of socknameinfo_pretty() is in src/journal-remote/journal-remote.c, to determine the output filename. Replaces #8120.
* | fd-util: move certain fds above fd #2 (#8129)Lennart Poettering2018-02-099-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.
* | Suspend on lid close based on power status. (#8016)Simon Fowler2018-02-098-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.
* | Merge pull request #8066 from LittleCVR/udevadm-trigger-and-settleZbigniew Jędrzejewski-Szmek2018-02-092-12/+112
|\ \ | | | | | | udevadm: allow trigger command to be synchronous
| * | udevadm: check for oom and other style fixesZbigniew Jędrzejewski-Szmek2018-02-091-11/+19
| | |
| * | udevadm: allow trigger command to be synchronousMao2018-02-092-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.
* | | Merge pull request #8134 from keszybz/unit-load-pathsZbigniew Jędrzejewski-Szmek2018-02-0919-273/+452
|\ \ \ | | | | | | | | Various fixes to unit load paths, and systemd-analyze load-paths verb to list them
| * | | analyze: slight simplificationZbigniew Jędrzejewski-Szmek2018-02-091-12/+13
| | | |
| * | | analyze: remove implicit conversions of numbers to booleansZbigniew Jędrzejewski-Szmek2018-02-091-14/+14
| | | |
| * | | man: make Notes section in systemd.geneator(5) toplevelZbigniew Jędrzejewski-Szmek2018-02-091-147/+120
| | | | | | | | | | | | | | | | This is mostly a indentation change and rewrapping.
| * | | man: document unit load pathsZbigniew Jędrzejewski-Szmek2018-02-092-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.
| * | | shared/path-lookup: rename user control dirs to "user.control"Zbigniew Jędrzejewski-Szmek2018-02-091-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
| * | | shared/path-lookup: rearrange paths in --global mode to match --user modeZbigniew Jędrzejewski-Szmek2018-02-092-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.
| * | | path-lookup: include paths from --global in --user search path tooZbigniew Jędrzejewski-Szmek2018-02-091-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.
| * | | path-lookup: fix confusion between persistent_control and persistent_configZbigniew Jędrzejewski-Szmek2018-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | persistent_config would not appear in the search path at all, hence those overrides would not work at all.
| * | | shell-completion: add --global and unit-pathsZbigniew Jędrzejewski-Szmek2018-02-092-5/+7
| | | |
| * | | analyze: add unit-paths verbZbigniew Jędrzejewski-Szmek2018-02-092-0/+40
| | | |
| * | | analyze: add --global optionZbigniew Jędrzejewski-Szmek2018-02-082-21/+34
| | | | | | | | | | | | | | | | This is somewhat useful for 'verify', and will be used later with 'unit-paths'.
| * | | tree-wide: use "cannot" instead of "can not"Zbigniew Jędrzejewski-Szmek2018-02-0811-22/+22
| | | | | | | | | | | | | | | | This is the usual spelling, and a bit shorter.
* | | | service: relax PID file symlink chain checks a bit (#8133)Lennart Poettering2018-02-091-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
* | | | man:systemd.service(5): fix description of specifiers in command lines (#8146)Oleander Reis2018-02-091-3/+1
| | | | | | | | | | | | | | | | | | | | Command lines now accept specifiers within the first argument. see issues #3061, #679 and pr #4835
* | | | Merge pull request #8083 from shawnl/close-sshLennart Poettering2018-02-096-2/+34
|\ \ \ \ | | | | | | | | | | sd-bus: cleanup ssh sessions (Closes: #8076)
| * | | | sd-bus: cleanup ssh sessions (Closes: #8076)Shawn Landden2018-02-085-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()
| * | | | machine: add some missing assertsShawn Landden2018-02-081-0/+6
| |/ / /
* | | | Merge pull request #8142 from yuwata/sd-bus-memleakLennart Poettering2018-02-095-35/+33
|\ \ \ \ | | | | | | | | | | Fix potential memory leaks and several code style updates
| * | | | core: remove unnecessary initializationYu Watanabe2018-02-093-4/+4
| | | | |
| * | | | udev: use "#pragma once"Yu Watanabe2018-02-091-5/+2
| | | | |
| * | | | sd-bus: explicitly convert int to boolYu Watanabe2018-02-091-5/+5
| | | | |
| * | | | sd-bus: use free_and_replace()Yu Watanabe2018-02-091-14/+7
| | | | |
| * | | | sd-bus: avoid potential memory leaksYu Watanabe2018-02-091-7/+15
| | |_|/ | |/| |
* | | | man: fix capability name in man:systemd-tmpfiles(8) (#8139)Lucas Werkmeister2018-02-091-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.
* | | | Periodically call sd_journal_process in journalctlPeter Portante2018-02-081-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.
* | | networkd: vxlan require Remote= to be a non multicast address (#8117)Susant Sahani2018-02-082-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.