Commit graph

59 commits

Author SHA1 Message Date
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
Lennart Poettering 2fd9ae2e9b bus: implement 'unixexec:' protocol 2013-03-25 02:33:35 +01:00
Lennart Poettering 021a1e78d7 bus: make optional whether unix socket passing is negotiated and whether hello is sent
This alos gets rid of explicit sd_open_fd() and sd_open_address()
constructors in favour of sd_new() + sd_new_start() where the
negotiation parameters may be set it in between.
2013-03-25 02:33:35 +01:00
Lennart Poettering 66f931b4c8 bus: properly handle termination of connections 2013-03-25 02:33:35 +01:00
Lennart Poettering 2c93b4efec bus: implement support for FD passing 2013-03-25 02:33:34 +01:00
Zbigniew Jędrzejewski-Szmek 9e1fe7c3db bus: don't free an unallocated var
Also remove unused variable.
2013-03-22 23:08:17 -04:00
Lennart Poettering a652755d2e bus: implement object handler registry 2013-03-22 15:46:49 +01:00
Lennart Poettering 2571ead1a6 bus: implicitly collect ucred/label information 2013-03-22 03:37:10 +01:00
Lennart Poettering 20902f3ec8 bus: also finish connection before returning from sd_bus_get_unique_name() 2013-03-22 03:37:10 +01:00
Lennart Poettering 2bf938c191 bus: fix uninitialized variable 2013-03-22 02:20:39 +01:00
Lennart Poettering dafb75912a bus: validate the hello response properly 2013-03-22 02:20:21 +01:00
Lennart Poettering d728d708c3 bus: rework synchronization logic
Instead of allowing certain actions fail during authentication and
connection setup, implicitly synchronize on the connection to be set up
completely before returning.
2013-03-22 01:49:56 +01:00
Lennart Poettering b9bf7e2be9 bus: implicitly handle peer commands Ping() and GetMachineId() 2013-03-22 00:12:37 +01:00