JFLib

plat/control_ipc_apple.rs (Apple)#

Source: lib/plat/control_ipc_apple.rs

Nonblocking Unix sockets restricted to the effective user on macOS and iOS (libSystem; the same
promises as control_ipc_linux.rs).  The peer's user comes from getpeereid.  Darwin has no abstract
socket names: the app's single instance is a socket file in a private folder of the user, a stale
one (nobody answers) is replaced.  Socket paths never accept external directory or file input.
  • struct Listener Private local listener. Dropping it closes and removes only its own socket path.

  • struct Stream One nonblocking authenticated local connection.

impl Listener

  • fn bind(app: &str) -> Result<Self, i32> Bind below a verified, non-symlink, mode-0700 directory owned by the effective UID.
  • fn endpoint(&self) -> &str Address to advertise only while control is active.
  • fn accept(&mut self) -> Result<Option<Stream>, i32> Accept at most one available connection and validate its effective UID (getpeereid).

impl Stream

  • fn read(&mut self, bytes: &mut [u8]) -> Result<Option<usize>, i32> Read available bytes. None means would block; Some(0) means peer EOF.
  • fn write(&mut self, bytes: &[u8]) -> Result<Option<usize>, i32> Write available bytes without SIGPIPE (SO_NOSIGPIPE). None means would block.

Source: docs/API.md in the JFLib repository.