libinotifytools
inotifytools.h
Go to the documentation of this file.
1 #ifndef _inotifytools_H
2 #define _inotifytools_H
3 
4 #ifdef __FreeBSD__
5 #define stat64 stat
6 #define lstat64 lstat
7 #endif
8 
9 #ifdef __cplusplus
10 extern "C"
11 {
12 #endif
13 
14 #include <stdio.h>
15 
16 #define MAX_STRLEN 4096
17 
25 struct nstring {
26  char buf[MAX_STRLEN];
27  unsigned int len;
28 };
29 
30 int inotifytools_str_to_event(char const * event);
31 int inotifytools_str_to_event_sep(char const * event, char sep);
32 char * inotifytools_event_to_str(int events);
33 char * inotifytools_event_to_str_sep(int events, char sep);
34 void inotifytools_set_filename_by_wd( int wd, char const * filename );
35 void inotifytools_set_filename_by_filename( char const * oldname,
36  char const * newname );
37 void inotifytools_replace_filename( char const * oldname,
38  char const * newname );
39 struct inotify_event;
40 const char* inotifytools_dirname_from_event(struct inotify_event* event,
41  size_t* dirnamelen);
42 char* inotifytools_dirpath_from_event(struct inotify_event* event);
43 struct watch;
44 const char* inotifytools_filename_from_watch(struct watch* w);
45 const char* inotifytools_filename_from_wd(int wd);
46 int inotifytools_wd_from_filename( char const * filename );
47 int inotifytools_remove_watch_by_filename( char const * filename );
49 int inotifytools_watch_file(char const* filename, int events);
50 int inotifytools_watch_files(char const* filenames[], int events);
51 int inotifytools_watch_recursively(char const* path, int events);
53  int events,
54  char const** exclude_list);
55 // [UH]
56 int inotifytools_ignore_events_by_regex( char const *pattern, int flags );
57 int inotifytools_ignore_events_by_inverted_regex( char const *pattern, int flags );
58 struct inotify_event * inotifytools_next_event( long int timeout );
59 struct inotify_event * inotifytools_next_events( long int timeout, int num_events );
60 int inotifytools_error();
61 int inotifytools_get_stat_by_wd( int wd, int event );
62 int inotifytools_get_stat_total( int event );
63 int inotifytools_get_stat_by_filename( char const * filename,
64  int event );
65 void inotifytools_initialize_stats();
66 int inotifytools_initialize();
67 int inotifytools_init(int fanotify, int watch_filesystem, int verbose);
70 
71 int inotifytools_printf( struct inotify_event* event, char* fmt );
72 int inotifytools_fprintf( FILE* file, struct inotify_event* event, char* fmt );
73 int inotifytools_sprintf( struct nstring * out, struct inotify_event* event, char* fmt );
74 int inotifytools_snprintf( struct nstring * out, int size, struct inotify_event* event,
75  char* fmt );
76 void inotifytools_set_printf_timefmt( char * fmt );
77 
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif // _inotifytools_H
int inotifytools_init(int fanotify, int watch_filesystem, int verbose)
Definition: inotifytools.c:299
int inotifytools_ignore_events_by_regex(char const *pattern, int flags)
const char * inotifytools_dirname_from_event(struct inotify_event *event, size_t *dirnamelen)
Definition: inotifytools.c:893
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)
Definition: inotifytools.c:653
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)
Definition: inotifytools.c:950
int inotifytools_fprintf(FILE *file, struct inotify_event *event, char *fmt)
int inotifytools_ignore_events_by_inverted_regex(char const *pattern, int flags)
char * inotifytools_event_to_str(int events)
Definition: inotifytools.c:625
void inotifytools_set_filename_by_filename(char const *oldname, char const *newname)
Definition: inotifytools.c:995
int inotifytools_remove_watch_by_wd(int wd)
int inotifytools_str_to_event_sep(char const *event, char sep)
Definition: inotifytools.c:463
void inotifytools_cleanup()
Definition: inotifytools.c:365
int inotifytools_watch_files(char const *filenames[], int events)
int inotifytools_snprintf(struct nstring *out, int size, struct inotify_event *event, char *fmt)
int inotifytools_get_max_user_instances()
const char * inotifytools_filename_from_watch(struct watch *w)
Definition: inotifytools.c:845
int inotifytools_get_num_watches()
int inotifytools_printf(struct inotify_event *event, char *fmt)
int inotifytools_str_to_event(char const *event)
Definition: inotifytools.c:538
void inotifytools_replace_filename(char const *oldname, char const *newname)
const char * inotifytools_filename_from_wd(int wd)
Definition: inotifytools.c:874
struct inotify_event * inotifytools_next_event(long int timeout)
int inotifytools_get_max_user_watches()
void inotifytools_set_printf_timefmt(char *fmt)
char * inotifytools_dirpath_from_event(struct inotify_event *event)
Definition: inotifytools.c:919
int inotifytools_sprintf(struct nstring *out, struct inotify_event *event, char *fmt)
void inotifytools_set_filename_by_wd(int wd, char const *filename)
Definition: inotifytools.c:973
int inotifytools_watch_file(char const *filename, int events)
This structure holds string that can contain any character including NULL.
Definition: inotifytools.h:25
unsigned int len
Definition: inotifytools.h:27
char buf[MAX_STRLEN]
Definition: inotifytools.h:26