summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/test-bus-kernel.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-01-22 16:09:59 +0100
committerLennart Poettering <lennart@poettering.net>2014-01-22 16:09:59 +0100
commit5972fe953ec56c77936a1e612ca87d8a0e6c0c64 (patch)
tree515ee99fed073c4184a84eb5ee7cdb55bdf43900 /src/libsystemd/sd-bus/test-bus-kernel.c
parent7f96b1d8147b164bc7c8ce119aeea5fed6ceecb7 (diff)
bus: add support for attaching name to bus connections for debugging purposes
Diffstat (limited to 'src/libsystemd/sd-bus/test-bus-kernel.c')
-rw-r--r--src/libsystemd/sd-bus/test-bus-kernel.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/test-bus-kernel.c b/src/libsystemd/sd-bus/test-bus-kernel.c
index 3dcc5d351d..0fab88021d 100644
--- a/src/libsystemd/sd-bus/test-bus-kernel.c
+++ b/src/libsystemd/sd-bus/test-bus-kernel.c
@@ -39,6 +39,7 @@ int main(int argc, char *argv[]) {
const char *ua = NULL, *ub = NULL, *the_string = NULL;
sd_bus *a, *b;
int r, pipe_fds[2];
+ const char *nn;
log_set_max_level(LOG_DEBUG);
@@ -59,6 +60,9 @@ int main(int argc, char *argv[]) {
r = sd_bus_new(&b);
assert_se(r >= 0);
+ r = sd_bus_set_name(a, "a");
+ assert_se(r >= 0);
+
r = sd_bus_set_address(a, address);
assert_se(r >= 0);
@@ -79,14 +83,20 @@ int main(int argc, char *argv[]) {
r = sd_bus_get_unique_name(a, &ua);
assert_se(r >= 0);
-
printf("unique a: %s\n", ua);
- r = sd_bus_get_unique_name(b, &ub);
+ r = sd_bus_get_name(a, &nn);
assert_se(r >= 0);
+ printf("name of a: %s\n", nn);
+ r = sd_bus_get_unique_name(b, &ub);
+ assert_se(r >= 0);
printf("unique b: %s\n", ub);
+ r = sd_bus_get_name(b, &nn);
+ assert_se(r >= 0);
+ printf("name of b: %s\n", nn);
+
r = sd_bus_call_method(a, "this.doesnt.exist", "/foo", "meh.mah", "muh", &error, NULL, "s", "yayayay");
assert_se(sd_bus_error_has_name(&error, SD_BUS_ERROR_SERVICE_UNKNOWN));
assert_se(r == -EHOSTUNREACH);