summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/sd-bus.c
AgeCommit message (Collapse)Author
2014-07-29time-util: add and use USEC/NSEC_INFINIYKay Sievers
2014-07-03bus: close a bus that failed to connectLennart Poettering
2014-07-03sd-bus: support connecting to remote hosts, directly into containersLennart Poettering
systemctl -H root@foobar:waldi will now show a list of services running on container "waldi" on host "foobar", using "root" for authenticating at "foobar". Since entereing a container requires priviliges, this will only work correctly for root logins.
2014-07-02sd-bus: when an event loop terminates, explicitly close the busLennart Poettering
This makes sure we actually release the bus and all the messages it references.
2014-07-02bus: drop bus/message GC logicLennart Poettering
When a caller drops all references to a bus and its messages while the messages where still queue, this causes the bus to reference the messages, and the messages to reference the bus, without anybody else keeping a reference, which is something we so far considered a leak, and tried to fix with a GC logic that would recognize cases like this, and drop the reference. This GC logic has been broken sofar, and remained unfixed. This commit removes it altogther, replacing it with nothing. The rationale is that simply because all refs to the bus have been dropped its queued messages should *still* be written to the bus, even if the caller doesn't retain any reference to either bus nor message. This means it was actually wrong to attempt to clean up the bus in this case. The proper way how applications should handle this is by explicitly invoking sd_bus_close(), when they want busses to go away. This is probably want they want to do anyway to avoid getting spurious callbacks after they stopped using a bus.
2014-05-16bus: fix unitialized variable access in error pathZbigniew Jędrzejewski-Szmek
2014-05-15sd-bus: always keep slot reference while dispatching callbackLennart Poettering
Also, make sure we automatically destroy reply callbacks that are floating.
2014-05-15Remove unnecessary casts in printfsZbigniew Jędrzejewski-Szmek
No functional change expected :)
2014-05-15sd-bus: introduce sd_bus_slot objects encapsulating callbacks or vtables ↵Lennart Poettering
attached to a bus connection This makes callback behaviour more like sd-event or sd-resolve, and creates proper object for unregistering callbacks. Taking the refernce to the slot is optional. If not taken life time of the slot will be bound to the underlying bus object (or in the case of an async call until the reply has been recieved).
2014-04-29sd-resolve: rework sd-resolve to be callback based, similar in style to ↵Lennart Poettering
sd-bus and sd-event
2014-03-24sd-bus: invert bus->is_kernel check in sd_bus_get_peer_creds()Daniel Mack
The bug was introducted in a3d59cd1 ("sd-bus: don't use assert_return() to check for disconnected bus connections")
2014-03-24sd-event: rework API to support CLOCK_REALTIME_ALARM and ↵Lennart Poettering
CLOCK_BOOTTIME_ALARM, too
2014-03-22sd-bus: mark sd_bus_unref() as broken regarding self-refsDavid Herrmann
If you allocate a message with bus==NULL and then unref the main bus, it will free your message underneath and your program will go boom! To fix that, we really need to figure out what the semantics for self-references (m->bus) should be and when/where/what accesses are actually allowed. Same is true for the pseudo-thread-safety we employ..
2014-03-22sd-bus: add note about sd_bus_unref() recursionDavid Herrmann
In sd_bus_unref() we check for self-reference loops and destruct our queues in case we're the only reference holders. However, we do _not_ modify our own ref-count, thus effectively causing the message-destructions to enter with the same reference count as we did. The only reason this doesn't cause an endless recursion (or trigger assert(m->n_ref > 0) in sd_bus_message_unref()) is the fact that we decrease queue-counters _before_ calling _unref(). That's not obvious at all, so add a big fat note in bus_reset_queues() to everyone touching that code.
2014-03-19sd-bus: don't use assert_return() to check for disconnected bus connectionsLennart Poettering
A terminated connection is a runtime error and not a developer mistake, hence don't use assert_return() to check for it.
2014-03-19sd-bus: properly translate high-level attach flags into kdbus attach flagsLennart Poettering
2014-03-19sd-bus: add proper monitoring APILennart Poettering
2014-03-18sd-bus: if we got a message with fds attached even though we didn't ↵Lennart Poettering
negotiate it, refuse to take it This makes sure we don't mishandle if developers specificy a different AcceptFileDescriptors= setting in .busname units then they set for the bus connection in the activated program.
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-13sd-bus: don't look for a 64bit value when we only have 32bit value on reply ↵Lennart Poettering
cookie hash table access This broke hashtable lookups for the message cookies on s390x, which is a 64bit BE machine where accessing 32bit values as 64bit and vice versa will explode. Also, while we are at it, be a bit more careful when dealing with the 64bit cookies we expose and the 32bit serial numbers dbus uses in its payload. Problem identified by Fridrich Strba.
2014-03-13bus: fix memory leak when kdbus is not enabledLennart Poettering
2014-03-11bus: replace sd_bus_label_{escape,unescape}() by new ↵Lennart Poettering
sd_bus_path_{encode,decode}() The new calls work similarly, but enforce a that a common, fixed bus path prefix is used. This follows discussions with Simon McVittie on IRC that it should be a good idea to make sure that people don't use the escaping applied here too wildly as anything other than the last label of a bus path.
2014-03-03bus: add sd_bus_track object for tracking peers, and port core over to itLennart Poettering
This is primarily useful for services that need to track clients which reference certain objects they maintain, or which explicitly want to subscribe to certain events. Something like this is done in a large number of services, and not trivial to do. Hence, let's unify this at one place. This also ports over PID 1 to use this to ensure that subscriptions to job and manager events are correctly tracked. As a side-effect this makes sure we properly serialize and restore the track list across daemon reexec/reload, which didn't work correctly before. This also simplifies how we distribute messages to broadcast to the direct busses: we only track subscriptions for the API bus and implicitly assume that all direct busses are subscribed. This should be a pretty OK simplification since clients connected via direct bus connections are shortlived anyway.
2014-02-26Revert back to /var/run at a couple of problemsLennart Poettering
This partially reverts 41a55c46ab8fb4ef6727434227071321fc762cce Some specifications we want to stay compatibility actually document /var/run, not /run, and we should stay compatible with that. In order to make sure our D-Bus implementation works on any system, regardless if running systemd or not, we should always use /var/run which is the only path mandated by the D-Bus spec. Similar, glibc hardcodes the utmp location to /var/run, and this is exposed in _UTMP_PATH in limits.h, hence let's stay in sync with this public API, too. We simply do not support systems where /var/run is not a symlink → /run. Hence both are equivalent. Staying compatible with upstream specifications hence weighs more than cleaning up superficial appearance.
2014-02-25Replace /var/run with /run in remaining placesZbigniew Jędrzejewski-Szmek
/run was already used almost everywhere, fix the remaining places for consistency.
2014-02-23src/shared/ cannot reference symbols from librariesKay Sievers
../src/shared/unit-name.c:462: error: undefined reference to 'sd_bus_label_escape' ../src/shared/unit-name.c:477: error: undefined reference to 'sd_bus_label_unescape' collect2: error: ld returned 1 exit status
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-20sd-bus: the bus returned should be the first argJason A. Donenfeld
This matches the API of previous headers, such as sd-journal.h.
2014-02-19bus: fix unreffing logicLennart Poettering
2014-02-05bus: properly unset default bus pointer when destroying last referenceLennart Poettering
2014-02-03bus: when closing the bus don't end up in a recursive destruction deadlockLennart Poettering
2014-01-27bus: add API calls for connecting to starter busLennart Poettering
Add new calls sd_bus_open() and sd_bus_default() for connecting to the starter bus a service was invoked for, or -- if the process is not a bus-activated service -- the appropriate bus for the scope the process has been started in.
2014-01-22bus: add sd_bus_process_priority() to support prioq mode of kdbusLennart Poettering
2014-01-22bus: add support for attaching name to bus connections for debugging purposesLennart Poettering
2014-01-22bus: simplify naming of feature negotation callsLennart Poettering
Two verbs in a function name suck, so let's simplify this a bit.
2014-01-21bus: implement synchronous message calls via kernel ioctlLennart Poettering
2014-01-21libsystemd: split up into subdirsTom Gundersen
We still only produce on .so, but let's keep the sources separate to make things a bit less messy.