Skip to content

Commit 0c7a143

Browse files
authored
Add missing epoll links (#1099)
* Add missing epoll links * Remove incorrect comment * Tweak the epoll docs some more Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com> --------- Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
1 parent 2293963 commit 0c7a143

File tree

1 file changed

+36
-7
lines changed

1 file changed

+36
-7
lines changed

src/backend/linux_raw/event/epoll.rs

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ bitflags! {
154154
///
155155
/// Use the [`CreateFlags::CLOEXEC`] flag to prevent the resulting file
156156
/// descriptor from being implicitly passed across `exec` boundaries.
157+
///
158+
/// # References
159+
///
160+
/// - [Linux]
161+
///
162+
/// [Linux]: https://man7.org/linux/man-pages/man2/epoll_create.2.html
157163
#[inline]
158164
#[doc(alias = "epoll_create1")]
159165
pub fn create(flags: CreateFlags) -> io::Result<OwnedFd> {
@@ -166,12 +172,17 @@ pub fn create(flags: CreateFlags) -> io::Result<OwnedFd> {
166172
/// This registers interest in any of the events set in `events` occurring on
167173
/// the file descriptor associated with `data`.
168174
///
169-
/// If [`delete`] is not called on the I/O source passed into this function
170-
/// before the I/O source is `close`d, then the `epoll` will act as if the I/O
171-
/// source is still registered with it. This can lead to spurious events being
172-
/// returned from [`wait`]. If a file descriptor is an
173-
/// `Arc<dyn SystemResource>`, then `epoll` can be thought to maintain a
174-
/// `Weak<dyn SystemResource>` to the file descriptor.
175+
/// Note that `close`ing a file descriptor does not necessarily unregister interest
176+
/// which can lead to spurious events being returned from [`wait`]. If a file descriptor
177+
/// is an `Arc<dyn SystemResource>`, then `epoll` can be thought to maintain a
178+
/// `Weak<dyn SystemResource>` to the file descriptor. Check the [faq] for details.
179+
///
180+
/// # References
181+
///
182+
/// - [Linux]
183+
///
184+
/// [Linux]: https://man7.org/linux/man-pages/man2/epoll_ctl.2.html
185+
/// [faq]: https://man7.org/linux/man-pages/man7/epoll.7.html#:~:text=Will%20closing%20a%20file%20descriptor%20cause%20it%20to%20be%20removed%20from%20all%0A%20%20%20%20%20%20%20%20%20%20epoll%20interest%20lists%3F
175186
#[doc(alias = "epoll_ctl")]
176187
#[inline]
177188
pub fn add(
@@ -198,6 +209,12 @@ pub fn add(
198209
/// given epoll object.
199210
///
200211
/// This sets the events of interest with `target` to `events`.
212+
///
213+
/// # References
214+
///
215+
/// - [Linux]
216+
///
217+
/// [Linux]: https://man7.org/linux/man-pages/man2/epoll_ctl.2.html
201218
#[doc(alias = "epoll_ctl")]
202219
#[inline]
203220
pub fn modify(
@@ -223,6 +240,12 @@ pub fn modify(
223240

224241
/// `epoll_ctl(self, EPOLL_CTL_DEL, target, NULL)`—Removes an element in a
225242
/// given epoll object.
243+
///
244+
/// # References
245+
///
246+
/// - [Linux]
247+
///
248+
/// [Linux]: https://man7.org/linux/man-pages/man2/epoll_ctl.2.html
226249
#[doc(alias = "epoll_ctl")]
227250
#[inline]
228251
pub fn delete(epoll: impl AsFd, source: impl AsFd) -> io::Result<()> {
@@ -239,8 +262,14 @@ pub fn delete(epoll: impl AsFd, source: impl AsFd) -> io::Result<()> {
239262
///
240263
/// For each event of interest, an element is written to `events`. On
241264
/// success, this returns the number of written elements.
265+
///
266+
/// # References
267+
///
268+
/// - [Linux]
269+
///
270+
/// [Linux]: https://man7.org/linux/man-pages/man2/epoll_wait.2.html
242271
#[cfg(feature = "alloc")]
243-
#[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
272+
#[cfg_attr(doc_cfg, doc(cfg(feature = "alloc"), alias = "epoll_wait"))]
244273
#[inline]
245274
pub fn wait(epoll: impl AsFd, event_list: &mut EventVec, timeout: c::c_int) -> io::Result<()> {
246275
// SAFETY: We're calling `epoll_wait` via FFI and we know how it

0 commit comments

Comments
 (0)