summaryrefslogtreecommitdiff
path: root/src/core/service.c
AgeCommit message (Collapse)Author
2013-10-19mount/service: drop FsckPassNo supportTom Gundersen
We now treat passno as boleans in the generators, and don't need this any more. fsck itself is able to sequentialize checks on the same local media, so in the common case the ordering is redundant. It is still possible to force an order by using .d fragments, in case that is desired.
2013-10-09core: unify the way we denote serialization attributesLennart Poettering
2013-10-07systemd: serialize/deserialize forbid_restart valueSylvia Else
The Service type's forbid_restart field was not preserved by serialization/deserialization, so the fact that the service should not be restarted after stopping was lost. If a systemctl stop foo command has been given, but the foo service has not yet stopped, and then the systemctl --system daemon-reload was given, then when the foo service eventually stopped, systemd would restart it. https://bugs.freedesktop.org/show_bug.cgi?id=69800
2013-10-01core: whenever a new PID is passed to us, make sure we watch itLennart Poettering
2013-09-25cgroup: if we do a cgroup operation then do something on all supported ↵Lennart Poettering
controllers Previously we did operations like attach, trim or migrate only on the controllers that were enabled for a specific unit. With this changes we will now do them for all supproted controllers, and fall back to all possible prefix paths if the specified paths do not exist. This fixes issues if a controller is being disabled for a unit where it was previously enabled, and makes sure that all processes stay as "far down" the tree as groups exist.
2013-09-17specifier: rework specifier calls to return proper error messageLennart Poettering
Previously the specifier calls could only indicate OOM by returning NULL. With this change they will return negative errno-style error codes like everything else.
2013-09-12core: notify triggered by socket of a serviceUmut Tezduyar
2013-09-12service: Implement 'on-watchdog' restart optionHannes Reinecke
Services using the watchdog option might want to be restarted only if the watchdog triggers.
2013-09-10service: remove pidfile after exit of a serviceLukas Nykryn
2013-08-09service: prohibit Restart= set when Type=oneshotMaciej Wereski
2013-08-09service: always unwatch PIDs before forgetting old onesLennart Poettering
2013-07-18service: don't enter a second SIGTERM/SIGKILL cycle if no ExecStopPost= ↵Michael Olbrich
process is defined It won't help if the main process is still there and there is no new process to kill.
2013-07-01core: add new "scope" unit type for making a unit of pre-existing processesLennart Poettering
"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.
2013-06-28core: add transient unitsLennart Poettering
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.
2013-06-27dbus: hookup runtime property changes for mouns, services, sockets, swaps tooLennart Poettering
2013-06-27core: general cgroup reworkLennart Poettering
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=).
2013-06-20logind: add infrastructure to keep track of machines, and move to slicesLennart Poettering
- 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.
2013-06-17core: add new .slice unit type for partitioning systemsLennart Poettering
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.
2013-06-09service: don't report alien child as alive when it's notRoss Lagerwall
When a sigchld is received from an alien child, main_pid is set to 0 then service_enter_running calls main_pid_good to check if the child is running. This incorrectly returned true because kill(main_pid, 0) would return >= 0. This fixes an error where a service would die and the cgroup would become empty but the service would still report as active (running).
2013-06-06service: execute ExecStopPost= commands when the watchdog timeout hitsLennart Poettering
We can assume that a service for which a watchdog timeout was triggered is unresponsive to a clean shutdown. However, it still makes sense to execute the post-stop cleanup commands that can be configured with ExecStopPost=. Hence, when the timeout is hit enter STOP_SIGKILL rather than FINAL_SIGKILL.
2013-05-21service: kill processes with SIGKILL on watchdog failureMichael Olbrich
Just calling service_enter_dead() does not kill any processes. As a result, the old process may still be running when the new one is started. After a watchdog failure the service is in an undefined state. Using the normal shutdown mechanism makes no sense. Instead all processes are just killed and the service can try to restart.
2013-05-02Add __attribute__((const, pure, format)) in various placesZbigniew Jędrzejewski-Szmek
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.
2013-04-29man: clarify what Restart= meansZbigniew Jędrzejewski-Szmek
Related to https://bugzilla.redhat.com/show_bug.cgi?id=957135.
2013-04-18move _cleanup_ attribute in front of the typeHarald Hoyer
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-18Move bus_error to dbus-common and remove bus_error_message_or_strerrorSimon Peeters
bus_error and bus_error_message_or_strerror dit almost exactly the same, so use only one of them and place it in dbus-common.
2013-04-05Use initalization instead of explicit zeroingZbigniew Jędrzejewski-Szmek
Before, we would initialize many fields twice: first by filling the structure with zeros, and then a second time with the real values. We can let the compiler do the job for us, avoiding one copy. A downside of this patch is that text gets slightly bigger. This is because all zero() calls are effectively inlined: $ size build/.libs/systemd text data bss dec hex filename before 897737 107300 2560 1007597 f5fed build/.libs/systemd after 897873 107300 2560 1007733 f6075 build/.libs/systemd … actually less than 1‰. A few asserts that the parameter is not null had to be removed. I don't think this changes much, because first, it is quite unlikely for the assert to fail, and second, an immediate SEGV is almost as good as an assert.
2013-03-25units: introduce new timers.target and paths.target to hook timer/path units ↵Lennart Poettering
into for boot
2013-03-25core: ensure LSB Provides are handled correctlyFrederic Crozat
Let's say you have two initscripts, A and B: A contains in its LSB header: Required-Start: C and B contains in its LSB header: Provides: C When systemd is parsing /etc/rc.d/, depending on the file order, you can end up with either: - B is parsed first. An unit "C.service" will be "created" and will be added as additional name to B.service, with unit_add_name. No bug. - A is parsed first. An unit "C.service" is created for the "Required-Start" dependency (it will have no file attached, since nothing provides this dependency yet). Then B is parsed and when trying to handle "Provides: C", unit_add_name is called but will fail, because "C.service" already exists in manager->units. Therefore, a merge should occur for that case.
2013-03-24service: no need to drop rc. prefix anymoreMiklos Vajna
This reverts commit f5c88ec1330b61787441156de7d764a140774bd2. It is no longer necessary, and adds unnecessary magic.
2013-03-15core: reuse the same /tmp, /var/tmp and inaccessible dirMichal Sekletar
All Execs within the service, will get mounted the same /tmp and /var/tmp directories, if service is configured with PrivateTmp=yes. Temporary directories are cleaned up by service itself in addition to systemd-tmpfiles. Directory which is mounted as inaccessible is created at runtime in /run/systemd.
2013-03-13core: single unit_kill implementation for all unit typesMichal Schmidt
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().
2013-03-06service: sysv - properly handle init scripts with .sh suffixMichael Biebl
Dropping the distribution specific #ifdefs in 88516c0c952b9502e8ef1d6a1481af61b0fb422d broke the .sh suffix stripping since we now always used the else clause of the rc. check. We eventually want to drop the rc. prefix stripping, but for now we assume that no sysv init script uses both an rc. prefix and .sh suffix, so make the check for the .sh suffix and rc. prefix mutually exclusive.
2013-03-03core/path: install inotify watches top-down instead of bottom-upZbigniew Jędrzejewski-Szmek
When watches are installed from the bottom, it is always possible to race, and miss a file creation event. The race can be avoided if a watch is first established for a parent directory, and then for the file in the directory. If the file is created in the time between, the watch on the parent directory will fire. Some messages (mostly at debug level) are added to help diagnose pidfile issues. Should fix https://bugzilla.redhat.com/show_bug.cgi?id=917075.
2013-03-03core/service: use cleanup functions, wrap linesZbigniew Jędrzejewski-Szmek
2013-02-14honor SELinux labels, when creating and writing config filesHarald Hoyer
Also split out some fileio functions to fileio.c and provide a SELinux aware pendant in fileio-label.c see https://bugzilla.redhat.com/show_bug.cgi?id=881577
2013-02-11env: considerably beef up environment cleaning logicLennart Poettering
Now, actually check if the environment variable names and values used are valid, before accepting them. With this in place are at some places more rigid than POSIX, and less rigid at others. For example, this code allows lower-case environment variables (which POSIX suggests not to use), but it will not allow non-UTF8 variable values. All in all this should be a good middle ground of what to allow and what not to allow as environment variables. (This also splits out all environment related calls into env-util.[ch])
2013-01-26core: unify kill code of mount, service, socket, swap unitsLennart Poettering
2013-01-24service: make sure the watchdog timer is not restarted while stoppingMichael Olbrich
A watchdog notification may be handled after the watchdog timer was stopped while stopping the service. As a result the timer is restarted and the service may be restarted as well. The watchdog timestamp is initially set during startup in service_enter_start_post() and cleared when the timer is stopped. Therefore it can be used as an indication if the timer should be reset.
2013-01-24service: really stop watchdog timer when stoppingMichael Olbrich
For services without ExecStop= the state SERVICE_STOP is never entered. as a result the watchdog timer is not stopped and the service is restarted (if it is configuered to restart). Stopping the watchdog timer for SERVICE_STOP_SIGTERM as well fixes this.
2013-01-19unit: optionally allow making cgroup attribute changes persistentLennart Poettering
2013-01-18core: log USER_UNIT instead of UNIT if in user sessionMirco Tischler
2013-01-17service: properly signal permanent failure of a service to its socketLennart Poettering
This makes sure that a service is not indefinitely restarted in a tight loop if it fails before it is able to process its socket. This corrects the breakage introduced with 8d1b002a2e389e79a2414491523de549783abf73. Shame on me.
2013-01-16service: ignore dependencies on $syslog and $local_fs in LSB scriptsLennart Poettering
We no longer allow early-boot init scripts, however in late boot the syslog socket and local mounts are established anyway, so let's simplify our dep graph a bit. If $syslog doesn't resolve to syslog.target anymore there's no reason to keep syslog.target around anymore. Let's remove it. Note that many 3rd party service unit files order themselves after syslog.target. These will be dangling dependencies now, which should be unproblematic, however.
2013-01-16service: sysv - remove distribution specific targetsKay Sievers
Systemd should not introduce any new facilities. Distributions which still need to support their non-standard/legacy facilities should add them as patches to their packaging. The following facilities are no longer recognized: $x-display-manager $mail-transfer-agent $mail-transport-agent $mail-transfer-agent $smtp $null This target is no longer available: mail-transfer-agent.target
2013-01-14service: for Type=forking services, ignore exit status of main process ↵Lennart Poettering
depending on ExecStart's ignore setting https://bugzilla.redhat.com/show_bug.cgi?id=860464
2013-01-12service: remove distribution specific comments, the code runs unconditional nowKay Sievers
2013-01-12service: remove distribution specific comments, the code run unconditional nowKay Sievers
2013-01-06systemd: use unit logging macrosZbigniew Jędrzejewski-Szmek
2013-01-04service: fixup after ifdef droppingZbigniew Jędrzejewski-Szmek
Commit 88516c0 removed one line too much.
2013-01-04service: drop inserv.conf parsingLennart Poettering
This Suse specific configuration file should really be done in a generator that is shipped downstream by suse.