Skip to content

Comment on Way too many ways to wait on a child process with a timeout

Comments

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.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.