1d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh/* 2d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * Copyright (C) 2013 The Android Open Source Project 3d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * All rights reserved. 4d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * 5d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * Redistribution and use in source and binary forms, with or without 6d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * modification, are permitted provided that the following conditions 7d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * are met: 8d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * * Redistributions of source code must retain the above copyright 9d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * notice, this list of conditions and the following disclaimer. 10d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * * Redistributions in binary form must reproduce the above copyright 11d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * notice, this list of conditions and the following disclaimer in 12d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * the documentation and/or other materials provided with the 13d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * distribution. 14d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * 15d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 22d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh * SUCH DAMAGE. 27d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh */ 28d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#ifndef _SYS_EPOLL_H_ 29d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define _SYS_EPOLL_H_ 30d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh 31d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#include <sys/cdefs.h> 32d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh 33d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh__BEGIN_DECLS 34d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh 35d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define EPOLLIN 0x00000001 36d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define EPOLLPRI 0x00000002 37d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define EPOLLOUT 0x00000004 38d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define EPOLLERR 0x00000008 39d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define EPOLLHUP 0x00000010 40d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define EPOLLRDNORM 0x00000040 41d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define EPOLLRDBAND 0x00000080 42d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define EPOLLWRNORM 0x00000100 43d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define EPOLLWRBAND 0x00000200 44d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define EPOLLMSG 0x00000400 45d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define EPOLLET 0x80000000 46d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh 47d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define EPOLL_CTL_ADD 1 48d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define EPOLL_CTL_DEL 2 49d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#define EPOLL_CTL_MOD 3 50d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh 51d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsiehtypedef union epoll_data 52d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh{ 53d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh void *ptr; 54d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh int fd; 55d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh unsigned int u32; 56d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh unsigned long long u64; 57d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh} epoll_data_t; 58d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh 59d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsiehstruct epoll_event 60d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh{ 61d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh unsigned int events; 62d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh unsigned char __padding[4]; 63d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh epoll_data_t data; 64d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh}; 65d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh 66d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsiehint epoll_create(int size); 67d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsiehint epoll_ctl(int epfd, int op, int fd, struct epoll_event *event); 68d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsiehint epoll_wait(int epfd, struct epoll_event *events, int max, int timeout); 69d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh 70d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh__END_DECLS 71d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh 72d9124876f07bb5f1f9d1de465aa4b93f41718efbAndrew Hsieh#endif /* _SYS_EPOLL_H_ */ 73