This adds a new type called `DeferredFdCloser` that can be used to close
files by their fd in a way that is safe even if the file is currently
held using `fdget`.
This is done by grabbing an extra refcount to the file and dropping it
in a task work once we return to userspace.
See comments on `binder_do_fd_close` and commit `80cd795630d65` for
motivation.
Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
---
[...]
+/// Helper used for closing file descriptors in a way that is safe even if the file is currently
+/// held using `fdget`.
+///
+/// See comments on `binder_do_fd_close` and commit `80cd795630d65`.
+pub struct DeferredFdCloser {
+ inner: Box<DeferredFdCloserInner>,
+}
+
[...]