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]>
23 lines
978 B
C++
23 lines
978 B
C++
#pragma once
|
|
|
|
// Where the OS wants ephemeral runtime state and persistent user data to live, before
|
|
// velox appends its own "/velox" subdirectory and applies the shared 0700-and-owned check
|
|
// (rpc/runtime_dir.cpp — that enforcement is portable POSIX logic and stays there; only
|
|
// "which base directory" is per-OS). Linux: XDG. macOS: $TMPDIR (runtime) and
|
|
// ~/Library/Application Support (data) — see docs/08-porting.md "API mapping".
|
|
|
|
#include <string>
|
|
#include <system_error>
|
|
|
|
namespace velox::daemon::rpc::platform {
|
|
|
|
// The base directory ephemeral runtime state (sockets, lock files) should live under,
|
|
// e.g. "$XDG_RUNTIME_DIR" or "/run/user/<uid>" on Linux. No trailing slash.
|
|
std::error_code runtime_base_dir(std::string& out);
|
|
|
|
// The base directory persistent user data should live under, e.g. "$XDG_DATA_HOME" or
|
|
// "~/.local/share" on Linux. No trailing slash.
|
|
std::error_code data_base_dir(std::string& out);
|
|
|
|
} // namespace velox::daemon::rpc::platform
|