1 /* Copyright (C) 2002,2003,2004,2005,2006 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #define _SYS_EPOLL_H 1
23 #include <sys/types.h>
29 #define EPOLLIN EPOLLIN
31 #define EPOLLPRI EPOLLPRI
33 #define EPOLLOUT EPOLLOUT
35 #define EPOLLRDNORM EPOLLRDNORM
37 #define EPOLLRDBAND EPOLLRDBAND
39 #define EPOLLWRNORM EPOLLWRNORM
41 #define EPOLLWRBAND EPOLLWRBAND
43 #define EPOLLMSG EPOLLMSG
45 #define EPOLLERR EPOLLERR
47 #define EPOLLHUP EPOLLHUP
48 EPOLLONESHOT
= (1 << 30),
49 #define EPOLLONESHOT EPOLLONESHOT
51 #define EPOLLET EPOLLET
55 /* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */
56 #define EPOLL_CTL_ADD 1 /* Add a file decriptor to the interface. */
57 #define EPOLL_CTL_DEL 2 /* Remove a file decriptor from the interface. */
58 #define EPOLL_CTL_MOD 3 /* Change file decriptor epoll_event structure. */
61 typedef union epoll_data
71 uint32_t events
; /* Epoll events */
72 epoll_data_t data
; /* User data variable */
73 } __attribute__ ((__packed__
));
78 /* Creates an epoll instance. Returns an fd for the new instance.
79 The "size" parameter is a hint specifying the number of file
80 descriptors to be associated with the new instance. The fd
81 returned by epoll_create() should be closed with close(). */
82 extern int epoll_create (int __size
) __THROW
;
85 /* Manipulate an epoll instance "epfd". Returns 0 in case of success,
86 -1 in case of error ( the "errno" variable will contain the
87 specific error code ) The "op" parameter is one of the EPOLL_CTL_*
88 constants defined above. The "fd" parameter is the target of the
89 operation. The "event" parameter describes which events the caller
90 is interested in and any associated user data. */
91 extern int epoll_ctl (int __epfd
, int __op
, int __fd
,
92 struct epoll_event
*__event
) __THROW
;
95 /* Wait for events on an epoll instance "epfd". Returns the number of
96 triggered events returned in "events" buffer. Or -1 in case of
97 error with the "errno" variable set to the specific error code. The
98 "events" parameter is a buffer that will contain triggered
99 events. The "maxevents" is the maximum number of events to be
100 returned ( usually size of "events" ). The "timeout" parameter
101 specifies the maximum wait time in milliseconds (-1 == infinite).
103 This function is a cancellation point and therefore not marked with
105 extern int epoll_wait (int __epfd
, struct epoll_event
*__events
,
106 int __maxevents
, int __timeout
);
110 #endif /* sys/epoll.h */