Skip to content

feat: ignore negative fd and clear its revents in poll(2)

Steve Lau requested to merge SteveLauC/relibc:feat/ignore_neg_fd_poll into master

This PR makes the poll(2) system call ignore the passed pollfd with a negative file descriptor and sets its revents field to 0 following Linux's behavior:

If this field is negative, then the corresponding events field is ignored and the revents field returns zero.

Checks

  • What functions (if any) have been implemented or changed

    poll(2)

  • The rationale behind your merge request (e.g. why you thought this change was required. If you are just implementing some functions, you can ignore this)

    See issue #188 (closed)

  • Any issues that are related to the merge request

    #188 (closed)

Test

I would like to have a test for this feature, but I didn't any tests for poll(2), only tests for epoll, I guess this is because poll(2) is emulated through epoll in relibc?

Merge request reports