inotify_init


Description:

[ Version ( since = "1.0.66" ) ]
public bool inotify_init (int32 maxevents) throws Error

create an inotify handle

This command creates a new inotify handle. The inotify subsystem can be used to notify events which happen to objects in the guest filesystem.

maxevents is the maximum number of events which will be queued up between calls to inotify_read or inotify_files. If this is passed as @0, then the kernel (or previously set) default is used. For Linux 2.6.29 the default was 16384 events. Beyond this limit, the kernel throws away events, but records the fact that it threw them away by setting a flag IN_Q_OVERFLOW in the returned structure list (see inotify_read).

Before any events are generated, you have to add some watches to the internal watch list. See: inotify_add_watch and inotify_rm_watch.

Queued up events should be read periodically by calling inotify_read (or inotify_files which is just a helpful wrapper around inotify_read). If you don't read the events out often enough then you risk the internal queue overflowing.

The handle should be closed after use by calling inotify_close. This also removes any watches automatically.

See also inotify(7) for an overview of the inotify interface as exposed by the Linux kernel, which is roughly what we expose via libguestfs. Note that there is one global inotify handle per libguestfs instance.

This function depends on the feature "inotify". See also feature_available.

Parameters:

this

A GuestfsSession object

Returns:

true on success, false on error