1/* 2 * Copyright (c) 2013, University of Washington. 3 * All rights reserved. 4 * 5 * This file is distributed under the terms in the attached LICENSE file. 6 * If you do not find this file, copies can be found by writing to: 7 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 8 */ 9 10/* 11 * Copyright (C) 2008 The Android Open Source Project 12 * All rights reserved. 13 * 14 * Redistribution and use in source and binary forms, with or without 15 * modification, are permitted provided that the following conditions 16 * are met: 17 * * Redistributions of source code must retain the above copyright 18 * notice, this list of conditions and the following disclaimer. 19 * * Redistributions in binary form must reproduce the above copyright 20 * notice, this list of conditions and the following disclaimer in 21 * the documentation and/or other materials provided with the 22 * distribution. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 27 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 28 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 30 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 31 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 32 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 34 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 */ 37#ifndef _SYS_EPOLL_H_ 38#define _SYS_EPOLL_H_ 39 40#include <stdint.h> 41#include <signal.h> 42 43#define EPOLL_CLOEXEC 02000000 44#define EPOLL_NONBLOCK 04000 45 46#define EPOLLIN 0x00000001 47#define EPOLLPRI 0x00000002 48#define EPOLLOUT 0x00000004 49#define EPOLLERR 0x00000008 50#define EPOLLHUP 0x00000010 51#define EPOLLRDNORM 0x00000040 52#define EPOLLRDBAND 0x00000080 53#define EPOLLWRNORM 0x00000100 54#define EPOLLWRBAND 0x00000200 55#define EPOLLMSG 0x00000400 56#define EPOLLRDHUP 0x00002000 57#define EPOLLWAKEUP 0x20000000 58#define EPOLLONESHOT 0x40000000 59#define EPOLLET 0x80000000 60 61#define EPOLL_CTL_ADD 1 62#define EPOLL_CTL_DEL 2 63#define EPOLL_CTL_MOD 3 64 65typedef union epoll_data 66{ 67 void *ptr; 68 int fd; 69 uint32_t u32; 70 uint64_t u64; 71} epoll_data_t; 72 73struct epoll_event 74{ 75 uint32_t events; /* Epoll events */ 76 epoll_data_t data; /* User data variable */ 77} __attribute__ ((__packed__)); 78 79int epoll_create(int size); 80int epoll_create1(int flags); 81int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event); 82int epoll_wait(int epfd, struct epoll_event *events, 83 int max, int timeout); 84int epoll_pwait(int epfd, struct epoll_event *events, 85 int max, int timeout, const sigset_t *sigmask); 86 87#endif 88