#pragma once // Identifies the process on the other end of a connected Unix-domain socket, for the // same-UID check that is the Unix transport's authorization boundary (docs/01 §2, // CLAUDE.md §4). `SO_PEERCRED`/`struct ucred` is Linux-only; macOS has `getpeereid`, // Windows named pipes carry a token instead (docs/08-porting.md "The seams" / // "API mapping"). The same-UID check itself is the security property and must not change // per-OS (docs/adr/0020 decision 2). #include namespace velox::daemon::rpc::platform { struct PeerId { unsigned int uid = 0; }; // On success, fills `out` with the peer's identity of the already-connected `fd`. On // failure, `out` is untouched and the error_code explains why (matches errno on Linux). std::error_code peer_of(int fd, PeerId& out); } // namespace velox::daemon::rpc::platform