| [261] | 1 | #ifndef SH_INOTIFY_H
 | 
|---|
 | 2 | #define SH_INOTIFY_H
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 | #define SH_INOTIFY_MAX 128
 | 
|---|
 | 5 | 
 | 
|---|
 | 6 | typedef struct 
 | 
|---|
 | 7 | {
 | 
|---|
| [363] | 8 |   void * list_of_watches;
 | 
|---|
| [364] | 9 |   void * dormant_watches;
 | 
|---|
| [363] | 10 | 
 | 
|---|
| [364] | 11 |   /*
 | 
|---|
| [261] | 12 |   int    watch[SH_INOTIFY_MAX];
 | 
|---|
 | 13 |   int    flag[SH_INOTIFY_MAX];
 | 
|---|
 | 14 |   char * file[SH_INOTIFY_MAX];
 | 
|---|
| [364] | 15 |   */
 | 
|---|
| [261] | 16 | 
 | 
|---|
| [363] | 17 |   int     count;
 | 
|---|
 | 18 |   int  max_count;
 | 
|---|
| [261] | 19 | } sh_watches;
 | 
|---|
 | 20 | 
 | 
|---|
| [367] | 21 | /* #define SH_INOTIFY_INITIALIZER { { 0 }, { 0 }, { NULL}, 0, 0 } */
 | 
|---|
| [363] | 22 | 
 | 
|---|
| [367] | 23 | #define SH_INOTIFY_INITIALIZER { NULL, NULL, 0, 0 }
 | 
|---|
 | 24 | 
 | 
|---|
| [372] | 25 | #define SH_INOTIFY_FILE 0
 | 
|---|
 | 26 | #define SH_INOTIFY_DIR  1
 | 
|---|
 | 27 | 
 | 
|---|
| [261] | 28 | int sh_inotify_wait_for_change(char * filename, sh_watches * watches, 
 | 
|---|
 | 29 |                                int  * errnum,   int waitsec);
 | 
|---|
 | 30 | 
 | 
|---|
| [367] | 31 | int sh_inotify_rm_watch (sh_watches * watches, sh_watches * save, int wd);
 | 
|---|
| [261] | 32 | 
 | 
|---|
| [367] | 33 | int sh_inotify_add_watch(char * filename, sh_watches * watches, int  * errnum,
 | 
|---|
| [481] | 34 |                          int class, unsigned long check_flags, int type, int rdepth);
 | 
|---|
| [367] | 35 | 
 | 
|---|
| [373] | 36 | int sh_inotify_add_watch_later(const char * filename, sh_watches * watches, 
 | 
|---|
 | 37 |                                int  * errnum,
 | 
|---|
| [481] | 38 |                                int class, unsigned long check_flags, 
 | 
|---|
| [373] | 39 |                                int type, int rdepth);
 | 
|---|
| [367] | 40 | 
 | 
|---|
| [373] | 41 | char * sh_inotify_pop_dormant(sh_watches * watches, int * class, 
 | 
|---|
| [481] | 42 |                               unsigned long * check_flags, int * type, int * rdepth);
 | 
|---|
| [367] | 43 | 
 | 
|---|
 | 44 | void sh_inotify_purge_dormant(sh_watches * watches);
 | 
|---|
| [261] | 45 | void sh_inotify_remove(sh_watches * watches);
 | 
|---|
| [367] | 46 | void sh_inotify_init(sh_watches * watches);
 | 
|---|
| [496] | 47 | void sh_inotify_close();
 | 
|---|
| [261] | 48 | 
 | 
|---|
| [367] | 49 | char * sh_inotify_search_item(sh_watches * watches, int watch, 
 | 
|---|
| [481] | 50 |                               int * class, unsigned long * check_flags, 
 | 
|---|
| [373] | 51 |                               int * type, int * rdepth);
 | 
|---|
| [367] | 52 | ssize_t sh_inotify_read(char * buffer, size_t count);
 | 
|---|
| [371] | 53 | ssize_t sh_inotify_read_timeout(char * buffer, size_t count, int timeout);
 | 
|---|
| [367] | 54 | int sh_inotify_recheck_watches (sh_watches * watches, sh_watches * save);
 | 
|---|
 | 55 | 
 | 
|---|
| [261] | 56 | #define SH_INOTIFY_ERROR(a) (a != 0)
 | 
|---|
 | 57 | 
 | 
|---|
 | 58 | #endif
 | 
|---|