table of contents
- Tumbleweed 4.28.0-1.1
- Leap-16.0
- Leap-15.6
| inotify_add_watch(2) | System Calls Manual | inotify_add_watch(2) |
NOM¶
inotify_add_watch - Ajouter une surveillance à une instance inotify déjà initialisée
BIBLIOTHÈQUE¶
Bibliothèque C standard (libc, -lc)
SYNOPSIS¶
#include <sys/inotify.h>
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 renvoyé par des appels ultérieurs à read(2) sur le descripteur de fichier inotify. Ces lectures renvoient des structures inotify_event (consultez inotify(7)) indiquant des événements sur le système de fichiers ; le descripteur de surveillance de cette structure identifie l'objet pour lequel un événement a eu lieu.
VALEUR RENVOYÉE¶
S'il réussit, 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'accès en lecture au fichier indiqué 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'événements indiqué ne contient aucun événement valable ; ou mask contient à 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 répertoires du chemin d'accès chemin n'existe pas ou est un lien symbolique pointant nulle part.
- ENOMEM
- La mémoire disponible du noyau n'était 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 système nécessaire.
- ENOTDIR
- mask contains IN_ONLYDIR and path is not a directory.
STANDARDS¶
Linux.
HISTORIQUE¶
Linux 2.6.13.
EXEMPLES¶
Consultez inotify(7).
VOIR AUSSI¶
TRADUCTION¶
La traduction française de cette page de manuel a été créée par Christophe Blaess <https://www.blaess.fr/christophe/>, Stéphan Rafin <stephan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, François Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard <fevrier@tigreraye.org>, Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>, Thomas Huriaux <thomas.huriaux@gmail.com>, Nicolas François <nicolas.francois@centraliens.net>, Florentin Duneau <fduneau@gmail.com>, Simon Paillard <simon.paillard@resel.enst-bretagne.fr>, Denis Barbier <barbier@debian.org>, David Prévot <david@tilapin.org> et Jean-Philippe MENGUAL <jpmengual@debian.org>
Cette traduction est une documentation libre ; veuillez vous reporter à la GNU General Public License version 3 concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE.
Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à debian-l10n-french@lists.debian.org.
| 17 mai 2025 | Pages du manuel de Linux (non publiées) |