zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.08k stars 6.19k forks source link

Implement Poll for non-socket based file descriptor #34457

Open Navin-Sankar opened 3 years ago

Navin-Sankar commented 3 years ago

Problem Description

Currently poll() and select() syscall implementation is tightly bounded to networking interface. Which mean's we can't use poll(), select() syscall without enabling the NETWORKING Kconfig

Solution

Copied from slack, from @jukkar

Currently the poll is implemented in networking via ioctl virtual method (struct fd_op_vtable), see also subsys/net/lib/sockets/sockets.c. I think this is not the best way and we should probably create virtual method for poll in fdtable if we want to implement poll for other type file descriptors

jukkar commented 7 months ago

There is k_poll() for polling kernel objects that can be used. For non networking related file descriptors some more work would be needed, but that is out of scope for networking so removing the label.