1 <h2>thread_set_exception_ports
</h2>
4 <strong>Function
</strong> - Set exception ports for a thread.
7 <strong>kern_return_t thread_set_exception_ports
</strong>
8 <strong>(thread_act_t
</strong> <var>thread
</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>
17 <dt> <var>thread
</var>
19 [in thread send right]
20 The thread for which to set the ports.
22 <dt> <var>exception_types
</var>
25 A flag word indicating the types of exceptions for which the
26 exception port applies:
29 <dt> <strong>EXC_MASK_BAD_ACCESS
</strong>
31 Could not access memory.
33 <dt> <strong>EXC_MASK_BAD_INSTRUCTION
</strong>
35 Instruction failed. Illegal or undefined instruction or operand.
37 <dt> <strong>EXC_MASK_ARITHMETIC
</strong>
41 <dt> <strong>EXC_MASK_EMULATION
</strong>
43 Emulation instruction. Emulation support instruction
46 <dt> <strong>EXC_MASK_SOFTWARE
</strong>
48 Software generated exception.
50 <dt> <strong>EXC_MASK_BREAKPOINT
</strong>
52 Trace, breakpoint, etc.
54 <dt> <strong>EXC_MASK_SYSCALL
</strong>
56 System call requested.
58 <dt> <strong>EXC_MASK_MACH_SYSCALL
</strong>
60 System call with a number in the Mach call range requested.
63 <dt> <var>exception_port
</var>
65 [in exception send right]
66 The exception port for all selected exception
69 <dt> <var>behavior
</var>
72 The type of exception message to be sent. Defined types are:
75 <dt> <strong>EXCEPTION_DEFAULT
</strong>
77 Send a
<strong>catch_exception_raise
</strong> message including the thread
80 <dt> <strong>EXCEPTION_DEFAULT_PROTECTED
</strong>
82 Send a
<strong>catch_exception_raise
</strong> message including the thread
83 identity. Mark the exception port (and associated exceptions)
86 <dt> <strong>EXCEPTION_STATE
</strong>
88 Send a
<strong>catch_exception_raise_state
</strong> message including the
91 <dt> <strong>EXCEPTION_STATE_PROTECTED
</strong>
93 Send a
<strong>catch_exception_raise_state
</strong> message including the
94 thread state. Mark the exception port (and associated
95 exceptions) as protected.
97 <dt> <strong>EXCEPTION_STATE_IDENTITY
</strong>
99 Send a
<strong>catch_exception_raise_state_identity
</strong> message
100 including the thread identity and state.
102 <dt> <strong>EXCEPTION_STATE_IDENTITY_PROTECTED
</strong>
104 Send a
<strong>catch_exception_raise_state_identity
</strong> message
105 including the thread identity and state. Mark the exception port
106 (and associated exceptions) as protected.
109 <dt> <var>flavor
</var>
112 The type of state to be sent with the exception message.
113 These types are defined in \*L
<mach/thread_states.h
>\*O.
117 The
<strong>thread_set_exception_ports
</strong> function sets a specified
119 ports belonging to
<var>thread
</var>.
122 If the value of the
<strong>EXC_MACH_SYSCALL
</strong> exception class exception port is
123 the host name port, Mach kernel traps are executed by the kernel as expected;
124 any other value causes the attempted execution of these system call numbers to
125 be considered an exception.
127 A "protected" exception port is one which cannot be fetched and for which
128 exception processing cannot be aborted (
<strong>thread_abort
</strong>).
129 <h3>RETURN VALUES
</h3>
131 Only generic errors apply.
132 <h3>RELATED INFORMATION
</h3>
135 <a href=
"mach_thread_self.html"><strong>mach_thread_self
</strong></a>,
136 <a href=
"task_get_exception_ports.html"><strong>task_get_exception_ports
</strong></a>,
137 <a href=
"task_set_exception_ports.html"><strong>task_set_exception_ports
</strong></a>,
138 <a href=
"task_swap_exception_ports.html"><strong>task_swap_exception_ports
</strong></a>,
139 <a href=
"thread_create.html"><strong>thread_create
</strong></a>,
140 <a href=
"thread_get_exception_ports.html"><strong>thread_get_exception_ports
</strong></a>,
141 <a href=
"TS_exception_ports.html"><strong>thread_swap_exception_ports
</strong></a>,
142 <a href=
"catch_exception_raise.html"><strong>catch_exception_raise
</strong></a>,
143 <a href=
"thread_abort.html"><strong>thread_abort
</strong></a>.