summaryrefslogtreecommitdiff
path: root/src/test/test-daemon.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-10-06 12:06:56 +0200
committerTom Gundersen <teg@jklm.no>2015-10-06 12:06:56 +0200
commite1719ef19d542c88e319e77aaf970dc36c2269f4 (patch)
tree674f2f4b65756cb993709a8c75b82c082fb68a36 /src/test/test-daemon.c
parentf0990739fc24e60facb7ef0c3e97a046bd1d9d17 (diff)
parentdf9d6993b677c05c7f502acafc5c8efa642792fe (diff)
Merge pull request #1468 from poettering/fdnames
Add support for naming fds for socket activation and more
Diffstat (limited to 'src/test/test-daemon.c')
-rw-r--r--src/test/test-daemon.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/test/test-daemon.c b/src/test/test-daemon.c
index 7e0ac754d1..45fb554445 100644
--- a/src/test/test-daemon.c
+++ b/src/test/test-daemon.c
@@ -21,9 +21,22 @@
#include <unistd.h>
-#include "systemd/sd-daemon.h"
+#include "sd-daemon.h"
+
+#include "strv.h"
int main(int argc, char*argv[]) {
+ _cleanup_strv_free_ char **l = NULL;
+ int n, i;
+
+ n = sd_listen_fds_with_names(false, &l);
+ if (n < 0) {
+ log_error_errno(n, "Failed to get listening fds: %m");
+ return EXIT_FAILURE;
+ }
+
+ for (i = 0; i < n; i++)
+ log_info("fd=%i name=%s\n", SD_LISTEN_FDS_START + i, l[i]);
sd_notify(0,
"STATUS=Starting up");
@@ -49,5 +62,5 @@ int main(int argc, char*argv[]) {
"STOPPING=1");
sleep(5);
- return 0;
+ return EXIT_SUCCESS;
}