1*6777b538SAndroid Build Coastguard Worker /*
2*6777b538SAndroid Build Coastguard Worker * Copyright 2003 Niels Provos <[email protected]>
3*6777b538SAndroid Build Coastguard Worker * All rights reserved.
4*6777b538SAndroid Build Coastguard Worker *
5*6777b538SAndroid Build Coastguard Worker * Redistribution and use in source and binary forms, with or without
6*6777b538SAndroid Build Coastguard Worker * modification, are permitted provided that the following conditions
7*6777b538SAndroid Build Coastguard Worker * are met:
8*6777b538SAndroid Build Coastguard Worker * 1. Redistributions of source code must retain the above copyright
9*6777b538SAndroid Build Coastguard Worker * notice, this list of conditions and the following disclaimer.
10*6777b538SAndroid Build Coastguard Worker * 2. Redistributions in binary form must reproduce the above copyright
11*6777b538SAndroid Build Coastguard Worker * notice, this list of conditions and the following disclaimer in the
12*6777b538SAndroid Build Coastguard Worker * documentation and/or other materials provided with the distribution.
13*6777b538SAndroid Build Coastguard Worker * 3. The name of the author may not be used to endorse or promote products
14*6777b538SAndroid Build Coastguard Worker * derived from this software without specific prior written permission.
15*6777b538SAndroid Build Coastguard Worker *
16*6777b538SAndroid Build Coastguard Worker * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17*6777b538SAndroid Build Coastguard Worker * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18*6777b538SAndroid Build Coastguard Worker * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19*6777b538SAndroid Build Coastguard Worker * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20*6777b538SAndroid Build Coastguard Worker * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21*6777b538SAndroid Build Coastguard Worker * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22*6777b538SAndroid Build Coastguard Worker * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23*6777b538SAndroid Build Coastguard Worker * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24*6777b538SAndroid Build Coastguard Worker * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25*6777b538SAndroid Build Coastguard Worker * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*6777b538SAndroid Build Coastguard Worker */
27*6777b538SAndroid Build Coastguard Worker #include <stdint.h>
28*6777b538SAndroid Build Coastguard Worker
29*6777b538SAndroid Build Coastguard Worker #include <sys/param.h>
30*6777b538SAndroid Build Coastguard Worker #include <sys/types.h>
31*6777b538SAndroid Build Coastguard Worker #include <sys/syscall.h>
32*6777b538SAndroid Build Coastguard Worker #include <sys/epoll.h>
33*6777b538SAndroid Build Coastguard Worker #include <unistd.h>
34*6777b538SAndroid Build Coastguard Worker
35*6777b538SAndroid Build Coastguard Worker int
epoll_create(int size)36*6777b538SAndroid Build Coastguard Worker epoll_create(int size)
37*6777b538SAndroid Build Coastguard Worker {
38*6777b538SAndroid Build Coastguard Worker return (syscall(__NR_epoll_create, size));
39*6777b538SAndroid Build Coastguard Worker }
40*6777b538SAndroid Build Coastguard Worker
41*6777b538SAndroid Build Coastguard Worker int
epoll_ctl(int epfd,int op,int fd,struct epoll_event * event)42*6777b538SAndroid Build Coastguard Worker epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
43*6777b538SAndroid Build Coastguard Worker {
44*6777b538SAndroid Build Coastguard Worker
45*6777b538SAndroid Build Coastguard Worker return (syscall(__NR_epoll_ctl, epfd, op, fd, event));
46*6777b538SAndroid Build Coastguard Worker }
47*6777b538SAndroid Build Coastguard Worker
48*6777b538SAndroid Build Coastguard Worker int
epoll_wait(int epfd,struct epoll_event * events,int maxevents,int timeout)49*6777b538SAndroid Build Coastguard Worker epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
50*6777b538SAndroid Build Coastguard Worker {
51*6777b538SAndroid Build Coastguard Worker return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout));
52*6777b538SAndroid Build Coastguard Worker }
53