Skip to content

Process

Defined in: src/process.ts:51

A process, basically the same as struct task_struct

new Process(init?): Process

Defined in: src/process.ts:126

ProcessInit = {}

Process

protected readonly _exited: PromiseWithResolvers<number>

Defined in: src/process.ts:70


argv: string[]

Defined in: src/process.ts:85


caps: Capabilities

Defined in: src/process.ts:95

What the process is allowed to do beyond what its uid allows, inherited across a fork


readonly caught: Set<Signal>

Defined in: src/process.ts:62

The signals userspace asked to handle itself, i.e. the ones with something other than SIG_DFL. The kernel raises these on the thread instead of acting on them.


readonly children: Set<Process>

Defined in: src/process.ts:83


optional code?: number

Defined in: src/process.ts:98

What the process stopped with, once it has.


readonly context: FSContext

Defined in: src/process.ts:53

The context this process runs in. Its id is the pid.


env: Record<string, string> = {}

Defined in: src/process.ts:86


optional exe?: string

Defined in: src/process.ts:92

The path of the program currently loaded


readonly exited: Promise<number>

Defined in: src/process.ts:73

Resolves with the exit code once the process has stopped


optional killed_by?: Signal

Defined in: src/process.ts:101

The signal that killed the process, if one did


optional parent?: Process

Defined in: src/process.ts:81

Whatever forked this process, or whatever adopted it once that exited.


readonly sigHandlers: Map<Signal, Set<SignalHandler>>

Defined in: src/process.ts:110

What the process has asked to be told about, like struct sighand_struct. A signal with nothing here gets its default_action.


readonly sigwait: WaitQueue

Defined in: src/process.ts:68

Woken when a signal is raised on the process, so a syscall the kernel is still working on can come back with EINTR instead of leaving the thread waiting on something nobody will finish.


stopped: boolean = false

Defined in: src/process.ts:104

Whether a job control signal has stopped the process, like JOBCTL_STOPPED


optional thread?: Thread

Defined in: src/process.ts:56

What the process is running on, once it has been given a program


protected readonly timers: Map<number, { interval: number; started: number; timer: Timeout; value: number; }>

Defined in: src/process.ts:313

The interval timers, by ITIMER_*, i.e. signal->real_timer and the two that count CPU time.


readonly tty: TTY | null

Defined in: src/process.ts:89

The controlling terminal


static exit: any

Defined in: src/process.ts:351

get comm(): string

Defined in: src/process.ts:122

The name of the program without its path.

string


get cwd(): string

Defined in: src/process.ts:152

string


get pid(): number

Defined in: src/process.ts:113

A pid is the id of the process’ context.

number


get ppid(): number

Defined in: src/process.ts:117

number


get zombie(): boolean

Defined in: src/process.ts:76

Whether the process has stopped but not yet been waited for

boolean

[dispose](): void

Defined in: src/process.ts:347

void


catch_signal(signal): void

Defined in: src/process.ts:184

Tell the kernel userspace handles this signal itself, i.e. it is no longer SIG_DFL

SignalLike

void


chdir(directory): void

Defined in: src/process.ts:156

string

void


dispose(): void

Defined in: src/process.ts:342

void


exit(code?): void

Defined in: src/process.ts:240

Stop the process.

What is left is a zombie: it keeps its pid and its exit code until its parent waits for it, the way Linux keeps one around so a wait that comes late still has something to find.

number = 0

void


kill(signal): boolean

Defined in: src/process.ts:196

Send a signal to the process

SignalLike

boolean


reap(): void

Defined in: src/process.ts:277

Drop what is left of a stopped process, i.e. what a wait does once it has the exit code

void


setitimer(which, value, interval): object

Defined in: src/process.ts:318

Arm or disarm an interval timer, i.e. setitimer.

number

number

number

object

interval: number

value: number


sig_action(signal, handler): void

Defined in: src/process.ts:164

Ask to be told when a signal arrives, like sigaction with a handler.

SignalLike

SignalHandler

void


sig_default(signal, handler?): void

Defined in: src/process.ts:177

Stop listening for a signal, like going back to SIG_DFL. Without a handler every one installed for the signal is taken off.

SignalLike

SignalHandler

void


uncatch_signal(signal): void

Defined in: src/process.ts:191

Go back to the default action for a signal

SignalLike

void


wait(pid?): Promise<number>

Defined in: src/process.ts:291

Wait for a child to stop and take its exit code.

number = -1

which child, or -1 for whichever stops first

Promise<number>

ECHILD when there is no such child