summaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)Author
2016-04-12Merge pull request #2973 from poettering/search-pathMartin Pitt
Many fixes, in particular to the install logic
2016-04-12load-fragment: Resolve specifiers in DeviceAllow (#3019)Nicolas Braud-Santoni
Closes #1602
2016-04-12core: make sure we always free the list of changesLennart Poettering
2016-04-12core: keep track of the mtime of the transient unit file we wroteLennart Poettering
Otherwise "systemctl status" will immediately report that our unit file is out of date.
2016-04-12core: make sure we generate a nicer error when a linked unit is attempted to ↵Lennart Poettering
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.
2016-04-12core: optimize unit_write_drop_in a bitLennart Poettering
There's no point in first determining the drop-in file name path, then forgetting it again, and then determining it again. Instead, just generated it once, and then write to ti directly.
2016-04-12core: when creating a drop-in snippet, add a comment explaining this to itLennart Poettering
2016-04-12core,systemctl: add new "systemctl revert" commandLennart Poettering
This allows dropping all user configuration and reverting back to the vendor default of a unit file. It basically undoes what "systemctl edit", "systemctl set-property" and "systemctl mask" do.
2016-04-12tree-wide: add new SIGNAL_VALID() macro-like function that validates signal ↵Lennart Poettering
numbers And port all code over to use it.
2016-04-12systemctl: don't confuse sysv code with generated unitsLennart Poettering
The SysV compat code checks whether there's a native unit file before looking for a SysV init script. Since the newest rework generated units will show up in the unit path, and hence the checks ended up assuming that there always was a native unit file for each init script: the generated one. With this change the generated unit file directory is suppressed from the search path when this check is done, to avoid the confusion.
2016-04-12core: rework reboot parameter logic a bitLennart Poettering
Always warn if something fails, and clarify that the involved utility functions do so in their name. Drop the REBOOT_PARAM_FILE macro. We don't do this for other flag file paths like this, so don't do this for this one either. The path isn't configurable anyway, hence let's make this easier to read by avoiding this one indirection.
2016-04-12core: be more paranoid when mixing umask and fopen()Lennart Poettering
Let's be extra careful with the umask when we use simple fopen(), as this creates files with 0777 by default.
2016-04-12core: rework how transient unit files and property drop-ins workLennart Poettering
With this change the logic for placing transient unit files and drop-ins generated via "systemctl set-property" is reworked. The latter are now placed in the newly introduced "control" unit file directory. The fomer are now placed in the "transient" unit file directory. Note that the properties originally set when a transient unit was created will be written to and stay in the transient unit file directory, while later changes are done via drop-ins. This is preparation for a later "systemctl revert" addition, where existing drop-ins are flushed out, but the original transient definition is restored.
2016-04-12install: rename generator_paths() → generator_binary_paths()Lennart Poettering
This is too confusing, as this funciton returns the paths to the generator binaries, while usually when we refer to the just the "generator path" we mean the generated unit files. Let's clean this up.
2016-04-12core: move flushing of generated unit files to path-lookup.cLennart Poettering
It's very similar to the mkdir and trim operations for the generator dirs, hence let's unify this at a single place.
2016-04-12core: minor coding style fixLennart Poettering
2016-04-12install: introduce a new unit file state "transient"Lennart Poettering
Now, that the search path logic knows the unit path for transient units we also can introduce an explicit unit file state "transient" that clarifies to the user what kind of unit file he is encountering.
2016-04-12core: modernize manager_build_unit_patch_cache() a bitLennart Poettering
2016-04-12core: don't reorder drop-ins when changing propertiesLennart Poettering
The drop-in order we present should actually show what we is in effect, hence let's not reorder it when writing changes. After all, just sorting alphabetically is going to break things, as it doesn't respect that /etc breaks /run breaks /usr...
2016-04-12core: don't drop transient drop-ins when loading the restLennart Poettering
Previously, when creating a transient unit, we'd first add the transient drop-ins to the unit, and then normally load any other drop-ins later on top of this, replacing the already loaded drop-ins. Let's not do this, after all the transient drop-ins area already in effect, let's just add what we find on disk, but not replace it.
2016-04-12core: rework logic to drop duplicate and non-existing items from search pathLennart Poettering
Move this into a function of its own, so that we can run it after we ran the generators, so that it takes into account removed generator dirs.
2016-04-12path-lookup: split out logic for mkdir/rmdir of generator dirs in their own ↵Lennart Poettering
functions
2016-04-12core: add a separate unit directory for transient unitsLennart Poettering
Previously, transient units were created below the normal runtime directory /run/systemd/system. With this change they are created in a special transient directory /run/systemd/transient, which only contains data for transient units. This clarifies the life-cycle of transient units, and makes clear they are distinct from user-provided runtime units. In particular, users may now extend transient units via /run/systemd/system, without systemd interfering with the life-cycle of these files. This change also adds code so that when a transient unit exits only the drop-ins in this new directory are removed, but nothing else. Fixes: #2139
2016-04-12core: reuse manager_get_runtime_prefix() at more placesLennart Poettering
2016-04-12core: introduce MANAGER_IS_RELOADING() macroLennart Poettering
This replaces the old function call manager_is_reloading_or_reexecuting() which was used only at very few places. Use the new macro wherever we check whether we are reloading. This should hopefully make things a bit more readable, given the nature of Manager:n_reloading being a counter.
2016-04-12core: remove ManagerRunningAs enumLennart Poettering
Previously, we had two enums ManagerRunningAs and UnitFileScope, that were mostly identical and converted from one to the other all the time. The latter had one more value UNIT_FILE_GLOBAL however. Let's simplify things, and remove ManagerRunningAs and replace it by UnitFileScope everywhere, thus making the translation unnecessary. Introduce two new macros MANAGER_IS_SYSTEM() and MANAGER_IS_USER() to simplify checking if we are running in one or the user context.
2016-04-12core: when enabling a generated unit file, return a clean errorLennart Poettering
Let's be precise when the user tries to invoke an "enable" operation on a generated unit file.
2016-04-12core: rework generator dir logic, move the dirs into LookupPaths structureLennart Poettering
A long time ago – when generators where first introduced – the directories for them were randomly created via mkdtemp(). This was changed later so that they use fixed name directories now. Let's make use of this, and add the genrator dirs to the LookupPaths structure and into the unit file search path maintained in it. This has the benefit that the generator dirs are now normal part of the search path for all tools, and thus are shown in "systemctl list-unit-files" too.
2016-04-12Do not report masked units as changed (#2921)Zbigniew Jędrzejewski-Szmek
* core/unit: extract checking of stat paths into helper function The same code was repeated three times. * core: treat masked files as "unchanged" systemctl prints the "unit file changed on disk" warning for a masked unit. I think it's better to print nothing in that case. When a masked unit is loaded, set mtime as 0. When checking if a unit with mtime of 0 needs reload, check that the mask is still in place. * test-dnssec: fix build without gcrypt Also reorder the test functions to follow the way they are called from main().
2016-04-08core/service: only search for pid if loading from file failedZbigniew Jędrzejewski-Szmek
CID #1237511.
2016-04-08core/service: drop return value that is always ignored anywayZbigniew Jędrzejewski-Szmek
2016-04-08shutdown: use (void)Zbigniew Jędrzejewski-Szmek
NULL cgroup is handled below.
2016-04-08import: use (void) moreZbigniew Jędrzejewski-Szmek
CID #1299018-9.
2016-04-07core: downgrade warning about duplicate device names againVladimir Panteleev
Pull request #2412 seemed to have unintentionally reverted 5259bcf6a638d8d489db1ddefd55327aa15f3e51, thus reintroducing https://bugs.freedesktop.org/show_bug.cgi?id=90386. This commit reverts that part of the commit, changing the log level to debug again.
2016-04-06Merge pull request #2970 from msekletar/machine-id-prefix-rootaZbigniew Jędrzejewski-Szmek
machine-id-setup: simplify by using prefix_roota
2016-04-06machine-id-setup: simplify by using prefix_rootaMichal Sekletar
2016-04-02rpm triggers: add note about minimum supported versionZbigniew Jędrzejewski-Szmek
2016-03-30core: improve error message when starting template without instanceLukas Nykryn
2016-03-29Merge pull request #2903 from keszybz/cgroup2-v3Zbigniew Jędrzejewski-Szmek
core: cgroup2 support
2016-03-29core: ShutdownWatchdogSec=infinity disables the watchdog logic tooEvgeny Vereshchagin
This is a follow-up for 947292eef
2016-03-28core: RuntimeWatchdogSec=infinity disables the watchdog logicEvgeny Vereshchagin
2016-03-26core: update invoke_sigchld_event() to handle NULL ->sigchld_event()Tejun Heo
After receiving SIGCHLD, one of the ways manager_dispatch_sigchld() maps the now zombie $PID to its unit is through manager_get_unit_by_pid_cgroup() which reads /proc/$PID/cgroup and looks up the unit associated with the cgroup path. On non-unified cgroup hierarchies, a process is immediately migrated to the root cgroup on death and the cgroup lookup would always have returned the unit associated with it, making it rather pointless but safe. On unified hierarchy, a zombie remains associated with the cgroup that it was associated with at the time of death and thus manager_get_unit_by_pid_cgroup() will look up the unit properly. However, by the time manager_dispatch_sigchld() is running, the original cgroup may have become empty and it and its associated unit might already have been removed. If the cgroup path doesn't yield a match, manager_dispatch_sigchld() keeps pruning the leaf component. This means that the function may return a slice unit for a pid and as a slice doesn't have ->sigchld_event() handler, calling invoke_sigchld_event() on it causes a segfault. This patch updates invoke_sigchld_event() so that it skips calling if the handler is not set.
2016-03-26core: update populated event handling in unified hierarchyTejun Heo
Earlier during the development of unified hierarchy, the populated event was reported through by the dedicated "cgroup.populated" file; however, the interface was updated so that it's reported through the "populated" field of "cgroup.events" file. Update populated event handling logic accordingly.
2016-03-26cgroup2: use new fstype for unified hierarchyAlban Crequy
Since Linux v4.4-rc1, __DEVEL__sane_behavior does not exist anymore and is replaced by a new fstype "cgroup2". With this patch, systemd no longer supports the old (unstable) way of doing unified hierarchy with __DEVEL__sane_behavior and systemd now requires Linux v4.4 for unified hierarchy. Non-unified hierarchy is still the default and is unchanged by this patch. https://github.com/torvalds/linux/commit/67e9c74b8a873408c27ac9a8e4c1d1c8d72c93ff
2016-03-24core: fix "stoppping" typoMartin Pitt
2016-03-23core: Fix path for opening ffs endpoint ep0Georgia Brikis
usbffs_address_create() expects an absolute path to the file that is supposed to be opened. The path specified only leads to the directory containing the endpoint ep0 not the endpoint itself. This commit adds the endpoints name to the path.
2016-03-21Merge pull request #2760 from ronnychevalier/rc/core_no_new_privileges_seccompv3Daniel Mack
core: set NoNewPrivileges for seccomp if we don't have CAP_SYS_ADMIN
2016-03-17Merge pull request #2854 from keszybz/log-colorsDaniel Mack
systemd: obey systemd.log_color config
2016-03-17systemd: obey systemd.log_color configZbigniew Jędrzejewski-Szmek
Fixes #2845.
2016-03-16core: look for instance when processing template nameMichal Sekletar
If first attempt to merge units failed and we are trying to do merge the other way around and at the same time we are working with template name, then other unit can't possibly be template, because it is not possible to have template unit running, only instances of the template. Thus we need to look for already active instance instead.