#ifndef SH_INOTIFY_H #define SH_INOTIFY_H #define SH_INOTIFY_MAX 128 typedef struct { void * list_of_watches; void * dormant_watches; /* int watch[SH_INOTIFY_MAX]; int flag[SH_INOTIFY_MAX]; char * file[SH_INOTIFY_MAX]; */ int count; int max_count; } sh_watches; /* #define SH_INOTIFY_INITIALIZER { { 0 }, { 0 }, { NULL}, 0, 0 } */ #define SH_INOTIFY_INITIALIZER { NULL, NULL, 0, 0 } int sh_inotify_wait_for_change(char * filename, sh_watches * watches, int * errnum, int waitsec); int sh_inotify_rm_watch (sh_watches * watches, sh_watches * save, int wd); int sh_inotify_add_watch(char * filename, sh_watches * watches, int * errnum, int class, unsigned long check_mask); int sh_inotify_add_watch_later(char * filename, sh_watches * watches, int * errnum, int class, unsigned long check_mask); char * sh_inotify_pop_dormant(sh_watches * watches, int * class, unsigned long * check_mask); void sh_inotify_purge_dormant(sh_watches * watches); void sh_inotify_remove(sh_watches * watches); void sh_inotify_init(sh_watches * watches); char * sh_inotify_search_item(sh_watches * watches, int watch, int * class, unsigned long * check_mask); ssize_t sh_inotify_read(char * buffer, size_t count); int sh_inotify_recheck_watches (sh_watches * watches, sh_watches * save); #define SH_INOTIFY_ERROR(a) (a != 0) #endif