Expand description
Where Dreamer keeps per-user runtime and state files, and the checks that keep them private (spec 11.3: owner-restricted runtime directories and sockets).
| Directory | Default | Override |
|---|---|---|
| runtime (socket, lock) | $XDG_RUNTIME_DIR/dreamer, else $TMPDIR/dreamer-<uid>, else /tmp/dreamer-<uid> | DREAMER_RUNTIME_DIR |
| state (log, action ledger) | $XDG_STATE_HOME/dreamer, else ~/.local/state/dreamer | DREAMER_STATE_DIR |
| data (managed agent installs, Dreamer Web) | $XDG_DATA_HOME/dreamer, else ~/.local/share/dreamer | DREAMER_DATA_DIR |
Constants§
- SOCKET_
PATH_ MAX - The longest Unix socket path the system accepts, in bytes (the size of
sun_path, less its terminating NUL).
Functions§
- check_
socket_ path - Refuse a socket path the system could not bind, before trying, with a reason a person can act on.
- data_
dir - Data Dreamer installs and keeps for the user, such as managed agent harnesses and the Dreamer Web component. The same place on macOS and Linux.
- detach_
session - Detach from the launching terminal: a new session has no controlling terminal, so closing the terminal or SSH session sends it no hangup.
- heap_
in_ use - Bytes the allocator has handed out and not had back, without the freed
memory it keeps for reuse: what a process really holds, where resident
size also counts retained free pages.
Nonewhere it cannot tell. - ledger_
path - lock_
holder - The pid recorded in the daemon’s startup lock, if any.
- lock_
path - log_
path - owner_
only - Restrict a file (the socket, the log) to its owner.
- private_
dir - Create
dir(mode 0700) or check that the existing one belongs to this user and is closed to everyone else. Never loosens or takes over a directory it does not own. - process_
alive - Whether a process with this pid exists.
- release_
free_ memory - Hand memory that the allocator holds but no longer uses back to the
system: glibc’s
malloc_trim, or macOS’s malloc pressure relief. A daemon that has just dropped many terminal mirrors calls this so its resident size shrinks with them. Elsewhere it does nothing. - rpc_
socket_ path - The JSON-RPC endpoint, beside the native socket.
- runtime_
dir - session_
of - The session a process belongs to (diagnostics and tests).
- socket_
path - state_
dir - terminate
- Ask a process to stop (SIGTERM).
- terminate_
group - Signal a whole process group: SIGTERM, or SIGKILL with
force. - uid