Obsolete
/
libipc-old
Archived
3
0
Fork 0
This repository has been archived on 2024-06-18. You can view files and clone it, but cannot push or open issues/pull-requests.
libipc-old/examples/test-ask-for-fd-to-networkd.c

33 lines
546 B
C
Raw Normal View History

2019-07-27 15:48:10 +02:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../src/ipc.h"
int main (int argc, char *argv[])
2019-07-27 15:48:10 +02:00
{
if (argc != 2) {
fprintf (stderr, "usage: %s service_name\n", argv[0]);
exit (1);
}
2020-07-06 14:38:06 +02:00
SECURE_DECLARATION (struct ipc_error, ret);
int fd = 0;
2019-07-27 15:48:10 +02:00
char *service_name = argv[1];
2020-07-06 14:38:06 +02:00
ret = ipc_contact_ipcd (&fd, service_name);
2019-07-27 15:48:10 +02:00
printf ("ret = %d\n", ret.error_code);
2019-07-27 15:48:10 +02:00
2020-07-06 14:38:06 +02:00
if (ret.error_code == IPC_ERROR_NONE && fd > 0) {
2019-07-27 15:48:10 +02:00
printf ("Success\n");
} else {
2019-07-27 15:48:10 +02:00
printf ("Ow. :(\n");
}
2020-07-08 01:15:18 +02:00
usock_close (fd);
2019-07-27 15:48:10 +02:00
return EXIT_SUCCESS;
2019-07-27 15:48:10 +02:00
}