task_create.html   [plain text]

<strong>Function</strong> - Create a new task.
<strong>kern_return_t   task_create</strong>
                <strong>(task_t</strong>                             <var>parent_task</var>,
                 <strong>ledger_port_array_t</strong>                    <var>ledgers</var>,
                 <strong>int</strong>                               <var>ledger_count</var>,
                 <strong>boolean_t</strong>                       <var>inherit_memory</var>,
                 <strong>task_t</strong>                              <var>child_task</var><strong>);</strong>
<dt> <var>parent_task</var> 
[in task send right]
The port for the task from which to draw the child 
task's port rights and address space.
<dt> <var>ledgers</var> 
[pointer to in array of ledger send rights]
Resource ledgers (on the
destination host) from which the task will draw its resources.  The first
element of this array is the wired kernel ledger, the second the paged 
space ledger.  If the number of ledgers supplied does not match the
required number or one or more is null, the parent task's ledger is used.
<dt> <var>ledger_count</var> 
[in scalar]
The number of ledger ports in the <var>ledgers</var> array.
<dt> <var>inherit_memory</var> 
[in scalar]
Address space inheritance indicator.  If true, the child task
inherits the (inheritable) address space of the parent task.  If false, the
kernel assigns the child task an empty address space.
<dt> <var>child_task</var> 
[out task send right]
The kernel-assigned port for the new task.
The <strong>task_create</strong> function creates a new task from <var>parent_task</var>
and returns the name of the new task in <var>child_task</var>.  
The child task acquires shared or copied parts of the parent's address space 
(see <strong>vm_inherit</strong>).  The child task initially
contains no threads.  The child task inherits the parent's security ID.
The child task receives the following "special" ports, which are created or
copied for it at task creation:
<dt> [task-self send right]
The port by which the kernel knows the new child task 
and allows it to be manipulated.  The child task holds a send right for this 
port.  The port name is also returned to the calling task.
<dt> [bootstrap send right]
The port to which the child task can send a message
requesting return of any system service ports that it needs (for
example, a port 
to the Network Name Server or the Environment Manager).  The child task 
inherits a send right for this port from the parent task.  The task can use 
<strong>task_set_special_port</strong> to change this port.
<dt> [host-self send right]
The port by which the child task requests information 
about its host.  The child task inherits a send right for this port from the
parent task.
<dt> [ledger send rights]
The ports naming the ledgers from which the task draws 
its resources.
The child task also inherits the following ports:
<dt> [sample send right]
The port to which PC sampling messages are to be sent.
<dt> [exception send rights]
Ports to which exception messages are sent.
<dt> [registered send rights]
Ports to system services.
The <strong>ledgers</strong> functionality mentioned above is not
currently implemented.
Only generic errors apply.
<a href="task_create_security_token.html"><strong>task_create_security_token</strong></a>,
<a href="task_resume.html"><strong>task_resume</strong></a>,
<a href="task_set_special_port.html"><strong>task_set_special_port</strong></a>,
<a href="task_suspend.html"><strong>task_suspend</strong></a>,
<a href="task_terminate.html"><strong>task_terminate</strong></a>,
<a href="task_threads.html"><strong>task_threads</strong></a>,
<a href="thread_create.html"><strong>thread_create</strong></a>,
<a href="thread_resume.html"><strong>thread_resume</strong></a>,
<a href="vm_inherit.html"><strong>vm_inherit</strong></a>,
<a href="task_sample.html"><strong>task_sample</strong></a>,
<a href="task_set_exception_ports.html"><strong>task_set_exception_ports</strong></a>,
<a href="mach_ports_register.html"><strong>mach_ports_register</strong></a>,
<a href="norma_task_create.html"><strong>norma_task_create</strong></a>,
<a href="host_security_set_task_token.html"><strong>host_security_set_task_token</strong></a>.