passfd allows passing file descriptors between unrelated processes using Unix sockets.

Both tokio 0.1 and 0.2 are supported with tokio_01 and tokio_02 features. Please note that these features rely on internal representation of UnixStream and are unsafe.

use passfd :: FdPassingExt ; use std :: fs :: File ; use std :: os :: unix :: io :: AsRawFd ; use std :: os :: unix :: net :: UnixListener ; fn main () { let file = File :: open ( "/etc/passwd" ). unwrap (); let listener = UnixListener :: bind ( "/tmp/test.sock" ). unwrap (); let ( stream , _ ) = listener . accept (). unwrap (); stream . send_fd ( file . as_raw_fd ()). unwrap (); }