24 return fanotify_mark ( fanotify_d, FAN_MARK_ADD | FAN_MARK_DONT_FOLLOW,
30 struct fanotify_event_metadata buf[
BUFSIZ / sizeof ( struct fanotify_event_metadata ) + 1];
35 struct fanotify_event_metadata *metadata;
36 size_t len = read ( fanotify_d, (
void * ) buf,
sizeof ( buf ) -
sizeof ( *buf ) );
40 error (
"cannot read(%i, &metadata, sizeof(metadata)).", fanotify_d );
44 while ( FAN_EVENT_OK ( metadata, len ) ) {
45 debug ( 2,
"metadata->pid: %i; metadata->fd: %i", metadata->pid, metadata->fd );
47 if ( metadata->fd != FAN_NOFD ) {
48 if ( metadata->fd >= 0 ) {
51 debug ( 2,
"Event %i on \"%s\".", metadata->mask, fpath );
56 close ( metadata->fd );
57 metadata = FAN_EVENT_NEXT ( metadata, len );
63 error (
"got error while sync_idle()." );
#define FANOTIFY_MARKMASK
#define debug(debug_level,...)
char * fd2fpath_malloc(int fd)
int fanotify_add_watch_dir(struct ctx *ctx_p, const char *const accpath)
int sync_idle(ctx_t *ctx_p, indexes_t *indexes_p)
static int sync_queuesync(const char *fpath_rel, eventinfo_t *evinfo, ctx_t *ctx_p, indexes_t *indexes_p, queue_id_t queue_id)
volatile state_t * state_p