Commit graph

71 commits

Author SHA1 Message Date
Lennart Poettering 9db7635521 bus: if a a Set() vtable callback of a writable is left NULL, try to do the right thing automatically 2013-10-11 20:03:19 +02:00
Lennart Poettering 43a43f5016 bus: automatically do a NOP reply when a NULL callback is specified for a method in a vtable
Also, allow specifiying NULL as signature in vtables equivalent to ""
for empty parameter lists.
2013-10-11 20:03:19 +02:00
Lennart Poettering adcdb37476 bus: when NULL is specified as property callback, automatically handle serialization on Get() 2013-10-11 06:10:15 +02:00
Lennart Poettering 62b5c2aec1 bus: make PropertiesChanged emission work 2013-10-11 05:22:00 +02:00
Lennart Poettering 5a037827f6 bus: allow specifying NULL as type string when we want to construct messages with no payload 2013-10-11 05:20:24 +02:00
Lennart Poettering 5d12cc3e28 bus: make GetManagedObjects() work 2013-10-11 04:52:38 +02:00
Lennart Poettering 753eff037e bus: fix missing initialization 2013-10-09 04:08:00 +02:00
Lennart Poettering bb874efc38 bus: fix GetAll() userdata passing 2013-10-09 03:29:20 +02:00
Lennart Poettering 486e950bd9 bus: don't require that if a child object node exists its parent node must too 2013-10-09 03:29:20 +02:00
Lennart Poettering 29ddb38fea libsystemd-bus: add lightweight object vtable implementation for exposing objects on the bus
This adds a lightweight scheme how to define interfaces in static fixed
arrays which then can be easily registered on a bus connection. This
makes it much easier to write bus services.

This automatically handles implementation of the Properties,
ObjectManager, and Introspection bus interfaces.
2013-10-09 02:40:07 +02:00
Lennart Poettering 2e8d788c2f dbus: fix return value of dispatch_rqueue() 2013-10-02 19:45:12 +02:00
Lennart Poettering 8f155917bf bus: add benchmark tool to determine the right threshold for copying vs. memfd 2013-05-22 16:04:39 +02:00
Lennart Poettering c78196699d bus: calculate bloom filter for match
Yay! Filtering using kernel bloom filter matches works now! Yippieh!
2013-05-20 10:13:38 +02:00
Lennart Poettering 264ad849a4 bus: add APIs for negotiating what is attached to messages 2013-05-17 04:26:27 +02:00
Lennart Poettering 45fbe937d7 bus: add minimal locking around the memfd cache
We want to allow clients to process an sd_bus_message on a different
thread than it was received on. Since unreffing a bus message might
readd some of its memfds to the memfd cache add some minimal locking
around the cache.
2013-05-17 04:26:27 +02:00
Lennart Poettering d5a2b9a6f4 bus: return ECHILD as soon as people try to reuse a bus connection across a fork() 2013-05-17 04:26:27 +02:00
Lennart Poettering 63edf05ed9 bus: actually unmap kdbus pool after use 2013-05-17 04:26:27 +02:00
Lennart Poettering f54514f354 bus: keep kernel bus fd around during entire life-time of bus
We need this since we might need to invoke the release ioctl for
messages. Since we don't want to add any locking for that we simply keep
a reference to the bus and then rely that the fd stays valid all the
time.
2013-05-17 04:26:27 +02:00
Lennart Poettering e4ee6e5cc3 bus: make bus ref counting atomic
This is preparation to allow sd_bus_message obejcts to be processed in a
different thread from their originating sd_bus object.
2013-05-16 21:58:34 +02:00
Lennart Poettering eb01ba5de1 bus: synthesize timeout message errors instead of returning error codes 2013-05-16 21:14:56 +02:00
Lennart Poettering bc7fd8cdbe bus: properly handle message bodies that are a chain of memory areas rather than a single one 2013-05-14 22:28:45 +02:00
Zbigniew Jędrzejewski-Szmek ef42202ac8 Add set_consume which always takes ownership
Freeing in error path is the common pattern with set_put().
2013-04-24 00:25:04 -04:00
Lennart Poettering 6c03089c32 bus: handle env vars safely
Make sure that our library is safe for usage in SUID programs when it
comes to env var handling
2013-04-15 14:05:03 +02:00
Lennart Poettering 88fe224c8c bus: always explicitly rewind read index before passing message to caller or callback 2013-04-14 17:46:41 +02:00
Lennart Poettering f08838da22 bus: implement basic name registration with kdbus 2013-04-12 03:08:50 +02:00
Lennart Poettering e9a967f9a0 bus: make kdbus work so that we can exchange real messages
We have ignition, we have tremendous fire!
2013-04-12 01:19:32 +02:00
Lennart Poettering 6629161f82 bus: basic implementation of kdbus client side 2013-04-11 23:10:41 +02:00
Lennart Poettering 2100fa1099 bus: calculate iovec for messages only when we need it 2013-04-11 23:10:40 +02:00
Zbigniew Jędrzejewski-Szmek b92bea5d2a Use initalization instead of explicit zeroing
Before, we would initialize many fields twice: first
by filling the structure with zeros, and then a second
time with the real values. We can let the compiler do
the job for us, avoiding one copy.

A downside of this patch is that text gets slightly
bigger. This is because all zero() calls are effectively
inlined:

$ size build/.libs/systemd
         text    data     bss     dec     hex filename
before 897737  107300    2560 1007597   f5fed build/.libs/systemd
after  897873  107300    2560 1007733   f6075 build/.libs/systemd

… actually less than 1‰.

A few asserts that the parameter is not null had to be removed. I
don't think this changes much, because first, it is quite unlikely
for the assert to fail, and second, an immediate SEGV is almost as
good as an assert.
2013-04-05 19:50:57 -04:00
Lennart Poettering b7f247e0be bus: various improvements for test-bus-chat 2013-04-05 14:56:48 +02:00
Lennart Poettering f10dda3b82 bus: add convenience calls for method replies, too 2013-04-05 14:56:48 +02:00
Lennart Poettering eba8617efc bus: make sure callback structs are always properly initialized 2013-04-05 14:56:48 +02:00
Lennart Poettering c784c5ce77 bus: use C99 struct construction for error initializers
That way we can allocate an error struct on-the-fly while calling a
function. Nice!
2013-04-05 13:12:11 +02:00
Lennart Poettering 917b5dc707 bus: add convenience functions for constructing and sending method calls/signals in one call 2013-04-05 04:15:39 +02:00
Lennart Poettering 7286037fd4 bus: properly detect and handle if a callback is installed/removed from within a callback 2013-04-05 03:55:58 +02:00
Lennart Poettering 6807947e56 bus: don't allow recursive invocation of sd_bus_process() 2013-04-05 03:15:10 +02:00
Lennart Poettering adee69fa7a bus: always return something in sd_bus_get_timeout() 2013-04-01 03:29:30 +02:00
Lennart Poettering e82c950997 bus: allow two different fds for input/output in sd_bus_set_fd()
This is useful so that we can speak D-Bus over a FIFO pair such as
stdin+stdout.
2013-04-01 03:29:29 +02:00
Lennart Poettering 98178d3947 bus: rename sd_bus_get_peer() to sd_bus_get_server_id()
This function always returns the server side ID. The name suggested it
was actually always the peer's ID, but that's not correct if the call is
called on a server bus context. Hence, let's correct the name a bit.
2013-03-31 16:46:21 +02:00
Lennart Poettering 52f3ba915b bus: s/sd_message_handler_t/sd_bus_message_handler_t/g 2013-03-31 16:26:14 +02:00
Lennart Poettering 392d5b378c bus: parse matches locally and allow registration of callbacks for them
This includes code to parse and split up match strings which will also
be useful to calculate bloom filter masks when the time comes.
2013-03-31 16:16:37 +02:00
Lennart Poettering 2181a7f558 bus: implement server mode, and anonymous authentication 2013-03-30 15:21:55 +01:00
Lennart Poettering 3d339fec29 bus: properly set up bus connections with sd_bus_set_exec() 2013-03-30 15:21:55 +01:00
Lennart Poettering 9d37386224 bus: consider it an error if the first message we get on the bus is not a reply to HELLO 2013-03-30 15:21:54 +01:00
Zbigniew Jędrzejewski-Szmek 8333c77edf Always use errno > 0 to help gcc
gcc thinks that errno might be negative, and functions could return
something positive on error (-errno). Should not matter in practice,
but makes an -O4 build much quieter.
2013-03-29 10:12:41 -04:00
Lukas Nykryn 531991b64d sd-bus: check c->path for null instead of path 2013-03-27 12:01:44 -04:00
Lennart Poettering 5a0f6033be bus: fix missing variable initialization 2013-03-26 03:42:03 +01:00
Lennart Poettering 0a72c2bdef bus: automatically generate minimal introspection data to find installed objects 2013-03-26 02:19:34 +01:00
Lennart Poettering 94bbf1ba6d bus: rename send_hello flag to bus_cient
This way we can hide more than just the hello logic behind this flag,
for example, later on automatic match management.
2013-03-26 02:19:34 +01:00
Lennart Poettering a7e3212d89 bus: split socket related code into bus-socket.[ch], to prepare for kdbus backend 2013-03-25 03:43:19 +01:00