Hacker News new | past | comments | ask | show | jobs | submit login

Isn’t this the whole point of using file descriptors? As long as you have an open file descriptor, the kernel resource it references should remain stable. And if the resource is unexpectedly destroyed from under the process’s nose, the file descriptor should report an I/O error the next time you try to read or write from it.



> Isn’t this the whole point of using file descriptors?

Opening the same file multiple times will yield different fds, and the paths can be modified independently of the fd.

The goal here is to find if:

1. there are new input devices

2. which are joysticks (a category which, for SDL, includes gamepads, so basically "has the user plugged in a new gamepad they might want to use for the game")

How would keeping a bunch of fds around help?




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: