Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions fs/vfs/fs_epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ static const struct file_operations g_epoll_ops =
#endif
};

static struct inode g_epoll_inode =
{
.i_crefs = 1,
.i_flags = FSNODEFLAG_TYPE_DRIVER,
.u =
{
.i_ops = &g_epoll_ops,
},
};

/****************************************************************************
* Private Functions
****************************************************************************/
Expand All @@ -109,12 +119,12 @@ static FAR struct epoll_head *epoll_head_from_fd(int fd)
return NULL;
}

return (FAR struct epoll_head *)filep->f_inode->i_private;
return (FAR struct epoll_head *)filep->f_priv;
}

static int epoll_do_open(FAR struct file *filep)
{
FAR struct epoll_head *eph = filep->f_inode->i_private;
FAR struct epoll_head *eph = filep->f_priv;
int ret;

ret = nxsem_wait(&eph->sem);
Expand All @@ -130,7 +140,7 @@ static int epoll_do_open(FAR struct file *filep)

static int epoll_do_close(FAR struct file *filep)
{
FAR struct epoll_head *eph = filep->f_inode->i_private;
FAR struct epoll_head *eph = filep->f_priv;
int ret;

ret = nxsem_wait(&eph->sem);
Expand Down Expand Up @@ -187,7 +197,7 @@ static int epoll_do_create(int size, int flags)

/* Alloc the file descriptor */

fd = files_allocate(&eph->in, flags, 0, eph, 0);
fd = files_allocate(&g_epoll_inode, flags, 0, eph, 0);
if (fd < 0)
{
nxsem_destroy(&eph->sem);
Expand All @@ -196,6 +206,7 @@ static int epoll_do_create(int size, int flags)
return -1;
}

inode_addref(&g_epoll_inode);
nxsem_post(&eph->sem);
return fd;
}
Expand Down