]> git.saurik.com Git - apple/xnu.git/blob - osfmk/man/task_create.html
xnu-344.49.tar.gz
[apple/xnu.git] / osfmk / man / task_create.html
1 <h2>task_create</h2> <hr> <p> <strong>Function</strong> - Create a new task. <h3>SYNOPSIS</h3> <pre> <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> </pre> <h3>PARAMETERS</h3> <dl> <p> <dt> <var>parent_task</var> <dd> [in task send right] The port for the task from which to draw the child task's port rights and address space. <p> <dt> <var>ledgers</var> <dd> [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. <p> <dt> <var>ledger_count</var> <dd> [in scalar] The number of ledger ports in the <var>ledgers</var> array. <p> <dt> <var>inherit_memory</var> <dd> [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. <p> <dt> <var>child_task</var> <dd> [out task send right] The kernel-assigned port for the new task. </dl> <h3>DESCRIPTION</h3> <p> 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. <p> The child task receives the following "special" ports, which are created or copied for it at task creation: <dl> <dt> [task-self send right] <dd> 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. <p> <dt> [bootstrap send right] <dd> 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. <p> <dt> [host-self send right] <dd> 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. <p> <dt> [ledger send rights] <dd> The ports naming the ledgers from which the task draws its resources. </dl> <p> The child task also inherits the following ports: <dl> <dt> [sample send right] <dd> The port to which PC sampling messages are to be sent. <p> <dt> [exception send rights] <dd> Ports to which exception messages are sent. <p> <dt> [registered send rights] <dd> Ports to system services. </dl> <h3>NOTES</h3> <p> The <strong>ledgers</strong> functionality mentioned above is not currently implemented. <h3>RETURN VALUES</h3> <p> Only generic errors apply. <h3>RELATED INFORMATION</h3> <p> Functions: <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="task_set_security_token.html"><strong>task_set_security_token</strong></a>.