summaryrefslogtreecommitdiff
path: root/src/core/unit.h
Commit message (Collapse)AuthorAge
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* Add missing includes in header filesThomas Hindoe Paaboel Andersen2015-02-12
| | | | | This fixes various issues found by globally reordering the include sections of all .c files.
* core: add new logic for services to store file descriptors in PID 1Lennart Poettering2015-01-06
| | | | | | | | | | | | | | 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.
* unit: handle nicely of certain unit types are not supported on specific systemsLennart Poettering2014-12-15
| | | | | | | | | | | | 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.
* core: correct spacing near eol in code commentsTorstein Husebø2014-12-11
|
* systemctl: show unit file preset state in "systemctl status" output"Lennart Poettering2014-12-02
|
* core: add log_unit_*_errno() macrosMichal Schmidt2014-11-28
|
* log: fix order of log_unit_struct() to match other logging callsLennart Poettering2014-11-28
| | | | | Also, while we are at it, introduce some syntactic sugar for creating ERRNO= and MESSAGE= structured logging fields.
* log: rearrange log function namingLennart Poettering2014-11-27
| | | | | | | | | | - 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.
* log: add an "error" parameter to all low-level logging calls and intrdouce ↵Lennart Poettering2014-11-27
| | | | | | | | | | | | | | | | | | | | log_error_errno() as log calls that take error numbers This change has two benefits: - The format string %m will now resolve to the specified error (or to errno if the specified error is 0. This allows getting rid of a ton of strerror() invocations, a function that is not thread-safe. - The specified error can be passed to the journal in the ERRNO= field. Now of course, we just need somebody to convert all cases of this: log_error("Something happened: %s", strerror(-r)); into thus: log_error_errno(-r, "Something happened: %m");
* shared: rename condition-util.[ch] to condition.[ch]Lennart Poettering2014-11-06
| | | | | Now that we only have one file with condition implementations around, we can drop the -util suffix and simplify things a bit.
* core: get rid of condition.c and move the remaining call into util.cLennart Poettering2014-11-06
| | | | | | | 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].
* core: introduce the concept of AssertXYZ= similar to ConditionXYZ=, but ↵Lennart Poettering2014-11-06
| | | | fatal for a start job if not met
* core: send sigabrt on watchdog timeout to get the stacktraceUmut Tezduyar Lindskog2014-10-28
| | | | | if sigabrt doesn't do the job, follow regular shutdown routine, sigterm > sigkill.
* job: optionally, when a job timeout is hit, also execute a failure actionLennart Poettering2014-10-28
|
* Rearrange Unit to make pahole happyZbigniew Jędrzejewski-Szmek2014-10-25
| | | | After all we have lots of those.
* unit: move UnitDependency to unit-nameLukas Nykryn2014-10-08
|
* core: rework context initialization/destruction logicLennart Poettering2014-03-19
| | | | | | | | 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.
* core: add global settings for enabling CPUAccounting=, MemoryAccounting=, ↵Lennart Poettering2014-02-24
| | | | BlockIOAccounting= for all units at once
* core: rework cgroup mask propagationLennart Poettering2014-02-17
| | | | | | | Previously a cgroup setting down tree would result in cgroup membership additions being propagated up the tree and to the siblings, however a unit could never lose cgroup memberships again. With this change we'll make sure that both cgroup additions and removals propagate properly.
* core: watch SIGCHLD more closely to track processes of units with no ↵Lennart Poettering2014-02-07
| | | | | | | | | | | | | | | | | | | reliable cgroup empty notifier When a process dies that we can associate with a specific unit, start watching all other processes of that unit, so that we can associate those processes with the unit too. Also, for service units start doing this as soon as we get the first SIGCHLD for either control or main process, so that we can follow the processes of the service from one to the other, as long as process that remain are processes of the ones we watched that died and got reassigned to us as parent. Similar, for scope units start doing this as soon as the scope controller abandons the unit, and thus management entirely reverts to systemd. To abandon a unit introduce a new Abandon() scope unit method call.
* core: add function to tell when job will time outZbigniew Jędrzejewski-Szmek2014-01-27
| | | | | | Things will continue when either the job timeout or the unit timeout is reached. Add functionality to access that info.
* core: no need to list properties for PropertiesChanged messages anymoreLennart Poettering2013-12-22
| | | | Since the vtable includes this information anyway, let's just use that
* bus: add .busname unit type to implement kdbus-style bus activationLennart Poettering2013-12-02
|
* service: add the ability for units to join other unit's PrivateNetwork= and ↵Lennart Poettering2013-11-27
| | | | PrivateTmp= namespaces
* core: replace OnFailureIsolate= setting by a more generic OnFailureJobMode= ↵Lennart Poettering2013-11-26
| | | | setting and make use of it where applicable
* core: include following set data in dumpLennart Poettering2013-11-25
|
* cgroups: Cache controller masks and optimize queues.David Strauss2013-11-22
|
* core: convert PID 1 to libsystemd-busLennart Poettering2013-11-20
| | | | | | | | | | | | | | | | | | | | | | This patch converts PID 1 to libsystemd-bus and thus drops the dependency on libdbus. The only remaining code using libdbus is a test case that validates our bus marshalling against libdbus' marshalling, and this dependency can be turned off. This patch also adds a couple of things to libsystem-bus, that are necessary to make the port work: - Synthesizing of "Disconnected" messages when bus connections are severed. - Support for attaching multiple vtables for the same interface on the same path. This patch also fixes the SetDefaultTarget() and GetDefaultTarget() bus calls which used an inappropriate signature. As a side effect we will now generate PropertiesChanged messages which carry property contents, rather than just invalidation information.
* Remove dead code and unexport some callsLennart Poettering2013-11-08
| | | | | | "make check-api-unused" informs us about code that is not used anymore or that is exported but only used internally. Fix these all over the place.
* macro: clean up usage of gcc attributesLennart Poettering2013-10-16
| | | | Always use our own macros, and name all our own macros the same style.
* core: rework how we match mount units against each otherLennart Poettering2013-09-26
| | | | | | | | | | | | | | | | | | | | | | | Previously to automatically create dependencies between mount units we matched every mount unit agains all others resulting in O(n^2) complexity. On setups with large amounts of mount units this might make things slow. This change replaces the matching code to use a hashtable that is keyed by a path prefix, and points to a set of units that require that path to be around. When a new mount unit is installed it is hence sufficient to simply look up this set of units via its own file system paths to know which units to order after itself. This patch also changes all unit types to only create automatic mount dependencies via the RequiresMountsFor= logic, and this is exposed to the outside to make things more transparent. With this change we still have some O(n) complexities in place when handling mounts, but that's currently unavoidable due to kernel APIs, and still substantially better than O(n^2) as before. https://bugs.freedesktop.org/show_bug.cgi?id=69740
* core: simplify drop-in writing logic a bitLennart Poettering2013-07-11
| | | | let's make use of some format string magic!
* core: add new "scope" unit type for making a unit of pre-existing processesLennart Poettering2013-07-01
| | | | | | | | | | | | | | | | | "Scope" units are very much like service units, however with the difference that they are created from pre-existing processes, rather than processes that systemd itself forks off. This means they are generated programmatically via the bus API as transient units rather than from static configuration read from disk. Also, they do not provide execution-time parameters, as at the time systemd adds the processes to the scope unit they already exist and the parameters cannot be applied anymore. The primary benefit of this new unit type is to create arbitrary cgroups for worker-processes forked off an existing service. This commit also adds a a new mode to "systemd-run" to run the specified processes in a scope rather then a transient service.
* core: add transient unitsLennart Poettering2013-06-28
| | | | | | | | | | | | | | | | | | Transient units can be created via the bus API. They are configured via the method call parameters rather than on-disk files. They are subject to normal GC. Transient units currently may only be created for services (however, we will extend this), and currently only ExecStart= and the cgroup parameters can be configured (also to be extended). Transient units require a unique name, that previously had no configuration file on disk. A tool systemd-run is added that makes use of this functionality to run arbitrary command lines as transient services: $ systemd-run /bin/ping www.heise.de Will cause systemd to create a new transient service and run ping in it.
* dbus: make more cgroup attributes runtime settableLennart Poettering2013-06-27
|
* dbus: add infrastructure for changing multiple properties at once on units ↵Lennart Poettering2013-06-27
| | | | | | | | | | | | | | | | and hook some cgroup attributes up to it This introduces two bus calls to make runtime changes to selected bus properties, optionally with persistence. This currently hooks this up only for three cgroup atributes, but this brings the infrastructure to add more changable attributes. This allows setting multiple attributes at once, and takes an array rather than a dictionary of properties, in order to implement simple resetting of lists using the same approach as when they are sourced from unit files. This means, that list properties are appended to by this call, unless they are first reset via assigning the empty list.
* core: general cgroup reworkLennart Poettering2013-06-27
| | | | | | | | | | | | | | | | Replace the very generic cgroup hookup with a much simpler one. With this change only the high-level cgroup settings remain, the ability to set arbitrary cgroup attributes is removed, so is support for adding units to arbitrary cgroup controllers or setting arbitrary paths for them (especially paths that are different for the various controllers). This also introduces a new -.slice root slice, that is the parent of system.slice and friends. This enables easy admin configuration of root-level cgrouo properties. This replaces DeviceDeny= by DevicePolicy=, and implicitly adds in /dev/null, /dev/zero and friends if DeviceAllow= is used (unless this is turned off by DevicePolicy=).
* logind: add infrastructure to keep track of machines, and move to slicesLennart Poettering2013-06-20
| | | | | | | | | | | | | | | | | | | | - This changes all logind cgroup objects to use slice objects rather than fixed croup locations. - logind can now collect minimal information about running VMs/containers. As fixed cgroup locations can no longer be used we need an entity that keeps track of machine cgroups in whatever slice they might be located. Since logind already keeps track of users, sessions and seats this is a trivial addition. - nspawn will now register with logind and pass various bits of metadata along. A new option "--slice=" has been added to place the container in a specific slice. - loginctl gained commands to list, introspect and terminate machines. - user.slice and machine.slice will now be pulled in by logind.service, since only logind.service requires this slice.
* core: add new .slice unit type for partitioning systemsLennart Poettering2013-06-17
| | | | | | | | | | | | In order to prepare for the kernel cgroup rework, let's introduce a new unit type to systemd, the "slice". Slices can be arranged in a tree and are useful to partition resources freely and hierarchally by the user. Each service unit can now be assigned to one of these slices, and later on login users and machines may too. Slices translate pretty directly to the cgroup hierarchy, and the various objects can be assigned to any of the slices in the tree.
* Add __attribute__((const, pure, format)) in various placesZbigniew Jędrzejewski-Szmek2013-05-02
| | | | | | | | I'm assuming that it's fine if a _const_ or _pure_ function calls assert. It is assumed that the assert won't trigger, and even if it does, it can only trigger on the first call with a given set of parameters, and we don't care if the compiler moves the order of calls.
* Add some extra __attribute__ ((format)) sCristian Rodríguez2013-04-25
|
* unit: rework stop pending logicLennart Poettering2013-04-25
| | | | | | | | | | | When a trigger unit wants to know if a stop is queued for it, we should just check precisely that and do not check whether it is actually stopped already. This is because we use these checks usually from state change calls where the state variables are not updated yet. This change splits unit_pending_inactive() into two calls unit_inactive_or_pending() and unit_stop_pending(). The former checks state and pending jobs, the latter only pending jobs.
* cgroup: always validate cgroup controller namesLennart Poettering2013-04-24
| | | | Let's better be safe than sorry.
* unit: rework trigger dependency logicLennart Poettering2013-04-23
| | | | | | | | | | | Instead of having explicit type-specific callbacks that inform the triggering unit when a triggered unit changes state, make this generic so that state changes are forwarded betwee any triggered and triggering unit. Also, get rid of UnitRef references from automount, timer, path units, to the units they trigger and rely exclsuively on UNIT_TRIGGER type dendencies.
* Report about syntax errors with metadataZbigniew Jędrzejewski-Szmek2013-04-17
| | | | | | | | | | | | | The information about the unit for which files are being parsed is passed all the way down. This way messages land in the journal with proper UNIT=... or USER_UNIT=... attribution. 'systemctl status' and 'journalctl -u' not displaying those messages has been a source of confusion for users, since the journal entry for a misspelt setting was often logged quite a bit earlier than the failure to start a unit. Based-on-a-patch-by: Oleksii Shevchuk <alxchk@gmail.com>
* Introspect and monitor dropin configurationOleksii Shevchuk2013-04-01
|
* core: single unit_kill implementation for all unit typesMichal Schmidt2013-03-13
| | | | | | | There are very few differences in the implementations of the kill method in the unit types that have one. Let's unify them. This does not yet unify unit_kill() with unit_kill_context().
* core: redefine unit_status_printf()Michal Schmidt2013-02-28
| | | | | | Take advantage of the fact that almost all callers want to pass unit description as the last parameter. Those who don't can use the more flexible manager_status_printf().
* core: add manager_status_printf()Michal Schmidt2013-02-28
| | | | | | | unit_status_printf() checks the state of the manager, not of the unit as such. Move it to manager.c and rename it to manager_status_printf(). Temporarily keep unit_status_printf as a wrapper macro.