This section contains file access monitoring routines.
More...
|
RUAPI ruFamCtx | ruFamMonitorFilePath (trans_chars filePath, trans_chars threadName, ruFamHandler eventCallBack, perm_ptr ctx) |
|
RUAPI ruFamCtx | ruFamKillMonitor (ruFamCtx o) |
|
RUAPI bool | ruFamQuit (ruFamCtx o) |
|
RUAPI const char * | ruFamEventTypeString (int32_t action) |
|
RUAPI void | ruFamLogEventFunc (uint32_t loglevel, trans_chars file, trans_chars func, int32_t line, ruFamEvent *fe, trans_chars prefix) |
|
RUAPI char * | ruFamEventString (ruFamEvent *fe) |
|
RUAPI ruFamEvent * | ruFamEventNew (int eventType, trans_chars filePath, trans_chars destPath) |
|
RUAPI ptr | ruFamEventFree (ptr o) |
|
This section contains file access monitoring routines.
Example:
}
"/some/dir","test",
myfamHandler, NULL);
void * ruFamCtx
Definition: fam.h:88
#define ruFamEventLog(lvl, fe, prefix)
Definition: fam.h:145
RUAPI ptr ruFamEventFree(ptr o)
RUAPI ruFamCtx ruFamKillMonitor(ruFamCtx o)
RUAPI ruFamCtx ruFamMonitorFilePath(trans_chars filePath, trans_chars threadName, ruFamHandler eventCallBack, perm_ptr ctx)
#define RU_LOG_VERB
This level includes RU_LOG_INFO and verbose logging used for debugging and is usually high quantity.
Definition: logging.h:106
const void * perm_ptr
A permanent pointer.
Definition: regify-util.h:277
◆ RU_FAM_ATTRIB
#define RU_FAM_ATTRIB 0x010 |
◆ RU_FAM_CREATED
#define RU_FAM_CREATED 0x001 |
◆ RU_FAM_DELETED
#define RU_FAM_DELETED 0x002 |
◆ RU_FAM_KILL_TIMEOUT
#define RU_FAM_KILL_TIMEOUT 5 |
seconds to wait before hard kill
◆ RU_FAM_MODIFIED
#define RU_FAM_MODIFIED 0x004 |
◆ RU_FAM_MOVED
#define RU_FAM_MOVED 0x008 |
File was moved or renamed
◆ RU_FAM_POLL_TIMEOUT
#define RU_FAM_POLL_TIMEOUT 250 |
to wait when no events are pending
◆ RU_FAM_QUEUE_TIMEOUT
#define RU_FAM_QUEUE_TIMEOUT 50 |
to wait when events (like moves) are pending
◆ ruFamEventLog
#define ruFamEventLog |
( |
|
lvl, |
|
|
|
fe, |
|
|
|
prefix |
|
) |
| |
Value: ruMacStart { \
ruFamLogEventFunc(lvl, __FILE__, __func__, __LINE__, fe, prefix); \
} \
} ruMacEnd
RUAPI bool ruDoesLog(uint32_t log_level)
Returns whether the given log level should log.
Log string representation of famEvent
- Parameters
-
lvl | Log level of this message. |
fe | famEvent tp log |
prefix | optional prefix message |
◆ ruFamCtx
Opaque internal fam context pointer
◆ ruFamEvent
◆ ruFamHandler
Signature of call back event handler
- Parameters
-
◆ ruFamEventFree()
RUAPI ptr ruFamEventFree |
( |
ptr |
o | ) |
|
famEvent destructor
- Parameters
-
- Returns
- NULL
◆ ruFamEventNew()
famEvent Constructor
- Parameters
-
eventType | event type |
filePath | file path |
destPath | optional destination path |
- Returns
- famEvent free with ruFamEventFree after use
◆ ruFamEventString()
String representation of famEvent
- Parameters
-
- Returns
- string to be freed after use
◆ ruFamEventTypeString()
RUAPI const char* ruFamEventTypeString |
( |
int32_t |
action | ) |
|
Return string representation of the event type code
- Parameters
-
- Returns
- string representating the given eventType. User must not free this.
◆ ruFamKillMonitor()
This function stop the thread started by ruFamMonitorFilePath and closes the associated monitor handles.
- Parameters
-
- Returns
- NULL
◆ ruFamLogEventFunc()
Internal logging function used by ruFamEventLog
- Parameters
-
loglevel | Log level of this message. |
file | FILE |
func | func |
line | LINE |
fe | famE vent tp log |
prefix | optional prefix message |
◆ ruFamMonitorFilePath()
This function creates a new thread that recursively watches filePath and below and calls eventCallBack with events.
- Parameters
-
filePath | Filepath to monitor. |
threadName | The name that the new thread should go by in the logs |
eventCallBack | callback that will process given event |
ctx | user defined data that is then passed to the given eventCallBack along with the event. |
- Returns
◆ ruFamQuit()
Reports whether fam is in a running state or not
- Parameters
-
- Returns
- false if fam is running