epoll_createのヘルプ・マニュアル
日本語 英語
epoll_create --help
man epoll_create
EPOLL_CREATE(2) Linux Programmer’s Manual EPOLL_CREATE(2)
名前
epoll_create, epoll_create1 - epoll ファイルディスクリプタをオープンす
る
書式
#include
int epoll_create(int size);
int epoll_create1(int flags);
説明
epoll_create() は、 size 個のディスクリプタを保持できる大きさのイベント
バ ッキングストアの割り当てをカーネルに対して要求することにより、 epoll
「インスタンス」を作成する。 size はバッキングストアの最大サイズでは な
く 、内部構造の大きさをどの位にするかをカーネルに知らせるヒントでしかな
い。 (現在は size は無視される。下記の「注意」を参照。)
epoll_create() は、新しい epoll インスタンスを参照するファイルディス ク
リプタを返す。このファイルディスクリプタは、その後の epoll インタフェー
スの呼び出しに使われる。もう必要でなくなった場合は、 epoll_create() で
返 されたファイルディスクリプタは close(2) を使ってクローズされるべきで
ある。ある epoll インスタンスを参照する全てのファイルディスクリプタがク
ロ ーズされると、カーネルはそのインスタンスを破壊して、対応するリソース
を解放し、再使用できるようにする。
epoll_create1() は、 flags が 0 の場合、現在では使われていない size 引
き数がなくなっている点を除けば epoll_create() と同じである。 flags に以
下の値をビット毎の論理和 (OR) で指定することで、異なる動作をさせるこ と
ができる。
EPOLL_CLOEXEC
新 しいファイルディスクリプタに対して close-on-exec (FD_CLOEXEC)
フラグをセットする。このフラグが役に立つ理由については、 open(2)
の O_CLOEXEC フラグの説明を参照のこと。
返り値
成 功すると、これらのシステムコールは非負のファイルディスクリプタを返す
。エラーの場合、-1 を返し、 errno にエラーを示す値を設定する。
エラー
EINVAL size が正でない。
EINVAL (epoll_create1()) flags に無効な値が指定された。
EMFILE /proc/sys/fs/epoll/max_user_instances によって指定さ れ て い る
、epoll インスタンスのユーザー単位の制限に達した。更なる詳細につ
いては epoll(7) を参照のこと。
ENFILE オープンされたファイルの総数がシステム制限に達した。
ENOMEM カーネルオブジェクトを作成するのに十分なメモリがなかった。
準拠
epoll_create() は Linux 独自であり、カーネル 2.5.44 で導入された。
注意
Linux 2.6.8 以降では、 size 引き数は使用されない (カーネルは、動的に 必
要なデータ構造の大きさを決定し、最初のヒントを必要しない)。
関連項目
close(2), epoll_ctl(2), epoll_wait(2), epoll(7)
Linux 2009-01-17 EPOLL_CREATE(2)
EPOLL_CREATE(2) Linux Programmer’s Manual EPOLL_CREATE(2)
NAME
epoll_create, epoll_create1 - open an epoll file descriptor
SYNOPSIS
#include
int epoll_create(int size);
int epoll_create1(int flags);
DESCRIPTION
epoll_create() creates an epoll "instance", requesting the kernel to
allocate an event backing store dimensioned for size descriptors. The
size is not the maximum size of the backing store but just a hint to
the kernel about how to dimension internal structures. (Nowadays, size
is ignored; see NOTES below.)
epoll_create() returns a file descriptor referring to the new epoll
instance. This file descriptor is used for all the subsequent calls to
the epoll interface. When no longer required, the file descriptor
returned by epoll_create() should be closed by using close(2). When
all file descriptors referring to an epoll instance have been closed,
the kernel destroys the instance and releases the associated resources
for re-use.
If flags is 0, then, other than the fact that the obsolete size argu-
ment is dropped, epoll_create1() is the same as epoll_create(). The
following value can be included in flags to obtain different behavior:
EPOLL_CLOEXEC
Set the close-on-exec (FD_CLOEXEC) flag on the new file descrip-
tor. See the description of the O_CLOEXEC flag in open(2) for
reasons why this may be useful.
RETURN VALUE
On success, these system calls return a non-negative file descriptor.
On error, -1 is returned, and errno is set to indicate the error.
ERRORS
EINVAL size is not positive.
EINVAL (epoll_create1()) Invalid value specified in flags.
EMFILE The per-user limit on the number of epoll instances imposed by
/proc/sys/fs/epoll/max_user_instances was encountered. See
epoll(7) for further details.
ENFILE The system limit on the total number of open files has been
reached.
ENOMEM There was insufficient memory to create the kernel object.
CONFORMING TO
epoll_create() is Linux-specific, and was introduced in kernel 2.5.44.
NOTES
Since Linux 2.6.8, the size argument is unused. (The kernel dynami-
cally sizes the required data structures without needing this initial
hint.)
SEE ALSO
close(2), epoll_ctl(2), epoll_wait(2), epoll(7)
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2009-01-17 EPOLL_CREATE(2)