X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/1c79356b52d46aa6b508fb032f5ae709b1f2897b..de355530ae67247cbd0da700edb3a2a1dae884c2:/osfmk/ipc/ipc_port.c diff --git a/osfmk/ipc/ipc_port.c b/osfmk/ipc/ipc_port.c index 7cd8a39f7..9bb7ed781 100644 --- a/osfmk/ipc/ipc_port.c +++ b/osfmk/ipc/ipc_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2002,2000 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -66,9 +66,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -413,8 +411,8 @@ ipc_port_clear_receiver( * pull ourselves from any sets. */ if (port->ip_pset_count != 0) { - ipc_pset_remove_all(port); - port->ip_pset_count = 0; + ipc_pset_remove_from_all(port); + assert(port->ip_pset_count == 0); } /* @@ -459,10 +457,6 @@ ipc_port_init( port->ip_pset_count = 0; port->ip_premsg = IKM_NULL; - thread_pool_init(&port->ip_thread_pool); - - port->ip_subsystem = RPC_SUBSYSTEM_NULL; - #if MACH_ASSERT ipc_port_init_debug(port); #endif /* MACH_ASSERT */ @@ -602,7 +596,6 @@ ipc_port_destroy( ipc_kmsg_queue_t kmqueue; ipc_kmsg_t kmsg; ipc_port_request_t dnrequests; - thread_pool_t thread_pool; assert(ip_active(port)); /* port->ip_receiver_name is garbage */ @@ -653,30 +646,19 @@ ipc_port_destroy( /* * If the port has a preallocated message buffer and that buffer - * is not inuse, free it. If it has and inuse one, then the kmsg + * is not inuse, free it. If it has an inuse one, then the kmsg * free will detect that we freed the association and it can free it * like a normal buffer. */ if (IP_PREALLOC(port)) { kmsg = port->ip_premsg; assert(kmsg != IKM_NULL); - if (!ikm_prealloc_inuse(kmsg)) { - ikm_prealloc_clear_inuse(kmsg, port); - IP_CLEAR_PREALLOC(port, kmsg); + IP_CLEAR_PREALLOC(port, kmsg); + if (!ikm_prealloc_inuse(kmsg)) ipc_kmsg_free(kmsg); - } else { - assert(ikm_prealloc_inuse_port(kmsg) == port); - ikm_prealloc_clear_inuse(kmsg, port); - IP_CLEAR_PREALLOC(port, kmsg); - } } - ip_unlock(port); - /* wakeup any threads waiting on this pool port for an activation */ - if ((thread_pool = &port->ip_thread_pool) != THREAD_POOL_NULL) - thread_pool_wakeup(thread_pool); - /* throw away no-senders request */ nsrequest = port->ip_nsrequest; @@ -694,12 +676,6 @@ ipc_port_destroy( ipc_kobject_destroy(port); - if (port->ip_subsystem != RPC_SUBSYSTEM_NULL) { - subsystem_deallocate((subsystem_t) port->ip_kobject); - } - - /* XXXX Perhaps should verify that ip_thread_pool is empty! */ - ipc_port_release(port); /* consume caller's ref */ } @@ -888,29 +864,51 @@ ipc_port_lookup_notify( } /* - * Routine: ipc_port_make_send + * Routine: ipc_port_make_send_locked * Purpose: * Make a naked send right from a receive right. + * * Conditions: - * The port is not locked but it is active. + * port locked and active. */ - ipc_port_t -ipc_port_make_send( +ipc_port_make_send_locked( ipc_port_t port) { - assert(IP_VALID(port)); - - ip_lock(port); assert(ip_active(port)); port->ip_mscount++; port->ip_srights++; ip_reference(port); ip_unlock(port); - return port; } +/* + * Routine: ipc_port_make_send + * Purpose: + * Make a naked send right from a receive right. + */ + +ipc_port_t +ipc_port_make_send( + ipc_port_t port) +{ + + if (!IP_VALID(port)) + return port; + + ip_lock(port); + if (ip_active(port)) { + port->ip_mscount++; + port->ip_srights++; + ip_reference(port); + ip_unlock(port); + return port; + } + ip_unlock(port); + return IP_DEAD; +} + /* * Routine: ipc_port_copy_send * Purpose: @@ -1330,7 +1328,6 @@ ipc_port_print( ipc_object_print(&port->ip_object); if (ipc_port_print_long) { - iprintf("pool=0x%x", port->ip_thread_pool); printf("\n"); } @@ -1535,8 +1532,8 @@ print_ports(void) PRINT_ONE_PORT_TYPE(PSET); PRINT_ONE_PORT_TYPE(PSET_NAME); PRINT_ONE_PORT_TYPE(PAGING_REQUEST); - PRINT_ONE_PORT_TYPE(XMM_OBJECT); - PRINT_ONE_PORT_TYPE(DEVICE); + PRINT_ONE_PORT_TYPE(MEMORY_OBJECT); + PRINT_ONE_PORT_TYPE(MIG); PRINT_ONE_PORT_TYPE(XMM_PAGER); PRINT_ONE_PORT_TYPE(XMM_KERNEL); PRINT_ONE_PORT_TYPE(XMM_REPLY);