pub(crate) fn write_fd_all(
fd: &OwnedFd,
data: &[u8],
idle: Duration,
) -> Result<(), String>Expand description
Write all of data to fd, tolerating a slow reader up to idle per chunk.
EPIPE is success-shaped: the paster stopped reading, which is its right.
The fd is switched to non-blocking for the transfer (original flags are restored on every exit path): a single blocking write() of a large payload would stay parked in the kernel once the peer stops draining mid-transfer, and the poll deadline could never fire. With O_NONBLOCK, write() returns EAGAIN instead and the idle deadline bounds the whole transfer.