Blame man2/inotify_init.2

Packit 7cfc04
.\" Copyright (C) 2005 Robert Love
Packit 7cfc04
.\" and Copyright (C) 2008, Michael Kerrisk <mtk.manpages@gmail.com>
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
Packit 7cfc04
.\" This is free documentation; you can redistribute it and/or
Packit 7cfc04
.\" modify it under the terms of the GNU General Public License as
Packit 7cfc04
.\" published by the Free Software Foundation; either version 2 of
Packit 7cfc04
.\" the License, or (at your option) any later version.
Packit 7cfc04
.\"
Packit 7cfc04
.\" The GNU General Public License's references to "object code"
Packit 7cfc04
.\" and "executables" are to be interpreted as the output of any
Packit 7cfc04
.\" document formatting or typesetting system, including
Packit 7cfc04
.\" intermediate and printed output.
Packit 7cfc04
.\"
Packit 7cfc04
.\" This manual is distributed in the hope that it will be useful,
Packit 7cfc04
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 7cfc04
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 7cfc04
.\" GNU General Public License for more details.
Packit 7cfc04
.\"
Packit 7cfc04
.\" You should have received a copy of the GNU General Public
Packit 7cfc04
.\" License along with this manual; if not, see
Packit 7cfc04
.\" <http://www.gnu.org/licenses/>.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.\" 2005-07-19 Robert Love <rlove@rlove.org> - initial version
Packit 7cfc04
.\" 2006-02-07 mtk, minor changes
Packit 7cfc04
.\" 2008-10-10 mtk: add description of inotify_init1()
Packit 7cfc04
.\"
Packit 7cfc04
.TH INOTIFY_INIT 2 2017-09-15 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
inotify_init, inotify_init1 \- initialize an inotify instance
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.nf
Packit 7cfc04
.B #include <sys/inotify.h>
Packit 7cfc04
.PP
Packit 7cfc04
.B "int inotify_init(void);"
Packit 7cfc04
.BI "int inotify_init1(int " flags );
Packit 7cfc04
.fi
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
For an overview of the inotify API, see
Packit 7cfc04
.BR inotify (7).
Packit 7cfc04
.PP
Packit 7cfc04
.BR inotify_init ()
Packit 7cfc04
initializes a new inotify instance and returns a file descriptor associated
Packit 7cfc04
with a new inotify event queue.
Packit 7cfc04
.PP
Packit 7cfc04
If
Packit 7cfc04
.I flags
Packit 7cfc04
is 0, then
Packit 7cfc04
.BR inotify_init1 ()
Packit 7cfc04
is the same as
Packit 7cfc04
.BR inotify_init ().
Packit 7cfc04
The following values can be bitwise ORed in
Packit 7cfc04
.IR flags
Packit 7cfc04
to obtain different behavior:
Packit 7cfc04
.TP 12
Packit 7cfc04
.B IN_NONBLOCK
Packit 7cfc04
Set the
Packit 7cfc04
.BR O_NONBLOCK
Packit 7cfc04
file status flag on the new open file description.
Packit 7cfc04
Using this flag saves extra calls to
Packit 7cfc04
.BR fcntl (2)
Packit 7cfc04
to achieve the same result.
Packit 7cfc04
.TP
Packit 7cfc04
.B IN_CLOEXEC
Packit 7cfc04
Set the close-on-exec
Packit 7cfc04
.RB ( FD_CLOEXEC )
Packit 7cfc04
flag on the new file descriptor.
Packit 7cfc04
See the description of the
Packit 7cfc04
.B O_CLOEXEC
Packit 7cfc04
flag in
Packit 7cfc04
.BR open (2)
Packit 7cfc04
for reasons why this may be useful.
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
On success, these system calls return a new file descriptor.
Packit 7cfc04
On error, \-1 is returned, and
Packit 7cfc04
.I errno
Packit 7cfc04
is set to indicate the error.
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.RB ( inotify_init1 ())
Packit 7cfc04
An invalid value was specified in
Packit 7cfc04
.IR flags .
Packit 7cfc04
.TP
Packit 7cfc04
.B EMFILE
Packit 7cfc04
The user limit on the total number of inotify instances has been reached.
Packit 7cfc04
.TP
Packit 7cfc04
.B EMFILE
Packit 7cfc04
The per-process limit on the number of open file descriptors has been reached.
Packit 7cfc04
.TP
Packit 7cfc04
.B ENFILE
Packit 7cfc04
The system-wide limit on the total number of open files has been reached.
Packit 7cfc04
.TP
Packit 7cfc04
.B ENOMEM
Packit 7cfc04
Insufficient kernel memory is available.
Packit 7cfc04
.SH VERSIONS
Packit 7cfc04
.BR inotify_init ()
Packit 7cfc04
first appeared in Linux 2.6.13;
Packit 7cfc04
library support was added to glibc in version 2.4.
Packit 7cfc04
.BR inotify_init1 ()
Packit 7cfc04
was added in Linux 2.6.27;
Packit 7cfc04
library support was added to glibc in version 2.9.
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
These system calls are Linux-specific.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR inotify_add_watch (2),
Packit 7cfc04
.BR inotify_rm_watch (2),
Packit 7cfc04
.BR inotify (7)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.