Commit graph

80 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek d9f644e2cd bus: export libsystemd-bus as a public library
Old static libsystemd-bus.la becomes libsystemd-bus-internal.la.
memfd functions are also exported in the same library.

(Best viewed with --color-words -U0).
2013-11-06 14:56:47 -05:00
Lennart Poettering cd6f997f71 bus: handle serialization of NULL strings
Instead of simply crashing be somewhat nicer and serialize a NULL string
into the empty string and generate an error on signature and object path
strings.
2013-11-06 02:31:35 +01:00
Lennart Poettering 7b05894275 bus: add new bus API call sd_bus_message_at_end()
This may be used to determine whether we are at the end of a container
ot the entire message.
2013-11-05 19:36:05 +01:00
Lennart Poettering 9d6c7c821c bus: make use of assert_return() in all API calls that don't use it yet 2013-11-05 19:14:58 +01:00
Marc-Antoine Perennou 4686d1b6ee bus: add sd_bus_message_read_strv()
It will be useful to have that in the public API.
2013-11-05 18:12:18 +01:00
Lennart Poettering 275b39fe4b bus: support entering containers without specifying the type
On request om Tom Gundersen...
2013-11-05 03:07:39 +01:00
Lennart Poettering 9b07511d65 bus: add sd_bus_message_skip() to skip over multiple fields 2013-11-05 02:26:48 +01:00
Lennart Poettering 0dcd14b940 bus: allow that if the destination pointer in sd_bus_message_read_basic() is NULL we skip over a field 2013-11-05 02:26:48 +01:00
Lennart Poettering 3fc047f43c bus: make bus message dump output a bit smaller 2013-10-30 02:08:57 +01:00
Lennart Poettering 80ba3b84dd bus: add extra validity checks 2013-10-29 19:55:37 +01:00
Lennart Poettering c430fee6ff bus: add new sd_bus_message_verify_type() and sd_bus_message_copy() API calls 2013-10-29 19:34:59 +01:00
Lennart Poettering 430fb8fab2 bus: only if the user tries to read over the end of an array we should handle this as EOF 2013-10-22 12:41:54 +01:00
Kay Sievers 9bcbce4201 bus: avoid 'bool' storage when retrieving 'b' from the message
Just use an unsigned int as a bool type to avoid issues in the public
message reading API; sizeof(bool) == 1, but the code copies 4 bytes at
the pointers destination.
2013-10-22 03:35:45 +02:00
Lennart Poettering 1daf812152 bus: if we hit the end of an array container return 0 as EOF indicator when reading it 2013-10-18 14:07:44 +02:00
Lennart Poettering 40ca29a137 timedated: use libsystemd-bus instead of libdbus for bus communication
Among other things this also adds a few things necessary for the change:

- Considerably more powerful error returning APIs in libsystemd-bus

- Adapter for connecting an sd_bus to an sd_event

- As I reworked the PolicyKit logic to the new library I also made it
  asynchronous, so that PolicyKit requests of one user cannot block out
  another user anymore.

- We always use the macro names for common bus error. That way it is
  harder to mistype them since the compiler will notice
2013-10-16 06:15:02 +02:00
Zbigniew Jędrzejewski-Szmek 23c6f770cc bus: make sure we don't try to malloc 0 bytes 2013-10-13 17:56:55 -04:00
Zbigniew Jędrzejewski-Szmek a3e7f417d7 bus: fix access to unitialized variable in error path
src/machine/machined-dbus.c:237:13: warning: Branch condition evaluates to a garbage value
        if (m)
            ^
2013-10-13 17:56:54 -04:00
Lennart Poettering 55736ed0c7 bus: add sd_bus_message_append_strv() to easily add a NULL terminated string array to a message 2013-10-11 23:02:47 +02:00
Lennart Poettering 3a7d4f1ba4 bus: fix synthetic error messages 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
Kay Sievers bf30e48fe5 bus: unmap memfd retrieved from the memfd cache 2013-06-04 23:37:57 +02:00
Kay Sievers 311754514c bus-benchmark: add performance data output mode
- for now, comment out munmap() check to enable memfd passing
  - print tab-separated values and header
  - add memcpy() to fill the memfd, to produce real-world results

$ ./test-bus-kernel-benchmark
SIZE    COPY    MEMFD
4194304 370     370
2097152 810     810
1048576 2130    2130
524288  4090    4090
262144  7080    7080
131072  11380   11380
65536   17140   17140
98304   13930   13930
114688  12890   12890
122880  12350   12350
126976  12150   12150
129024  12170   12170
130048  12040   12040
130560  12080   12080
130816  12010   12010
130944  12020   12020
131008  12040   12040
131040  12050   12050
131056  12010   12010
131064  12060   12060
131068  12040   12040
131070  11310   11310
131069  11420   11420
Copying/memfd are equally fast at 131068 bytes

$ ./test-bus-kernel-benchmark chart
SIZE    COPY    MEMFD
1       35570   23690
2       36470   23680
4       36160   23520
8       36600   22220
16      33900   20830
32      33990   21360
64      33480   21280
128     34050   20910
256     32950   21750
512     34730   21900
1024    33810   22890
2048    36280   23110
4096    30790   21610
8192    29380   21100
16384   26880   19820
32768   22510   17980
65536   17270   15180
131072  11400   11420
262144  7140    8270
524288  4090    5050
1048576 2110    2780
2097152 800     1140
4194304 350     580
2013-06-04 21:00:30 +02:00
Kay Sievers 62b3e928de bus: update for kdbus changes 2013-05-30 05:35:42 +02:00
Lennart Poettering 89b4fc4656 bus: properly unmap mapped area 2013-05-29 17:05:01 +09: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 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 eb01ba5de1 bus: synthesize timeout message errors instead of returning error codes 2013-05-16 21:14:56 +02:00
Lennart Poettering 5cbe749238 bus: implement sd_bus_message_append_string_memfd() 2013-05-16 16:53:03 +02:00
Lennart Poettering 66b26c5c9b bus: send memfds as payload only on directed messages and for large parts 2013-05-16 16:26:35 +02:00
Lennart Poettering 1307c3ff9a bus: implement receiving side of memfd hookup 2013-05-16 02:37:42 +02:00
Lennart Poettering a392d36195 bus: put together messages with memfd payload correctly 2013-05-16 02:04:13 +02:00
Lennart Poettering 453a0c2946 bus: add support for adding memfds into message payload 2013-05-15 19:45:45 +02:00
Lennart Poettering c91cb83c4d bus: rework message struct to keep header with fields in same malloc() block
This allows us to guarantee that the first payload_vec we pass to the
kernel for each message is guaranteed to include the full header and all
its field.
2013-05-15 02:56:45 +02:00
Lennart Poettering 9b29bb6853 bus: add macro for iterating through body parts of a message 2013-05-15 01:43:15 +02:00
Lennart Poettering 13c299d3a8 bus: minor fixes 2013-05-15 01:36:09 +02:00
Lennart Poettering 47e6ce32bb bus: seal off memfds when sealing messages 2013-05-15 00:46:24 +02:00
Lennart Poettering 9b05bc4866 bus: fix allocation of body parts from memfd 2013-05-14 22:52:58 +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
Lennart Poettering fd8d62d940 bus: catch up with latest kdbus 2013-05-10 03:38:11 +02:00
Lennart Poettering f8e013f8bf bus: add sd_bus_message_append_string_space() for zero-copy string appending 2013-05-10 03:38:11 +02:00
Lennart Poettering b3af9646f8 bus: add API for appending/reading fixed arrays 2013-05-09 20:01:21 +02:00
Lennart Poettering 102ea8e4f2 bus: parse capability kdbus meta data of messages 2013-04-23 00:14:30 -03:00
Lennart Poettering 120f919e70 bus: parse audit metadata from kdbus messages 2013-04-22 23:38:38 -03:00
Lennart Poettering bc7f3beb30 bus: parse owner uid from cgroup path, too 2013-04-22 23:27:38 -03:00
Lennart Poettering d8d3d8a781 bus: parse unit/user unit/session from cgroup path 2013-04-16 04:54:46 +02:00
Lennart Poettering 4a875b6133 kdbus: parse cgroup meta data, too 2013-04-15 01:51:37 +02:00
Lennart Poettering 42c5aaf3ba bus: fix counting of argN= matches 2013-04-14 17:45:26 +02:00
Lennart Poettering 77930f1120 kdbus: also parse cmdline message attribute 2013-04-14 03:20:23 +02:00
Lennart Poettering 69aec65cf8 kdbus: parse even more kernel meta data fields 2013-04-13 21:53:11 +02:00
Lennart Poettering acb5a3cb20 bus: parse and expose kdbus message timestamps 2013-04-12 01:57:53 +02:00