[Overview][Constants][Types][Procedures and functions][Index] Reference for unit 'Linux' (#rtl)

inotify_add_watch

Add a watch to a notify file descriptor

Declaration

Source position: linux.pp line 443

function inotify_add_watch(

  fd: cint;

  name: PChar;

  mask: cuint32

):cint;

Description

inotify_add_watch can be used to add a watch to an initialized inotify file descriptor (fd). The file or directory to watch can be specified in the name parameter, and the events that must be reported can be specified in mask. The following flags can be specified:

IN_ACCESS
Data was read from file.
IN_MODIFY
Data was written to file.
IN_ATTRIB
File attributes changed.
IN_CLOSE_WRITE
File opened for write was closed
IN_CLOSE_NOWRITE
File opened for read was closed
IN_CLOSE
File was closed (read or write)
IN_OPEN
File was opened
IN_MOVED_FROM
File was moved away from watched directory
IN_MOVED_TO
File was moved into watched directory
IN_MOVE
File was moved (in or out of directory)
IN_CREATE
A file was created in the directory.
IN_DELETE
A file was deleted from the directory.
IN_DELETE_SELF
Directory or file under observation was deleted.
IN_MOVE_SELF
Directory or file under observation was moved.
IN_ALL_EVENTS
All possible events OR-ed together.

These events can be OR-ed with some flags, controlling the behaviour of the watch:

IN_ONLYDIR
Only watch filename if it is a directory.
IN_ISDIR
Event occurred against directory.
IN_DONT_FOLLOW
Do not follow symlinks
IN_MASK_ADD
Add events to existing watch (OR-ing the sets) if one exists.
IN_ONESHOT
Only report one event, then remove the watch.

On return, the function returns a watch descriptor, which will be reported in the inotify_event structure's wd.

Errors

On Error, -1 is returned. fpgeterrno can be used to get more detailed error information.

See also

inotify_init

  

Initialize a new inotify file descriptor

inotify_init1

  

Initialize a new inotify file descriptor with extra options.

inotify_rm_watch

  

Remove watch from Inotify file descriptor.

inotify_event

  

INotify event structure


Documentation generated on: May 14 2021