Unix-system-calls-epoll-wait
[top]#
|http://www.google.com/[Google] | a|
Web | This Site |
選択した読書
Copyright©2014 by finddevguides |
[cols=",,,,,,,",] |
| | Home | | References | | Discussion Forums | | About TP
[width="100%",cols="100%",] |
a| == epoll_wait()-Unix、Linuxシステムコール
[[File:]] image :http://www.finddevguides.com/images/next.gif [next] image:http://www.finddevguides.com/add- this.gif [AddThisソーシャルブックマークボタン]
広告
NAME
epoll_wait-epollファイル記述子のI/Oイベントを待つ
概要
#include <sys/epoll.h> int epoll_wait(int epfd, struct epoll_event* events, int maxevents, int timeout); |
説明
_timeout_ミリ秒の最大時間、 epoll ファイル記述子_epfd_のイベントを待ちます。 _events_が指すメモリ領域には、呼び出し元が利用できるイベントが含まれます。 epoll_wait (2)は最大_maxevents_を返します。
_maxevents_パラメーターはゼロより大きくなければなりません。 _timeout_に-1を指定すると、 epoll_wait (2)は無期限に待機し、_timeout_に0を指定すると、 epoll_wait (2)は、使用可能なイベントがない場合(ゼロに等しい戻りコード)でもすぐに戻ります。
_struct epoll_event_は次のように定義されます:
typedef union epoll_data { void *ptr; int fd; __uint32_t u32; __uint64_t u64; } epoll_data_t; struct epoll_event { __uint32_t events; /*Epoll events*/ epoll_data_t data; /*User data variable*/ }; |
返された各構造の_data_には、ユーザーが epoll_ctl (2)( EPOLL_CTL_ADD 、 EPOLL_CTL_MOD _)_で設定したデータと同じデータが含まれ、_events_メンバーには返されたイベントビットフィールドが含まれます。
返り値
成功すると、 epoll_wait (2)は、要求されたI/Oの準備ができたファイル記述子の数を返します。要求された_timeout_ミリ秒の間にファイル記述子が準備できなかった場合はゼロを返します。 エラーが発生すると、 epoll_wait (2)は-1を返し、_errno_が適切に設定されます。
エラー
Tag | Description |
---|---|
EBADF | epfd is not a valid file descriptor. |
EFAULT | The memory area pointed to by events is not accessible with write permissions. |
EINTR | The call was interrupted by a signal handler before any of the requested events occurred or the timeout expired. |
*EINVAL * | epfd is not an* epoll* file descriptor, or maxevents is less than or equal to zero. |
準拠
関連項目
[[File:]] image :http://www.finddevguides.com/images/next.gif [next] [[File:]]
広告
|
[cols="^",] |
|Advertisements