← Back to context

Comment by akira2501

1 month ago

> I would prefer extending poll to support things other than file descriptors, instead of converting everything a file descriptor to be able to use poll.

Why? The ability to block on these descriptors as a one off rather than wrapping into a poll makes them extremely useful and avoids the race issues that exist with signal handlers and other non-blocking mechanisms.

signalfd, timerfd, eventfd, userfaultfd, pidfd are all great applications of this strategy.

One issue is that fds are a relatively limited and relatively heavyweight resource.

  • They used to be.

        $ cat /proc/sys/fs/file-max
        3235242
    

    And `nr_open` has been 1048576 for a long time. The default quota limit is 1024 but that is easy to change.