1 <h2>task_swap_exception_ports
</h2>
4 <strong>Function
</strong> - Set target task's exception ports, returning the previous exception ports.
7 <strong>kern_return_t task_swap_exception_ports
</strong>
8 <strong>(task_t
</strong> <var>task
</var>,
9 <strong>exception_mask_t
</strong> <var>exception_types
</var>,
10 <strong>mach_port_t
</strong> <var>exception_port
</var>,
11 <strong>exception_behavior_t
</strong> <var>behavior
</var>,
12 <strong>thread_state_flavor_t
</strong> <var>flavor
</var>,
13 <strong>exception_mask_array_t
</strong> <var>old_exception_masks
</var>,
14 <strong>old_exception_masks
</strong> <var>old_exception_count
</var>,
15 <strong>exception_port_array_t
</strong> <var>old_exception_ports
</var>,
16 <strong>exception_behavior_array_t
</strong> <var>old_behaviors
</var>,
17 <strong>exception_flavor_array_t
</strong> <var>old_flavors
</var><strong>);
</strong>
25 The task for which to set the ports.
27 <dt> <var>exception_types
</var>
30 A flag word indicating the types of exceptions for which the
31 exception port applies:
34 <dt> <strong>EXC_MASK_BAD_ACCESS
</strong>
36 Could not access memory.
38 <dt> <strong>EXC_MASK_BAD_INSTRUCTION
</strong>
40 Instruction failed. Illegal or undefined instruction or operand.
42 <dt> <strong>EXC_MASK_ARITHMETIC
</strong>
46 <dt> <strong>EXC_MASK_EMULATION
</strong>
48 Emulation instruction. Emulation support instruction
51 <dt> <strong>EXC_MASK_SOFTWARE
</strong>
53 Software generated exception.
55 <dt> <strong>EXC_MASK_BREAKPOINT
</strong>
57 Trace, breakpoint, etc.
59 <dt> <strong>EXC_MASK_SYSCALL
</strong>
61 System call requested.
63 <dt> <strong>EXC_MASK_MACH_SYSCALL
</strong>
65 System call with a number in the Mach call range requested.
67 <dt> <strong>EXC_MASK_RPC_ALERT
</strong>
69 Exceptional condition encountered during execution of RPC.
72 <dt> <var>exception_port
</var>
74 [in exception send right]
75 The exception port for all selected exception
78 <dt> <var>behavior
</var>
81 The type of exception message to be sent. Defined types are:
84 <dt> <strong>EXCEPTION_DEFAULT
</strong>
86 Send a
<strong>catch_exception_raise
</strong> message including the thread
89 <dt> <strong>EXCEPTION_STATE
</strong>
91 Send a
<strong>catch_exception_raise_state
</strong> message including the
94 <dt> <strong>EXCEPTION_STATE_PROTECTED
</strong>
96 Send a
<strong>catch_exception_raise_state
</strong> message including the
97 thread state. Mark the exception port (and associated
98 exceptions) as protected.
100 <dt> <strong>EXCEPTION_STATE_IDENTITY
</strong>
102 Send a
<strong>catch_exception_raise_state_identity
</strong> message
103 including the thread identity and state.
105 <dt> <strong>EXCEPTION_STATE_IDENTITY_PROTECTED
</strong>
107 Send a
<strong>catch_exception_raise_state_identity
</strong> message
108 including the thread identity and state. Mark the exception port
109 (and associated exceptions) as protected.
112 <dt> <var>flavor
</var>
115 The type of state to be sent with the exception message.
116 These types are defined in
<strong><mach/thread_states.h>
</strong>.
118 <dt> <var>old_exception_masks
</var>
120 [out array of
<var>exception_mask_t
</var>]
121 An array, each element being a mask
122 specifying for which exception types the corresponding element of the
125 <dt> <var>old_exception_count
</var>
127 [pointer to in/out scalar]
128 On input, the maximum size of the array
129 buffers; on output, the number of returned
<exception type mask,
130 exception port, behavior, flavor
> sets returned.
132 <dt> <var>old_exception_ports
</var>
134 [out array of exception send rights]
135 The returned exception ports.
137 <dt> <var>old_behaviors
</var>
139 [out array of
<var>exception_behavior_t
</var>]
140 The type of exception message to
141 be sent as with
<var>behavior
</var>.
143 <dt> <var>old_flavors
</var>
145 [out array of
<var>thread_state_flavor_t
</var>]
146 The type of state to be sent with
147 the exception message. These types are defined in
<strong><mach/thread_states.h>
</strong>.
151 The
<strong>task_swap_exception_ports
</strong> function sets a specified
153 ports belonging to
<var>task
</var>, returning the old set. A task exception
155 a thread specific exception port returns a non-success reply.
158 If the value of the
<strong>EXC_MACH_SYSCALL
</strong> exception class exception port is
159 the host name port, Mach kernel traps are executed by the kernel as expected;
160 any other value causes the attempted execution of these system call numbers to
161 be considered an exception.
162 <h3>RETURN VALUES
</h3>
164 Only generic errors apply.
165 <h3>RELATED INFORMATION
</h3>
168 <a href=
"mach_task_self.html"><strong>mach_task_self
</strong></a>,
169 <a href=
"task_get_exception_ports.html"><strong>task_get_exception_ports
</strong></a>,
170 <a href=
"task_set_exception_ports.html"><strong>task_set_exception_ports
</strong></a>,
171 <a href=
"thread_create.html"><strong>thread_create
</strong></a>,
172 <a href=
"thread_get_exception_ports.html"><strong>thread_get_exception_ports
</strong></a>,
173 <a href=
"thread_set_exception_ports.html"><strong>thread_set_exception_ports
</strong></a>,
174 <a href=
"TS_exception_ports.html"><strong>thread_swap_exception_ports
</strong></a>,
175 <a href=
"catch_exception_raise.html"><strong>catch_exception_raise
</strong></a>,
176 <a href=
"thread_abort.html"><strong>thread_abort
</strong></a>.