Skip to content

CreateTask

Creates a task in a space.

Number Selector Blocking Since
0x04 SVC_CREATE OBJECT_TASK (0) no 2.0
Handle CreateTask(Handle space_handle);

Registers: (space) -> r0 task handle or error

The task does not run until TaskStart().

Its priority and maximum priority start at the caller's, capped by the space's maximum.

Parameters

Name Direction Description
space_handle in Space to create it in, with PERM_CNTL; -1 for the caller's own space.

Returns

A task handle with all permissions, or a negative error code.

Errors

Error Condition
ERR_BADHANDLE space_handle is not a live handle.
ERR_BADTYPE space_handle is not a space.
ERR_NOPERM space_handle lacks PERM_CNTL.
ERR_DEAD The space has been torn down.
ERR_BUSY The task could not be created (no kernel stack or task slot left).
ERR_NOMEM The caller's handle table is full.