pspawn
| Number | 0x06 |
|---|---|
| Signature | (args*) -> {handle, pid} or -err |
| Group | task |
| Since | 1.0 |
Create a frozen child process. First step of the three-step spawn sequence:
pspawncreates a new FROZEN process and returns its handle and PID.asinjectfills the new process’s address space with parsed ELF data.kickstartmarks the process schedulable.
The child inherits the caller’s first four handle slots (0–3), so it starts with the name-server endpoint in slot 0 and can reach the system without further setup.
Pitfalls
The returned process is FROZEN and will not run until kickstart. Because asinject is
init-only, ordinary processes spawn children by messaging init rather than driving the
sequence themselves.
The task handle is retained after kickstart: hold it to pkill or wait the child; it
is your only reference to it.
Arguments
| Register | Name | Description |
|---|---|---|
r0 | args | Pointer to a `spawn_args_t`; carries the process name and its length |
Returns
r0 = task handle slot in the caller's table; r1 = the new child's PID.
Errors
| Code | Condition |
|---|---|
ERR_BADPTR | Args pointer invalid, or the name could not be copied |
ERR_BADARG | `size` is smaller than `sizeof(spawn_args_t)` |
ERR_NOMEM | Could not create the process, or the caller's handle table is full |