-/*
- * Routine: host_ipc_hash_info
- * Purpose:
- * Return information about the global reverse hash table.
- * Conditions:
- * Nothing locked. Obeys CountInOut protocol.
- * Returns:
- * KERN_SUCCESS Returned information.
- * KERN_INVALID_HOST The host is null.
- * KERN_RESOURCE_SHORTAGE Couldn't allocate memory.
- */
-
-#if !MACH_IPC_DEBUG
-kern_return_t
-host_ipc_hash_info(
- __unused host_t host,
- __unused hash_info_bucket_array_t *infop,
- __unused mach_msg_type_number_t *countp)
-{
- return KERN_FAILURE;
-}
-#else
-kern_return_t
-host_ipc_hash_info(
- host_t host,
- hash_info_bucket_array_t *infop,
- mach_msg_type_number_t *countp)
-{
- vm_map_copy_t copy;
- vm_offset_t addr;
- vm_size_t size;
- hash_info_bucket_t *info;
- natural_t count;
- kern_return_t kr;
-
- if (host == HOST_NULL)
- return KERN_INVALID_HOST;
-
- /* start with in-line data */
-
- count = ipc_hash_size();
- size = round_page(count * sizeof(hash_info_bucket_t));
- kr = kmem_alloc_pageable(ipc_kernel_map, &addr, size);
- if (kr != KERN_SUCCESS)
- return KERN_RESOURCE_SHORTAGE;
-
- info = (hash_info_bucket_t *) addr;
- count = ipc_hash_info(info, count);
-
- if (size > count * sizeof(hash_info_bucket_t))
- bzero((char *)&info[count], size - count * sizeof(hash_info_bucket_t));
-
- kr = vm_map_copyin(ipc_kernel_map, (vm_map_address_t)addr,
- (vm_map_size_t)size, TRUE, ©);
- assert(kr == KERN_SUCCESS);
-
- *infop = (hash_info_bucket_t *) copy;
- *countp = count;
- return KERN_SUCCESS;
-}
-#endif /* MACH_IPC_DEBUG */