summaryrefslogtreecommitdiff
path: root/src/core/unit.c
AgeCommit message (Collapse)Author
2015-02-12include <poll.h> instead of <sys/poll.h>Thomas Hindoe Paaboel Andersen
include-what-you-use automatically does this and it makes finding unnecessary harder to spot. The only content of poll.h is a include of sys/poll.h so should be harmless.
2015-02-12core: don't fail to run services in --user instances if $HOME is missingLennart Poettering
Otherwise we cannot even invoke systemd-exit.service anymore, thus not even exit. https://bugs.freedesktop.org/show_bug.cgi?id=83100 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759320
2015-02-11core: correct a log messageLennart Poettering
The log message talks specifically about services, though it actually applies to any kind of unit.
2015-02-03util: rework strappenda(), and rename it strjoina()Lennart Poettering
After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary.
2015-02-01Add a snprinf wrapper which checks that the buffer was big enoughZbigniew Jędrzejewski-Szmek
If we scale our buffer to be wide enough for the format string, we should expect that the calculation was correct. char_array_0() invocations are removed, since snprintf nul-terminates the output in any case. A similar wrapper is used for strftime calls, but only in timedatectl.c.
2015-01-28core: output unit status output strings to console, only if we actually are ↵Lennart Poettering
changing unit state Unit _start() and _stop() implementations can fail with -EAGAIN to delay execution temporarily. Thus, we should not output status messages before invoking these calls, but after, and only when we know that the invocation actually made a change.
2015-01-06core: add new logic for services to store file descriptors in PID 1Lennart Poettering
With this change it is possible to send file descriptors to PID 1, via sd_pid_notify_with_fds() which PID 1 will store individually for each service, and pass via the usual fd passing logic on next invocation. This is useful for enable daemon reload schemes where daemons serialize their state to /run, push their fds into PID 1 and terminate, restoring their state on next start from the data in /run and passed in from PID 1. The fds are kept by PID 1 as long as no POLLHUP or POLLERR is seen on them, and the service they belong to are either not dead or failed, or have a job queued.
2015-01-05core: rework counting of running jobsLennart Poettering
Let's unify the code that counts the running jobs a bit, in order to make sure we are less likely to miss one. This is related to this bug: https://bugs.freedesktop.org/show_bug.cgi?id=87349 However, it probably won't fix it fully, and I cannot reproduce the issue. The change also adds an explicit assert change when the counter is off.
2014-12-30tree-wide: spelling fixesVeres Lajos
https://github.com/vlajos/misspell_fixer https://github.com/torstehu/systemd/commit/b6fdeb618cf2f3ce1645b3315f15f482710c7ffa Thanks to Torstein Husebo <torstein@huseboe.net>.
2014-12-16Move dropin listing to sharedZbigniew Jędrzejewski-Szmek
No functional change. This is in preparation for using this in systemctl in the future.
2014-12-15unit: handle nicely of certain unit types are not supported on specific systemsLennart Poettering
Containers do not really support .device, .automount or .swap units; Systems compiled without support for swap do not support .swap units; Systems without kdbus do not support .busname units. With this change attempts to start a unsupported unit types will result in an immediate "unsupported" job result, which is a lot more descriptive then before. Also, attempts to start device units in containers will now immediately fail instead of causing jobs to be enqueued that never go away.
2014-12-10sd-bus: move common errors src/shared/bus-errors.h → ↵Lennart Poettering
src/libsystemd/sd-bus/bus-common-errors.h Stuff in src/shared/ should not use stuff from src/libsystemd/ really.
2014-12-09unit: update unit dropin paths and time when dropin file is written.WaLyong Cho
If a unit is set property by "systemctl set-property", a new dropin file is generated. But the unit's dropin_paths and dropin_mtime are not updated. So the unit is shown as need daemon reload. Update unit dropin_paths and dropin_mtime also when dropin file is written.
2014-12-09core: rename unit_destroy_cgroup() to unit_destroy_cgroup_if_empty() since ↵Lennart Poettering
it's not quite as destructive as it sounds nowadays
2014-12-02systemctl: show unit file preset state in "systemctl status" output"Lennart Poettering
2014-11-28core: convert log_unit_*() to log_unit_*_errno()Michal Schmidt
Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_unit_(debug|info|notice|warning|error|emergency)\(([^"]+), "(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_unit_\1_errno(\2, \5, "\3%m"\4);/'
2014-11-28log: fix order of log_unit_struct() to match other logging callsLennart Poettering
Also, while we are at it, introduce some syntactic sugar for creating ERRNO= and MESSAGE= structured logging fields.
2014-11-27log: rearrange log function namingLennart Poettering
- Rename log_meta() → log_internal(), to follow naming scheme of most other log functions that are usually invoked through macros, but never directly. - Rename log_info_object() to log_object_info(), simply because the object should be before any other parameters, to follow OO-style programming style.
2014-11-06core: get rid of condition.c and move the remaining call into util.cLennart Poettering
That way only one file with condition code remaining, in src/shared/, rather than src/core/. Next step: dropping the "-util" suffix from condition-util.[ch].
2014-11-06core: introduce the concept of AssertXYZ= similar to ConditionXYZ=, but ↵Lennart Poettering
fatal for a start job if not met
2014-10-30Convert the rest to sd_bus_errnomapZbigniew Jędrzejewski-Szmek
I tried to preserve most errno values, but in some cases they were inconsistent (different errno values for the same error name) or just mismatched.
2014-10-28core: send sigabrt on watchdog timeout to get the stacktraceUmut Tezduyar Lindskog
if sigabrt doesn't do the job, follow regular shutdown routine, sigterm > sigkill.
2014-10-27manager: convert ephemeral to enumZbigniew Jędrzejewski-Szmek
In preparation for subsequent changes.
2014-10-28job: optionally, when a job timeout is hit, also execute a failure actionLennart Poettering
2014-10-23unit: adjust for the possibility of set_move() failingMichal Schmidt
2014-10-23unit: place reservations before merging other's dependenciesMichal Schmidt
With the hashmap implementation that uses chaining the reservations merely ensure that the merging won't result in long bucket chains. With a future alternative implementation it will additionally reserve memory to make sure the merging won't fail.
2014-10-08unit: move UnitDependency to unit-nameLukas Nykryn
2014-10-02Rename user_runtime to user_runtime_dirZbigniew Jędrzejewski-Szmek
This makes this function name similar to user_config_home() and makes it match the name of the environment variable.
2014-10-02add a transient user unit directorySteven Allen
This patch adds a transient user unit directory under `$XDG_RUNTIME_DIR/systemd/user/` and stores transient user-instance units (such as those created by `systemd-run --user`) under there instead of putting them in $XDG_CONFIG_HOME/systemd/user/. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=67331
2014-09-15hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt
It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
2014-08-30Fix a few more typosRuben Kerkhof
2014-08-21core: unify how we generate the prefix string when dumping unit stateLennart Poettering
2014-08-18core: minor modernizationsLennart Poettering
2014-08-18units: fix BindsTo= logic when applied relative to services with Type=oneshotLennart Poettering
Start jobs for Type=oneshot units are successful when the unit state transition activating → inactive took place. In such a case all units that BindsTo= on it previously would continue to run, even though the unit they dependet on was actually already gone.
2014-08-07core: warn when merged units have conflicting dependenciesZbigniew Jędrzejewski-Szmek
A unit should not Conflict with itself. It also does not make much sense for a unit to be After or Before itself, or to trigger itself in some way. If one of those dependency types is encountered, warn, instead of dropping it silently like other dependency types. % build/systemd-analyze verify test/loopy3.service ... Dependency Conflicts dropped when merging unit loopy4.service into loopy3.service Dependency ConflictedBy dropped when merging unit loopy4.service into loopy3.service
2014-08-07core: do not add dependencies to selfZbigniew Jędrzejewski-Szmek
Adds a pair of files which cause a segfault (also with systemd-analyze verify). https://bugzilla.redhat.com/show_bug.cgi?id=1124843
2014-07-20path-lookup: make SYSTEMD_UNIT_PATH more flexibleZbigniew Jędrzejewski-Szmek
It can now contain more than one directory, and can be used to only prepend, not totally override, the normal load path.
2014-06-30cryptsetup: allow x-systemd.device-timeoutZbigniew Jędrzejewski-Szmek
https://bugs.freedesktop.org/show_bug.cgi?id=54210
2014-06-30Move x-systemd-device.timeout handling from core to fstab-generatorZbigniew Jędrzejewski-Szmek
Instead of adjusting job timeouts in the core, let fstab-generator write out a dropin snippet with the appropriate JobTimeout. x-systemd-device.timeout option is removed from Options= line in the generated unit. The functions to write dropins are moved from core/unit.c to shared/dropin.c, to make them available outside of core. generator.c is moved to libsystemd-label, because it now uses functions defined in dropin.c, which are in libsystemd-label.
2014-05-24Fix several small typosJonathan Boulle
2014-05-22cgroups: simplify CPUQuota= logicLennart Poettering
Only accept cpu quota values in percentages, get rid of period definition. It's not clear whether the CFS period controllable per-cgroup even has a future in the kernel, hence let's simplify all this, hardcode the period to 100ms and only accept percentage based quota values.
2014-05-22cgroup: rework startup logicLennart Poettering
Introduce a (unsigned long) -1 as "unset" state for cpu shares/block io weights, and keep the startup unit set around all the time.
2014-05-22core: add startup resource control optionWaLyong Cho
Similar to CPUShares= and BlockIOWeight= respectively. However only assign the specified weight during startup. Each control group attribute is re-assigned as weight by CPUShares=weight and BlockIOWeight=weight after startup. If not CPUShares= or BlockIOWeight= be specified, then the attribute is re-assigned to each default attribute value. (default cpu.shares=1024, blkio.weight=1000) If only CPUShares=weight or BlockIOWeight=weight be specified, then that implies StartupCPUShares=weight and StartupBlockIOWeight=weight.
2014-05-16core: make sure to serialize jobs for all unitsLennart Poettering
Previously we wouldn't serialize jobs for units that themselves have nothing to serialize. http://lists.freedesktop.org/archives/systemd-devel/2014-May/019051.html
2014-05-15Make sure that keys are properly removed from hashmapZbigniew Jędrzejewski-Szmek
This is a speculative fix for https://bugzilla.redhat.com/show_bug.cgi?id=1088865. Even though I cannot find a code path that where this would be an issue, for consistency, if we assume that cgroup_path might have been set before we got to unit_deserialize, we should make sure that the unit is removed from the hashmap before we free the key. This seems to be the only place where the key could be prematurely freed, leading to hashmap corruption.
2014-04-25core: expose CFS CPU time quota as high-level unit propertiesLennart Poettering
2014-03-19core: rework context initialization/destruction logicLennart Poettering
Let's automatically initialize the kill, exec and cgroup contexts of the various unit types when the object is constructed, instead of invididually in type-specific code. Also, when PrivateDevices= is set, set DevicePolicy= to closed.
2014-03-19core: when PrivateTmp= is set for a unit, make sure to order it after /tmp ↵Lennart Poettering
and /var/tmp are mounted
2014-03-18core: drop CAP_MKNOD when PrivateDevices= is setLennart Poettering
2014-03-17core, libsystemd, systemd, timedate, udev: spelling fixesMiklos Vajna