.\" -*- coding: UTF-8 -*- .\" Copyright 2005, Robert Love .\" Copyright 2006, Michael Kerrisk .\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: GPL-2.0-or-later .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH inotify_add_watch 2 "8 февраля 2026 г." "Linux man\-pages 6.18" .SH НАИМЕНОВАНИЕ inotify_add_watch \- добавляет сторожок к инициализированному экземпляру inotify .SH БИБЛИОТЕКА Стандартная библиотека языка C (\fIlibc\fP,\ \fI\-lc\fP) .SH СИНТАКСИС .nf \fB#include \fP .P \fBint inotify_add_watch(int \fP\fIfd\fP\fB, const char *\fP\fIpath\fP\fB, uint32_t \fP\fImask\fP\fB);\fP .fi .SH ОПИСАНИЕ \fBinotify_add_watch\fP() adds a new watch, or modifies an existing watch, for the file whose location is specified in \fIpath\fP; the caller must have read permission for this file. The \fIfd\fP argument is a file descriptor referring to the inotify instance whose watch list is to be modified. The events to be monitored for \fIpath\fP are specified in the \fImask\fP bit\-mask argument. See \fBinotify\fP(7) for a description of the bits that can be set in \fImask\fP. .P A successful call to \fBinotify_add_watch\fP() returns a unique watch descriptor for this inotify instance, for the filesystem object (inode) that corresponds to \fIpath\fP. 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. .P Дескриптор сторожка возвращается при последующих операциях \fBread\fP(2) из файлового дескриптора inotify. При чтении извлекаются структуры \fIinotify_event\fP (см. \fBinotify\fP(7)), указывающие на события в файловой системе; дескриптор сторожка внутри этой структуры определяет объект, для которого произошло событие. .SH "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ" При успешном выполнении \fBinotify_add_watch\fP() возвращает дескриптор наблюдения (неотрицательное целое число). В случае ошибки возвращает \-1, а \fIerrno\fP устанавливается для указания ошибки. .SH ОШИБКИ .TP \fBEACCES\fP Нет прав на чтение указанного файла. .TP \fBEBADF\fP Указан неверный файловый дескриптор. .TP \fBEEXIST\fP \fImask\fP contains \fBIN_MASK_CREATE\fP and \fIpath\fP refers to a file already being watched by the same \fIfd\fP. .TP \fBEFAULT\fP \fIpath\fP points outside of the process's accessible address space. .TP \fBEINVAL\fP Указанная маска событий не содержит допустимых событий; \fImask\fP содержит \fBIN_MASK_ADD\fP и \fBIN_MASK_CREATE\fP одновременно; \fIfd\fP не является файловым дескриптором inotify. .TP \fBENAMETOOLONG\fP \fIpath\fP слишком длинен. .TP \fBENOENT\fP A directory component in \fIpath\fP does not exist or is a dangling symbolic link. .TP \fBENOMEM\fP Недостаточное количество памяти ядра. .TP \fBENOSPC\fP Достигнуто максимальное количество сторожков inotify доступных пользователю или ядру не удалось выделить необходимые ресурсы. .TP \fBENOTDIR\fP \fImask\fP contains \fBIN_ONLYDIR\fP and \fIpath\fP is not a directory. .SH СТАНДАРТЫ Linux. .SH ИСТОРИЯ Linux 2.6.13. .SH ПРИМЕРЫ Смотрите \fBinotify\fP(7). .SH "СМОТРИТЕ ТАКЖЕ" \fBinotify_init\fP(2), \fBinotify_rm_watch\fP(2), \fBinotify\fP(7) .PP .SH ПЕРЕВОД Русский перевод этой страницы руководства разработал(и) Azamat Hackimov , Dmitriy S. Seregin , Yuri Kozlov и Иван Павлов . .PP Этот перевод является свободной программной документацией; он распространяется на условиях общедоступной лицензии GNU (GNU General Public License - GPL, .UR https://www.gnu.org/licenses/gpl-3.0.html .UE версии 3 или более поздней) в отношении авторского права, но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ. .PP Если вы обнаружите какие-либо ошибки в переводе этой страницы руководства, пожалуйста, сообщите об этом разработчику(ам) по его(их) адресу(ам) электронной почты или по адресу .MT debian-l10n-russian@lists.debian.org списка рассылки русских переводчиков .ME .