thread_set_exception_ports


Function - Set exception ports for a thread.

SYNOPSIS

kern_return_t   thread_set_exception_ports
                (thread_act_t                            thread,
                 exception_mask_t               exception_types,
                 mach_port_t                     exception_port,
                 exception_behavior_t                  behavior,
                 thread_state_flavor_t                   flavor);

PARAMETERS

thread
[in thread send right] The thread for which to set the ports.

exception_types
[in scalar] A flag word indicating the types of exceptions for which the exception port applies:

EXC_MASK_BAD_ACCESS
Could not access memory.

EXC_MASK_BAD_INSTRUCTION
Instruction failed. Illegal or undefined instruction or operand.

EXC_MASK_ARITHMETIC
Arithmetic exception.

EXC_MASK_EMULATION
Emulation instruction. Emulation support instruction encountered.

EXC_MASK_SOFTWARE
Software generated exception.

EXC_MASK_BREAKPOINT
Trace, breakpoint, etc.

EXC_MASK_SYSCALL
System call requested.

EXC_MASK_MACH_SYSCALL
System call with a number in the Mach call range requested.

exception_port
[in exception send right] The exception port for all selected exception types.

behavior
[in scalar] The type of exception message to be sent. Defined types are:

EXCEPTION_DEFAULT
Send a catch_exception_raise message including the thread identity.

EXCEPTION_DEFAULT_PROTECTED
Send a catch_exception_raise message including the thread identity. Mark the exception port (and associated exceptions) as protected.

EXCEPTION_STATE
Send a catch_exception_raise_state message including the thread state.

EXCEPTION_STATE_PROTECTED
Send a catch_exception_raise_state message including the thread state. Mark the exception port (and associated exceptions) as protected.

EXCEPTION_STATE_IDENTITY
Send a catch_exception_raise_state_identity message including the thread identity and state.

EXCEPTION_STATE_IDENTITY_PROTECTED
Send a catch_exception_raise_state_identity message including the thread identity and state. Mark the exception port (and associated exceptions) as protected.

flavor
[in scalar] The type of state to be sent with the exception message. These types are defined in \*L\*O.

DESCRIPTION

The thread_set_exception_ports function sets a specified set of exception ports belonging to thread.

NOTES

If the value of the EXC_MACH_SYSCALL exception class exception port is the host name port, Mach kernel traps are executed by the kernel as expected; any other value causes the attempted execution of these system call numbers to be considered an exception.

A "protected" exception port is one which cannot be fetched and for which exception processing cannot be aborted (thread_abort).

RETURN VALUES

Only generic errors apply.

RELATED INFORMATION

Functions: mach_thread_self, task_get_exception_ports, task_set_exception_ports, task_swap_exception_ports, thread_create, thread_get_exception_ports, thread_swap_exception_ports, catch_exception_raise, thread_abort.