From 7e8e5c10d1d14474341fe977ea53550e27be12c9 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sun, 6 Nov 2022 05:16:03 +0800 Subject: [PATCH] fs/epoll: Reuse fd returned from epoll for internal signaling to avoid the usage of nuttx special extension(POLLFILE) Signed-off-by: Xiang Xiao --- fs/vfs/fs_epoll.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/fs/vfs/fs_epoll.c b/fs/vfs/fs_epoll.c index 7d923c128ba..51e99fe256f 100644 --- a/fs/vfs/fs_epoll.c +++ b/fs/vfs/fs_epoll.c @@ -50,8 +50,6 @@ struct epoll_head int occupied; int crefs; mutex_t lock; - struct file fp; - struct inode in; FAR epoll_data_t *data; FAR struct pollfd *poll; }; @@ -190,14 +188,6 @@ static int epoll_do_create(int size, int flags) eph->data = (FAR epoll_data_t *)(eph + 1); eph->poll = (FAR struct pollfd *)(eph->data + reserve); - INODE_SET_DRIVER(&eph->in); - eph->in.u.i_ops = &g_epoll_ops; - eph->fp.f_inode = &eph->in; - eph->in.i_private = eph; - - eph->poll[0].ptr = &eph->fp; - eph->poll[0].events = POLLIN | POLLFILE; - /* Alloc the file descriptor */ fd = file_allocate(&g_epoll_inode, flags, 0, eph, 0, true); @@ -209,6 +199,11 @@ static int epoll_do_create(int size, int flags) return ERROR; } + /* Setup the first pollfd for internal use */ + + eph->poll[0].fd = fd; + eph->poll[0].events = POLLIN; + return fd; }