libinotifytools: inotifytools/inotifytools.h Source File

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
10extern "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
30int inotifytools_str_to_event(char const * event);
31int inotifytools_str_to_event_sep(char const * event, char sep);
32char * inotifytools_event_to_str(int events);
33char * inotifytools_event_to_str_sep(int events, char sep);
34void inotifytools_set_filename_by_wd( int wd, char const * filename );
35void inotifytools_set_filename_by_filename( char const * oldname,
36 char const * newname );
37void inotifytools_replace_filename( char const * oldname,
38 char const * newname );
39struct inotify_event;
40const char* inotifytools_dirname_from_event(struct inotify_event* event,
41 size_t* dirnamelen);
42char* inotifytools_dirpath_from_event(struct inotify_event* event);
43struct watch;
44const char* inotifytools_filename_from_watch(struct watch* w);
45const char* inotifytools_filename_from_wd(int wd);
46int inotifytools_wd_from_filename( char const * filename );
47int inotifytools_remove_watch_by_filename( char const * filename );
48int inotifytools_remove_watch_by_wd( int wd );
49int inotifytools_watch_file(char const* filename, int events);
50int inotifytools_watch_files(char const* filenames[], int events);
51int inotifytools_watch_recursively(char const* path, int events);
52int inotifytools_watch_recursively_with_exclude(char const* path,
53 int events,
54 char const** exclude_list);
55// [UH]
56int inotifytools_ignore_events_by_regex( char const *pattern, int flags );
57int inotifytools_ignore_events_by_inverted_regex( char const *pattern, int flags );
58struct inotify_event * inotifytools_next_event( long int timeout );
59struct inotify_event * inotifytools_next_events( long int timeout, int num_events );
60int inotifytools_error();
61int inotifytools_get_stat_by_wd( int wd, int event );
62int inotifytools_get_stat_total( int event );
63int inotifytools_get_stat_by_filename( char const * filename,
64 int event );
65void inotifytools_initialize_stats();
66int inotifytools_initialize();
67int inotifytools_init(int fanotify, int watch_filesystem, int verbose);
68void inotifytools_cleanup();
69int inotifytools_get_num_watches();
70
71int inotifytools_printf( struct inotify_event* event, char* fmt );
72int inotifytools_fprintf( FILE* file, struct inotify_event* event, char* fmt );
73int inotifytools_sprintf( struct nstring * out, struct inotify_event* event, char* fmt );
74int inotifytools_snprintf( struct nstring * out, int size, struct inotify_event* event,
75 char* fmt );
76void inotifytools_set_printf_timefmt( char * fmt );
77
78int inotifytools_get_max_user_watches();
79int inotifytools_get_max_user_instances();
80int inotifytools_get_max_queued_events();
81
82#ifdef __cplusplus
83}
84#endif
85
86#endif // _inotifytools_H
inotifytools_init
int inotifytools_init(int fanotify, int watch_filesystem, int verbose)
Definition: inotifytools.c:299
inotifytools_filename_from_wd
const char * inotifytools_filename_from_wd(int wd)
Definition: inotifytools.c:874
inotifytools_ignore_events_by_regex
int inotifytools_ignore_events_by_regex(char const *pattern, int flags)
Definition: inotifytools.c:2270
inotifytools_get_max_queued_events
int inotifytools_get_max_queued_events()
Definition: inotifytools.c:2186
inotifytools_watch_recursively_with_exclude
int inotifytools_watch_recursively_with_exclude(char const *path, int events, char const **exclude_list)
Definition: inotifytools.c:1679
inotifytools_remove_watch_by_filename
int inotifytools_remove_watch_by_filename(char const *filename)
Definition: inotifytools.c:1120
inotifytools_error
int inotifytools_error()
Definition: inotifytools.c:1790
inotifytools_watch_recursively
int inotifytools_watch_recursively(char const *path, int events)
Definition: inotifytools.c:1643
inotifytools_wd_from_filename
int inotifytools_wd_from_filename(char const *filename)
Definition: inotifytools.c:950
inotifytools_fprintf
int inotifytools_fprintf(FILE *file, struct inotify_event *event, char *fmt)
Definition: inotifytools.c:1915
inotifytools_ignore_events_by_inverted_regex
int inotifytools_ignore_events_by_inverted_regex(char const *pattern, int flags)
Definition: inotifytools.c:2285
inotifytools_set_filename_by_filename
void inotifytools_set_filename_by_filename(char const *oldname, char const *newname)
Definition: inotifytools.c:995
inotifytools_remove_watch_by_wd
int inotifytools_remove_watch_by_wd(int wd)
Definition: inotifytools.c:1095
inotifytools_event_to_str_sep
char * inotifytools_event_to_str_sep(int events, char sep)
Definition: inotifytools.c:653
inotifytools_dirname_from_event
const char * inotifytools_dirname_from_event(struct inotify_event *event, size_t *dirnamelen)
Definition: inotifytools.c:893
inotifytools_str_to_event_sep
int inotifytools_str_to_event_sep(char const *event, char sep)
Definition: inotifytools.c:463
inotifytools_cleanup
void inotifytools_cleanup()
Definition: inotifytools.c:365
inotifytools_watch_files
int inotifytools_watch_files(char const *filenames[], int events)
Definition: inotifytools.c:1167
inotifytools_snprintf
int inotifytools_snprintf(struct nstring *out, int size, struct inotify_event *event, char *fmt)
Definition: inotifytools.c:2030
inotifytools_dirpath_from_event
char * inotifytools_dirpath_from_event(struct inotify_event *event)
Definition: inotifytools.c:919
inotifytools_get_max_user_instances
int inotifytools_get_max_user_instances()
Definition: inotifytools.c:2201
inotifytools_next_event
struct inotify_event * inotifytools_next_event(long int timeout)
Definition: inotifytools.c:1336
inotifytools_get_num_watches
int inotifytools_get_num_watches()
Definition: inotifytools.c:1816
inotifytools_event_to_str
char * inotifytools_event_to_str(int events)
Definition: inotifytools.c:625
inotifytools_printf
int inotifytools_printf(struct inotify_event *event, char *fmt)
Definition: inotifytools.c:1866
inotifytools_str_to_event
int inotifytools_str_to_event(char const *event)
Definition: inotifytools.c:538
inotifytools_replace_filename
void inotifytools_replace_filename(char const *oldname, char const *newname)
Definition: inotifytools.c:1025
inotifytools_filename_from_watch
const char * inotifytools_filename_from_watch(struct watch *w)
Definition: inotifytools.c:845
inotifytools_get_max_user_watches
int inotifytools_get_max_user_watches()
Definition: inotifytools.c:2216
inotifytools_next_events
struct inotify_event * inotifytools_next_events(long int timeout, int num_events)
Definition: inotifytools.c:1393
inotifytools_set_printf_timefmt
void inotifytools_set_printf_timefmt(char *fmt)
Definition: inotifytools.c:2174
inotifytools_sprintf
int inotifytools_sprintf(struct nstring *out, struct inotify_event *event, char *fmt)
Definition: inotifytools.c:1975
inotifytools_set_filename_by_wd
void inotifytools_set_filename_by_wd(int wd, char const *filename)
Definition: inotifytools.c:973
inotifytools_watch_file
int inotifytools_watch_file(char const *filename, int events)
Definition: inotifytools.c:1145
nstring
This structure holds string that can contain any character including NULL.
Definition: inotifytools.h:25
nstring::len
unsigned int len
Definition: inotifytools.h:27
nstring::buf
char buf[MAX_STRLEN]
Definition: inotifytools.h:26