/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <kern/misc_protos.h>
#include <vm/vm_map.h>
#include <vm/vm_kern.h>
+#include <ipc/port.h>
+#include <ipc/ipc_types.h>
#include <ipc/ipc_space.h>
#include <ipc/ipc_port.h>
#include <ipc/ipc_hash.h>
* KERN_INVALID_RIGHT Name doesn't denote receive rights.
*/
+#if !MACH_IPC_DEBUG
+kern_return_t
+mach_port_get_srights(
+ __unused ipc_space_t space,
+ __unused mach_port_name_t name,
+ __unused mach_port_rights_t *srightsp)
+{
+ return KERN_FAILURE;
+}
+#else
kern_return_t
mach_port_get_srights(
ipc_space_t space,
mach_port_name_t name,
mach_port_rights_t *srightsp)
{
-#if !MACH_IPC_DEBUG
- return KERN_FAILURE;
-#else
ipc_port_t port;
kern_return_t kr;
mach_port_rights_t srights;
*srightsp = srights;
return KERN_SUCCESS;
-#endif /* MACH_IPC_DEBUG */
}
+#endif /* MACH_IPC_DEBUG */
/*
* Routine: host_ipc_hash_info
* KERN_RESOURCE_SHORTAGE Couldn't allocate memory.
*/
+#if !MACH_IPC_DEBUG
kern_return_t
host_ipc_hash_info(
- host_t host,
- hash_info_bucket_array_t *infop,
- mach_msg_type_number_t *countp)
+ __unused host_t host,
+ __unused hash_info_bucket_array_t *infop,
+ __unused mach_msg_type_number_t *countp)
{
-#if !MACH_IPC_DEBUG
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_offset_t addr;
- vm_size_t size;
+ vm_size_t size = 0;
hash_info_bucket_t *info;
unsigned int potential, actual;
kern_return_t kr;
if (used != size)
kmem_free(ipc_kernel_map, addr + used, size - used);
- kr = vm_map_copyin(ipc_kernel_map, addr, used,
- TRUE, ©);
+ kr = vm_map_copyin(ipc_kernel_map, (vm_map_address_t)addr,
+ (vm_map_size_t)used, TRUE, ©);
assert(kr == KERN_SUCCESS);
*infop = (hash_info_bucket_t *) copy;
}
return KERN_SUCCESS;
-#endif /* MACH_IPC_DEBUG */
}
+#endif /* MACH_IPC_DEBUG */
/*
* Routine: mach_port_space_info
* KERN_RESOURCE_SHORTAGE Couldn't allocate memory.
*/
+#if !MACH_IPC_DEBUG
kern_return_t
mach_port_space_info(
- ipc_space_t space,
- ipc_info_space_t *infop,
+ __unused ipc_space_t space,
+ __unused ipc_info_space_t *infop,
+ __unused ipc_info_name_array_t *tablep,
+ __unused mach_msg_type_number_t *tableCntp,
+ __unused ipc_info_tree_name_array_t *treep,
+ __unused mach_msg_type_number_t *treeCntp)
+{
+ return KERN_FAILURE;
+}
+#else
+kern_return_t
+mach_port_space_info(
+ ipc_space_t space,
+ ipc_info_space_t *infop,
ipc_info_name_array_t *tablep,
mach_msg_type_number_t *tableCntp,
- ipc_info_tree_name_array_t *treep,
+ ipc_info_tree_name_array_t *treep,
mach_msg_type_number_t *treeCntp)
{
-#if !MACH_IPC_DEBUG
- return KERN_FAILURE;
-#else
ipc_info_name_t *table_info;
unsigned int table_potential, table_actual;
vm_offset_t table_addr;
ipc_entry_num_t tsize;
mach_port_index_t index;
kern_return_t kr;
- ipc_entry_bits_t *capability;
if (space == IS_NULL)
return KERN_INVALID_TASK;
/* start with in-line memory */
+ table_size = 0;
table_info = *tablep;
table_potential = *tableCntp;
+ tree_size = 0;
tree_info = *treep;
tree_potential = *treeCntp;
bzero((char *) (table_addr + size_used),
rsize_used - size_used);
- kr = vm_map_unwire(ipc_kernel_map, table_addr,
- table_addr + rsize_used, FALSE);
+ kr = vm_map_unwire(ipc_kernel_map, vm_map_trunc_page(table_addr),
+ vm_map_round_page(table_addr + rsize_used), FALSE);
assert(kr == KERN_SUCCESS);
- kr = vm_map_copyin(ipc_kernel_map, table_addr, rsize_used,
- TRUE, ©);
+ kr = vm_map_copyin(ipc_kernel_map, (vm_map_address_t)table_addr,
+ (vm_map_size_t)rsize_used, TRUE, ©);
assert(kr == KERN_SUCCESS);
*tablep = (ipc_info_name_t *) copy;
bzero((char *) (tree_addr + size_used),
rsize_used - size_used);
- kr = vm_map_unwire(ipc_kernel_map, tree_addr,
- tree_addr + rsize_used, FALSE);
+ kr = vm_map_unwire(ipc_kernel_map, vm_map_trunc_page(tree_addr),
+ vm_map_round_page(tree_addr + rsize_used), FALSE);
assert(kr == KERN_SUCCESS);
- kr = vm_map_copyin(ipc_kernel_map, tree_addr, rsize_used,
- TRUE, ©);
+ kr = vm_map_copyin(ipc_kernel_map, (vm_map_address_t)tree_addr,
+ (vm_map_size_t)rsize_used, TRUE, ©);
assert(kr == KERN_SUCCESS);
*treep = (ipc_info_tree_name_t *) copy;
}
return KERN_SUCCESS;
-#endif /* MACH_IPC_DEBUG */
}
+#endif /* MACH_IPC_DEBUG */
/*
* Routine: mach_port_dnrequest_info
* KERN_INVALID_RIGHT Name doesn't denote receive rights.
*/
+#if !MACH_IPC_DEBUG
kern_return_t
mach_port_dnrequest_info(
- ipc_space_t space,
- mach_port_name_t name,
- unsigned int *totalp,
- unsigned int *usedp)
+ __unused ipc_space_t space,
+ __unused mach_port_name_t name,
+ __unused unsigned int *totalp,
+ __unused unsigned int *usedp)
{
-#if !MACH_IPC_DEBUG
return KERN_FAILURE;
+}
#else
+kern_return_t
+mach_port_dnrequest_info(
+ ipc_space_t space,
+ mach_port_name_t name,
+ unsigned int *totalp,
+ unsigned int *usedp)
+{
unsigned int total, used;
ipc_port_t port;
kern_return_t kr;
*totalp = total;
*usedp = used;
return KERN_SUCCESS;
-#endif /* MACH_IPC_DEBUG */
}
+#endif /* MACH_IPC_DEBUG */
/*
* Routine: mach_port_kernel_object [kernel call]
* send or receive rights.
*/
+#if !MACH_IPC_DEBUG
kern_return_t
mach_port_kernel_object(
- ipc_space_t space,
- mach_port_name_t name,
- unsigned int *typep,
- vm_offset_t *addrp)
+ __unused ipc_space_t space,
+ __unused mach_port_name_t name,
+ __unused unsigned int *typep,
+ __unused vm_offset_t *addrp)
{
-#if !MACH_IPC_DEBUG
return KERN_FAILURE;
+}
#else
+kern_return_t
+mach_port_kernel_object(
+ ipc_space_t space,
+ mach_port_name_t name,
+ unsigned int *typep,
+ vm_offset_t *addrp)
+{
ipc_entry_t entry;
ipc_port_t port;
kern_return_t kr;
ip_unlock(port);
return KERN_SUCCESS;
-#endif /* MACH_IPC_DEBUG */
}
+#endif /* MACH_IPC_DEBUG */