daemon: Phase 0 platform seams (ADR 0020) — eventfd/SO_PEERCRED/instance-lock/XDG behind platform/, zero behaviour change
Introduces the four rpc-layer seams docs/08-porting.md calls for this lane: platform::Wakeup (eventfd), platform::peer_of (SO_PEERCRED/struct ucred, same-UID check preserved unchanged), platform::acquire_instance_lock (abstract-namespace socket), platform::runtime_base_dir/data_base_dir (XDG lookups). Today's Linux code moves unchanged into daemon/src/rpc/platform/linux/; the seam headers carry no OS types and no #ifdef. No fifth interface for timerfd: EventLoop gains a portable add_timer() that folds the next deadline into poll()'s own timeout, replacing both timerfd instances in main.cpp — the loop already computes a deadline, so this needs no per-OS backend at all. Full suite 59/59 green; no #ifdef outside platform/linux/, no behaviour change. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#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 <system_error>
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user