* sysdeps/unix/sysv/linux/bits/sched.h: Make second parameter of
[glibc.git] / sysdeps / unix / sysv / linux / epoll_pwait.c
blobe689073d18fded5877e258d663088e966aeb8cea
1 /* Copyright (C) 2007 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
17 02111-1307 USA. */
19 #include <errno.h>
20 #include <signal.h>
21 #include <unistd.h>
22 #include <sys/epoll.h>
24 #include <sysdep-cancel.h>
25 #include <sys/syscall.h>
27 #ifdef __NR_epoll_pwait
29 /* Wait for events on an epoll instance "epfd". Returns the number of
30 triggered events returned in "events" buffer. Or -1 in case of
31 error with the "errno" variable set to the specific error code. The
32 "events" parameter is a buffer that will contain triggered
33 events. The "maxevents" is the maximum number of events to be
34 returned ( usually size of "events" ). The "timeout" parameter
35 specifies the maximum wait time in milliseconds (-1 == infinite).
36 The thread's signal mask is temporarily and atomically replaced with
37 the one provided as parameter. */
39 int epoll_pwait (int epfd, struct epoll_event *events,
40 int maxevents, int timeout,
41 const sigset_t *set)
43 if (SINGLE_THREAD_P)
44 return INLINE_SYSCALL (epoll_pwait, 6, epfd, events, maxevents, timeout,
45 set, _NSIG / 8);
47 int oldtype = LIBC_CANCEL_ASYNC ();
49 int result = INLINE_SYSCALL (epoll_pwait, 6, epfd, events, maxevents,
50 timeout, set, _NSIG / 8);
52 LIBC_CANCEL_RESET (oldtype);
54 return result;
57 #else
59 int epoll_pwait (int epfd, struct epoll_event *events,
60 int maxevents, int timeout,
61 const sigset_t *set)
63 __set_errno (ENOSYS);
64 return -1;
66 stub_warning (epoll_pwait)
68 # include <stub-tag.h>
69 #endif