xenstore-watch.c 529 B

1234567891011121314151617181920212223242526272829
  1. #include <sys/types.h>
  2. #include <xs.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. int 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_domain_open();
  16. if (!xs) {
  17. perror("xs_domain_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. return 0;
  29. }