Skip to main content

running_process_platform_internal/platform/
private_dir.rs

1//! Owner-private directory permissions without local-IPC transport selection.
2//!
3//! Persisted registration records use the same host policy as IPC roots, but
4//! do not need a listener, endpoint naming, or transport implementation.
5
6/// Result of enforcing owner-private permissions on a local directory.
7#[cfg(feature = "private-dir")]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum OwnerPrivateDirectoryOutcome {
10    /// The existing directory already had the complete host policy.
11    AlreadyPrivate,
12    /// Permissions were applied or repaired.
13    Hardened,
14}
15
16/// Create a directory and enforce the selected host's owner-private policy.
17#[cfg(feature = "private-dir")]
18pub fn ensure_owner_private_directory(
19    path: &std::path::Path,
20) -> std::io::Result<OwnerPrivateDirectoryOutcome> {
21    crate::private_dir_ensure_owner_private_directory(path)
22}
23
24/// Return whether a directory has the selected host's owner-private policy.
25#[cfg(feature = "private-dir")]
26pub fn owner_private_directory(path: &std::path::Path) -> std::io::Result<bool> {
27    crate::private_dir_owner_private_directory(path)
28}