Skip to main content

inherited_datagram

Function inherited_datagram 

Source
pub fn inherited_datagram(fd: RawFd) -> Result<OwnedFd, Inherited>
Expand description

A close-on-exec copy of the inherited Unix datagram socket at fd.

Call it before starting threads that open or close descriptors: the number is borrowed while it is copied, and must not be closed or replaced meanwhile. What is checked and returned is the copy, so a later change of the number doesn’t matter.

§Errors

Inherited when fd is stdin, stdout, stderr or negative, isn’t open, isn’t a Unix datagram socket, or can’t be duplicated.