/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
- * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
+ * The contents of this file constitute Original Code as defined in and
+ * are subject to the Apple Public Source License Version 1.1 (the
+ * "License"). You may not use this file except in compliance with the
+ * License. Please obtain a copy of the License at
+ * http://www.apple.com/publicsource and read it before using this file.
*
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This Original Code and all software distributed under the License are
+ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
+ * License for the specific language governing rights and limitations
+ * under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#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 */