- ip_lock(xport); /* Lock the exception port */
- if (!ip_active(xport)) { /* and is it active? */
- ip_unlock(xport); /* Nope, fail */
- mutex_unlock(&hostp->lock); /* Unlock */
- return(KERN_FAILURE); /* Go away... */
- }
-
- if (task->itk_space == xport->data.receiver) { /* Are we trying to send to ourselves? */
- ip_unlock(xport); /* Yes, fail */
- mutex_unlock(&hostp->lock); /* Unlock */
- return(KERN_FAILURE); /* Go away... */
- }
-
- ip_reference(xport); /* Bump reference so it doesn't go away */
- xport->ip_srights++; /* Bump send rights */
- ip_unlock(xport); /* We can unlock it now */
-
- mutex_unlock(&hostp->lock); /* All done with the lock */
-
- wsave = thread_interrupt_level(THREAD_UNINT); /* Make sure we aren't aborted here */
-
- ret = exception_raise(xport, /* Send the exception to the perf handler */
- retrieve_thread_self_fast(thread), /* Not always the dying guy */
- retrieve_task_self_fast(thread->task), /* Not always the dying guy */
- EXC_RPC_ALERT, /* Unused exception type until now */
- code, codeCnt);
-
- (void)thread_interrupt_level(wsave); /* Restore interrupt level */
-
- return(ret); /* Tell caller how it went */