task_createcreates a new task from parent_task; the resulting task (child_task) acquires shared or copied parts of the parent's address space (see
vm_inherit). The child task initially contains no threads.
If inherit_memory is set, the child task's address space is built from the parent task according to its memory inheritance values; otherwise, the child task is given an empty address space.
The child task gets the three special ports created or copied for it at task creation. The
TASK_KERNEL_PORTis created and send rights for it are given to the child and returned to the caller. The
TASK_EXCEPTION_PORTare inherited from the parent task. The new task can get send rights to these ports with the call
The function returns
KERN_SUCCESSif a new task has been created,
KERN_INVALID_ARGUMENTif parent_task is not a valid task port and
KERN_RESOURCE_SHORTAGEif some critical kernel resource is unavailable.