Skip to content
Open
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
16 changes: 14 additions & 2 deletions components/libc/posix/io/poll/poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,28 @@ static int do_pollfd(struct pollfd *pollfd, rt_pollreq_t *req)
if (fd >= 0)
{
struct dfs_file *f = fd_get(fd);
const struct dfs_file_ops *fops = RT_NULL;
mask = POLLNVAL;

if (f)
{
#ifdef RT_USING_DFS_V2
fops = f->fops;
#else
if (f->vnode)
{
fops = f->vnode->fops;
}
#endif
}
if (fops)
{
mask = POLLMASK_DEFAULT;
if (f->vnode->fops->poll)
if (fops->poll)
{
req->_key = pollfd->events | POLLERR | POLLHUP;

mask = f->vnode->fops->poll(f, req);
mask = fops->poll(f, req);

/* dealwith the device return error -1*/
if (mask < 0)
Expand Down
Loading