Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / unix / sysv / linux / hppa / sys / epoll.h
blob86e2ca1f6a499bd204984ecc09ad6bfe69152348
1 /* Copyright (C) 2002-2014 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, see
16 <http://www.gnu.org/licenses/>. */
18 #ifndef _SYS_EPOLL_H
19 #define _SYS_EPOLL_H 1
21 #include <stdint.h>
22 #include <sys/types.h>
24 /* Get __sigset_t. */
25 #include <bits/sigset.h>
27 #ifndef __sigset_t_defined
28 # define __sigset_t_defined
29 typedef __sigset_t sigset_t;
30 #endif
33 /* Flags to be passed to epoll_create1. */
34 enum
36 EPOLL_CLOEXEC = 010000000
37 #define EPOLL_CLOEXEC EPOLL_CLOEXEC
41 enum EPOLL_EVENTS
43 EPOLLIN = 0x001,
44 #define EPOLLIN EPOLLIN
45 EPOLLPRI = 0x002,
46 #define EPOLLPRI EPOLLPRI
47 EPOLLOUT = 0x004,
48 #define EPOLLOUT EPOLLOUT
49 EPOLLRDNORM = 0x040,
50 #define EPOLLRDNORM EPOLLRDNORM
51 EPOLLRDBAND = 0x080,
52 #define EPOLLRDBAND EPOLLRDBAND
53 EPOLLWRNORM = 0x100,
54 #define EPOLLWRNORM EPOLLWRNORM
55 EPOLLWRBAND = 0x200,
56 #define EPOLLWRBAND EPOLLWRBAND
57 EPOLLMSG = 0x400,
58 #define EPOLLMSG EPOLLMSG
59 EPOLLERR = 0x008,
60 #define EPOLLERR EPOLLERR
61 EPOLLHUP = 0x010,
62 #define EPOLLHUP EPOLLHUP
63 EPOLLRDHUP = 0x2000,
64 #define EPOLLRDHUP EPOLLRDHUP
65 EPOLLWAKEUP = 1u << 29,
66 #define EPOLLWAKEUP EPOLLWAKEUP
67 EPOLLONESHOT = 1u << 30,
68 #define EPOLLONESHOT EPOLLONESHOT
69 EPOLLET = 1u << 31
70 #define EPOLLET EPOLLET
74 /* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */
75 #define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */
76 #define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */
77 #define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */
80 typedef union epoll_data
82 void *ptr;
83 int fd;
84 uint32_t u32;
85 uint64_t u64;
86 } epoll_data_t;
88 struct epoll_event
90 uint32_t events; /* Epoll events */
91 epoll_data_t data; /* User data variable */
95 __BEGIN_DECLS
97 /* Creates an epoll instance. Returns an fd for the new instance.
98 The "size" parameter is a hint specifying the number of file
99 descriptors to be associated with the new instance. The fd
100 returned by epoll_create() should be closed with close(). */
101 extern int epoll_create (int __size) __THROW;
103 /* Same as epoll_create but with an FLAGS parameter. The unused SIZE
104 parameter has been dropped. */
105 extern int epoll_create1 (int __flags) __THROW;
108 /* Manipulate an epoll instance "epfd". Returns 0 in case of success,
109 -1 in case of error ( the "errno" variable will contain the
110 specific error code ) The "op" parameter is one of the EPOLL_CTL_*
111 constants defined above. The "fd" parameter is the target of the
112 operation. The "event" parameter describes which events the caller
113 is interested in and any associated user data. */
114 extern int epoll_ctl (int __epfd, int __op, int __fd,
115 struct epoll_event *__event) __THROW;
118 /* Wait for events on an epoll instance "epfd". Returns the number of
119 triggered events returned in "events" buffer. Or -1 in case of
120 error with the "errno" variable set to the specific error code. The
121 "events" parameter is a buffer that will contain triggered
122 events. The "maxevents" is the maximum number of events to be
123 returned ( usually size of "events" ). The "timeout" parameter
124 specifies the maximum wait time in milliseconds (-1 == infinite).
126 This function is a cancellation point and therefore not marked with
127 __THROW. */
128 extern int epoll_wait (int __epfd, struct epoll_event *__events,
129 int __maxevents, int __timeout);
132 /* Same as epoll_wait, but the thread's signal mask is temporarily
133 and atomically replaced with the one provided as parameter.
135 This function is a cancellation point and therefore not marked with
136 __THROW. */
137 extern int epoll_pwait (int __epfd, struct epoll_event *__events,
138 int __maxevents, int __timeout,
139 const __sigset_t *__ss);
141 __END_DECLS
143 #endif /* sys/epoll.h */