summaryrefslogtreecommitdiff
path: root/src/core/service.c
AgeCommit message (Collapse)Author
2014-07-18core: show timeouts when watchdog howlsZbigniew Jędrzejewski-Szmek
2014-07-07service: flush status text and errno values each time a service is startedLennart Poettering
We shouldn't show status texts from previous service starts
2014-07-07service: don't accept negative ERRNO= notification messagesLennart Poettering
2014-07-07service: minor modernizationLennart Poettering
2014-07-07core: Added support for ERRNO NOTIFY_SOCKET message parsing, and added ↵Miguel Angel Ajo
StatusErrno dbus property along StatusText to allow notification of numeric status condition while degraded service operation or any other special situation.
2014-07-03core: introduce exit_status_set_is_empty() to make things a bit easier to readLennart Poettering
2014-07-03exit-status: rename ExitStatusSet's "code" field to "status"Lennart Poettering
We should follow the naming scheme waitid() uses, not come up with our own reversed one...
2014-07-03core: introduce new RestartForceExitStatus= service settingLennart Poettering
This does the inverse of RestartPreventExitStatus=: it forces a restart of a service when a certain exit status is returned by a service process.
2014-06-07Remove sysv parser from service.cThomas Hindoe Paaboel Andersen
Parsing sysv files was moved to the sysv-generator in the previous commit. This patch removes the sysv parsing from serivce.c. Note that this patch drops the following now unused sysv-specific info from service dump: "SysV Init Script has LSB Header: (yes/no)" "SysVEnabled: (yes/no)" "SysVRunLevels: (levels)"
2014-06-05core: introduce new Restart=on-abnormal settingLennart Poettering
Restart=on-abnormal is similar to Restart=on-failure, but avoids restarts on unclean exit codes (but still doing restarts on all obviously unclean exits, such as timeouts, signals, coredumps, watchdog timeouts). Also see: https://fedorahosted.org/fpc/ticket/191
2014-05-15core: close socket fds asynchronouslyZbigniew Jędrzejewski-Szmek
http://lists.freedesktop.org/archives/systemd-devel/2014-April/018928.html
2014-05-14core: sysvcompat - avoid repeated function callTom Gundersen
2014-05-14core: sysvcompat - $network should be equivalent to network-online, rather ↵Tom Gundersen
than network target Most likely the facility needed is actual connectivity, rather than whether or not the network managment daemon is running. We also need to explicitly pull in the network-online.target, as it is not active by default. This means {systemd-networkd,NetworkManager}-wait-online.service, can be enabled by default as part of network-online.target, and only delay boot when some service actively pulls it in. See: <https://bugzilla.gnome.org/show_bug.cgi?id=728965> Cc: Pavel Šimerda <psimerda@redhat.com> Cc: Michal Sekletar <msekleta@redhat.com>
2014-04-24service: rename StartLimitAction enum to FailureActionMichael Olbrich
It's used for the FailureAction property as well.
2014-04-24service: add FailureAction= optionMichael Olbrich
It has the same possible values as StartLimitAction= and is executed immediately if a service fails.
2014-04-21service: add support for reboot argument when triggered by StartLimitAction=Michael Olbrich
When rebooting with systemctl, an optional argument can be passed to the reboot system call. This makes it possible the specify the argument in a service file and use it when the service triggers a restart. This is useful to distinguish between manual reboots and reboots caused by failing services.
2014-03-24service: don't take chkconfig priority into accountLennart Poettering
Given that native services do not carry a sysv priority anyway it is pointless reading them from chkconfig headers, and pretend they'd work. So let's drop this.
2014-03-24sd-event: rework API to support CLOCK_REALTIME_ALARM and ↵Lennart Poettering
CLOCK_BOOTTIME_ALARM, too
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-18util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering
safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
2014-03-17core, libsystemd, systemd, timedate, udev: spelling fixesMiklos Vajna
2014-03-16Use strlen even for constant stringsJosh Triplett
GCC optimizes strlen("string constant") to a constant, even with -O0. Thus, replace patterns like sizeof("string constant")-1 with strlen("string constant") where possible, for clarity. In particular, for expressions intended to add up the lengths of components going into a string, this often makes it clearer that the expression counts the trailing '\0' exactly once, by putting the +1 for the '\0' at the end of the expression, rather than hidden in a sizeof in the middle of the expression.
2014-03-03core: introduce new RuntimeDirectory= and RuntimeDirectoryMode= unit settingsLennart Poettering
As discussed on the ML these are useful to manage runtime directories below /run for services.
2014-02-24Remove dead lines in various placesZbigniew Jędrzejewski-Szmek
As pointed-out by clang -Wunreachable-code. No behaviour changes.
2014-02-24core: add global settings for enabling CPUAccounting=, MemoryAccounting=, ↵Lennart Poettering
BlockIOAccounting= for all units at once
2014-02-20manager: be more precise in message about restartZbigniew Jędrzejewski-Szmek
2014-02-20api: in constructor function calls, always put the returned object pointer ↵Lennart Poettering
first (or second) Previously the returned object of constructor functions where sometimes returned as last, sometimes as first and sometimes as second parameter. Let's clean this up a bit. Here are the new rules: 1. The object the new object is derived from is put first, if there is any 2. The object we are creating will be returned in the next arguments 3. This is followed by any additional arguments Rationale: For functions that operate on an object we always put that object first. Constructors should probably not be too different in this regard. Also, if the additional parameters might want to use varargs which suggests to put them last. Note that this new scheme only applies to constructor functions, not to all other functions. We do give a lot of freedom for those. Note that this commit only changes the order of the new functions we added, for old ones we accept the wrong order and leave it like that.
2014-02-18util: generalize code that checks whether PIDs are alive or unwaited forLennart Poettering
2014-02-16core: check for return value from get_process_stateYuxuan Shui
Fix for commit e10c9985bb.
2014-02-14core: fix detection of dead processesYuxuan Shui
Commit 5ba6985b moves the UNIT_VTABLE(u)->sigchld_event before systemd actually reaps the zombie. Which leads to service_load_pid_file accepting zombie as a valid pid. This fixes timeouts like: [ 2746.602243] systemd[1]: chronyd.service stop-sigterm timed out. Killing. [ 2836.852545] systemd[1]: chronyd.service still around after SIGKILL. Ignoring. [ 2927.102187] systemd[1]: chronyd.service stop-final-sigterm timed out. Killing. [ 3017.352560] systemd[1]: chronyd.service still around after final SIGKILL. Entering failed mode.
2014-02-14service: when we complain about a notify message we cannot map to main pid ↵Lennart Poettering
because we don't know anything about the main pid, do so at debug level
2014-02-14service: if we don't know the main pid of a service, we cannot accept any ↵Lennart Poettering
notification messages
2014-02-07core: watch SIGCHLD more closely to track processes of units with no ↵Lennart Poettering
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.
2014-01-29core: make sure to always go through both SIGTERM and SIGKILL states of unitsLennart Poettering
Given that we now have KillMode=mixed where SIGTERM might kill a smaller set than SIGKILL we need to make sure to always go explicitly throught the SIGKILL state to get the right end result.
2014-01-29service: allow KillMode=mixed in conjunction with PAMName=Lennart Poettering
2014-01-27core: add function to tell when job will time outZbigniew Jędrzejewski-Szmek
Things will continue when either the job timeout or the unit timeout is reached. Add functionality to access that info.
2014-01-07core: do not add implicit dbus.socket dependencyKay Sievers
Sockets are ordered before sockets.target anyway, and sockets.target is ordered before basic.target, and hence all bus services end up being ordered after dbus.socket anyway. Since for kdbus clients dbus.socket is obsolete, let's not add this dependency explicitly. Also, it's hot in Australia and we are going for breakfast now.
2014-01-07core: --user -- add basic.target an sort against it like --system doesKay Sievers
2014-01-02Use format patterns for usec_t, pid_t, nsec_t, usec_tZbigniew Jędrzejewski-Szmek
It is nicer to predefine patterns using configure time check instead of using casts everywhere. Since we do not need to use any flags, include "%" in the format instead of excluding it like PRI* macros.
2014-01-02core/service: check if mainpid matches only if it is setZbigniew Jędrzejewski-Szmek
https://bugzilla.redhat.com/show_bug.cgi?id=1047304
2014-01-02core/service: tweak messages on operation timeoutsZbigniew Jędrzejewski-Szmek
2013-12-25unit: include peer identity in description of per-connection ↵Lennart Poettering
socket-activated services
2013-12-22sd-daemon: introduce sd_watchdog_enabled() for parsing $WATCHDOG_USECLennart Poettering
Also, introduce a new environment variable named $WATCHDOG_PID which cotnains the PID of the process that is supposed to send the keep-alive events. This is similar how $LISTEN_FDS and $LISTEN_PID work together, and protects against confusing processes further down the process tree due to inherited environment.
2013-12-22core: no need to list properties for PropertiesChanged messages anymoreLennart Poettering
Since the vtable includes this information anyway, let's just use that
2013-12-19service: don't send out PropertiesChanged message for each watchdog notificationLennart Poettering
2013-12-18service: watch main pid even in final statesLennart Poettering
In some circumstances, for example when start-up times out we immediately jump into the final state, at which point we still should try to watch the main pid so that the SIGCHLD allows us to quickly move into dead state.
2013-12-16systemctl: properly initialize and free sd_bus_error in "systemctl cat"Lennart Poettering
We need to properly initialize all error structs before use and free them after use. Also, there's no point in flushing stdout if we output a \n anyway...
2013-12-12service: process watchdog timeouts with lowest priorityLennart Poettering
2013-12-12service: actually leave watchdog enabled in the states where it mattersLennart Poettering
2013-12-11service: clean up watchdog logic a bitLennart Poettering