Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/ntirpc/misc/bsd_epoll.h
$ cat -n /usr/include/ntirpc/misc/bsd_epoll.h 1 /* 2 * bsd_epoll.h - Linux epoll.h compatible header 3 * 4 * Signed-off-by: Boaz Harrosh
2009 5 * 6 * description: 7 * This file makes any code that was compiled with
header 8 * on Linux compile-able under FreeBSD and derivatives. It is meant to be 9 * used Together with bsd_epoll.c source file, to also be run-able. 10 * 11 * Example useage: 12 * Any code that was using epoll.h before can now do: 13 * #if defined(__linux__) 14 * # include
15 * #else 16 * # include "bsd_epoll.h" 17 * #endif 18 * Under FreeBSD the Makefile should add the bsd_epoll.c source file 19 * 20 * License: 21 * This header file is not under any license it has been long claimed 22 * and legally proven that Interfaces cannot be copyrighted. 23 * Now since this file only defines interfaces originally put forth 24 * by the Linux Kernel, they are not governed by any License. 25 * In anyway, Linus Trovalds, the originator of the Linux Kernel as 26 * Stated that the Linux Kernel's user-mode APIs are not copyrighted. 27 * 28 * This file was hand crafted by me based on Linux Kernel sources 29 * and GlibC's header epoll.h to be made code compatible with epoll.h 30 * Header on Linux. 31 * 32 * However, the implementation file bsd_epoll.c is copyrighted under 33 * the "New BSD License" so it can be included in the tirpc library 34 * project. 35 * But I fully expect that if you make any fixes/enhancements to 36 * bsd_epoll.c you shall send these changes to me for inclusion 37 * in the next version. (Or I'll hunt your dreams, and you will 38 * not have peace) 39 * 40 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 43 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 44 *
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 46 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 47 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 48 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 49 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 50 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 * SUCH DAMAGE. 52 */ 53 54 #ifndef __BSD_EPOLL_H__ 55 #define __BSD_EPOLL_H__ 56 57 #include
58 59 union epoll_data { 60 int fd; 61 uint32_t u32; 62 uint64_t u64; 63 void *ptr; 64 }; 65 66 struct epoll_event { 67 uint32_t events; 68 union epoll_data data; 69 }; 70 71 enum EPOLL_EVENTS { 72 EPOLLIN = 0x001, 73 #define EPOLLIN EPOLLIN 74 EPOLLPRI = 0x002, 75 #define EPOLLPRI EPOLLPRI 76 EPOLLOUT = 0x004, 77 #define EPOLLOUT EPOLLOUT 78 /* 79 EPOLLRDNORM = 0x040, 80 #define EPOLLRDNORM EPOLLRDNORM 81 EPOLLRDBAND = 0x080, 82 #define EPOLLRDBAND EPOLLRDBAND 83 EPOLLWRNORM = 0x100, 84 #define EPOLLWRNORM EPOLLWRNORM 85 EPOLLWRBAND = 0x200, 86 #define EPOLLWRBAND EPOLLWRBAND 87 EPOLLMSG = 0x400, 88 #define EPOLLMSG EPOLLMSG 89 EPOLLERR = 0x008, 90 #define EPOLLERR EPOLLERR 91 EPOLLHUP = 0x010, 92 #define EPOLLHUP EPOLLHUP 93 */ 94 EPOLLRDHUP = 0x2000, 95 #define EPOLLRDHUP EPOLLRDHUP 96 EPOLLONESHOT = (1 << 30), 97 #define EPOLLONESHOT EPOLLONESHOT 98 EPOLLET = (1 << 31) 99 #define EPOLLET EPOLLET 100 }; 101 102 #define EPOLL_CTL_ADD 1 103 #define EPOLL_CTL_DEL 2 104 #define EPOLL_CTL_MOD 3 105 106 #define EPOLL_MAX_EVENTS (INT_MAX / sizeof(struct epoll_event)) 107 108 extern int epoll_create(int size /*unused */); 109 extern int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event); 110 extern int epoll_wait(int epfd, struct epoll_event *events, int maxevents, 111 int timeout); 112 113 #endif /* __BSD_EPOLL_H__ */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™