1<h2>task_set_exception_ports</h2>
2<hr>
3<p>
4<strong>Function</strong> - Set target task's exception ports.
5<h3>SYNOPSIS</h3>
6<pre>
7<strong>kern_return_t   task_set_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><strong>);</strong>
13</pre>
14<h3>PARAMETERS</h3>
15<dl>
16<p>
17<dt> <var>task</var> 
18<dd>
19[in task send right]
20The task for which to set the ports.
21<p>
22<dt> <var>exception_types</var> 
23<dd>
24[in scalar]
25A flag word indicating the types of exceptions for which the 
26exception port applies:
27<dl>
28<p>
29<dt> <strong>EXC_MASK_BAD_ACCESS</strong>
30<dd>
31Could not access memory.
32<p>
33<dt> <strong>EXC_MASK_BAD_INSTRUCTION</strong>
34<dd>
35Instruction failed.  Illegal or undefined instruction or operand.
36<p>
37<dt> <strong>EXC_MASK_ARITHMETIC</strong>
38<dd>
39Arithmetic exception
40<p>
41<dt> <strong>EXC_MASK_EMULATION</strong>
42<dd>
43Emulation instruction.  Emulation support instruction
44encountered.
45<p>
46<dt> <strong>EXC_MASK_SOFTWARE</strong>
47<dd>
48Software generated exception.
49<p>
50<dt> <strong>EXC_MASK_BREAKPOINT</strong>
51<dd>
52Trace, breakpoint, etc.
53<p>
54<dt> <strong>EXC_MASK_SYSCALL</strong>
55<dd>
56System call requested.
57<p>
58<dt> <strong>EXC_MASK_MACH_SYSCALL</strong>
59<dd>
60System call with a number in the Mach call range requested.
61<p>
62<dt> <strong>EXC_MASK_RPC_ALERT	</strong>
63<dd>
64Exceptional condition encountered during execution of RPC.
65</dl>
66<p>
67<dt> <var>exception_port</var> 
68<dd>
69[in exception send right]
70The exception port for all selected exception 
71types.
72<p>
73<dt> <var>behavior</var> 
74<dd>
75[in scalar]
76The type of exception message to be sent.  Defined types are:
77<dl>
78<p>
79<dt> <strong>EXCEPTION_DEFAULT</strong>
80<dd>
81Send a <strong>catch_exception_raise</strong> message including the thread 
82identity.
83<p>
84<dt> <strong>EXCEPTION_STATE</strong>
85<dd>
86Send a <strong>catch_exception_raise_state</strong> message including the 
87thread state.
88<p>
89<dt> <strong>EXCEPTION_STATE_PROTECTED</strong>
90<dd>
91Send a <strong>catch_exception_raise_state</strong> message including the 
92thread state.  Mark the exception port (and associated
93exceptions) as protected.
94<p>
95<dt> <strong>EXCEPTION_STATE_IDENTITY</strong>
96<dd>
97Send a <strong>catch_exception_raise_state_identity</strong> message
98including the thread identity and state.
99<p>
100<dt> <strong>EXCEPTION_STATE_IDENTITY_PROTECTED</strong>
101<dd>
102Send a <strong>catch_exception_raise_state_identity</strong> message
103including the thread identity and state.  Mark the exception port 
104(and associated exceptions) as protected.
105</dl>
106<p>
107<dt> <var>flavor</var> 
108<dd>
109[in scalar]
110The type of state to be sent with the exception message. 
111These types are defined in <strong>&ltmach/thread_states.h&gt</strong>.
112</dl>
113<h3>DESCRIPTION</h3>
114<p>
115The <strong>task_set_exception_ports</strong> function sets a specified
116set of exception ports belonging to <var>task</var>.  A task exception port 
117is used when a thread specific exception port returns a non-success reply.
118<h3>NOTES</h3>
119<p>
120If the value of the <strong>EXC_MACH_SYSCALL</strong> exception class exception port is 
121the host name port, Mach kernel traps are executed by the kernel as expected; 
122any other value causes the attempted execution of these system call numbers to 
123be considered an exception.
124<h3>RETURN VALUES</h3>
125<p>
126Only generic errors apply.
127<h3>RELATED INFORMATION</h3>
128<p>
129Functions:
130<a href="mach_task_self.html"><strong>mach_task_self</strong></a>,
131<a href="task_get_exception_ports.html"><strong>task_get_exception_ports</strong></a>,
132<a href="task_swap_exception_ports.html"><strong>task_swap_exception_ports</strong></a>,
133<a href="thread_set_exception_ports.html"><strong>thread_set_exception_ports</strong></a>,
134<a href="thread_create.html"><strong>thread_create</strong></a>,
135<a href="thread_get_exception_ports.html"><strong>thread_get_exception_ports</strong></a>,
136<a href="TS_exception_ports.html"><strong>thread_swap_exception_ports</strong></a>,
137<a href="catch_exception_raise.html"><strong>catch_exception_raise</strong></a>,
138<a href="thread_abort.html"><strong>thread_abort</strong></a>.
139