4 <strong>Function
</strong> - Create a new task.
7 <strong>kern_return_t task_create
</strong>
8 <strong>(task_t
</strong> <var>parent_task
</var>,
9 <strong>ledger_port_array_t
</strong> <var>ledgers
</var>,
10 <strong>int
</strong> <var>ledger_count
</var>,
11 <strong>boolean_t
</strong> <var>inherit_memory
</var>,
12 <strong>task_t
</strong> <var>child_task
</var><strong>);
</strong>
17 <dt> <var>parent_task
</var>
20 The port for the task from which to draw the child
21 task's port rights and address space.
23 <dt> <var>ledgers
</var>
25 [pointer to in array of ledger send rights]
26 Resource ledgers (on the
27 destination host) from which the task will draw its resources. The first
28 element of this array is the wired kernel ledger, the second the paged
29 space ledger. If the number of ledgers supplied does not match the
30 required number or one or more is null, the parent task's ledger is used.
32 <dt> <var>ledger_count
</var>
35 The number of ledger ports in the
<var>ledgers
</var> array.
37 <dt> <var>inherit_memory
</var>
40 Address space inheritance indicator. If true, the child task
41 inherits the (inheritable) address space of the parent task. If false, the
42 kernel assigns the child task an empty address space.
44 <dt> <var>child_task
</var>
47 The kernel-assigned port for the new task.
51 The
<strong>task_create
</strong> function creates a new task from
<var>parent_task
</var>
52 and returns the name of the new task in
<var>child_task
</var>.
53 The child task acquires shared or copied parts of the parent's address space
54 (see
<strong>vm_inherit
</strong>). The child task initially
55 contains no threads. The child task inherits the parent's security ID.
57 The child task receives the following "special" ports, which are created or
58 copied for it at task creation:
60 <dt> [task-self send right]
62 The port by which the kernel knows the new child task
63 and allows it to be manipulated. The child task holds a send right for this
64 port. The port name is also returned to the calling task.
66 <dt> [bootstrap send right]
68 The port to which the child task can send a message
69 requesting return of any system service ports that it needs (for
71 to the Network Name Server or the Environment Manager). The child task
72 inherits a send right for this port from the parent task. The task can use
73 <strong>task_set_special_port
</strong> to change this port.
75 <dt> [host-self send right]
77 The port by which the child task requests information
78 about its host. The child task inherits a send right for this port from the
81 <dt> [ledger send rights]
83 The ports naming the ledgers from which the task draws
87 The child task also inherits the following ports:
89 <dt> [sample send right]
91 The port to which PC sampling messages are to be sent.
93 <dt> [exception send rights]
95 Ports to which exception messages are sent.
97 <dt> [registered send rights]
99 Ports to system services.
103 The
<strong>ledgers
</strong> functionality mentioned above is not
104 currently implemented.
105 <h3>RETURN VALUES
</h3>
107 Only generic errors apply.
108 <h3>RELATED INFORMATION
</h3>
111 <a href=
"task_create_security_token.html"><strong>task_create_security_token
</strong></a>,
112 <a href=
"task_resume.html"><strong>task_resume
</strong></a>,
113 <a href=
"task_set_special_port.html"><strong>task_set_special_port
</strong></a>,
114 <a href=
"task_suspend.html"><strong>task_suspend
</strong></a>,
115 <a href=
"task_terminate.html"><strong>task_terminate
</strong></a>,
116 <a href=
"task_threads.html"><strong>task_threads
</strong></a>,
117 <a href=
"thread_create.html"><strong>thread_create
</strong></a>,
118 <a href=
"thread_resume.html"><strong>thread_resume
</strong></a>,
119 <a href=
"vm_inherit.html"><strong>vm_inherit
</strong></a>,
120 <a href=
"task_sample.html"><strong>task_sample
</strong></a>,
121 <a href=
"task_set_exception_ports.html"><strong>task_set_exception_ports
</strong></a>,
122 <a href=
"mach_ports_register.html"><strong>mach_ports_register
</strong></a>,
123 <a href=
"host_security_set_task_token.html"><strong>host_security_set_task_token
</strong></a>.