-#if MACH_KDB
- if (debug_user_with_kdb) {
- /*
- * Debug the exception with kdb.
- * If kdb handles the exception,
- * then thread_kdb_return won't return.
- */
- db_printf("No exception server, calling kdb...\n");
- thread_kdb_return();
+ if (kr == KERN_SUCCESS || kr == MACH_RCV_PORT_DIED)
+ return(KERN_SUCCESS);
+ return(KERN_FAILURE);
+}
+
+
+/*
+ * Raise an exception on a task.
+ * This should tell launchd to launch Crash Reporter for this task.
+ */
+kern_return_t task_exception_notify(exception_type_t exception,
+ mach_exception_data_type_t exccode, mach_exception_data_type_t excsubcode)
+{
+ mach_exception_data_type_t code[EXCEPTION_CODE_MAX];
+ wait_interrupt_t wsave;
+ kern_return_t kr = KERN_SUCCESS;
+
+ code[0] = exccode;
+ code[1] = excsubcode;
+
+ wsave = thread_interrupt_level(THREAD_UNINT);
+ kr = exception_triage(exception, code, EXCEPTION_CODE_MAX);
+ (void) thread_interrupt_level(wsave);
+ return kr;
+}
+
+
+/*
+ * Handle interface for special performance monitoring
+ * This is a special case of the host exception handler
+ */
+kern_return_t sys_perf_notify(thread_t thread, int pid)
+{
+ host_priv_t hostp;
+ ipc_port_t xport;
+ wait_interrupt_t wsave;
+ kern_return_t ret;
+
+ hostp = host_priv_self(); /* Get the host privileged ports */
+ mach_exception_data_type_t code[EXCEPTION_CODE_MAX];
+ code[0] = 0xFF000001; /* Set terminate code */
+ code[1] = pid; /* Pass out the pid */
+
+ struct task *task = thread->task;
+ xport = hostp->exc_actions[EXC_RPC_ALERT].port;
+
+ /* Make sure we're not catching our own exception */
+ if (!IP_VALID(xport) ||
+ !ip_active(xport) ||
+ task->itk_space == xport->data.receiver) {
+
+ return(KERN_FAILURE);