From: Ian Jackson Date: Mon, 17 May 2021 13:48:35 +0000 (+0100) Subject: timedfd: Add note re nonblock open-file X-Git-Tag: otter-0.6.0~219 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=7ee3018db9eb97390ac68bdb424cad08ceba189f;p=otter.git timedfd: Add note re nonblock open-file This is why we must swap both ends of a mgmtchannel at once. Signed-off-by: Ian Jackson --- diff --git a/src/timedfd.rs b/src/timedfd.rs index 91eed394..cffd5891 100644 --- a/src/timedfd.rs +++ b/src/timedfd.rs @@ -61,12 +61,17 @@ impl nix::Error { } impl TimedFd where RW: TimedFdReadWrite { + /// Takes ownership of the fd + /// + /// Will change the fd's open-file to nonblocking. #[throws(io::Error)] pub fn new(fd: F) -> TimedFd where F: IntoRawFd { Self::from_fd( Fd::from_raw_fd( fd.into_raw_fd() ))? } /// Takes ownership of the fd + /// + /// Will change the fd's open-file to nonblocking. #[throws(io::Error)] fn from_fd(fd: Fd) -> Self { fcntl(fd.as_raw_fd(), FcntlArg::F_SETFL(OFlag::O_NONBLOCK))