isProcessSandboxed

fnbool isProcessSandboxed(int pid) @trusted

Checks if a process is running in a sandbox environment.

This function detects various sandboxing mechanisms across platforms:

  • Linux: seccomp, containers, namespaces
  • Windows: AppContainer, low integrity
  • macOS: sandboxd, Seatbelt profiles

Parameters

pidThe process ID to check.

Returns

true if the process is sandboxed, false otherwise.

Example:

version (linux) {
  import core.sys.linux.unistd : getpid;
  bool sandboxed = isProcessSandboxed(getpid());
  writeln("Sandboxed: ", sandboxed);
}