14 #include "kdbus-test.h"
15 #include "kdbus-util.h"
16 #include "kdbus-enum.h"
18 int kdbus_test_daemon(struct kdbus_test_env *env)
24 /* This test doesn't make any sense in non-interactive mode */
25 if (!kdbus_util_verbose)
28 printf("Created connection %llu on bus '%s'\n",
29 (unsigned long long) env->conn->id, env->buspath);
31 ret = kdbus_name_acquire(env->conn, "com.example.kdbus-test", NULL);
32 ASSERT_RETURN(ret == 0);
33 printf(" Aquired name: com.example.kdbus-test\n");
35 fds[0].fd = env->conn->fd;
36 fds[1].fd = STDIN_FILENO;
38 printf("Monitoring connections:\n");
40 for (count = 0;; count++) {
41 int i, nfds = sizeof(fds) / sizeof(fds[0]);
43 for (i = 0; i < nfds; i++) {
44 fds[i].events = POLLIN | POLLPRI | POLLHUP;
48 ret = poll(fds, nfds, -1);
52 if (fds[0].revents & POLLIN) {
53 ret = kdbus_msg_recv(env->conn, NULL, NULL);
54 ASSERT_RETURN(ret == 0);
58 if (fds[1].revents & POLLIN)
62 printf("Closing bus connection\n");