Small unix utility crates: tiny-nix-ipc, shmemfdrs, pdfork

Hello everyone! I made three little useful utility libraries related to various UNIX APIs:

tiny-nix-ipc

A thin yet convenient wrapper for using (UNIX domain) sockets for simple synchronous IPC via sendmsg()/recvmsg(), which allows file descriptor passing.
You can easily send byte slices, custom structs (as raw memory), and Serde-serializable values (with CBOR, JSON or Bincode).

shmemfdrs

Creates anonymous shared memory file descriptors.
Uses memfd on Linux, SHM_ANON on FreeBSD, shm_unlink elsewhere.

pdfork

A fork() wrapper that uses process descriptors (pdfork()) on FreeBSD and normal fork elsewhere.
Process descriptors are immune to PID race conditions (they track the exact process in the kernel) and they work in the Capsicum sandbox.

8 Likes