|
fswatch 1.20.1
|
Event type manipulation. More...
Go to the source code of this file.
Classes | |
| struct | fsw_cevent |
| struct | fsw_cevent_v2 |
Typedefs | |
| typedef struct fsw_cevent | fsw_cevent |
| typedef struct fsw_cevent_v2 | fsw_cevent_v2 |
| typedef void(* | FSW_CEVENT_CALLBACK) (fsw_cevent const *const events, const unsigned int event_num, void *data) |
| typedef void(* | FSW_CEVENT_CALLBACK_V2) (fsw_cevent_v2 const *const events, const unsigned int event_num, void *data) |
Enumerations | |
| enum | fsw_event_flag { NoOp = 0 , PlatformSpecific = (1 << 0) , Created = (1 << 1) , Updated = (1 << 2) , Removed = (1 << 3) , Renamed = (1 << 4) , OwnerModified = (1 << 5) , AttributeModified = (1 << 6) , MovedFrom = (1 << 7) , MovedTo = (1 << 8) , IsFile = (1 << 9) , IsDir = (1 << 10) , IsSymLink = (1 << 11) , Link = (1 << 12) , Overflow = (1 << 13) , CloseWrite = (1 << 14) } |
| Backend-agnostic change flags. More... | |
| enum | fsw_process_id_kind { FSW_PROCESS_ID_NONE = 0 , FSW_PROCESS_ID_PID , FSW_PROCESS_ID_TID } |
| Type of process identifier associated with an event. More... | |
Functions | |
| FSW_STATUS | fsw_get_event_flag_by_name (const char *name, enum fsw_event_flag *flag) |
| Get event flag by name. | |
| char * | fsw_get_event_flag_name (const enum fsw_event_flag flag) |
| Get the name of an event flag. | |
Variables | |
| enum fsw_event_flag | FSW_ALL_EVENT_FLAGS [16] |
Event type manipulation.
This header file defines the event types of the libfswatch API.
| typedef struct fsw_cevent fsw_cevent |
A file change event is represented as an instance of this struct where:
| typedef void(* FSW_CEVENT_CALLBACK) (fsw_cevent const *const events, const unsigned int event_num, void *data) |
A function pointer of type FSW_CEVENT_CALLBACK is used by the API as a callback to provide information about received events. The callback is passed the following arguments:
The memory used by the fsw_cevent objects will be freed at the end of the callback invocation. A callback should copy such data instead of storing a pointer to it.
| typedef void(* FSW_CEVENT_CALLBACK_V2) (fsw_cevent_v2 const *const events, const unsigned int event_num, void *data) |
A callback receiving events with extended metadata.
| typedef struct fsw_cevent_v2 fsw_cevent_v2 |
A file change event with extended metadata.
This type is additive and preserves the ABI of fsw_cevent. The process file descriptor is owned by libfswatch and is valid only while the callback is executing.
| enum fsw_event_flag |
Backend-agnostic change flags.
Each element of this enum represents a backend-agnostic change flag. No direct mapping to backend-specific change types is guaranteed to exist: a change type may be mapped to multiple fsw_event_flag instances included the PlatformSpecific flag.
The values of event flags are all powers of 2, that is numbers 

A monitor implementation is required to map implementation-specific flags into API flags. Sometimes, though, a perfect match is not possible and the following situation may arise:
| enum fsw_process_id_kind |
| FSW_STATUS fsw_get_event_flag_by_name | ( | const char * | name, |
| enum fsw_event_flag * | flag ) |
Get event flag by name.
This function looks for an event flag called name and, if it exists, it writes its value onto flag and FSW_OK, otherwise flag is not modified and FSW_ERR_UNKNOWN_VALUE is returned.
| [in] | name | The name of the event flag to look for. |
| [out] | flag | The output variable where the event flag is returned. |
| char * fsw_get_event_flag_name | ( | const enum fsw_event_flag | flag | ) |
Get the name of an event flag.
This function looks for the name of the specified event flag. If it exists, it returns its name, otherwise nullptr is returned.
| [in] | flag | The event flag to look for. |
flag, or nullptr if it does not exist.