epoll.h 源码记录
生活随笔
收集整理的這篇文章主要介紹了
epoll.h 源码记录
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
epoll.h源碼:
/* Copyright (C) 2002-2013 Free Software Foundation, Inc.This file is part of the GNU C Library.The GNU C Library is free software; you can redistribute it and/ormodify it under the terms of the GNU Lesser General PublicLicense as published by the Free Software Foundation; eitherversion 2.1 of the License, or (at your option) any later version.The GNU C Library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNULesser General Public License for more details.You should have received a copy of the GNU Lesser General PublicLicense along with the GNU C Library; if not, see<http://www.gnu.org/licenses/>. */#ifndef _SYS_EPOLL_H #define _SYS_EPOLL_H 1#include <stdint.h> #include <sys/types.h>/* Get __sigset_t. */ #include <bits/sigset.h>#ifndef __sigset_t_defined # define __sigset_t_defined typedef __sigset_t sigset_t; #endif/* Get the platform-dependent flags. */ #include <bits/epoll.h>#ifndef __EPOLL_PACKED # define __EPOLL_PACKED #endifenum EPOLL_EVENTS{EPOLLIN = 0x001, #define EPOLLIN EPOLLINEPOLLPRI = 0x002, #define EPOLLPRI EPOLLPRIEPOLLOUT = 0x004, #define EPOLLOUT EPOLLOUTEPOLLRDNORM = 0x040, #define EPOLLRDNORM EPOLLRDNORMEPOLLRDBAND = 0x080, #define EPOLLRDBAND EPOLLRDBANDEPOLLWRNORM = 0x100, #define EPOLLWRNORM EPOLLWRNORMEPOLLWRBAND = 0x200, #define EPOLLWRBAND EPOLLWRBANDEPOLLMSG = 0x400, #define EPOLLMSG EPOLLMSGEPOLLERR = 0x008, #define EPOLLERR EPOLLERREPOLLHUP = 0x010, #define EPOLLHUP EPOLLHUPEPOLLRDHUP = 0x2000, #define EPOLLRDHUP EPOLLRDHUPEPOLLWAKEUP = 1u << 29, #define EPOLLWAKEUP EPOLLWAKEUPEPOLLONESHOT = 1u << 30, #define EPOLLONESHOT EPOLLONESHOTEPOLLET = 1u << 31 #define EPOLLET EPOLLET};/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */ #define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */ #define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */ #define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */typedef union epoll_data {void *ptr;int fd;uint32_t u32;uint64_t u64; } epoll_data_t;struct epoll_event {uint32_t events; /* Epoll events */epoll_data_t data; /* User data variable */ } __EPOLL_PACKED;__BEGIN_DECLS/* Creates an epoll instance. Returns an fd for the new instance.The "size" parameter is a hint specifying the number of filedescriptors to be associated with the new instance. The fdreturned by epoll_create() should be closed with close(). */ extern int epoll_create (int __size) __THROW;/* Same as epoll_create but with an FLAGS parameter. The unused SIZEparameter has been dropped. */ extern int epoll_create1 (int __flags) __THROW;/* Manipulate an epoll instance "epfd". Returns 0 in case of success,-1 in case of error ( the "errno" variable will contain thespecific error code ) The "op" parameter is one of the EPOLL_CTL_*constants defined above. The "fd" parameter is the target of theoperation. The "event" parameter describes which events the calleris interested in and any associated user data. */ extern int epoll_ctl (int __epfd, int __op, int __fd,struct epoll_event *__event) __THROW;/* Wait for events on an epoll instance "epfd". Returns the number oftriggered events returned in "events" buffer. Or -1 in case oferror with the "errno" variable set to the specific error code. The"events" parameter is a buffer that will contain triggeredevents. The "maxevents" is the maximum number of events to bereturned ( usually size of "events" ). The "timeout" parameterspecifies the maximum wait time in milliseconds (-1 == infinite).This function is a cancellation point and therefore not marked with__THROW. */ extern int epoll_wait (int __epfd, struct epoll_event *__events,int __maxevents, int __timeout);/* Same as epoll_wait, but the thread's signal mask is temporarilyand atomically replaced with the one provided as parameter.This function is a cancellation point and therefore not marked with__THROW. */ extern int epoll_pwait (int __epfd, struct epoll_event *__events,int __maxevents, int __timeout,const __sigset_t *__ss);__END_DECLS#endif /* sys/epoll.h */
?
總結
以上是生活随笔為你收集整理的epoll.h 源码记录的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2021-03-08-java-pdf导
- 下一篇: Linux-nohup命令详解