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 char * inotifytools_filename_from_wd( int wd );
40 int inotifytools_wd_from_filename( char const * filename );
41 int inotifytools_remove_watch_by_filename( char const * filename );
43 int inotifytools_watch_file( char const * filename, int events );
44 int inotifytools_watch_files( char const * filenames[], int events );
45 int inotifytools_watch_recursively( char const * path, int events );
46 int inotifytools_watch_recursively_with_exclude( char const * path,
47  int events,
48  char const ** exclude_list );
49  // [UH]
50 int inotifytools_ignore_events_by_regex( char const *pattern, int flags );
51 int inotifytools_ignore_events_by_inverted_regex( char const *pattern, int flags );
52 struct inotify_event * inotifytools_next_event( long int timeout );
53 struct inotify_event * inotifytools_next_events( long int timeout, int num_events );
54 int inotifytools_error();
55 int inotifytools_get_stat_by_wd( int wd, int event );
56 int inotifytools_get_stat_total( int event );
57 int inotifytools_get_stat_by_filename( char const * filename,
58  int event );
63 
64 int inotifytools_printf( struct inotify_event* event, char* fmt );
65 int inotifytools_fprintf( FILE* file, struct inotify_event* event, char* fmt );
66 int inotifytools_sprintf( struct nstring * out, struct inotify_event* event, char* fmt );
67 int inotifytools_snprintf( struct nstring * out, int size, struct inotify_event* event,
68  char* fmt );
69 void inotifytools_set_printf_timefmt( char * fmt );
70 
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #endif // _inotifytools_H
inotifytools_initialize
int inotifytools_initialize()
Definition: inotifytools.c:283
inotifytools_remove_watch_by_wd
int inotifytools_remove_watch_by_wd(int wd)
Definition: inotifytools.c:926
inotifytools_next_events
struct inotify_event * inotifytools_next_events(long int timeout, int num_events)
Definition: inotifytools.c:1110
inotifytools_get_stat_by_filename
int inotifytools_get_stat_by_filename(char const *filename, int event)
Definition: inotifytools.c:1597
inotifytools_set_printf_timefmt
void inotifytools_set_printf_timefmt(char *fmt)
Definition: inotifytools.c:1997
inotifytools_event_to_str_sep
char * inotifytools_event_to_str_sep(int events, char sep)
Definition: inotifytools.c:672
inotifytools_initialize_stats
void inotifytools_initialize_stats()
Definition: inotifytools.c:425
inotifytools_watch_recursively_with_exclude
int inotifytools_watch_recursively_with_exclude(char const *path, int events, char const **exclude_list)
Definition: inotifytools.c:1307
inotifytools_printf
int inotifytools_printf(struct inotify_event *event, char *fmt)
Definition: inotifytools.c:1689
nstring::buf
char buf[MAX_STRLEN]
Definition: inotifytools.h:26
inotifytools_get_max_user_watches
int inotifytools_get_max_user_watches()
Definition: inotifytools.c:2039
inotifytools_set_filename_by_filename
void inotifytools_set_filename_by_filename(char const *oldname, char const *newname)
Definition: inotifytools.c:845
inotifytools_fprintf
int inotifytools_fprintf(FILE *file, struct inotify_event *event, char *fmt)
Definition: inotifytools.c:1738
inotifytools_sprintf
int inotifytools_sprintf(struct nstring *out, struct inotify_event *event, char *fmt)
Definition: inotifytools.c:1798
inotifytools_get_stat_total
int inotifytools_get_stat_total(int event)
Definition: inotifytools.c:1543
inotifytools_set_filename_by_wd
void inotifytools_set_filename_by_wd(int wd, char const *filename)
Definition: inotifytools.c:823
inotifytools_snprintf
int inotifytools_snprintf(struct nstring *out, int size, struct inotify_event *event, char *fmt)
Definition: inotifytools.c:1853
inotifytools_get_num_watches
int inotifytools_get_num_watches()
Definition: inotifytools.c:1639
inotifytools_get_stat_by_wd
int inotifytools_get_stat_by_wd(int wd, int event)
Definition: inotifytools.c:1520
inotifytools_event_to_str
char * inotifytools_event_to_str(int events)
Definition: inotifytools.c:644
inotifytools_watch_file
int inotifytools_watch_file(char const *filename, int events)
Definition: inotifytools.c:972
inotifytools_error
int inotifytools_error()
Definition: inotifytools.c:1613
inotifytools_wd_from_filename
int inotifytools_wd_from_filename(char const *filename)
Definition: inotifytools.c:802
inotifytools_str_to_event
int inotifytools_str_to_event(char const *event)
Definition: inotifytools.c:557
inotifytools_watch_files
int inotifytools_watch_files(char const *filenames[], int events)
Definition: inotifytools.c:994
inotifytools_ignore_events_by_regex
int inotifytools_ignore_events_by_regex(char const *pattern, int flags)
Definition: inotifytools.c:2093
nstring
This structure holds string that can contain any charater including NULL.
Definition: inotifytools.h:25
inotifytools_remove_watch_by_filename
int inotifytools_remove_watch_by_filename(char const *filename)
Definition: inotifytools.c:949
inotifytools_replace_filename
void inotifytools_replace_filename(char const *oldname, char const *newname)
Definition: inotifytools.c:875
inotifytools_next_event
struct inotify_event * inotifytools_next_event(long int timeout)
Definition: inotifytools.c:1057
inotifytools_str_to_event_sep
int inotifytools_str_to_event_sep(char const *event, char sep)
Definition: inotifytools.c:478
inotifytools_filename_from_wd
char * inotifytools_filename_from_wd(int wd)
Definition: inotifytools.c:779
inotifytools_cleanup
void inotifytools_cleanup()
Definition: inotifytools.c:328
inotifytools_ignore_events_by_inverted_regex
int inotifytools_ignore_events_by_inverted_regex(char const *pattern, int flags)
Definition: inotifytools.c:2108
inotifytools_watch_recursively
int inotifytools_watch_recursively(char const *path, int events)
Definition: inotifytools.c:1271
inotifytools_get_max_queued_events
int inotifytools_get_max_queued_events()
Definition: inotifytools.c:2009
nstring::len
unsigned int len
Definition: inotifytools.h:27
inotifytools_get_max_user_instances
int inotifytools_get_max_user_instances()
Definition: inotifytools.c:2024