summaryrefslogtreecommitdiff
path: root/src/shared/bus-util.c
Commit message (Collapse)AuthorAge
...
* bus-util: treat an empty string as a NULLLennart Poettering2017-07-05
| | | | | Instead of ignoring empty strings retrieved via the bus, treat them as NULL, as it's customary in elogind.
* bus-util: support mapping signed integers with bus_map_properties()Lennart Poettering2017-07-05
| | | | | | Let's make sure we can read the exit code/status properties exposed by PID 1 properly. Let's reuse the existing code for unsigned fields, as we just use it to copy words around, and don't calculate it.
* Prep v231: Apply missing fixes from upstream (5/6) src/sharedSven Eden2017-06-16
|
* sd-bus: make sure bus_map_all_properties() handle booleans rightLennart Poettering2017-06-16
| | | | | | | | | | sd-bus generally exposes bools as "int" instead of "bool" in the public API. This is relevant when unmarshaling booleans, as the relevant functions expect an int* pointer and no bool* pointer. Since sizeof(bool) is not necessarily the same as sizeof(int) this is problematic and might result in memory corruption. Let's fix this, and make sure bus_map_all_properties() handles booleans as ints, as the rest of sd-bus, and make all users of it expect the right thing.
* bus_util: add support to map double (#3479)Susant Sahani2017-06-16
| | | | | | Now we don't support parsing double at map_basic. when trying to use bus_message_map_all_properties with a double this fails. Let's add it.
* Prep v230: Apply missing upstream fixes and updates (7/8) src/shared.Sven Eden2017-06-16
|
* shared/install,systemctl,core: report offending file on installation errorZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | | | | | | | | | | | | | | Fixes #2191: $ systemctl --root=/ enable sddm Created symlink /etc/elogind/system/display-manager.service, pointing to /usr/lib/elogind/system/sddm.service. $ sudo build/systemctl --root=/ enable gdm Failed to enable unit, file /etc/elogind/system/display-manager.service already exists and is a symlink to /usr/lib/elogind/system/sddm.service. $ sudo build/systemctl --root= enable sddm $ sudo build/systemctl --root= enable gdm Failed to enable unit: File /etc/elogind/system/display-manager.service already exists and is a symlink to /usr/lib/elogind/system/sddm.service. (I tried a few different approaches to pass the error information back to the caller. Adding a new parameter to hold the error results in a gigantic patch and a lot of hassle to pass the args arounds. Adding this information to the changes array is straightforward and can be more easily extended in the future.) In case local installation is performed, the full set of errors can be reported and we do that. When running over dbus, only the first error is reported.
* systemctl/core: ignore masked units in preset-allZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | | | | | | | | With any masked unit that would that would be enabled by presets, we'd get: test@rawhide $ sudo systemctl preset-all Failed to execute operation: Unit file is masked. test@rawhide $ sudo systemctl --root=/ preset-all Operation failed: Cannot send after transport endpoint shutdown Simply ignore those units: test@rawhide $ sudo systemctl preset-all Unit xxx.service is masked, ignoring.
* tree-wide: remove useless NULLs from strjoinaZbigniew Jędrzejewski-Szmek2017-06-16
| | | | The coccinelle patch didn't work in some places, I have no idea why.
* bus-util: Fix reading uint32 propertiesMartin Pitt2017-06-16
| | | | | | | | Fix copy&paste bug in map_basic() to use the correct data type for SD_BUS_TYPE_UINT32. Before we were copying the wrong 32 bits into the destination pointer, resulting in complete garbage on big-endian systems. Fixes #2927
* shared: fix a misspelling of "journalctl"Biao Lu2017-06-16
|
* tree-wide: minor formatting inconsistency cleanupsVito Caputo2017-06-16
|
* tree-wide: make ++/-- usage consistent WRT spacingVito Caputo2017-06-16
| | | | | | Throughout the tree there's spurious use of spaces separating ++ and -- operators from their respective operands. Make ++ and -- operator consistent with the majority of existing uses; discard the spaces.
* systemctl: fix style to avoid modification of array passed by callerZbigniew Jędrzejewski-Szmek2017-06-16
| | | | Followup for 4524439edb7d.
* systemctl: include -M or -H arguments in the hintZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | | | | | | | | | https://github.com/elogind/elogind/issues/2431 Some newlines are added, but the output will still exceed 80 columns in many cases. The fallback for oom conditions is changed from "n/a" to something "<service>", and a similar pattern is used for the new code. This way we have a realistic fallback for oom, which seems nicer than making the whole function return an error code which would then have to be propagated. $ systemctl -M fedora-rawhide restart elogind-networkd.service Job for elogind-networkd.service failed because start of the service was attempted too often. See "systemctl -M fedora-rawhide status elogind-networkd.service" and "journalctl -M fedora-rawhide -xe" for details. To force a start use "systemctl -M fedora-rawhide reset-failed elogind-networkd.service" followed by "systemctl -M fedora-rawhide start elogind-networkd.service" again.
* Prep v229: Add missing fixes from upstream [5/6] src/sharedSven Eden2017-05-17
|
* core: rework unit timeout handling, and add new setting RuntimeMaxSec=Lennart Poettering2017-05-17
| | | | | | | | | | | | | | | | | | | | | | 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: fix support for transient resource limit propertiesLennart Poettering2017-05-17
| | | | | | | | | | | | | Make sure we can properly process resource limit properties. Specifically, allow transient configuration of both the soft and hard limit, the same way from the unit files. Previously, only the the hard rlimits could be configured but they'd implicitly spill into the soft hard rlimits. This also updates the client-side code to be able to parse hard/soft resource limit specifications. Since we need to serialize two properties in bus_append_unit_property_assignment() now, the marshalling of the container around it is now moved into the function itself. This has the benefit of shortening the calling code. As a side effect this now beefs up the rlimit parser of "systemctl set-property" to understand time and disk sizes where that's appropriate.
* shared: simplify parsing of bus properties a bitLennart Poettering2017-05-17
| | | | Let's write the property name and value in one call, when that's possible, shorthing our code a bit.
* core: fix handling of AccuracyUSec and RandomDelayUSec bus propertiesLennart Poettering2017-05-17
| | | | | | | | | | | Clear up some confusion regarding the USec and Sec suffixes we use. In configuration files we usually use the Sec suffix, to indicate the implied time unit if none is specified. The respective bus properties however use the USec property, since they expose 64bit unsigned integers containing time in µs. Before this patch timer units exposed a bus property AccuracyUSec (which hence is the correct name) but when parsing transient property data would look for AccuracySec instead (which is incorrect). This patch ensures we look for AccuracySec correctly, but keeps the code for AccuracyUSec in place for compatibility, but adds a warning to ensure that apps are updated to use the right property.
* systemctl: improve message when a job fails with a JOB_INVALID stateLennart Poettering2017-05-17
| | | | This result can only happen if the job was a reload job for an inactive unit. Make the error message actually say that.
* bus-util: print "systemctl --user" on user service managerWaLyong Cho2017-05-17
| | | | | | When a unit was started with "systemctl --user" and it failed, error messages is printed as "systemctl status". But it should be "systemctl --user status".
* core: expose soft limits on the busEvgeny Vereshchagin2017-05-17
| | | | | | This is a follow-up for https://github.com/elogind/elogind/pull/1994 See https://github.com/elogind/elogind/pull/1994#issuecomment-160087219
* core: rename Random* to RandomizedDelay*Zbigniew Jędrzejewski-Szmek2017-05-17
| | | | | | | The name RandomSec is too generic: "Sec" just specifies the default unit type, and "Random" by itself is not enough. Rename to something that should give the user general idea what the setting does without looking at documentation.
* core: add new RandomSec= setting for time unitsLennart Poettering2017-05-17
| | | | | This allows configuration of a random time on top of the elapse events, in order to spread time events in a network evenly across a range.
* bus-util: make sure --property=RemainAfterElapse=1 worksLennart Poettering2017-05-17
|
* bus-util: add in forgotten error messagesLennart Poettering2017-05-17
|
* Prep v228: Condense elogind source masks (5/5)Sven Eden2017-04-26
|
* Prep v228: Add remaining updates from upstream (3/3)Sven Eden2017-04-26
| | | | | Apply remaining fixes and the performed move of utility functions into their own foo-util.[hc] files on the rest of elogind.
* [5/5] Apply missing fixes from upstreamSven Eden2017-03-29
|
* Major cleanup of all leftovers after rebasing on master.Sven Eden2017-03-14
| | | | | | | | The patching of elogind in several steps with only partly rebasing on a common commit with upstream, left the tree in a state, that was unmergeable with master. By rebasing on master and manually cleaning up all commits, this merge is now possible. However, this process left some orphans, that are cleanup now.
* Unifiy free() usageSven Eden2017-03-14
| | | | | | | | This commit substitutes all occurrences of free(foo); foo = NULL; with foo = mfree(foo);
* Cleaned up more unneeded types and functions.Sven Eden2017-03-14
| | | | | | | | | | | | | | - src/shared/install.h - removed - src/basic/unit-name.[hc] - cleaned - src/core/cgroup.[hc] - cleaned - src/libelogind/libelogind.sym - cleaned - src/libelogind/sd-daemon/sd-daemon.c - cleaned - src/shared/acl-util.[hc] - cleaned - src/shared/bus-util.[hc] - cleaned - src/shared/output-mode.h - cleaned - src/shared/path-lookup.h - cleaned - src/systemd/sd-daemon.h - cleaned
* Classify processes from sessions into cgroupsSven Eden2017-03-14
| | | | | | | Create a private cgroup tree associated with no controllers, and use it to map PIDs to sessions. Since we use our own path structure, remove internal cgroup-related helpers that interpret the cgroup path structure to pull out users, slices, and scopes.
* Prep v226: Apply missing fixes and changes to src/sharedSven Eden2017-03-14
|
* bus-util: make more properties settable in --property=Lennart Poettering2017-03-14
| | | | | Add a couple of new properties to the supported set we can pass in systemd-run's and systemd-nspawn's --property= switch.
* Prep v224: Major cleanup of unneeded functions and some source files.Sven Eden2017-03-14
|
* Prep v222: Update build system:Sven Eden2017-03-14
| | | | | | | | - The content of the man pages directory has been overhauled - Makefile-man.am was regenerated - Makefile.am and configure.ac needed a few addtitions and fixes - Some masked functions had to be unmasked - Now superfluous files have been removed
* Prep v221: Update and clean up build system to sync with upstreamSven Eden2017-03-14
This commit replays the moving around of source files that have been done between systemd-219 and systemd-221. Further the Makefile.am is synchronized with the upstream version and then "re-cleaned". A lot of functions, that are not used anywhere in elogind have been coated into #if 0/#endif directives to further shorten the list of dependencies. All unneeded files have been removed.