pkill
| Number | 0x08 |
|---|---|
| Signature | (task_handle) -> 0 or -err |
| Group | task |
| Since | 1.0 |
Terminate a child process through its task handle. The process is killed unconditionally unlike pquit, which a process calls on itself, pkill is how a parent ends a child. The child exits with status KILLED_TAG | KILL_BY_PARENT, which the parent reads through wait.
The task handle is consumed: the parent’s slot is freed as the process is killed.
Pitfalls
This operates on whole processes. There is no way to kill an individual thread; a thread ends by returning from its entry point or calling tquit.
Arguments
| Register | Name | Description |
|---|---|---|
r0 | task_handle | Slot index of a task handle from `pspawn` |
Returns
0 on success.
Errors
| Code | Condition |
|---|---|
ERR_BADHANDLE | No such handle, or the task has no live process or thread |
ERR_BADTYPE | Handle is not a task handle |