[][src]Function inotify_sys::inotify_add_watch

pub unsafe extern "C" fn inotify_add_watch(
    fd: c_int,
    pathname: *const c_char,
    mask: u32
) -> c_int

Adds or updates an inotify watch

Adds an item to the watch list of an inotify instance, or modifies an item on that list. This function takes the following arguments:

  • fd is the file descriptor of the inotify instance (created by inotify_init or inotify_init1)
  • pathname is the path of the file or directory watch
  • mask defines the behavior of this function and configures the watch

The following flags in mask control the type of events to watch for:

The following constants can be used as shortcuts to set multiple event flags:

In addition, the following flags can be set to control the behaviors of the watch and this function:

The function returns -1 if an error occured. Otherwise, it returns a watch descriptor that can be used to remove the watch using inotify_rm_watch or identify the watch via inotify_event's [wd`] field.

Please refer to the man page for additional details.