diff --git a/fs/vfs/epoll/fs_epoll.c b/fs/vfs/epoll/fs_epoll.c index 8591d61287823ef6995685e725914ff21aa17d46..822634f5f6a8749c82b5c1e48dcbdc1740220959 100644 --- a/fs/vfs/epoll/fs_epoll.c +++ b/fs/vfs/epoll/fs_epoll.c @@ -164,23 +164,23 @@ static VOID DoEpollClose(struct epoll_head *epHead) } /** - * epoll_create, + * epoll_create unsupported api + * + * epoll_create is implemented by calling epoll_create1, it's parameter 'size' is useless. + * + * epoll_create1, * The simple version of epoll does not use red-black trees, * so when fd is normal value (greater than 0), * actually allocated epoll can manage num of EPOLL_DEFAULT_SIZE * - * @param size: not actually used + * @param flags: not actually used * @return epoll fd */ -int epoll_create(int size) +int epoll_create1(int flags) { + (void)flags; int fd = -1; - if (size <= 0) { - set_errno(EINVAL); - return fd; - } - struct epoll_head *epHead = (struct epoll_head *)malloc(sizeof(struct epoll_head)); if (epHead == NULL) { set_errno(ENOMEM); diff --git a/fs/vfs/include/epoll.h b/fs/vfs/include/epoll.h index c6f6ff3a679febf318a584232f55a5750fc18530..e0aed193101347cfda05ee85b196b51723e61d2d 100644 --- a/fs/vfs/include/epoll.h +++ b/fs/vfs/include/epoll.h @@ -72,7 +72,7 @@ struct epoll_event { epoll_data_t data; }; -int epoll_create(int size); +int epoll_create1(int flags); int epoll_close(int epfd); int epoll_ctl(int epfd, int op, int fd, struct epoll_event *ev); int epoll_wait(int epfd, FAR struct epoll_event *evs, int maxevents, int timeout); diff --git a/syscall/fs_syscall.c b/syscall/fs_syscall.c index 40d4c0c23ee2c0a332c0ce5ae4eb70fdf43f0a91..57e9f37c35b5935e427493e2afb868a8e5e791c1 100644 --- a/syscall/fs_syscall.c +++ b/syscall/fs_syscall.c @@ -2601,18 +2601,15 @@ int SysPselect6(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, return ret; } -int SysEpollCreate(int size) +static int DoEpollCreate1(int flags) { int ret; int procFd; - if (size <= 0) { - return -EINVAL; - } - - ret = epoll_create(size); + ret = epoll_create1(flags); if (ret < 0) { ret = -get_errno(); + return ret; } procFd = AllocAndAssocProcessFd((INTPTR)(ret), MIN_START_FD); @@ -2624,23 +2621,15 @@ int SysEpollCreate(int size) return procFd; } -int SysEpollCreate1(int flags) +int SysEpollCreate(int size) { - int ret; - int procFd; - - ret = epoll_create(flags); - if (ret < 0) { - ret = -get_errno(); - } - - procFd = AllocAndAssocProcessFd((INTPTR)(ret), MIN_START_FD); - if (procFd == -1) { - epoll_close(ret); - return -EMFILE; - } + (void)size; + return DoEpollCreate1(0); +} - return procFd; +int SysEpollCreate1(int flags) +{ + return DoEpollCreate1(flags); } int SysEpollCtl(int epfd, int op, int fd, struct epoll_event *ev)