fswatch 1.20.1
Loading...
Searching...
No Matches
cevent.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014-2026 Enrico M. Crisostomo
3 *
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License as published by the Free Software
6 * Foundation; either version 3, or (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11 * details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
28#ifndef FSW__CEVENT_H
29# define FSW__CEVENT_H
30
31# include <time.h>
32# include <limits.h>
33# include <stdbool.h>
34# include "libfswatch_types.h"
35
36# ifdef __cplusplus
37extern "C"
38{
39# endif
40
66 {
67 NoOp = 0,
68 PlatformSpecific = (1 << 0),
69 Created = (1 << 1),
70 Updated = (1 << 2),
71 Removed = (1 << 3),
72 Renamed = (1 << 4),
73 OwnerModified = (1 << 5),
74 AttributeModified = (1 << 6),
75 MovedFrom = (1 << 7),
76 MovedTo = (1 << 8),
77 IsFile = (1 << 9),
78 IsDir = (1 << 10),
79 IsSymLink = (1 << 11),
80 Link = (1 << 12),
81 Overflow = (1 << 13),
82 CloseWrite = (1 << 14)
83 };
84
85 extern const enum fsw_event_flag FSW_ALL_EVENT_FLAGS[16];
86
99 FSW_STATUS fsw_get_event_flag_by_name(const char *name, enum fsw_event_flag *flag);
100
110 char *fsw_get_event_flag_name(const enum fsw_event_flag flag);
111
119 typedef struct fsw_cevent
120 {
121 char * path;
122 time_t evt_time;
123 enum fsw_event_flag * flags;
124 unsigned int flags_num;
126
136
144 typedef struct fsw_cevent_v2
145 {
146 char * path;
147 time_t evt_time;
148 enum fsw_event_flag * flags;
149 unsigned int flags_num;
150 unsigned long correlation_id;
151 enum fsw_process_id_kind process_id_kind;
152 long long process_id;
153 int process_pidfd;
154 bool has_process_pidfd;
156
169 typedef void (*FSW_CEVENT_CALLBACK)(fsw_cevent const *const events,
170 const unsigned int event_num,
171 void *data);
172
176 typedef void (*FSW_CEVENT_CALLBACK_V2)(fsw_cevent_v2 const *const events,
177 const unsigned int event_num,
178 void *data);
179
180# ifdef __cplusplus
181}
182# endif
183
184#endif /* FSW__CEVENT_H */
void(* FSW_CEVENT_CALLBACK_V2)(fsw_cevent_v2 const *const events, const unsigned int event_num, void *data)
Definition cevent.h:176
char * fsw_get_event_flag_name(const enum fsw_event_flag flag)
Get the name of an event flag.
Definition cevent.cpp:59
FSW_STATUS fsw_get_event_flag_by_name(const char *name, enum fsw_event_flag *flag)
Get event flag by name.
Definition cevent.cpp:45
fsw_event_flag
Backend-agnostic change flags.
Definition cevent.h:66
@ Renamed
Definition cevent.h:72
@ MovedTo
Definition cevent.h:76
@ Removed
Definition cevent.h:71
@ Updated
Definition cevent.h:70
@ Overflow
Definition cevent.h:81
@ IsSymLink
Definition cevent.h:79
@ OwnerModified
Definition cevent.h:73
@ MovedFrom
Definition cevent.h:75
@ IsDir
Definition cevent.h:78
@ AttributeModified
Definition cevent.h:74
@ Created
Definition cevent.h:69
@ PlatformSpecific
Definition cevent.h:68
@ IsFile
Definition cevent.h:77
@ CloseWrite
Definition cevent.h:82
@ NoOp
Definition cevent.h:67
@ Link
Definition cevent.h:80
fsw_process_id_kind
Type of process identifier associated with an event.
Definition cevent.h:131
@ FSW_PROCESS_ID_PID
Definition cevent.h:133
@ FSW_PROCESS_ID_TID
Definition cevent.h:134
@ FSW_PROCESS_ID_NONE
Definition cevent.h:132
void(* FSW_CEVENT_CALLBACK)(fsw_cevent const *const events, const unsigned int event_num, void *data)
Definition cevent.h:169
Header of the libfswatch library containing common types.
int FSW_STATUS
Status of a library call.
Definition libfswatch_types.h:49
Definition cevent.h:145
Definition cevent.h:120