summaryrefslogtreecommitdiff
path: root/src/core/service.c
AgeCommit message (Collapse)Author
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.
2013-01-04service: drop the per-distro ifdefs in service.cLennart Poettering
They don't really hurt on other distros, and this allows us to ship the same code on all distros
2012-11-24build-sys: drop TARGET_UBUNTULennart Poettering
TARGET_UBUNTU is effectively the same as TARGET_DEBIAN. Given the Ubuntu is unlikely to use systemd anytime soon there's no point in keeping this separate.
2012-11-23timer: implement calendar time eventsLennart Poettering
2012-11-22manager: introduce watch_init() initializer for watchesLennart Poettering
2012-11-16service: drop support for SysV scripts for the early bootLennart Poettering
This remove distro-specific support for early-boot SysV init scripts. (And leaves support for normal SysV scripts untouched). If distributions wish to continue to allow early-boot SysV scripts in their distribution-specific way they should either maintain this patch downstream manually, or write a generator for them, or simply ship all those scripts with a .service wrapper.
2012-11-16shutdown: readd explicit sync() when shutting downLennart Poettering
As it turns out reboot() doesn't actually imply a file system sync, but only a disk sync. Accordingly, readd explicit sync() invocations immediately before we invoke reboot(). This is much less dramatic than it might sounds as we umount all disks/read-only remount them anyway before going down.
2012-10-31service: drop special HTTP server target, as it is a bad idea anf Fedora ↵Lennart Poettering
specific This was premarily intended to support the LSB facility $httpd which is only known by Fedora, and a bad idea since it lacks any real-life usecase. Similar, drop support for some other old Fedora-specific facilities. Also, document the rules for introduction of new facilities, to clarify the situation for the future.
2012-10-18systemd: use structured logging for unit changesZbigniew Jędrzejewski-Szmek
Information which unit a log entry pertains to enables systemctl status to display more log messages.
2012-10-18service: when invoking service processes in --user mode set MANAGERPID to ↵Lennart Poettering
PID of systemd
2012-10-16service: Heuristically determine whether SysV scripts support reloadMichael Stapelberg
This commit checks for a usage line which contains [{|]reload[|}"] (to not errnously match force-reload). Heuristics like this suck, but it solves a real problem and there appears to be no better way...
2012-10-16core: allow Type=oneshot services to have ExecReloadMantas Mikulėnas
Use cases: * iptables.service – atomically reload rules without having to flush them beforehand (which may leave the system insecure if reload fails) * rpc-nfsd.service – reexport filesystems after /etc/exports update without completely stopping and restarting nfsd (In both cases, the actual service is provided by a kernel module and does not have any associated user-space processes, thus Type=oneshot.)
2012-09-21journal: completely rework the mmap cache as I too dumb to actually ↵Lennart Poettering
understand it Instead of doing hand optimized fd bisect arrays just use plain old hashmaps. Now I can understand my own code again. Yay! As a side effect this should fix some bad memory accesses caused by accesses after mmap(), introduced in 189.
2012-09-18core: move ManagerRunningAs to sharedZbigniew Jędrzejewski-Szmek
Note: I did s/MANAGER/SYSTEMD/ everywhere, even though it makes the patch quite verbose. Nevertheless, keeping MANAGER prefix in some places, and SYSTEMD prefix in others would just lead to confusion down the road. Better to rip off the band-aid now.
2012-09-18unit-printf: before resolving exec context specifiers check whether the ↵Lennart Poettering
object actually has an exec context
2012-09-18unit: split unit_printf() and friends into its own .c fileLennart Poettering
2012-09-17conf-parser: don't unescape parsed configuration strings by defaultLennart Poettering
In many cases this might have a negative effect since we drop escaping from strings where we better shouldn't have dropped it. If unescaping makes sense for some settings we can readd it later again, on a per-case basis. https://bugs.freedesktop.org/show_bug.cgi?id=54522
2012-09-17service: don't hit an assert if a service unit changes type and we get a ↵Lennart Poettering
spurious event from before
2012-08-22service: introduce a proper service result if the start limit is hitLennart Poettering
2012-08-14service: add options RestartPreventExitStatus and SuccessExitStatusLukas Nykryn
In some cases, like wrong configuration, restarting after error does not help, so administrator can specify statuses by RestartPreventExitStatus which will not cause restart of a service. Sometimes you have non-standart exit status, so this can be specified by SuccessfulExitStatus.
2012-08-08systemd: introduced new timeout typesMichal Sekletar
Makes possible to specify separate timeout for start and stop of the service. [ Improved the manpage. Coding style fix. -- michich ]
2012-07-23sd-daemon: remove unnecessary memset callsJim Meyering
There is no point in clearing the bits of a "struct stat" when the very next statement just calls stat or fstat to fill in that same memory. [zj: two more places]