summaryrefslogtreecommitdiff
path: root/src/core/dbus-service.c
Commit message (Collapse)AuthorAgeFilesLines
* execute: replace command flag bools by a flags fieldLennart Poettering2017-08-101-2/+2
| | | | | This way, we can extend it later on in an easier way, and can pass it along nicely.
* core: introduce a restart counter (#6495)Lennart Poettering2017-08-091-0/+1
| | | | | | | | | | | | | This adds a per-service restart counter. Each time an automatic restart is scheduled (due to Restart=) it is increased by one. Its current value is exposed over the bus as NRestarts=. It is also logged (in a structured, recognizable way) on each restart. Note that this really only counts automatic starts triggered by Restart= (which it nicely complements). Manual restarts will reset the counter, as will explicit calls to "systemctl reset-failed". It's supposed to be a tool for measure the automatic restart feature, and nothing else. Fixes: #4126
* tree-wide: fput[cs]() → fput[cs]_unlocked() wherever that makes sense (#6396)Lennart Poettering2017-07-211-1/+1
| | | | | | | | As a follow-up for db3f45e2d2586d78f942a43e661415bc50716d11 let's do the same for all other cases where we create a FILE* with local scope and know that no other threads hence can have access to it. For most cases this shouldn't change much really, but this should speed dbus introspection and calender time formatting up a bit.
* core: make NotifyAccess= and FileDescriptorStoreMax= available to transient ↵Lennart Poettering2017-06-261-0/+33
| | | | | | services This is helpful for debugging/testing #5606.
* core: make "Restart" service property accessible via the transient APILennart Poettering2016-12-141-0/+23
| | | | Fixes: #4402
* failure-action: generalize failure action to emergency actionLukas Nykryn2016-10-211-3/+3
|
* core: add RemoveIPC= settingLennart Poettering2016-08-191-0/+3
| | | | | | | | | | | | | | | | | | This adds the boolean RemoveIPC= setting to service, socket, mount and swap units (i.e. all unit types that may invoke processes). if turned on, and the unit's user/group is not root, all IPC objects of the user/group are removed when the service is shut down. The life-cycle of the IPC objects is hence bound to the unit life-cycle. This is particularly relevant for units with dynamic users, as it is essential that no objects owned by the dynamic users survive the service exiting. In fact, this patch adds code to imply RemoveIPC= if DynamicUser= is set. In order to communicate the UID/GID of an executed process back to PID 1 this adds a new "user lookup" socket pair, that is inherited into the forked processes, and closed before the exec(). This is needed since we cannot do NSS from PID 1 due to deadlock risks, However need to know the used UID/GID in order to clean up IPC owned by it if the unit shuts down.
* core: move obsolete properties to the end of vtablesLennart Poettering2016-08-181-5/+6
| | | | | | This makes it easier to discern the relevant and obsolete parts of the vtables, and in particular helps when comparing introspection data with the actual vtable definitions.
* tree-wide: remove newlines from unit_write_drop_inZbigniew Jędrzejewski-Szmek2016-05-281-3/+3
| | | | This reverts part of #3329, but all for a good cause.
* Merge pull request #2569 from zonque/removalsMartin Pitt2016-02-101-2/+0
|\ | | | | Remove some old cruft
| * tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | | | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* | core: make the StartLimitXYZ= settings generic and apply to any kind of ↵Lennart Poettering2016-02-101-4/+5
|/ | | | | | | | | | | | | | | | | | | | unit, not just services This moves the StartLimitBurst=, StartLimitInterval=, StartLimitAction=, RebootArgument= from the [Service] section into the [Unit] section of unit files, and thus support it in all unit types, not just in services. This way we can enforce the start limit much earlier, in particular before testing the unit conditions, so that repeated start-up failure due to failed conditions is also considered for the start limit logic. For compatibility the four options may also be configured in the [Service] section still, but we only document them in their new section [Unit]. This also renamed the socket unit failure code "service-failed-permanent" into "service-start-limit-hit" to express more clearly what it is about, after all it's only triggered through the start limit being hit. Finally, the code in busname_trigger_notify() and socket_trigger_notify() is altered to become more alike. Fixes: #2467
* core: rework unit timeout handling, and add new setting RuntimeMaxSec=Lennart Poettering2016-02-011-0/+14
| | | | | | | | | | | | | | | | | | | | | | This clean-ups timeout handling in PID 1. Specifically, instead of storing 0 in internal timeout variables as indication for a disabled timeout, use USEC_INFINITY which is in-line with how we do this in the rest of our code (following the logic that 0 means "no", and USEC_INFINITY means "never"). This also replace all usec_t additions with invocations to usec_add(), so that USEC_INFINITY is properly propagated, and sd-event considers it has indication for turning off the event source. This also alters the deserialization of the units to restart timeouts from the time they were originally started from. Before this patch timeouts would be restarted beginning with the time of the deserialization, which could lead to artificially prolonged timeouts if a daemon reload took place. Finally, a new RuntimeMaxSec= setting is introduced for service units, that specifies a maximum runtime after which a specific service is forcibly terminated. This is useful to put time limits on time-intensive processing jobs. This also simplifies the various xyz_spawn() calls of the various types in that explicit distruction of the timers is removed, as that is done anyway by the state change handlers, and a state change is always done when the xyz_spawn() calls fail. Fixes: #2249
* core: don't reset /dev/console if stdin/stdout/stderr as passed as fd in a ↵Lennart Poettering2016-01-281-0/+2
| | | | | | | | | | transient service Otherwise we might end resetting /dev/console all the time when a transient service starts or stops. Fixes #2377 Fixes #2198 Fixes #2061
* core: expose number of file descriptors in fd store on the busLennart Poettering2015-11-021-1/+2
| | | | | | | | | For each service expose how many file descriptors there are currently in the fd store. (Also, fix the exporting of the fdstore limit, given that the field is just an "unsigned" but we exported it as "uint32_t". Not that there way any effective difference, but let's make this clean...)
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: move more file I/O related calls into fileio.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-1/+2
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-6/+7
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* core dbus: Check that flush works with memstreamNicolas Cornu2015-10-211-1/+3
|
* core: add support for setting stdin/stdout/stderr for transient servicesLennart Poettering2015-10-081-0/+32
| | | | | | | When starting a transient service, allow setting stdin/stdout/stderr fds for it, by passing them in via the bus. This also simplifies some of the serialization code for units.
* core: Add FFSDescriptors and FFSStrings service parametersPawel Szewczyk2015-09-221-0/+2
| | | | | By using these parameters functionfs service can specify ffs descriptors and strings which should be written to ep0.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-1/+0
| | | | | | 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.
* core: add new logic for services to store file descriptors in PID 1Lennart Poettering2015-01-061-0/+1
| | | | | | | | | | | | | | 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.
* core: make exec_command_free_list return NULLZbigniew Jędrzejewski-Szmek2014-12-181-4/+2
|
* core: Added support for ERRNO NOTIFY_SOCKET message parsing, and added ↵Miguel Angel Ajo2014-07-071-0/+1
| | | | StatusErrno dbus property along StatusText to allow notification of numeric status condition while degraded service operation or any other special situation.
* service: rename StartLimitAction enum to FailureActionMichael Olbrich2014-04-241-3/+3
| | | | It's used for the FailureAction property as well.
* service: add FailureAction= optionMichael Olbrich2014-04-241-0/+1
| | | | | It has the same possible values as StartLimitAction= and is executed immediately if a service fails.
* service: add support for reboot argument when triggered by StartLimitAction=Michael Olbrich2014-04-211-0/+1
| | | | | | | | 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.
* core: rework cgroup mask propagationLennart Poettering2014-02-171-0/+2
| | | | | | | 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: allow User=, Group=, Nice=, Environment=, Type= to be passed when ↵Lennart Poettering2014-02-051-0/+24
| | | | creating a transient service
* core: no need to list properties for PropertiesChanged messages anymoreLennart Poettering2013-12-221-15/+0
| | | | Since the vtable includes this information anyway, let's just use that
* bus: decorate the various object vtables with SD_BUS_VTABLE_PROPERTY_CONST ↵Lennart Poettering2013-12-221-22/+22
| | | | where appropriate
* core: fix serialization of exec command structsLennart Poettering2013-11-251-6/+6
|
* core: fix deserialization of StartTransientUnit() parametersLennart Poettering2013-11-211-0/+4
|
* core: convert PID 1 to libsystemd-busLennart Poettering2013-11-201-176/+90
| | | | | | | | | | | | | | | | | | | | | | 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.
* bus: remove static introspection file exportKay Sievers2013-10-211-1/+1
|
* systemd-run: properly escape argumentsZbigniew Jędrzejewski-Szmek2013-09-091-13/+8
| | | | | | | Spaces, quotes, and such, were not properly escaped. We should write them like we read them. https://bugs.freedesktop.org/show_bug.cgi?id=67971
* core: open up SendSIGHUP property for transient unitsLennart Poettering2013-07-301-0/+4
|
* core: allow setting RemainAfterExit= for transient servicesLennart Poettering2013-07-261-1/+16
|
* core: simplify drop-in writing logic a bitLennart Poettering2013-07-111-1/+1
| | | | let's make use of some format string magic!
* core: when writing drop-in files, name them directly after the property we setLennart Poettering2013-07-111-1/+1
| | | | | | Mapping from "FooBar" to "foo-bar" is unnecessary and makes it hard to handle many different properties with the same code, hence, let's just not do it.
* core: move ControlGroup and Slice properties out of the dbus "Unit" interfaceLennart Poettering2013-07-011-0/+2
| | | | | | | | | | | Slice/ControlGroup only really makes sense for unit types which actually have cgroups attached to them, hence move them out of the generic Unit interface and into the specific unit type interfaces. These fields will continue to be part of Unit though, simply because things are a log easier that way. However, regardless how this looks internally we should keep things clean and independent of the specific implementation of the inside.
* core: allow setting of the description string for transient unitsLennart Poettering2013-07-011-2/+2
|
* dbus: expose cgroup properties in introspection everywhereLennart Poettering2013-07-011-0/+1
|
* service: correct service bus introspection for timeoutsLennart Poettering2013-07-011-5/+5
|
* core: add transient unitsLennart Poettering2013-06-281-0/+128
| | | | | | | | | | | | | | | | | | 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: hookup runtime property changes for mouns, services, sockets, swaps tooLennart Poettering2013-06-271-0/+28
|
* core: general cgroup reworkLennart Poettering2013-06-271-3/+3
| | | | | | | | | | | | | | | | 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=).
* core: fix DBus property ExecMainExitTimestampMichal Schmidt2013-05-201-2/+2
| | | | | Possibly due to copy&paste error it was identical to ExecMainStartTimestamp.