xenstore-watch.c 586 B

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