Skip to main content

Module process_use

Module process_use 

Source
Expand description

The processes of this host that use a directory or a file. What: The processes of this host that use a directory or a file: a working directory or an open descriptor inside the directory, or an open descriptor on the file. Why: Recovery may treat a directory or a lock as abandoned only when no process can still be using it. A process that holds a path open is the one proof of use that survives a lost record, so the scan reads it from /proc and says what it could not read instead of guessing. Only processes of the scanning account are reported as unreadable: another account’s process cannot have opened a private file this account created, and every unprivileged scan meets some of them.

In TS you’d write (pseudocode):

const users = await processesUsing({ target: { inside: directory }, selfPid: process.pid });

Structs§

ProcessUser
One process found using the target.
UseScan
What: The processes found using a target and the reasons the scan could not see everything. Why: A caller that cannot rely on a scan with no process table refuses when unavailable is set; unreadable lists single processes the scan could not see into, which a caller may or may not tolerate.

Enums§

UseTarget
What: What a scan looks for. Why: A directory is matched by path because a record inside it may be opened under any name; a file is matched by device and inode because a lock has more than one name.

Constants§

PROC_ROOT
The root of the process table on Linux.

Functions§

processes_using
What: Every other process that uses the target on this host. Why: The production scan of processes_using_through.
processes_using_through
What: Every process other than self_pid that uses the target, through a proc root. Why: Recovery runs this only after a record is missing or a lock is unproven, so the scan costs nothing on a commit that finds its state whole.