async-send-fd

Crates.ioasync-send-fd
lib.rsasync-send-fd
version1.2.0
sourcesrc
created_at2024-04-08 19:57:02.234791
updated_at2024-05-22 14:31:43.756298
descriptionA wrapper for async UnixStream's to send file descriptors
homepage
repositoryhttps://github.com/alexander-smoktal/async-send-fd
max_upload_size
id1201084
size24,110
Alexander Smoktal (alexander-smoktal)

documentation

README

async-send-fd

A library for sending and receiving Unix file descriptors over async UnixStream connections.

Crates.io MIT licensed Build Status

Overview

The crate is a library for sending and receiving Unix file descriptors over Tokio or Smol UnixStream connections. You can send RawFd or UnixStream using provided interfaces.

See test_smol_stream.rs or test_tokio_stream.rs for code examples.

Creating tokio::net::UnixStream from RawFd

If you make a Tokio UnixStream from a raw file descriptor made by an OS call (e.g. UnixStream::pair), you must make it set_nonblocking(true), otherwise receivers scheduler will block writing into the socket ⚠️

Smol UnixStream does it automatically if created using UnixStream::from(Async::new(stream))

Transfering socket pair ownership

Note: the library closes Tokio stream if sent into another process.

Features

  • tokio - for Tokio support
  • smol - for Smol support
Commit count: 23

cargo fmt