summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-kernel.c
AgeCommit message (Collapse)Author
2016-05-25stuffLuke Shumaker
2016-02-10tree-wide: remove Emacs lines from all filesDaniel Mack
This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
2016-01-18bus-kernel: reword assignment of dst_id in bus_message_setup_kmsgZbigniew Jędrzejewski-Szmek
Setting of dst_id was based on interplay of two booleans, making the logic hard to follow (for humans and compilers alike). gcc was confused and emmitted a warning about an uninitialized variable. Rework the code to make it obvious that dst_id is set properly.
2016-01-12tree-wide: use xsprintf() where applicableDaniel Mack
Also add a coccinelle receipt to help with such transitions.
2015-11-27tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering
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.
2015-10-27util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering
2015-10-27user-util: move UID/GID related macros from macro.h to user-util.hLennart Poettering
2015-10-27src/basic: rename audit.[ch] → audit-util.[ch] and capability.[ch] → ↵Lennart Poettering
capability-util.[ch] The files are named too generically, so that they might conflict with the upstream project headers. Hence, let's add a "-util" suffix, to clarify that this are just our utility headers and not any official upstream headers.
2015-10-27util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]Lennart Poettering
2015-10-25util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering
There are more than enough to deserve their own .c file, hence move them over.
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering
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.
2015-10-17sd-bus: fix error handling of pthread API callsLennart Poettering
pthread APIs (unlike the rest of libc) return their errors as positive error codes directly from the functions, rather than using errno. Let's make sure we always handle things that way.
2015-08-27Revert "sd-bus: do not connect to dbus-1 socket when kdbus is available"David Herrmann
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.
2015-08-27sd-bus: rename bloom-tag to arg0-hasDavid Herrmann
We use dashes in our bloom-tags. Make sure the newly introduced arg0has tag uses the same style. Note that the external dbus-tags don't use dashes, though. They are defined in the spec and we need to keep compatibility there.
2015-08-25sd-bus: introduce new match type "arg0has=" for matching arrays of stringsLennart Poettering
Previously, sd-bus inofficially already supported bus matches that tested a string against an array of strings ("as"). This was done via an enhanced way to interpret "arg0=" matches. This is problematic however, since clients have no way to determine if their respective implementation understood strv matches or not, thus allowing invalid matches to be installed without a way to detect that. This patch changes the logic to only allow such matches with a new "arg0has=" syntax. This has the benefit that non-conforming implementations will return a parse error and a client application may thus efficiently detect support for the match type. Matches of this type are useful for "udev"-like systems that "tag" objects with a number of strings, and clients need to be able to match against any of these "tags". The name "has" takes inspiration from Python's ".has_key()" construct.
2015-08-11 sd-bus: do not connect to dbus-1 socket when kdbus is availableKay Sievers
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
2015-08-06sd-bus: ignore BLOOM_FILTER kdbus itemsLennart Poettering
The kernel nowadays sends these along, and that's OK, hence don't even debug log about it, but completely ignore it.
2015-08-06tree-wide: fix indentationThomas Hindoe Paaboel Andersen
2015-07-24sd-bus: don't treat KDBUS_ITEM_TIMESTAMP as unknown itemDavid Herrmann
In bus_kernel_translate_message(), we print a DEBUG message on unknown items. But right now, we also print this message for KDBUS_ITEM_TIMESTAMP despite parsing it properly. Fix this!
2015-07-02sd-bus: don't leak kdbus notificationsDavid Herrmann
When we get notifications from the kernel, we always turn them into synthetic dbus1 messages. This means, we do *not* consume the kdbus message, and as such have to free the offset. Right now, the translation-helpers told the caller that they consumed the message, which is wrong. Fix this by explicitly releasing all kernel messages that are translated.
2015-06-17Stop talking about the "XDG" version of basename()Simon McVittie
XDG refers to X Desktop Group, a former name for freedesktop.org. This group is responsible for specifications like basedirs, .desktop files and icon naming, but as far as I know, it has never tried to redefine basename(). I think these references were meant to say XPG (X/Open Portability Guide), a precursor of POSIX. POSIX is better-known and less easily confused with XDG, and is how the basename(3) man page describes the libgen.h version of basename(). The other version of basename() is glibc-specific and is described in basename(3) as "the GNU version"; specifically mention that version, to disambiguate.
2015-06-10sd-bus: remove ucred parameter from bus_message_from_header() since we don't ↵Lennart Poettering
use it anymore
2015-06-05bus: don't force send-masks on kdbus busesDavid Herrmann
Right now we always pass KDBUS_ITEM_ATTACH_FLAGS_RECV to KDBUS_CMD_BUS_MAKE, effectively forcing every bus connection to do the same during KDBUS_CMD_HELLO. This used to be a workaround to make sure all metadata is always present. However, we refrained from that approach and intend to make all metadata collection solely rely on /proc access restrictions. Therefore, there is no need to force the send-flags mask on newly created buses.
2015-06-03kdbus: remove attach_flags_mask module parameter settingKay Sievers
2015-05-11treewide: Correct typos and spell plural of bus consistentTorstein Husebø
2015-04-30sd-bus: when we get ENOTTY on the HELLO ioctl assume incompatible API versionLennart Poettering
As perparation for future incompatible kdbus kernel API changes.
2015-04-29sd-bus: properly handle creds that are known but undefined for a processLennart Poettering
A number of fields do not apply to all processes, including: there a processes without a controlling tty, without parent process, without service, user services or session. To distuingish these cases from the case where we simply don't have the data, always return ENXIO for them, while returning ENODATA for the case where we really lack the information. Also update the credentials dumping code to show this properly. Fields that are known but do not apply are now shown as "n/a". Note that this also changes some of the calls in process-util.c and cgroup-util.c to return ENXIO for these cases.
2015-04-21sd-bus: expose ppid fieldLennart Poettering
kdbus has been passing us the ppid file for a while, actually make use of it.
2015-04-10shared: add formats-util.hRonny Chevalier
2015-03-13tree-wide: there is no ENOTSUP on linuxDavid Herrmann
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
2015-03-02sd-bus: sync kdbus.h (ABI break)Daniel Mack
After some reconsideration, we decided to move the binary protocol back to 64-bit wide UIDs and GIDs. After all, it should be possible to redefine [gu]id_t to uint64_t and things should continue to work. As we want to avoid such data types in kdbus.h, let's move back to 64-bit values and be safe. In sd-bus, we have to do a translation between uint64_t and gid_t now for supplementary gids. Some inline comments have also been updated in kdbus upstream.
2015-02-24sd-bus: sync kdbus.hDaniel Mack
Follow two small changes in the kdbus API: * Flags are now returned in cmd->return_flags by KDBUS_CMD_NAME_ACQUIRE * struct kdbus_item_list has been dropped. The information stored in this struct was redundant since awhile already, as all commands report their returned slice size anyway.
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen
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.
2015-02-17bus: sync with kdbusDavid Herrmann
Pull in new kdbus changes, namely: - EOVERFLOW is replaces by KDBUS_RECV_RETURN_DROPPED_MSGS - ENOMSG is merged with EAGAIN for consistency
2015-02-16sd-bus: make sure we always serialize the reply cookie as 64bit on dbus2, ↵Lennart Poettering
and 32bit on dbus1
2015-02-16Revert "Revert "sd-bus: change serialization of kdbus messages to qualify in ↵Lennart Poettering
their entirety as gvariant objects"" This reverts commit 954871d8ba15911d014f76ed2c7a9492953cf39d.
2015-02-13sd-bus: sync kdbus.h (ABI break)Daniel Mack
Another slice logic rework in kdbus made KDBUS_ITEM_PAYLOAD_OFF items relative to the message header again. Catch up with that in sd-bus.
2015-02-11tree-wide: whenever we include libgen.h, immediately undefine basename()Lennart Poettering
Also, document in adjacent comments and in CODING_STYLE why we do that.
2015-02-05bus: sync with kdbus (ABI break)David Herrmann
2015-01-30Revert "sd-bus: change serialization of kdbus messages to qualify in their ↵Kay Sievers
entirety as gvariant objects" This breaks booting with kdbus. This reverts commit b381de4197157748ed96e469fcc372c23f842ae1.
2015-01-26sd-bus: change serialization of kdbus messages to qualify in their entirety ↵Lennart Poettering
as gvariant objects Previously, we only minimally altered the dbus1 framing for kdbus, and while the header and its fields where compliant Gvariant objects, and so was the body, the entire message together was not. As result of discussions with Ryan Lortie this is now changed, so that the messages in there entirely are fully compliant GVariants. This follows the framing description described here: https://wiki.gnome.org/Projects/GLib/GDBus/Version2 Note that this change changes the framing of *all* messages sent via kdbus, this means you have to reboot your kdbus system, after compiling and installing this new version.
2015-01-26sd-bus: reuse the KDBUS_CMD_FREE wrapper wherever appropriateLennart Poettering
2015-01-18bus: drop systemd.kdbus_attach_flags_mask= cmdlineDavid Herrmann
There is no reason to provide our own attach_flags_mask. We can simply rely on kdbus.attach_flags_mask= which is read by the kernel *and* kmod. If it's set, we assume the user wants to override our setting, so we simply skip setting it.
2015-01-12sd-bus: sync kdbus.h (API break)Daniel Mack
Just a simple variable rename, and a dropped flag that sd-bus didn't make use of.
2015-01-09bus: append bloom-filter to all signalsDavid Herrmann
Make sure to append bloom-filters to all signal-messages, not only broadcasts.
2015-01-07sd-bus: unify how we set the sender of synthetic messagesLennart Poettering
2015-01-07sd-bus: make use of the newly added timestamps on kdbus kernel messagesLennart Poettering
2015-01-05sd-bus: sync kdbus.hDaniel Mack
Catch up with latest changes in kdbus.ko: * Signals can be sent as unicast now, hence they need to be marked as such with the KDBUS_MSG_SIGNAL in the message flags. * Follow ioctl number change for KDBUS_CMD_FREE
2014-12-30bus: fix capabilities on big-endianDavid Herrmann
The kernel provides capabilities as a u32 array, sd-bus uses an u8 array. This works fine on little-endian as both are encoded the same way. However, this fails on big-endian if we do not perform sufficient byte-swapping on each u32 entry. This patch makes sd-bus use u32, too. We avoid changing any kernel provided data so we can keep pointing into kdbus pool buffers which contain u32 arrays.
2014-12-30bus: drop creds->capability_sizeDavid Herrmann
The number of available caps can be read from /proc/sys/kernel/cap_last_cap during runtime. Our helper cap_last_cap() does that, so there's no reason to remember the size of any capability cache. We can just pre-allocate arrays with a suitable size for all available caps and reject any higher caps. The kernel capability API uses u32 as base so make sure we do the same. Note that this is specified by POSIX, so it's unlikely to change.