summaryrefslogtreecommitdiff
path: root/src/shared/bus-util.h
Commit message (Collapse)AuthorAgeFilesLines
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-271-0/+1
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* bus-util: drop unnecessary re-formattingYu Watanabe2019-03-041-1/+2
|
* tree-wide: remove various unused functionsLennart Poettering2018-12-021-1/+0
| | | | All found with "cppcheck --enable=unusedFunction".
* bus-util: drop now-unused functionsZbigniew Jędrzejewski-Szmek2018-09-201-2/+0
|
* bus-util: use _printf_ attributeYu Watanabe2018-09-151-1/+1
| | | | | | Follow-up for eda193578effbc3cee0f6d56ade52434778737c9. Fixes oss-fuzz#10350.
* bus-util: make --property= optionally take valueYu Watanabe2018-09-121-2/+2
|
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-4/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: unify how we define bit mak enumsLennart Poettering2018-06-121-2/+2
| | | | | | Let's always write "1 << 0", "1 << 1" and so on, except where we need more than 31 flag bits, where we write "UINT64(1) << 0", and so on to force 64bit values.
* machined: move bus_reply_pair_array() into generic utilitiesLennart Poettering2018-05-241-0/+2
| | | | This way, we can reuse it in portabled.
* timesync,shared: move logic requesting bus name to sharedYu Watanabe2018-05-221-0/+2
| | | | | Preparation for setting DynamicUser= to other services which request bus names.
* bus-util: add more macros for defining functions of getting dbus propertiesYu Watanabe2018-05-151-25/+6
|
* bus-util: add several macros for defining functions of getting dbus propertiesYu Watanabe2018-05-131-0/+38
|
* bus-util: introduce bus_open_system_watch_bind_with_description()Yu Watanabe2018-04-171-1/+4
| | | | | | Similar to 56fbd7187a5af44a90c258fbeb1f17114f226bb3, this adds bus_open_system_watch_bind_with_description() to set description for busses.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* bus-util: fix a meaningless assertionYu Watanabe2018-04-051-1/+1
|
* bus-util: add flags for bus_map_all_properties() (#8546)Yu Watanabe2018-03-281-3/+9
| | | | | | | | | This adds flags BUS_MAP_STRDUP and BUS_MAP_BOOLEAN_AS_BOOL. If BUS_MAP_STRDUP is set, then each "s" message is duplicated. If BUS_MAP_BOOLEAN_AS_BOOL is set, then each "b" message is written to a bool pointer. Follow-up for #8488. See https://github.com/systemd/systemd/pull/8488#discussion_r175816270.
* bus-util: introduce bus_message_print_all_properties()Yu Watanabe2018-03-201-1/+4
| | | | Then, use it where applicable.
* bus-util: make bus_map_all_properties() not copy stringYu Watanabe2018-03-201-3/+3
|
* core: drop unnecessary __useless_struct_to_allow_trailing_semicolon__Zbigniew Jędrzejewski-Szmek2018-03-061-2/+1
| | | | | | | | | | | | | | ISO C does not allow empty statements outside of functions, and gcc will warn the trailing semicolons when compiling with -pedantic: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic] But our code cannot compile with -pedantic anyway, at least because warning: ISO C does not support ‘__PRETTY_FUNCTION__’ predefined identifier [-Wpedantic] Without -pedatnic, clang and even old gcc (3.4) generate no warnings about those semicolons, so let's just drop __useless_struct_to_allow_trailing_semicolon__.
* bus-util: add bool property setterJan Klötzke2018-01-221-0/+1
|
* networkd,resolved: make use of watch_bind feature to connect to the busLennart Poettering2018-01-051-0/+2
| | | | | | | | | | The changes both networkd and resolved to make use of the watch_bind feature of sd-bus to connect to the system bus. This way, both daemons can be started during early boot, and automatically and instantly connect to the system bus as it becomes available. This replaces prior code that used a time-based retry logic to connect to the bus.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* tree-wide: make bus_map_all_properties return a proper sd_bus_errorLennart Poettering2017-02-091-3/+3
| | | | | | | | And then show it, to make things a bit friendlier to the user if we fail acquiring some props. In fact, this fixes a number of actual bugs, where we used an error structure for output that we actually never got an error in.
* shared: split out code for adding multiple names to sd_bus_track objectLennart Poettering2016-11-161-0/+2
| | | | | Let's introduce a new call bus_track_add_name_many() that adds a string list to a tracking object.
* bus-util: generalize helper for ID128 prpoertiesLennart Poettering2016-10-071-0/+1
| | | | This way, we can make use of this in other code, too.
* Ensure kdbus isn't used (#3501)Dave Reisner2016-06-181-3/+0
| | | | | | | | Delete the dbus1 generator and some critical wiring. This prevents kdbus from being loaded or detected. As such, it will never be used, even if the user still has a useful kdbus module loaded on their system. Sort of fixes #3480. Not really, but it's better than the current state.
* shared: move unit-specific code from bus-util.h to bus-unit-util.hLennart Poettering2016-04-221-33/+0
| | | | | | | Previously we'd have generally useful sd-bus utilities in bust-util.h, intermixed with code that is specifically for writing clients for PID 1, wrapping job and unit handling. Let's split the latter out and move it into bus-unit-util.c, to make the sources a bit short and easier to grok.
* machinectl: add --value optionZbigniew Jędrzejewski-Szmek2016-04-051-1/+1
|
* systemctl: add --value optionZbigniew Jędrzejewski-Szmek2016-04-041-1/+1
| | | | | | | | | | With this option, systemctl will only print the rhs in show: $ systemctl show -p Wants,After systemd-journald --value systemd-journald.socket ... systemd-journald-dev-log.socket ... This is useful in scripts, because the need to call awk or similar is removed.
* systemctl: fix style to avoid modification of array passed by callerZbigniew Jędrzejewski-Szmek2016-02-151-1/+1
| | | | Followup for 4524439edb7d.
* systemctl: include -M or -H arguments in the hintZbigniew Jędrzejewski-Szmek2016-02-151-1/+1
| | | | | | | | | | | | | | | | https://github.com/systemd/systemd/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 systemd-networkd.service Job for systemd-networkd.service failed because start of the service was attempted too often. See "systemctl -M fedora-rawhide status systemd-networkd.service" and "journalctl -M fedora-rawhide -xe" for details. To force a start use "systemctl -M fedora-rawhide reset-failed systemd-networkd.service" followed by "systemctl -M fedora-rawhide start systemd-networkd.service" again.
* 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.
* bus-util: print "systemctl --user" on user service managerWaLyong Cho2016-01-141-1/+1
| | | | | | 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".
* shared: include what we useThomas Hindoe Paaboel Andersen2015-12-061-0/+7
| | | | | The next step of a general cleanup of our includes. This one mostly adds missing includes but there are a few removals as well.
* tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering2015-11-271-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GLIB has recently started to officially support the gcc cleanup attribute in its public API, hence let's do the same for our APIs. With this patch we'll define an xyz_unrefp() call for each public xyz_unref() call, to make it easy to use inside a __attribute__((cleanup())) expression. Then, all code is ported over to make use of this. The new calls are also documented in the man pages, with examples how to use them (well, I only added docs where the _unref() call itself already had docs, and the examples, only cover sd_bus_unrefp() and sd_event_unrefp()). This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we tend to call our destructors these days. Note that this defines no public macro that wraps gcc's attribute and makes it easier to use. While I think it's our duty in the library to make our stuff easy to use, I figure it's not our duty to make gcc's own features easy to use on its own. Most likely, client code which wants to make use of this should define its own: #define _cleanup_(function) __attribute__((cleanup(function))) Or similar, to make the gcc feature easier to use. Making this logic public has the benefit that we can remove three header files whose only purpose was to define these functions internally. See #2008.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-1/+3
| | | | | | | | | | | | | | 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.
* bus-util: add bus_property_get_rlimit (move from core/dbus_execute)Evgeny Vereshchagin2015-10-121-0/+2
|
* bus-util: rename bus_open_transport() to bus_connect_transport()Lennart Poettering2015-09-291-4/+4
| | | | | | | | | | | | | | In sd-bus, the sd_bus_open_xyz() family of calls allocates a new bus, while sd_bus_default_xyz() family tries to reuse the thread's default bus. bus_open_transport() sometimes internally uses the former, sometimes the latter family, but suggests it only calls the former via its name. Hence, let's avoid this confusion, and generically rename the call to bus_connect_transport(). Similar for all related calls. And while we are at it, also change cgls + cgtop to do direct systemd connections where possible, since all they do is talk to systemd itself.
* bus-util: support details in CheckAuthorization callsMichael Chapman2015-09-061-2/+2
| | | | | | Extra details for an action can be supplied when calling polkit's CheckAuthorization method. Details are a list of key/value string pairs. Custom policy can use these details when making authorization decisions.
* Revert "sd-bus: do not connect to dbus-1 socket when kdbus is available"David Herrmann2015-08-271-2/+26
| | | | | | | | This reverts commit d4d00020d6ad855d65d31020fefa5003e1bb477f. The idea of the commit is broken and needs to be reworked. We really cannot reduce the bus-addresses to a single address. We always will have systemd with native clients and legacy clients at the same time, so we also need both addresses at the same time.
* sd-bus: do not connect to dbus-1 socket when kdbus is availableKay Sievers2015-08-111-26/+2
| | | | | | | | | | | | We should not fall back to dbus-1 and connect to the proxy when kdbus returns an error that indicates that kdbus is running but just does not accept new connections because of quota limits or something similar. Using is_kdbus_available() in libsystemd/ requires it to move from shared/ to libsystemd/. Based on a patch from David Herrmann: https://github.com/systemd/systemd/pull/886
* sd-bus: introduce new sd_bus_flush_close_unref() callLennart Poettering2015-07-031-9/+2
| | | | | | | | | | | | | | | | sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush() (which writes all unwritten messages out) + sd_bus_close() (which terminates the connection, releasing all unread messages) + sd_bus_unref() (which frees the connection). The combination of this call is used pretty frequently in systemd tools right before exiting, and should also be relevant for most external clients, and is hence useful to cover in a call of its own. Previously the combination of the three calls was already done in the _cleanup_bus_close_unref_ macro, but this was only available internally. Also see #327
* build-sys: split internal basic/ library from shared/Kay Sievers2015-06-111-0/+209
basic/ can be used by everything cannot use anything outside of basic/ libsystemd/ can use basic/ cannot use shared/ shared/ can use libsystemd/