vfs/epoll: add epoll_create1(2) implement

Linux Programmer's Manual

NAME
       epoll_create, epoll_create1 - open an epoll file descriptor

...
SYNOPSIS
       #include <sys/epoll.h>

       int epoll_create1(int flags);
...

   epoll_create1()
       If flags is 0, then, other than the fact that the obsolete
       size argument is dropped, epoll_create1() is the same as
       epoll_create(). The following value can be included in flags
       to obtain different behavior:

       EPOLL_CLOEXEC
              Set the close-on-exec (FD_CLOEXEC) flag on the new file
              descriptor. See the description of the O_CLOEXEC flag in
              open(2) for reasons why this may be useful.

https://man7.org/linux/man-pages/man7/epoll.7.html
This commit is contained in:
chao.an
2020-08-17 10:58:27 +08:00
committed by Xiang Xiao
parent 2e2ebb95ca
commit b89737395b
3 changed files with 42 additions and 1 deletions
+11 -1
View File
@@ -76,6 +76,14 @@ enum EPOLL_EVENTS
#define EPOLLHUP EPOLLHUP
};
/* Flags to be passed to epoll_create1. */
enum
{
EPOLL_CLOEXEC = 02000000
#define EPOLL_CLOEXEC EPOLL_CLOEXEC
};
typedef union poll_data
{
void *ptr;
@@ -108,8 +116,10 @@ struct epoll_head
****************************************************************************/
int epoll_create(int size);
int epoll_create1(int flags);
int epoll_ctl(int epfd, int op, int fd, struct epoll_event *ev);
int epoll_wait(int epfd, struct epoll_event *evs, int maxevents, int timeout);
int epoll_wait(int epfd, struct epoll_event *evs,
int maxevents, int timeout);
void epoll_close(int epfd);