export interface NativeProcessIdentity { pid: number; process_group_id: number | null; started_identity: string; argv_digest: string; } export interface RuntimeProcess extends NativeProcessIdentity { executable?: string; parent_pid: number; cpu_seconds: number; command: string; stopped: boolean | null; } export declare function processIdentity(process: RuntimeProcess): NativeProcessIdentity; export declare function parseCpuTime(value: string): number; export declare function parsePosixProcessTable(text: string): RuntimeProcess[]; /** * hookを起動したharnessのprocess。shellを通す形のhookでは、harnessとhookの間にshellが挟まる。 * 挟まったshellはhookと一緒に終わるので、`pid`から先祖をたどり、shellでない最初のprocessを返す。 */ export declare function hookOwnerProcess(rows: readonly RuntimeProcess[], pid: number): RuntimeProcess | undefined; /** そのpidのprocessが今あるか。OSへ直接聞き、processを起こさない。権限が無くて触れないprocessも「ある」と読む。 */ export declare function processExists(pid: number): boolean; /** * 指定したpidだけの開始時刻。readRuntimeProcessesと同じ値を返し、process表に無いpidは返さない。全processの一覧を取らない。 * 開始時刻を読めないprocess(別の権限のserviceなど)は、pidがprocess表にある印として `started_identity: null` で返す。 */ export declare function readProcessIdentities(pids: readonly number[]): { pid: number; started_identity: string | null; }[]; /** そのpidのprocessが、記録にある本人(pidと開始時刻の組)のまま居るか。居ないと分かっている時はprocessを起こさない。 */ export declare function processIsRunning(pid: number, startedIdentity: string): boolean; /** * `pid` と、その先祖のprocess(近い順)。hookOwnerProcessへ渡す行を、全processの一覧を取らずに作る。 * Windowsは.NETのprocessの読みで親をたどる(`command` は実行fileのpathで、引数は入らない)。読めない時と、ほかのOSは、 * 今までどおり全processの一覧を返す。 */ export declare function readProcessLineage(pid: number, depth?: number): RuntimeProcess[]; export declare function readRuntimeProcesses(): RuntimeProcess[];