Skip to content
Français

LockInspectionState

The fields below cover all variants; the signature specifies their allowed combinations.

  • ownershipOptional
    LockOwnership | undefined
    Whether the recorded process still holds the lock, judged by host, boot, PID namespace and process start time. Rely on it rather than on state.
  • stateRequired
    "present" | "absent" | "unknown" | "skipped"
    present: a process with the recorded PID exists; absent: none exists; unknown: the file or PID could not be read or probed; skipped: the entry is not a file.
  • pidVariant-dependent
    number | number | undefined
    PID read from the lock file, absent when the file or its PID is unreadable.
  • reasonVariant-dependent
    string | "NOT_FILE"
    Why the state is unknown (LOCK_READ_FAILED, INVALID_PID, PID_PROBE_FAILED) or skipped (NOT_FILE).
export type LockInspectionState = {
  readonly ownership?: LockOwnership;
} & (
  | {
      readonly state: "present" | "absent";
      readonly pid: number;
    }
  | {
      readonly state: "unknown";
      readonly reason: string;
      readonly pid?: number;
    }
  | {
      readonly state: "skipped";
      readonly reason: "NOT_FILE";
    }
);