Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it safe to use inotify descriptors after they have been closed. #1

Closed
lpsmith opened this issue Aug 6, 2014 · 0 comments
Closed

Comments

@lpsmith
Copy link
Owner

lpsmith commented Aug 6, 2014

It turns out that the way I thought descriptors were allocated on Linux was completely incorrect, see for example jaspervdj/websockets-snap#10. Since descriptors are in fact likely to be soon reused whenever there is even a modest amount of descriptor churn, I do think it would be a good idea to protect against use-after-close faults.

This could be accomplished by adding an MVar Bool to the Inotify structure representing the descriptor, or by storing the descriptor itself inside a MVar (Maybe Fd). As a side benefit, it would also make it possible to make all the other operators thread-safe.

@lpsmith lpsmith closed this as completed in 7391b56 Aug 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant