xenstore-watch.c 514 B

12345678910111213141516171819202122232425262728
  1. #include <sys/types.h>
  2. #include <xs.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. main(int argc, char **argv)
  6. {
  7. struct xs_handle *xs;
  8. unsigned int count;
  9. char **vec;
  10. char dummy;
  11. if (argc != 2) {
  12. fprintf(stderr, "usage: %s xenstore_path\n", argv[0]);
  13. exit(1);
  14. }
  15. xs = xs_daemon_open();
  16. if (!xs) {
  17. perror("xs_daemon_open");
  18. exit(1);
  19. }
  20. if (!xs_watch(xs, argv[1], &dummy)) {
  21. perror("xs_watch");
  22. exit(1);
  23. }
  24. vec = xs_read_watch(xs, &count);
  25. free(vec);
  26. vec = xs_read_watch(xs, &count);
  27. free(vec);
  28. }