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
25struct 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);
42const char* inotifytools_filename_from_event(struct inotify_event* event,
43 char const** eventname,
44 size_t* dirnamelen);
45char* inotifytools_dirpath_from_event(struct inotify_event* event);
46struct watch;
47const char* inotifytools_filename_from_watch(struct watch* w);
48const char* inotifytools_filename_from_wd(int wd);
49int inotifytools_wd_from_filename( char const * filename );
50int inotifytools_remove_watch_by_filename( char const * filename );
52int inotifytools_watch_file(char const* filename, int events);
53int inotifytools_watch_files(char const* filenames[], int events);
54int inotifytools_watch_recursively(char const* path, int events);
56 int events,
57 char const** exclude_list);
58// [UH]
59int inotifytools_ignore_events_by_regex( char const *pattern, int flags );
60int inotifytools_ignore_events_by_inverted_regex( char const *pattern, int flags );
61struct inotify_event * inotifytools_next_event( long int timeout );
62struct inotify_event * inotifytools_next_events( long int timeout, int num_events );
64int inotifytools_get_stat_by_wd( int wd, int event );
65int inotifytools_get_stat_total( int event );
66int inotifytools_get_stat_by_filename( char const * filename,
67 int event );
68void inotifytools_initialize_stats();
69int inotifytools_initialize();
70int inotifytools_init(int fanotify, int watch_filesystem, int verbose);
73
74int inotifytools_printf( struct inotify_event* event, char* fmt );
75int inotifytools_fprintf( FILE* file, struct inotify_event* event, char* fmt );
76int inotifytools_sprintf( struct nstring * out, struct inotify_event* event, char* fmt );
77int inotifytools_snprintf( struct nstring * out, int size, struct inotify_event* event,
78 char* fmt );
79void inotifytools_set_printf_timefmt( char * fmt );
80
84
85#ifdef __cplusplus
86}
87#endif
88
89#endif // _inotifytools_H
int inotifytools_init(int fanotify, int watch_filesystem, int verbose)
const char * inotifytools_filename_from_wd(int wd)
int inotifytools_ignore_events_by_regex(char const *pattern, int flags)
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()
int inotifytools_watch_recursively(char const *path, int events)
int inotifytools_wd_from_filename(char const *filename)
const char * inotifytools_filename_from_event(struct inotify_event *event, char const **eventname, size_t *dirnamelen)
int inotifytools_fprintf(FILE *file, struct inotify_event *event, char *fmt)
int inotifytools_ignore_events_by_inverted_regex(char const *pattern, int flags)
void inotifytools_set_filename_by_filename(char const *oldname, char const *newname)
int inotifytools_remove_watch_by_wd(int wd)
char * inotifytools_event_to_str_sep(int events, char sep)
const char * inotifytools_dirname_from_event(struct inotify_event *event, size_t *dirnamelen)
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_snprintf(struct nstring *out, int size, struct inotify_event *event, char *fmt)
char * inotifytools_dirpath_from_event(struct inotify_event *event)
int inotifytools_get_max_user_instances()
struct inotify_event * inotifytools_next_event(long int timeout)
int inotifytools_get_num_watches()
char * inotifytools_event_to_str(int events)
int inotifytools_printf(struct inotify_event *event, char *fmt)
int inotifytools_str_to_event(char const *event)
void inotifytools_replace_filename(char const *oldname, char const *newname)
const char * inotifytools_filename_from_watch(struct watch *w)
int inotifytools_get_max_user_watches()
struct inotify_event * inotifytools_next_events(long int timeout, int num_events)
void inotifytools_set_printf_timefmt(char *fmt)
int inotifytools_sprintf(struct nstring *out, struct inotify_event *event, char *fmt)
void inotifytools_set_filename_by_wd(int wd, char const *filename)
int inotifytools_watch_file(char const *filename, int events)
This structure holds string that can contain any character including NULL.
unsigned int len
char buf[MAX_STRLEN]