IV_INOTIFY_WATCH_INIT (3) - Linux Manuals

IV_INOTIFY_WATCH_INIT: ivykis

NAME

IV_INOTIFY_INIT, iv_inotify_register, iv_inotify_unregister, IV_INOTIFY_WATCH_INIT, iv_inotify_watch_register, iv_inotify_watch_unregister - ivykis inotify(7) wrapper

SYNOPSIS

#include <iv_inotify.h>

struct iv_inotify {
};

void IV_INOTIFY_INIT(struct iv_inotify *inotify);
int iv_inotify_register(struct iv_inotify *inotify);
void iv_inotify_unregister(struct iv_inotify *inotify);

struct iv_inotify_watch {
        struct iv_inotify       *inotify;
        const char              *pathname;
        uint32_t                mask;
        void                    *cookie;
        void                    (*handler)(void *, struct inotify_event *);
};

void IV_INOTIFY_WATCH_INIT(struct iv_inotify_watch *watch);
int iv_inotify_watch_register(struct iv_inotify_watch *watch);
int iv_inotify_watch_unregister(struct iv_inotify_watch *watch);

DESCRIPTION

The iv_inotify_register function registers an iv_inotify instance with the iv_inotify(3) module. The inotify parameter is a pointer to the iv_inotify structure to be registered.

The iv_inotify_unregister function unregisters an iv_inotify instance from the iv_inotify(3) module. The inotify parameter is a pointer to the iv_inotify structure to be unregistered.

The iv_inotify_watch_register function adds a watch to the registered iv_inotify instance specified by the ->inotify member.

The iv_inotify_watch_unregister function removes a watch from the iv_inotify instance specified by the ->inotify member.

In the iv_inotify_watch structure used in these functions, the ->pathname and ->mask members correspond to the members of struct inotify_watch as described in inotify(7). ->handler is the event handler called when this watch triggers. The arguments to this handler function are the pointer stored in the ->cookie member of the iv_inotify_watch structure and a pointer to an inotify_event structure as described in inotify(7).

RETURN VALUE

iv_inotify_register and iv_inotify_watch_register return zero on success. On error, -1 is returned, and errno is set appropriately.

ERRORS

iv_inotify will return errors returned by inotify_init(3) and inotify_add_watch(3).