summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-kernel.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-04-12 03:08:14 +0200
committerLennart Poettering <lennart@poettering.net>2013-04-12 03:08:50 +0200
commitf08838da225678269945868a71bbdc79de967e1d (patch)
treeb9a94e4a59c8a2c9556d784f73c9ba030d3bf24c /src/libsystemd-bus/bus-kernel.c
parent8c11aac1d739f5e60822f65f5179d8c4cc212732 (diff)
bus: implement basic name registration with kdbus
Diffstat (limited to 'src/libsystemd-bus/bus-kernel.c')
-rw-r--r--src/libsystemd-bus/bus-kernel.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index add0bc11d0..9d0be7a190 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -158,6 +158,9 @@ int bus_kernel_take_fd(sd_bus *b) {
assert(b);
+ if (b->is_server)
+ return -EINVAL;
+
r = ioctl(b->input_fd, KDBUS_CMD_HELLO, &hello);
if (r < 0)
return -errno;
@@ -166,6 +169,7 @@ int bus_kernel_take_fd(sd_bus *b) {
return -ENOMEM;
b->is_kernel = true;
+ b->bus_client = true;
r = bus_start_running(b);
if (r < 0)
@@ -180,6 +184,9 @@ int bus_kernel_connect(sd_bus *b) {
assert(b->output_fd < 0);
assert(b->kernel);
+ if (b->is_server)
+ return -EINVAL;
+
b->input_fd = open(b->kernel, O_RDWR|O_NOCTTY|O_CLOEXEC);
if (b->input_fd < 0)
return -errno;
@@ -339,7 +346,7 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k, sd_bus_mess
int bus_kernel_read_message(sd_bus *bus, sd_bus_message **m) {
struct kdbus_msg *k;
- size_t sz = 128;
+ size_t sz = 1024;
int r;
assert(bus);