There is no real need to close descriptors before a process exits, but these close calls demonstrate by example that kqueue descriptors occupy the same namespace as other file descriptors.
Details
Details
- Reviewers
fernape markj - Commits
- rG20c9c3be5acc: kqueue: add close() calls to man page example
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
linux inotify man page states
* When all file descriptors referring to an inotify instance have been closed (using close(2)), the underlying object and its resources are freed for reuse by the kernel; all associated watches are automatically freed.
perhaps we should have similar text
Comment Actions
LGTM!
Thank your for this. It makes the example clearer in intention. Notice though, that the two calls to close(2) will never be reached due to the infinite loop.
When that paragraph talks about ..all file descriptors referring to an inotify instance..., what does it mean? Calling dup(2) on the fd returned by inotify_init(2)? How else is it possible to have more than one fd for an inotify instance?
Comment Actions
Calling dup(2) on the fd returned by inotify_init(2)? How else is it possible to have more than one fd for an inotify instance?
A process forking could be another example.