man-pages/man2/inotify_init.2.html
2021-03-31 01:06:50 +01:00

175 lines
4.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of INOTIFY_INIT</TITLE>
</HEAD><BODY>
<H1>INOTIFY_INIT</H1>
Section: Linux Programmer's Manual (2)<BR>Updated: 2019-03-06<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
inotify_init, inotify_init1 - initialize an inotify instance
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>#include &lt;<A HREF="file:///usr/include/sys/inotify.h">sys/inotify.h</A>&gt;</B>
<B>int inotify_init(void);</B>
<B>int inotify_init1(int </B><I>flags</I><B>);</B>
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
For an overview of the inotify API, see
<B><A HREF="/cgi-bin/man/man2html?7+inotify">inotify</A></B>(7).
<P>
<B>inotify_init</B>()
initializes a new inotify instance and returns a file descriptor associated
with a new inotify event queue.
<P>
If
<I>flags</I>
is 0, then
<B>inotify_init1</B>()
is the same as
<B>inotify_init</B>().
The following values can be bitwise ORed in
<I>flags</I>
to obtain different behavior:
<DL COMPACT>
<DT id="1"><B>IN_NONBLOCK</B>
<DD>
Set the
<B>O_NONBLOCK</B>
file status flag on the open file description (see
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2))
referred to by the new file descriptor.
Using this flag saves extra calls to
<B><A HREF="/cgi-bin/man/man2html?2+fcntl">fcntl</A></B>(2)
to achieve the same result.
<DT id="2"><B>IN_CLOEXEC</B>
<DD>
Set the close-on-exec
(<B>FD_CLOEXEC</B>)
flag on the new file descriptor.
See the description of the
<B>O_CLOEXEC</B>
flag in
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2)
for reasons why this may be useful.
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
On success, these system calls return a new file descriptor.
On error, -1 is returned, and
<I>errno</I>
is set to indicate the error.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
<DL COMPACT>
<DT id="3"><B>EINVAL</B>
<DD>
(<B>inotify_init1</B>())
An invalid value was specified in
<I>flags</I>.
<DT id="4"><B>EMFILE</B>
<DD>
The user limit on the total number of inotify instances has been reached.
<DT id="5"><B>EMFILE</B>
<DD>
The per-process limit on the number of open file descriptors has been reached.
<DT id="6"><B>ENFILE</B>
<DD>
The system-wide limit on the total number of open files has been reached.
<DT id="7"><B>ENOMEM</B>
<DD>
Insufficient kernel memory is available.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>VERSIONS</H2>
<B>inotify_init</B>()
first appeared in Linux 2.6.13;
library support was added to glibc in version 2.4.
<B>inotify_init1</B>()
was added in Linux 2.6.27;
library support was added to glibc in version 2.9.
<A NAME="lbAH">&nbsp;</A>
<H2>CONFORMING TO</H2>
These system calls are Linux-specific.
<A NAME="lbAI">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?2+inotify_add_watch">inotify_add_watch</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+inotify_rm_watch">inotify_rm_watch</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?7+inotify">inotify</A></B>(7)
<A NAME="lbAJ">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="8"><A HREF="#lbAB">NAME</A><DD>
<DT id="9"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="10"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="11"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="12"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="13"><A HREF="#lbAG">VERSIONS</A><DD>
<DT id="14"><A HREF="#lbAH">CONFORMING TO</A><DD>
<DT id="15"><A HREF="#lbAI">SEE ALSO</A><DD>
<DT id="16"><A HREF="#lbAJ">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:32 GMT, March 31, 2021
</BODY>
</HTML>