-
-/* Returns a +1 thread reference */
-thread_t
-port_name_to_thread_for_ulock(mach_port_name_t thread_name)
-{
- thread_t thread = THREAD_NULL;
- thread_t self = current_thread();
-
- /*
- * Translate the port name if supplied.
- */
- if (thread_name != MACH_PORT_NULL) {
- ipc_port_t port;
-
- if (ipc_port_translate_send(self->task->itk_space,
- thread_name, &port) == KERN_SUCCESS) {
- ip_reference(port);
- ip_unlock(port);
-
- thread = convert_port_to_thread(port);
- ip_release(port);
-
- if (thread == THREAD_NULL) {
- return thread;
- }
-
- if ((thread == self) || (thread->task != self->task)) {
- thread_deallocate(thread);
- thread = THREAD_NULL;
- }
- }
- }
-
- return thread;
-}
-