core-agent-linux/misc/xenstore-watch.c

34 lines
586 B
C
Raw Normal View History

2011-03-09 17:27:35 +01:00
#include <sys/types.h>
#ifdef USE_XENSTORE_H
#include <xenstore.h>
#else
2011-03-09 17:27:35 +01:00
#include <xs.h>
#endif
2011-03-09 17:27:35 +01:00
#include <stdio.h>
#include <stdlib.h>
2014-02-07 02:10:13 +01:00
int main(int argc, char **argv)
2011-03-09 17:27:35 +01:00
{
struct xs_handle *xs;
unsigned int count;
char **vec;
char dummy;
if (argc != 2) {
fprintf(stderr, "usage: %s xenstore_path\n", argv[0]);
exit(1);
}
xs = xs_domain_open();
if (!xs) {
perror("xs_domain_open");
exit(1);
}
if (!xs_watch(xs, argv[1], &dummy)) {
perror("xs_watch");
exit(1);
}
vec = xs_read_watch(xs, &count);
free(vec);
vec = xs_read_watch(xs, &count);
free(vec);
2014-02-07 02:10:13 +01:00
return 0;
2011-03-09 17:27:35 +01:00
}