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 __cplusplus
5extern "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
25int inotifytools_str_to_event(char const * event);
26int inotifytools_str_to_event_sep(char const * event, char sep);
27char * inotifytools_event_to_str(int events);
28char * inotifytools_event_to_str_sep(int events, char sep);
29void inotifytools_set_filename_by_wd( int wd, char const * filename );
30void inotifytools_set_filename_by_filename( char const * oldname,
31 char const * newname );
32void inotifytools_replace_filename( char const * oldname,
33 char const * newname );
34struct inotify_event;
35const char* inotifytools_dirname_from_event(struct inotify_event* event,
36 size_t* dirnamelen);
37const char* inotifytools_filename_from_event(struct inotify_event* event,
38 char const** eventname,
39 size_t* dirnamelen);
40char* inotifytools_dirpath_from_event(struct inotify_event* event);
41struct watch;
42const char* inotifytools_filename_from_watch(struct watch* w);
43const char* inotifytools_filename_from_wd(int wd);
44int inotifytools_wd_from_filename( char const * filename );
45int inotifytools_remove_watch_by_filename( char const * filename );
46int inotifytools_remove_watch_by_wd( int wd );
47int inotifytools_watch_file(char const* filename, int events);
48int inotifytools_watch_files(char const* filenames[], int events);
49int inotifytools_watch_recursively(char const* path, int events);
50int inotifytools_watch_recursively_with_exclude(char const* path,
51 int events,
52 char const** exclude_list);
53// [UH]
54int inotifytools_ignore_events_by_regex( char const *pattern, int flags, int recursive );
55int inotifytools_ignore_events_by_inverted_regex( char const *pattern, int flags, int recursive );
56struct inotify_event * inotifytools_next_event( long int timeout );
57struct inotify_event * inotifytools_next_events( long int timeout, int num_events );
58int inotifytools_error();
59int inotifytools_get_stat_by_wd( int wd, int event );
60int inotifytools_get_stat_total( int event );
61int inotifytools_get_stat_by_filename( char const * filename,
62 int event );
63void inotifytools_initialize_stats();
64int inotifytools_initialize();
65int inotifytools_init(int fanotify, int watch_filesystem, int verbose);
66void inotifytools_cleanup();
67int inotifytools_get_num_watches();
68
69int inotifytools_printf(struct inotify_event* event, const char* fmt);
70int inotifytools_fprintf(FILE* file,
71 struct inotify_event* event,
72 const char* fmt);
73int inotifytools_sprintf(struct nstring* out,
74 struct inotify_event* event,
75 const char* fmt);
76int inotifytools_snprintf(struct nstring* out,
77 int size,
78 struct inotify_event* event,
79 const char* fmt);
80void inotifytools_set_printf_timefmt(const char* fmt);
81void inotifytools_clear_timefmt();
82
83int inotifytools_get_max_user_watches();
84int inotifytools_get_max_user_instances();
85int inotifytools_get_max_queued_events();
86
87#ifdef __cplusplus
88}
89#endif
90
91#endif // _inotifytools_H
inotifytools_init
int inotifytools_init(int fanotify, int watch_filesystem, int verbose)
Definition inotifytools.cpp:345
inotifytools_filename_from_wd
const char * inotifytools_filename_from_wd(int wd)
Definition inotifytools.cpp:937
inotifytools_set_printf_timefmt
void inotifytools_set_printf_timefmt(const char *fmt)
Definition inotifytools.cpp:2306
inotifytools_get_max_queued_events
int inotifytools_get_max_queued_events()
Definition inotifytools.cpp:2322
inotifytools_watch_recursively_with_exclude
int inotifytools_watch_recursively_with_exclude(char const *path, int events, char const **exclude_list)
Definition inotifytools.cpp:1799
inotifytools_remove_watch_by_filename
int inotifytools_remove_watch_by_filename(char const *filename)
Definition inotifytools.cpp:1218
inotifytools_error
int inotifytools_error()
Definition inotifytools.cpp:1918
inotifytools_ignore_events_by_regex
int inotifytools_ignore_events_by_regex(char const *pattern, int flags, int recursive)
Definition inotifytools.cpp:2418
inotifytools_watch_recursively
int inotifytools_watch_recursively(char const *path, int events)
Definition inotifytools.cpp:1763
inotifytools_wd_from_filename
int inotifytools_wd_from_filename(char const *filename)
Definition inotifytools.cpp:1042
inotifytools_filename_from_event
const char * inotifytools_filename_from_event(struct inotify_event *event, char const **eventname, size_t *dirnamelen)
Definition inotifytools.cpp:985
inotifytools_set_filename_by_filename
void inotifytools_set_filename_by_filename(char const *oldname, char const *newname)
Definition inotifytools.cpp:1090
inotifytools_remove_watch_by_wd
int inotifytools_remove_watch_by_wd(int wd)
Definition inotifytools.cpp:1191
inotifytools_event_to_str_sep
char * inotifytools_event_to_str_sep(int events, char sep)
Definition inotifytools.cpp:717
inotifytools_dirname_from_event
const char * inotifytools_dirname_from_event(struct inotify_event *event, size_t *dirnamelen)
Definition inotifytools.cpp:956
inotifytools_str_to_event_sep
int inotifytools_str_to_event_sep(char const *event, char sep)
Definition inotifytools.cpp:525
inotifytools_cleanup
void inotifytools_cleanup()
Definition inotifytools.cpp:416
inotifytools_watch_files
int inotifytools_watch_files(char const *filenames[], int events)
Definition inotifytools.cpp:1267
inotifytools_dirpath_from_event
char * inotifytools_dirpath_from_event(struct inotify_event *event)
Definition inotifytools.cpp:1011
inotifytools_ignore_events_by_inverted_regex
int inotifytools_ignore_events_by_inverted_regex(char const *pattern, int flags, int recursive)
Definition inotifytools.cpp:2433
inotifytools_get_max_user_instances
int inotifytools_get_max_user_instances()
Definition inotifytools.cpp:2338
inotifytools_next_event
struct inotify_event * inotifytools_next_event(long int timeout)
Definition inotifytools.cpp:1441
inotifytools_get_num_watches
int inotifytools_get_num_watches()
Definition inotifytools.cpp:1945
inotifytools_event_to_str
char * inotifytools_event_to_str(int events)
Definition inotifytools.cpp:689
inotifytools_str_to_event
int inotifytools_str_to_event(char const *event)
Definition inotifytools.cpp:603
inotifytools_replace_filename
void inotifytools_replace_filename(char const *oldname, char const *newname)
Definition inotifytools.cpp:1122
inotifytools_filename_from_watch
const char * inotifytools_filename_from_watch(struct watch *w)
Definition inotifytools.cpp:908
inotifytools_get_max_user_watches
int inotifytools_get_max_user_watches()
Definition inotifytools.cpp:2354
inotifytools_next_events
struct inotify_event * inotifytools_next_events(long int timeout, int num_events)
Definition inotifytools.cpp:1497
inotifytools_set_filename_by_wd
void inotifytools_set_filename_by_wd(int wd, char const *filename)
Definition inotifytools.cpp:1066
inotifytools_watch_file
int inotifytools_watch_file(char const *filename, int events)
Definition inotifytools.cpp:1245
nstring
This structure holds string that can contain any character including NULL.
Definition inotifytools.h:20
nstring::len
unsigned int len
Definition inotifytools.h:22
nstring::buf
char buf[MAX_STRLEN]
Definition inotifytools.h:21