1 #ifndef COMMON_H 2 #define COMMON_H 3 4 #if defined(__FreeBSD__) || defined(__DragonFly__) 5 #define stat64 stat 6 #define lstat64 lstat 7 #ifdef ENABLE_FANOTIFY 8 #error "FreeBSD does not support fanotify" 9 #endif 10 #endif 11 12 #include <stdbool.h> 13 14 #define BLOCKING_TIMEOUT 0 15 16 #ifndef EXIT_SUCCESS 17 #define EXIT_SUCCESS 0 18 #define EXIT_FAILURE 1 19 #endif 20 #define EXIT_TIMEOUT 2 21 22 #ifdef ENABLE_FANOTIFY 23 // fsnotifywait/fsnotifywatch defaults to fanotify 24 #define TOOLS_PREFIX "fsnotify" 25 #define DEFAULT_FANOTIFY_MODE 1 26 #else 27 // inotifywait/inotifywatch defaults to inotify 28 #define TOOLS_PREFIX "inotify" 29 #define DEFAULT_FANOTIFY_MODE 0 30 #endif 31 32 void print_event_descriptions(); 33 int isdir(char const *path); 34 35 typedef struct { 36 char const** watch_files; 37 char const** exclude_files; 38 } FileList; 39 40 void free_list(int argc, char** argv, FileList* list); 41 42 void construct_path_list(int argc, 43 char** argv, 44 char const* filename, 45 FileList* list); 46 47 void warn_inotify_init_error(int fanotify); 48 49 bool is_timeout_option_valid(unsigned int* timeout, char* o); 50 51 #endif 52