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:
parent
2e2ebb95ca
commit
b89737395b
@ -30,6 +30,12 @@ config FS_AUTOMOUNTER_DEBUG
|
||||
system debug is not enable. This is useful primarily for in vivo
|
||||
unit testing of the auto-mount feature.
|
||||
|
||||
config FS_NEPOLL_DESCRIPTORS
|
||||
int "Maximum number of default epoll descriptors for epoll_create1(2)"
|
||||
default 8
|
||||
---help---
|
||||
The maximum number of default epoll descriptors for epoll_create1(2)
|
||||
|
||||
config DISABLE_PSEUDOFS_OPERATIONS
|
||||
bool "Disable pseudo-filesystem operations"
|
||||
default y if DEFAULT_SMALL
|
||||
|
@ -80,6 +80,31 @@ int epoll_create(int size)
|
||||
return (int)((intptr_t)eph);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: epoll_create1
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Input Parameters:
|
||||
*
|
||||
* Returned Value:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int epoll_create1(int flags)
|
||||
{
|
||||
/* For current implementation, Close-on-exec is a default behavior,
|
||||
* the handle of epoll(2) is not a real file handle.
|
||||
*/
|
||||
|
||||
if (flags != EPOLL_CLOEXEC)
|
||||
{
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
return epoll_create(CONFIG_FS_NEPOLL_DESCRIPTORS);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: epoll_close
|
||||
*
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user