inotify_add_watch(2) System Calls Manual inotify_add_watch(2) NOM inotify_add_watch - Ajouter une surveillance a une instance inotify deja initialisee BIBLIOTHEQUE Bibliotheque C standard (libc, -lc) SYNOPSIS #include int inotify_add_watch(int fd, const char *path, uint32_t mask); DESCRIPTION inotify_add_watch() adds a new watch, or modifies an existing watch, for the file whose location is specified in path; the caller must have read permission for this file. The fd argument is a file descriptor referring to the inotify instance whose watch list is to be modified. The events to be monitored for path are specified in the mask bit-mask argument. See inotify(7) for a description of the bits that can be set in mask. A successful call to inotify_add_watch() returns a unique watch descriptor for this inotify instance, for the filesystem object (inode) that corresponds to path. If the filesystem object was not previously being watched by this inotify instance, then the watch descriptor is newly allocated. If the filesystem object was already being watched (perhaps via a different link to the same object), then the descriptor for the existing watch is returned. Le descripteur de surveillance est renvoye par des appels ulterieurs a read(2) sur le descripteur de fichier inotify. Ces lectures renvoient des structures inotify_event (consultez inotify(7)) indiquant des evenements sur le systeme de fichiers ; le descripteur de surveillance de cette structure identifie l'objet pour lequel un evenement a eu lieu. VALEUR RENVOYEE S'il reussit, inotify_add_watch() renvoie un descripteur de surveillance (un entier positif). En cas d'erreur, il renvoie -1 et positionne errno pour indiquer l'erreur. ERREURS EACCES L'acces en lecture au fichier indique est interdit. EBADF Le descripteur de fichier n'est pas valable. EEXIST mask contains IN_MASK_CREATE and path refers to a file already being watched by the same fd. EFAULT path points outside of the process's accessible address space. EINVAL Le masque d'evenements indique ne contient aucun evenement valable ; ou mask contient a la fois IN_MASK_ADD et IN_MASK_CREATE ; ou fd n'est pas un descripteur de fichier inotify. ENAMETOOLONG path est trop long. ENOENT Un des repertoires du chemin d'acces chemin n'existe pas ou est un lien symbolique pointant nulle part. ENOMEM La memoire disponible du noyau n'etait pas suffisante. ENOSPC La limite sur le nombre total de surveillances inotify pour l'utilisateur est atteinte, ou le noyau n'a pas pu allouer une ressource systeme necessaire. ENOTDIR mask contains IN_ONLYDIR and path is not a directory. STANDARDS Linux. HISTORIQUE Linux 2.6.13. EXEMPLES Consultez inotify(7). VOIR AUSSI inotify_init(2), inotify_rm_watch(2), inotify(7) TRADUCTION La traduction francaise de cette page de manuel a ete creee par Christophe Blaess , Stephan Rafin , Thierry Vignaud , Francois Micaux, Alain Portal , Jean-Philippe Guerard , Jean-Luc Coulon (f5ibh) , Julien Cristau , Thomas Huriaux , Nicolas Francois , Florentin Duneau , Simon Paillard , Denis Barbier , David Prevot et Jean-Philippe MENGUAL Cette traduction est une documentation libre ; veuillez vous reporter a la GNU General Public License version 3 concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITE LEGALE. Si vous decouvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message a . Pages du manuel de Linux 6.15 17 mai 2025 inotify_add_watch(2)