inotify_init
Section: System Calls (2)
Updated: 2026-02-08
Index
JM Home Page
roff page
名前
inotify_init, inotify_init1 - inotify インスタンスを初期化する
ライブラリ
標準 C ライブラリ (libc,~-lc)
書式
#include <sys/inotify.h>
int inotify_init(void);
int inotify_init1(int flags);
説明
inotify API の概要については inotify(7) を参照。
inotify_init() は、新規の inotify インスタンスを初期化し、作成された inotify イベントキュー
に対応するファイルディスクリプターを返す。
inotify_init1() は、 flags が 0 の場合、 inotify_init() と同じである。 flags
に以下の値をビット毎の論理和 (OR) で指定することで、 異なる動作をさせることができる。
- IN_NONBLOCK
-
Set the O_NONBLOCK file status flag on the open file description (see
open(2)) referred to by the new file descriptor. Using this flag saves
extra calls to fcntl(2) to achieve the same result.
- IN_CLOEXEC
-
新しいファイルディスクリプターに対して close-on-exec (FD_CLOEXEC) フラグをセットする。
このフラグが役に立つ理由については、 open(2) の O_CLOEXEC フラグの説明を参照のこと。
返り値
成功すると、これらのシステムコールは新しいファイルディスクリプターを返す。 エラーの場合、-1 を返し、 errno をエラーを示す値に設定する。
エラー
- EINVAL
-
(inotify_init1()) 無効な値が flags に指定された。
- EMFILE
-
inotify インスタンスの総数がユーザー単位の上限に達していた。
- EMFILE
-
The per-process limit on the number of open file descriptors has been
reached.
- ENFILE
-
オープンされたファイルの総数がシステム全体の上限に達していた。
- ENOMEM
-
カーネルメモリーが十分になかった。
標準規格
Linux.
歴史
- inotify_init()
-
Linux 2.6.13, glibc 2.4.
- inotify_init1()
-
Linux 2.6.27, glibc 2.9.
関連項目
inotify_add_watch(2), inotify_rm_watch(2), inotify(7)
Index
- 名前
-
- ライブラリ
-
- 書式
-
- 説明
-
- 返り値
-
- エラー
-
- 標準規格
-
- 歴史
-
- 関連項目
-
This document was created by
man2html,
using the manual pages.