Process
Defined in: src/process.ts:51
A process, basically the same as struct task_struct
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Process(
init?):Process
Defined in: src/process.ts:126
Parameters
Section titled “Parameters”ProcessInit = {}
Returns
Section titled “Returns”Process
Properties
Section titled “Properties”_exited
Section titled “_exited”
protectedreadonly_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
caught
Section titled “caught”
readonlycaught: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.
children
Section titled “children”
readonlychildren:Set<Process>
Defined in: src/process.ts:83
optionalcode?:number
Defined in: src/process.ts:98
What the process stopped with, once it has.
context
Section titled “context”
readonlycontext: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
optionalexe?:string
Defined in: src/process.ts:92
The path of the program currently loaded
exited
Section titled “exited”
readonlyexited:Promise<number>
Defined in: src/process.ts:73
Resolves with the exit code once the process has stopped
killed_by?
Section titled “killed_by?”
optionalkilled_by?:Signal
Defined in: src/process.ts:101
The signal that killed the process, if one did
parent?
Section titled “parent?”
optionalparent?:Process
Defined in: src/process.ts:81
Whatever forked this process, or whatever adopted it once that exited.
sigHandlers
Section titled “sigHandlers”
readonlysigHandlers: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.
sigwait
Section titled “sigwait”
readonlysigwait: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
Section titled “stopped”stopped:
boolean=false
Defined in: src/process.ts:104
Whether a job control signal has stopped the process, like JOBCTL_STOPPED
thread?
Section titled “thread?”
optionalthread?:Thread
Defined in: src/process.ts:56
What the process is running on, once it has been given a program
timers
Section titled “timers”
protectedreadonlytimers: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.
readonlytty:TTY|null
Defined in: src/process.ts:89
The controlling terminal
staticexit:any
Defined in: src/process.ts:351
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get comm():
string
Defined in: src/process.ts:122
The name of the program without its path.
Returns
Section titled “Returns”string
Get Signature
Section titled “Get Signature”get cwd():
string
Defined in: src/process.ts:152
Returns
Section titled “Returns”string
Get Signature
Section titled “Get Signature”get pid():
number
Defined in: src/process.ts:113
A pid is the id of the process’ context.
Returns
Section titled “Returns”number
Get Signature
Section titled “Get Signature”get ppid():
number
Defined in: src/process.ts:117
Returns
Section titled “Returns”number
zombie
Section titled “zombie”Get Signature
Section titled “Get Signature”get zombie():
boolean
Defined in: src/process.ts:76
Whether the process has stopped but not yet been waited for
Returns
Section titled “Returns”boolean
Methods
Section titled “Methods”[dispose]()
Section titled “[dispose]()”[dispose]():
void
Defined in: src/process.ts:347
Returns
Section titled “Returns”void
catch_signal()
Section titled “catch_signal()”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
Parameters
Section titled “Parameters”signal
Section titled “signal”Returns
Section titled “Returns”void
chdir()
Section titled “chdir()”chdir(
directory):void
Defined in: src/process.ts:156
Parameters
Section titled “Parameters”directory
Section titled “directory”string
Returns
Section titled “Returns”void
dispose()
Section titled “dispose()”dispose():
void
Defined in: src/process.ts:342
Returns
Section titled “Returns”void
exit()
Section titled “exit()”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.
Parameters
Section titled “Parameters”number = 0
Returns
Section titled “Returns”void
kill()
Section titled “kill()”kill(
signal):boolean
Defined in: src/process.ts:196
Send a signal to the process
Parameters
Section titled “Parameters”signal
Section titled “signal”Returns
Section titled “Returns”boolean
reap()
Section titled “reap()”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
Returns
Section titled “Returns”void
setitimer()
Section titled “setitimer()”setitimer(
which,value,interval):object
Defined in: src/process.ts:318
Arm or disarm an interval timer, i.e. setitimer.
Parameters
Section titled “Parameters”number
number
interval
Section titled “interval”number
Returns
Section titled “Returns”object
interval
Section titled “interval”interval:
number
value:
number
sig_action()
Section titled “sig_action()”sig_action(
signal,handler):void
Defined in: src/process.ts:164
Ask to be told when a signal arrives, like sigaction with a handler.
Parameters
Section titled “Parameters”signal
Section titled “signal”handler
Section titled “handler”Returns
Section titled “Returns”void
sig_default()
Section titled “sig_default()”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.
Parameters
Section titled “Parameters”signal
Section titled “signal”handler?
Section titled “handler?”Returns
Section titled “Returns”void
uncatch_signal()
Section titled “uncatch_signal()”uncatch_signal(
signal):void
Defined in: src/process.ts:191
Go back to the default action for a signal
Parameters
Section titled “Parameters”signal
Section titled “signal”Returns
Section titled “Returns”void
wait()
Section titled “wait()”wait(
pid?):Promise<number>
Defined in: src/process.ts:291
Wait for a child to stop and take its exit code.
Parameters
Section titled “Parameters”number = -1
which child, or -1 for whichever stops first
Returns
Section titled “Returns”Promise<number>
Throws
Section titled “Throws”ECHILD when there is no such child