libinotifytools
inotifytools.h
Go to the documentation of this file.
1 #ifndef _inotifytools_H
2 #define _inotifytools_H
3 
4 #ifdef __cplusplus
5 extern "C"
6 {
7 #endif
8 
9 #include <stdio.h>
10 
11 #define MAX_STRLEN 4096
12 
20 struct nstring {
21  char buf[MAX_STRLEN];
22  unsigned int len;
23 };
24 
25 int inotifytools_str_to_event(char const * event);
26 int inotifytools_str_to_event_sep(char const * event, char sep);
27 char * inotifytools_event_to_str(int events);
28 char * inotifytools_event_to_str_sep(int events, char sep);
29 void inotifytools_set_filename_by_wd( int wd, char const * filename );
30 void inotifytools_set_filename_by_filename( char const * oldname,
31  char const * newname );
32 void inotifytools_replace_filename( char const * oldname,
33  char const * newname );
34 struct inotify_event;
35 const char* inotifytools_dirname_from_event(struct inotify_event* event,
36  size_t* dirnamelen);
37 const char* inotifytools_filename_from_event(struct inotify_event* event,
38  char const** eventname,
39  size_t* dirnamelen);
40 char* inotifytools_dirpath_from_event(struct inotify_event* event);
41 struct watch;
42 const char* inotifytools_filename_from_watch(struct watch* w);
43 const char* inotifytools_filename_from_wd(int wd);
44 int inotifytools_wd_from_filename( char const * filename );
45 int inotifytools_remove_watch_by_filename( char const * filename );
47 int inotifytools_watch_file(char const* filename, int events);
48 int inotifytools_watch_files(char const* filenames[], int events);
49 int inotifytools_watch_recursively(char const* path, int events);
51  int events,
52  char const** exclude_list);
53 // [UH]
54 int inotifytools_ignore_events_by_regex( char const *pattern, int flags );
55 int inotifytools_ignore_events_by_inverted_regex( char const *pattern, int flags );
56 struct inotify_event * inotifytools_next_event( long int timeout );
57 struct inotify_event * inotifytools_next_events( long int timeout, int num_events );
58 int inotifytools_error();
59 int inotifytools_get_stat_by_wd( int wd, int event );
60 int inotifytools_get_stat_total( int event );
61 int inotifytools_get_stat_by_filename( char const * filename,
62  int event );
63 void inotifytools_initialize_stats();
64 int inotifytools_initialize();
65 int inotifytools_init(int fanotify, int watch_filesystem, int verbose);
68 
69 int inotifytools_printf(struct inotify_event* event, const char* fmt);
70 int inotifytools_fprintf(FILE* file,
71  struct inotify_event* event,
72  const char* fmt);
73 int inotifytools_sprintf(struct nstring* out,
74  struct inotify_event* event,
75  const char* fmt);
76 int inotifytools_snprintf(struct nstring* out,
77  int size,
78  struct inotify_event* event,
79  const char* fmt);
80 void inotifytools_set_printf_timefmt(const char* fmt);
81 void inotifytools_clear_timefmt();
82 
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif // _inotifytools_H
int inotifytools_init(int fanotify, int watch_filesystem, int verbose)
int inotifytools_ignore_events_by_regex(char const *pattern, int flags)
void inotifytools_set_printf_timefmt(const char *fmt)
const char * inotifytools_dirname_from_event(struct inotify_event *event, size_t *dirnamelen)
int inotifytools_get_max_queued_events()
int inotifytools_watch_recursively_with_exclude(char const *path, int events, char const **exclude_list)
int inotifytools_remove_watch_by_filename(char const *filename)
int inotifytools_error()
char * inotifytools_event_to_str_sep(int events, char sep)
int inotifytools_fprintf(FILE *file, struct inotify_event *event, const char *fmt)
int inotifytools_watch_recursively(char const *path, int events)
struct inotify_event * inotifytools_next_events(long int timeout, int num_events)
int inotifytools_wd_from_filename(char const *filename)
int inotifytools_ignore_events_by_inverted_regex(char const *pattern, int flags)
char * inotifytools_event_to_str(int events)
void inotifytools_set_filename_by_filename(char const *oldname, char const *newname)
int inotifytools_remove_watch_by_wd(int wd)
int inotifytools_str_to_event_sep(char const *event, char sep)
void inotifytools_cleanup()
int inotifytools_watch_files(char const *filenames[], int events)
int inotifytools_get_max_user_instances()
const char * inotifytools_filename_from_watch(struct watch *w)
int inotifytools_get_num_watches()
int inotifytools_str_to_event(char const *event)
void inotifytools_replace_filename(char const *oldname, char const *newname)
const char * inotifytools_filename_from_wd(int wd)
struct inotify_event * inotifytools_next_event(long int timeout)
int inotifytools_get_max_user_watches()
int inotifytools_snprintf(struct nstring *out, int size, struct inotify_event *event, const char *fmt)
int inotifytools_printf(struct inotify_event *event, const char *fmt)
int inotifytools_sprintf(struct nstring *out, struct inotify_event *event, const char *fmt)
char * inotifytools_dirpath_from_event(struct inotify_event *event)
void inotifytools_set_filename_by_wd(int wd, char const *filename)
int inotifytools_watch_file(char const *filename, int events)
const char * inotifytools_filename_from_event(struct inotify_event *event, char const **eventname, size_t *dirnamelen)
This structure holds string that can contain any character including NULL.
Definition: inotifytools.h:20
unsigned int len
Definition: inotifytools.h:22
char buf[MAX_STRLEN]
Definition: inotifytools.h:21