inotify.c 532 B

1234567891011121314151617181920212223242526
  1. #include <sys/inotify.h>
  2. #include <errno.h>
  3. #include "syscall.h"
  4. int inotify_init()
  5. {
  6. return inotify_init1(0);
  7. }
  8. int inotify_init1(int flags)
  9. {
  10. int r = __syscall(SYS_inotify_init1, flags);
  11. #ifdef SYS_inotify_init
  12. if (r==-ENOSYS && !flags) r = __syscall(SYS_inotify_init);
  13. #endif
  14. return __syscall_ret(r);
  15. }
  16. int inotify_add_watch(int fd, const char *pathname, uint32_t mask)
  17. {
  18. return syscall(SYS_inotify_add_watch, fd, pathname, mask);
  19. }
  20. int inotify_rm_watch(int fd, int wd)
  21. {
  22. return syscall(SYS_inotify_rm_watch, fd, wd);
  23. }