2 .\" epoll by Davide Libenzi ( efficient event notification retrieval )
3 .\" Copyright (C) 2003 Davide Libenzi
5 .\" This program is free software; you can redistribute it and/or modify
6 .\" it under the terms of the GNU General Public License as published by
7 .\" the Free Software Foundation; either version 2 of the License, or
8 .\" (at your option) any later version.
10 .\" This program is distributed in the hope that it will be useful,
11 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
12 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 .\" GNU General Public License for more details.
15 .\" You should have received a copy of the GNU General Public License
16 .\" along with this program; if not, write to the Free Software
17 .\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 .\" Davide Libenzi <davidel@xmailserver.org>
21 .\" 2007-04-30: mtk, Added description of epoll_pwait()
23 .\" Japanese Version Copyright (c) 2004-2005 Yuichi SATO
24 .\" all rights reserved.
25 .\" Translated Wed Jun 16 03:05:40 JST 2004
26 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
27 .\" Updated & Modified Tue Apr 19 07:05:42 JST 2005 by Yuichi SATO
28 .\" Updated 2007-06-02, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.51
29 .\" Updated 2009-02-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.18
31 .TH EPOLL_WAIT 2 2009-01-17 "Linux" "Linux Programmer's Manual"
33 epoll_wait, epoll_pwait \- epoll ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î I/O ¥¤¥Ù¥ó¥È¤òÂÔ¤Ä
36 .B #include <sys/epoll.h>
38 .BI "int epoll_wait(int " epfd ", struct epoll_event *" events ,
39 .BI " int " maxevents ", int " timeout );
40 .BI "int epoll_pwait(int " epfd ", struct epoll_event *" events ,
41 .BI " int " maxevents ", int " timeout ,
42 .BI " const sigset_t *" sigmask );
47 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
51 ¥¤¥ó¥¹¥¿¥ó¥¹¤ËÂФ¹¤ë¥¤¥Ù¥ó¥È¤òÂԤġ£
53 ¤¬»Ø¤¹¥á¥â¥êÎΰè¤Ë¤Ï¡¢¸Æ¤Ó½Ð¤·Â¦¤¬ÍøÍѲÄǽ¤Ê¥¤¥Ù¥ó¥È¤¬³ÊǼ¤µ¤ì¤ë¡£
60 °ú¤¿ô¤Ï 0 ¤è¤êÂ礤¯¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
64 ¥ß¥êÉô֥¤¥Ù¥ó¥È¤òÂԤġ£
73 ¤Ï¥¤¥Ù¥ó¥È¤¬ÍøÍѲÄǽ¤Ç¤Ê¤¯¤Æ¤â¡¢¤¹¤°¤ËÊÖ¤ë (ÊÖ¤êÃÍ¤Ï 0 ¤Ç¤¢¤ë)¡£
76 ¤Ï°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤ë:
80 typedef union epoll_data {
88 uint32_t events; /* epoll ¥¤¥Ù¥ó¥È */
89 epoll_data_t data; /* ¥æ¡¼¥¶¥Ç¡¼¥¿ÊÑ¿ô */
98 .RB ( EPOLL_CTL_ADD ", " EPOLL_CTL_MOD )
99 ¤Ç»ØÄꤷ¤¿¥Ç¡¼¥¿¤¬³ÊǼ¤µ¤ì¤ë¡£
102 ¥á¥ó¥Ð¤Ë¤ÏÊÖ¤µ¤ì¤¿ÍøÍѲÄǽ¤Ê¥¤¥Ù¥ó¥È¤Î¥Ó¥Ã¥È¥Õ¥£¡¼¥ë¥É¤¬³ÊǼ¤µ¤ì¤ë¡£
115 ¤ò»È¤¦¤È¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬½àÈ÷¤Ç¤¤¿¾õÂ֤ˤʤ뤫¡¢
116 ¥·¥°¥Ê¥ë¤¬Ê᪤µ¤ì¤ë¤Þ¤Ç¡¢°ÂÁ´¤ËÂԤĤ³¤È¤¬¤Ç¤¤ë¡£
123 ready = epoll_pwait(epfd, &events, maxevents, timeout, &sigmask);
128 ¤Ë¼Â¹Ô¤¹¤ë¤Î¤ÈÅù²Á¤Ç¤¢¤ë¡£
133 sigprocmask(SIG_SETMASK, &sigmask, &origmask);
134 ready = epoll_wait(epfd, &events, maxevents, timeout);
135 sigprocmask(SIG_SETMASK, &origmask, NULL);
139 °ú¤¿ô¤Ë¤Ï NULL ¤ò»ØÄꤷ¤Æ¤â¤è¤¤¡£
148 ¤ÏÍ׵ᤵ¤ì¤¿ I/O ¤ËÂФ·¤Æ½àÈ÷¤¬¤Ç¤¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î¿ô¤òÊÖ¤¹¡£
151 ¥ß¥êÉäδ֤˥ե¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬½àÈ÷¤Ç¤¤Ê¤¤¾ì¹ç¤Ï¡¢0 ¤òÊÖ¤¹¡£
152 ¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¾ì¹ç¡¢
161 ¤¬Í¸ú¤Ê¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤Ê¤¤¡£
165 ¤Ç»Ø¤µ¤ì¤ë¥á¥â¥êÎΰè¤Ë½ñ¤¹þ¤ß¸¢¸Â¤Ç¥¢¥¯¥»¥¹¤Ç¤¤Ê¤¤¡£
168 Í׵ᤵ¤ì¤¿¤É¤Î¥¤¥Ù¥ó¥È¤âȯÀ¸¤»¤º¡¢¤«¤Ä
170 ¤Î´ü¸Â¤¬ÀÚ¤ì¤ëÁ°¤Ë¡¢¥·¥¹¥Æ¥à¥³¡¼¥ë¤¬¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Ë¤è¤Ã¤Æ³ä¤ê¹þ¤Þ¤ì¤¿¡£
178 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤Ê¤¤¡£
184 ¤Ï¥«¡¼¥Í¥ë 2.6.19 ¤Ç Linux ¤ËÄɲ䵤줿¡£
187 ¤Î glibc ¤Ç¤Î¥µ¥Ý¡¼¥È¤Ï glibc 2.6 °Ê¹ß¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ë¡£
190 ¤Ï Linux Æȼ«¤Ç¤¢¤ê¡¢¥«¡¼¥Í¥ë 2.5.44 ¤ÇƳÆþ¤µ¤ì¤¿¡£
191 .\" ¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ï Linux ¥«¡¼¥Í¥ë 2.5.66 ¤Ç³ÎÄꤵ¤ì¤ë¤Ù¤¤Ç¤¢¤ë¡£
193 .BR epoll_create (2),