[Midnightbsd-cvs] src [7406] trunk/sys: initial import of mach emulation from trueos

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Jan 7 22:31:28 EST 2016


Revision: 7406
          http://svnweb.midnightbsd.org/src/?rev=7406
Author:   laffer1
Date:     2016-01-07 22:31:27 -0500 (Thu, 07 Jan 2016)
Log Message:
-----------
initial import of mach emulation from trueos

Modified Paths:
--------------
    trunk/sys/sys/proc.h

Added Paths:
-----------
    trunk/sys/compat/mach/
    trunk/sys/compat/mach/Makefile
    trunk/sys/compat/mach/clock_server.c
    trunk/sys/compat/mach/defs/
    trunk/sys/compat/mach/defs/clock.defs
    trunk/sys/compat/mach/defs/host_priv.defs
    trunk/sys/compat/mach/defs/mach_host.defs
    trunk/sys/compat/mach/defs/mach_port.defs
    trunk/sys/compat/mach/defs/mach_vm.defs
    trunk/sys/compat/mach/defs/task.defs
    trunk/sys/compat/mach/defs/vm_map.defs
    trunk/sys/compat/mach/host_priv_server.c
    trunk/sys/compat/mach/init_sysent.c
    trunk/sys/compat/mach/ipc/
    trunk/sys/compat/mach/ipc/ipc_entry.c
    trunk/sys/compat/mach/ipc/ipc_hash.c
    trunk/sys/compat/mach/ipc/ipc_init.c
    trunk/sys/compat/mach/ipc/ipc_kmsg.c
    trunk/sys/compat/mach/ipc/ipc_kobject.c
    trunk/sys/compat/mach/ipc/ipc_mqueue.c
    trunk/sys/compat/mach/ipc/ipc_notify.c
    trunk/sys/compat/mach/ipc/ipc_object.c
    trunk/sys/compat/mach/ipc/ipc_port.c
    trunk/sys/compat/mach/ipc/ipc_pset.c
    trunk/sys/compat/mach/ipc/ipc_right.c
    trunk/sys/compat/mach/ipc/ipc_space.c
    trunk/sys/compat/mach/ipc/ipc_table.c
    trunk/sys/compat/mach/ipc/ipc_thread.c
    trunk/sys/compat/mach/ipc/mach_debug.c
    trunk/sys/compat/mach/ipc/mach_msg.c
    trunk/sys/compat/mach/ipc/mach_port.c
    trunk/sys/compat/mach/kern/
    trunk/sys/compat/mach/kern/ipc_host.c
    trunk/sys/compat/mach/kern/ipc_tt.c
    trunk/sys/compat/mach/kern/task.c
    trunk/sys/compat/mach/kern/thread_pool.c
    trunk/sys/compat/mach/kern_types.h
    trunk/sys/compat/mach/mach_clock.c
    trunk/sys/compat/mach/mach_convert.c
    trunk/sys/compat/mach/mach_host.c
    trunk/sys/compat/mach/mach_host_priv.c
    trunk/sys/compat/mach/mach_host_server.c
    trunk/sys/compat/mach/mach_misc.c
    trunk/sys/compat/mach/mach_module.c
    trunk/sys/compat/mach/mach_port_server.c
    trunk/sys/compat/mach/mach_processor.c
    trunk/sys/compat/mach/mach_semaphore.c
    trunk/sys/compat/mach/mach_task.c
    trunk/sys/compat/mach/mach_thread.c
    trunk/sys/compat/mach/mach_traps.c
    trunk/sys/compat/mach/mach_vm.c
    trunk/sys/compat/mach/mach_vm_server.c
    trunk/sys/compat/mach/proc_info.c
    trunk/sys/compat/mach/task_server.c
    trunk/sys/compat/mach/vm_map_server.c
    trunk/sys/sys/mach/
    trunk/sys/sys/mach/clock_server.h
    trunk/sys/sys/mach/clock_types.defs
    trunk/sys/sys/mach/clock_types.h
    trunk/sys/sys/mach/device/
    trunk/sys/sys/mach/device/.cvsignore
    trunk/sys/sys/mach/device/buf.h
    trunk/sys/sys/mach/device/cdli.h
    trunk/sys/sys/mach/device/cdli_err.h
    trunk/sys/sys/mach/device/cdli_proto.h
    trunk/sys/sys/mach/device/cdrom_status.h
    trunk/sys/sys/mach/device/cirbuf.h
    trunk/sys/sys/mach/device/conf.h
    trunk/sys/sys/mach/device/data_device.h
    trunk/sys/sys/mach/device/dev_forward.defs
    trunk/sys/sys/mach/device/dev_hdr.h
    trunk/sys/sys/mach/device/dev_master.h
    trunk/sys/sys/mach/device/device.defs
    trunk/sys/sys/mach/device/device_emul.h
    trunk/sys/sys/mach/device/device_port.h
    trunk/sys/sys/mach/device/device_reply.defs
    trunk/sys/sys/mach/device/device_request.defs
    trunk/sys/sys/mach/device/device_typedefs.h
    trunk/sys/sys/mach/device/device_types.defs
    trunk/sys/sys/mach/device/device_types.h
    trunk/sys/sys/mach/device/device_types_kernel.h
    trunk/sys/sys/mach/device/disk_status.h
    trunk/sys/sys/mach/device/dk.h
    trunk/sys/sys/mach/device/driver_lock.h
    trunk/sys/sys/mach/device/ds_routines.h
    trunk/sys/sys/mach/device/ds_status.h
    trunk/sys/sys/mach/device/errno.h
    trunk/sys/sys/mach/device/io_req.h
    trunk/sys/sys/mach/device/io_scatter.h
    trunk/sys/sys/mach/device/misc_protos.h
    trunk/sys/sys/mach/device/ndd.h
    trunk/sys/sys/mach/device/param.h
    trunk/sys/sys/mach/device/subrs.h
    trunk/sys/sys/mach/device/template.mk
    trunk/sys/sys/mach/device/test_device_entries.h
    trunk/sys/sys/mach/device/test_device_status.h
    trunk/sys/sys/mach/device/tty.h
    trunk/sys/sys/mach/device/tty_status.h
    trunk/sys/sys/mach/error.h
    trunk/sys/sys/mach/etap_macros.h
    trunk/sys/sys/mach/exception.h
    trunk/sys/sys/mach/exception_types.h
    trunk/sys/sys/mach/host.h
    trunk/sys/sys/mach/host_info.h
    trunk/sys/sys/mach/host_notify.h
    trunk/sys/sys/mach/host_priv_server.h
    trunk/sys/sys/mach/host_special_ports.h
    trunk/sys/sys/mach/ipc/
    trunk/sys/sys/mach/ipc/ipc_entry.h
    trunk/sys/sys/mach/ipc/ipc_hash.h
    trunk/sys/sys/mach/ipc/ipc_init.h
    trunk/sys/sys/mach/ipc/ipc_kmsg.h
    trunk/sys/sys/mach/ipc/ipc_machdep.h
    trunk/sys/sys/mach/ipc/ipc_mqueue.h
    trunk/sys/sys/mach/ipc/ipc_notify.h
    trunk/sys/sys/mach/ipc/ipc_object.h
    trunk/sys/sys/mach/ipc/ipc_port.h
    trunk/sys/sys/mach/ipc/ipc_print.h
    trunk/sys/sys/mach/ipc/ipc_pset.h
    trunk/sys/sys/mach/ipc/ipc_right.h
    trunk/sys/sys/mach/ipc/ipc_space.h
    trunk/sys/sys/mach/ipc/ipc_table.h
    trunk/sys/sys/mach/ipc/ipc_thread.h
    trunk/sys/sys/mach/ipc/ipc_types.h
    trunk/sys/sys/mach/ipc/ipc_voucher.h
    trunk/sys/sys/mach/ipc/mach_msg.h
    trunk/sys/sys/mach/ipc/port.h
    trunk/sys/sys/mach/ipc_common.h
    trunk/sys/sys/mach/ipc_host.h
    trunk/sys/sys/mach/ipc_kobject.h
    trunk/sys/sys/mach/ipc_mig.h
    trunk/sys/sys/mach/ipc_sync.h
    trunk/sys/sys/mach/ipc_tt.h
    trunk/sys/sys/mach/kern_return.h
    trunk/sys/sys/mach/mach.h
    trunk/sys/sys/mach/mach_host_server.h
    trunk/sys/sys/mach/mach_init.h
    trunk/sys/sys/mach/mach_interface.h
    trunk/sys/sys/mach/mach_param.h
    trunk/sys/sys/mach/mach_port_server.h
    trunk/sys/sys/mach/mach_time.h
    trunk/sys/sys/mach/mach_traps.h
    trunk/sys/sys/mach/mach_types.defs
    trunk/sys/sys/mach/mach_types.h
    trunk/sys/sys/mach/mach_vm.h
    trunk/sys/sys/mach/mach_vm_server.h
    trunk/sys/sys/mach/mach_voucher_types.h
    trunk/sys/sys/mach/machine.h
    trunk/sys/sys/mach/machine_types.defs
    trunk/sys/sys/mach/macro_help.h
    trunk/sys/sys/mach/memory_object.h
    trunk/sys/sys/mach/memory_object_types.h
    trunk/sys/sys/mach/message.h
    trunk/sys/sys/mach/mig.h
    trunk/sys/sys/mach/mig_errors.h
    trunk/sys/sys/mach/ndr.h
    trunk/sys/sys/mach/ndr_def.h
    trunk/sys/sys/mach/notify.h
    trunk/sys/sys/mach/policy.h
    trunk/sys/sys/mach/port.h
    trunk/sys/sys/mach/processor.h
    trunk/sys/sys/mach/processor_info.h
    trunk/sys/sys/mach/prof_types.h
    trunk/sys/sys/mach/queue.h
    trunk/sys/sys/mach/rpc.h
    trunk/sys/sys/mach/sched_prim.h
    trunk/sys/sys/mach/std_types.defs
    trunk/sys/sys/mach/std_types.h
    trunk/sys/sys/mach/task.h
    trunk/sys/sys/mach/task_info.h
    trunk/sys/sys/mach/task_policy.h
    trunk/sys/sys/mach/task_server.h
    trunk/sys/sys/mach/task_special_ports.h
    trunk/sys/sys/mach/thread.h
    trunk/sys/sys/mach/thread_info.h
    trunk/sys/sys/mach/thread_pool.h
    trunk/sys/sys/mach/thread_special_ports.h
    trunk/sys/sys/mach/thread_status.h
    trunk/sys/sys/mach/thread_switch.h
    trunk/sys/sys/mach/time_value.h
    trunk/sys/sys/mach/vm_attributes.h
    trunk/sys/sys/mach/vm_behavior.h
    trunk/sys/sys/mach/vm_inherit.h
    trunk/sys/sys/mach/vm_map_server.h
    trunk/sys/sys/mach/vm_prot.h
    trunk/sys/sys/mach/vm_region.h
    trunk/sys/sys/mach/vm_statistics.h
    trunk/sys/sys/mach/vm_sync.h
    trunk/sys/sys/mach/vm_types.h
    trunk/sys/sys/mach_debug/
    trunk/sys/sys/mach_debug/hash_info.h
    trunk/sys/sys/mach_debug/ipc_info.h
    trunk/sys/sys/mach_debug/lockgroup_info.h
    trunk/sys/sys/mach_debug/mach_debug.h
    trunk/sys/sys/mach_debug/mach_debug_types.defs
    trunk/sys/sys/mach_debug/mach_debug_types.h
    trunk/sys/sys/mach_debug/page_info.h
    trunk/sys/sys/mach_debug/vm_info.h
    trunk/sys/sys/mach_debug/zone_info.h

Added: trunk/sys/compat/mach/Makefile
===================================================================
--- trunk/sys/compat/mach/Makefile	                        (rev 0)
+++ trunk/sys/compat/mach/Makefile	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,58 @@
+# Makefile for syscall tables
+#
+# $MidnightBSD$
+
+
+
+all:
+	@echo "make serverdefs only"
+
+SYSPATH=../../sys/mach
+
+.PATH: defs
+.PATH: ${SYSPATH}
+
+HEADERNAMES= host_priv_server.h mach_host_server.h mach_port_server.h mach_vm_server.h \
+	task_server.h vm_map_server.h clock_server.c
+
+SERVERHEADERS= ${HEADERNAMES:S//${SYSPATH}\/&/1}
+
+serverdefs: ${SERVERHEADERS}	host_priv_server.c mach_host_server.c mach_port_server.c \
+	mach_vm_server.c task_server.c vm_map_server.c clock_server.c
+
+
+
+MFLAGS= -DKERNEL -I../.. -DKERNEL_SERVER
+
+# XXX
+MFLAGS+= -D__LP64__
+
+
+host_priv_server.h host_priv_server.c: defs/host_priv.defs
+	mig ${MFLAGS} -header /dev/null -user /dev/null -server host_priv_server.c defs/host_priv.defs
+	mig ${MFLAGS} -header /dev/null -user /dev/null -server /dev/null \
+	-sheader ${SYSPATH}/host_priv_server.h defs/host_priv.defs
+${SYSPATH}/mach_host_server.h mach_host_server.c: defs/mach_host.defs
+	mig ${MFLAGS} -header /dev/null -user /dev/null -server mach_host_server.c defs/mach_host.defs
+	mig ${MFLAGS} -header /dev/null -user /dev/null -server /dev/null \
+	-sheader ${SYSPATH}/mach_host_server.h defs/mach_host.defs
+${SYSPATH}/mach_port_server.h mach_port_server.c: defs/mach_port.defs
+	mig ${MFLAGS} -header /dev/null -user /dev/null -server mach_port_server.c defs/mach_port.defs 
+	mig ${MFLAGS} -header /dev/null -user /dev/null -server /dev/null \
+	-sheader ${SYSPATH}/mach_port_server.h defs/mach_port.defs
+${SYSPATH}/mach_vm_server.h mach_vm_server.c: defs/mach_vm.defs
+	mig ${MFLAGS} -header /dev/null -user /dev/null -server mach_vm_server.c defs/mach_vm.defs
+	mig ${MFLAGS} -header /dev/null -user /dev/null -server /dev/null \
+	-sheader ${SYSPATH}/mach_vm_server.h defs/mach_vm.defs
+${SYSPATH}/task_server.h task_server.c: defs/task.defs
+	mig ${MFLAGS} -header /dev/null -user /dev/null -server task_server.c defs/task.defs
+	mig ${MFLAGS} -header /dev/null -user /dev/null -server /dev/null \
+	-sheader ${SYSPATH}/task_server.h defs/task.defs
+${SYSPATH}/vm_map_server.h vm_map_server.c: defs/vm_map.defs
+	mig ${MFLAGS} -header /dev/null -user /dev/null -server vm_map_server.c defs/vm_map.defs
+	mig ${MFLAGS} -header /dev/null -user /dev/null -server /dev/null \
+	-sheader ${SYSPATH}/vm_map_server.h defs/vm_map.defs
+${SYSPATH}/clock_server.h clock_server.c: defs/clock.defs
+	mig ${MFLAGS} -header /dev/null -user /dev/null -server clock_server.c defs/clock.defs
+	mig ${MFLAGS} -header /dev/null -user /dev/null -server /dev/null \
+	-sheader ${SYSPATH}/clock_server.h defs/clock.defs


Property changes on: trunk/sys/compat/mach/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/clock_server.c
===================================================================
--- trunk/sys/compat/mach/clock_server.c	                        (rev 0)
+++ trunk/sys/compat/mach/clock_server.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,666 @@
+/*
+ * IDENTIFICATION:
+ * stub generated Thu Jun 11 18:17:44 2015
+ * with a MiG generated Thu Jun 11 16:16:11 PDT 2015 by kmacy at serenity
+ * OPTIONS: 
+ *	KernelServer
+ */
+
+/* Module clock */
+
+#define	__MIG_check__Request__clock_subsystem__ 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#ifdef _KERNEL
+#include <sys/mach/ndr.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#else /* !_KERNEL */
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#endif /*_KERNEL */
+
+#include <sys/mach/std_types.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc_mig.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/mach_types.h>
+
+#ifndef	mig_internal
+#define	mig_internal	static __inline__
+#endif	/* mig_internal */
+
+#ifndef	mig_external
+#define mig_external
+#endif	/* mig_external */
+
+#if	!defined(__MigTypeCheck) && defined(TypeCheck)
+#define	__MigTypeCheck		TypeCheck	/* Legacy setting */
+#endif	/* !defined(__MigTypeCheck) */
+
+#if	!defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
+#define	__MigKernelSpecificCode	_MIG_KERNEL_SPECIFIC_CODE_	/* Legacy setting */
+#endif	/* !defined(__MigKernelSpecificCode) */
+
+#ifndef	LimitCheck
+#define	LimitCheck 0
+#endif	/* LimitCheck */
+
+#ifndef	min
+#define	min(a,b)  ( ((a) < (b))? (a): (b) )
+#endif	/* min */
+
+#if !defined(_WALIGN_)
+#define _WALIGN_(x) (((x) + 7) & ~7)
+#endif /* !defined(_WALIGN_) */
+
+#if !defined(_WALIGNSZ_)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#endif /* !defined(_WALIGNSZ_) */
+
+#ifndef	UseStaticTemplates
+#define	UseStaticTemplates	1
+#endif	/* UseStaticTemplates */
+
+#define _WALIGN_(x) (((x) + 7) & ~7)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#ifndef	__DeclareRcvRpc
+#define	__DeclareRcvRpc(_NUM_, _NAME_)
+#endif	/* __DeclareRcvRpc */
+
+#ifndef	__BeforeRcvRpc
+#define	__BeforeRcvRpc(_NUM_, _NAME_)
+#endif	/* __BeforeRcvRpc */
+
+#ifndef	__AfterRcvRpc
+#define	__AfterRcvRpc(_NUM_, _NAME_)
+#endif	/* __AfterRcvRpc */
+
+#ifndef	__DeclareRcvSimple
+#define	__DeclareRcvSimple(_NUM_, _NAME_)
+#endif	/* __DeclareRcvSimple */
+
+#ifndef	__BeforeRcvSimple
+#define	__BeforeRcvSimple(_NUM_, _NAME_)
+#endif	/* __BeforeRcvSimple */
+
+#ifndef	__AfterRcvSimple
+#define	__AfterRcvSimple(_NUM_, _NAME_)
+#endif	/* __AfterRcvSimple */
+
+#define novalue void
+#if	__MigKernelSpecificCode
+#define msgh_request_port	msgh_remote_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_REMOTE(bits)
+#define msgh_reply_port		msgh_local_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#else
+#define msgh_request_port	msgh_local_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#define msgh_reply_port		msgh_remote_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_REMOTE(bits)
+#endif /* __MigKernelSpecificCode */
+
+#define MIG_RETURN_ERROR(X, code)	{\
+				((mig_reply_error_t *)X)->RetCode = code;\
+				((mig_reply_error_t *)X)->NDR = NDR_record;\
+				return;\
+				}
+
+/* typedefs for all requests */
+
+#ifndef __Request__clock_subsystem__defined
+#define __Request__clock_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__clock_get_time_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		clock_flavor_t flavor;
+		mach_msg_type_number_t clock_attrCnt;
+	} __Request__clock_get_attributes_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t alarm_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		alarm_type_t alarm_type;
+		mach_timespec_t alarm_time;
+	} __Request__clock_alarm_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__clock_subsystem__defined */
+
+/* typedefs for all replies */
+
+#ifndef __Reply__clock_subsystem__defined
+#define __Reply__clock_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_timespec_t cur_time;
+	} __Reply__clock_get_time_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t clock_attrCnt;
+		int clock_attr[1];
+	} __Reply__clock_get_attributes_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__clock_alarm_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__clock_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__clock_subsystem__defined
+#define __ReplyUnion__clock_subsystem__defined
+union __ReplyUnion__clock_subsystem {
+	__Reply__clock_get_time_t Reply_clock_get_time;
+	__Reply__clock_get_attributes_t Reply_clock_get_attributes;
+	__Reply__clock_alarm_t Reply_clock_alarm;
+};
+#endif /* __RequestUnion__clock_subsystem__defined */
+/* Forward Declarations */
+
+
+mig_internal novalue _Xclock_get_time
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xclock_get_attributes
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xclock_alarm
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__clock_subsystem__
+#if !defined(__MIG_check__Request__clock_get_time_t__defined)
+#define __MIG_check__Request__clock_get_time_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__clock_get_time_t(__attribute__((__unused__)) __Request__clock_get_time_t *In0P)
+{
+
+	typedef __Request__clock_get_time_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__clock_get_time_t__defined) */
+#endif /* __MIG_check__Request__clock_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine clock_get_time */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t clock_get_time
+#if	defined(LINTLIBRARY)
+    (clock_serv, cur_time)
+	clock_serv_t clock_serv;
+	mach_timespec_t *cur_time;
+{ return clock_get_time(clock_serv, cur_time); }
+#else
+(
+	clock_serv_t clock_serv,
+	mach_timespec_t *cur_time
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine clock_get_time */
+mig_internal novalue _Xclock_get_time
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__clock_get_time_t __Request;
+	typedef __Reply__clock_get_time_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__clock_get_time_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__clock_get_time_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(1000, "clock_get_time")
+	__BeforeRcvRpc(1000, "clock_get_time")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__clock_get_time_t__defined)
+	check_result = __MIG_check__Request__clock_get_time_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__clock_get_time_t__defined) */
+
+	OutP->RetCode = clock_get_time(convert_port_to_clock(In0P->Head.msgh_request_port), &OutP->cur_time);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(1000, "clock_get_time")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__clock_subsystem__
+#if !defined(__MIG_check__Request__clock_get_attributes_t__defined)
+#define __MIG_check__Request__clock_get_attributes_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__clock_get_attributes_t(__attribute__((__unused__)) __Request__clock_get_attributes_t *In0P)
+{
+
+	typedef __Request__clock_get_attributes_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__clock_get_attributes_t__defined) */
+#endif /* __MIG_check__Request__clock_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine clock_get_attributes */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t clock_get_attributes
+#if	defined(LINTLIBRARY)
+    (clock_serv, flavor, clock_attr, clock_attrCnt)
+	clock_serv_t clock_serv;
+	clock_flavor_t flavor;
+	clock_attr_t clock_attr;
+	mach_msg_type_number_t *clock_attrCnt;
+{ return clock_get_attributes(clock_serv, flavor, clock_attr, clock_attrCnt); }
+#else
+(
+	clock_serv_t clock_serv,
+	clock_flavor_t flavor,
+	clock_attr_t clock_attr,
+	mach_msg_type_number_t *clock_attrCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine clock_get_attributes */
+mig_internal novalue _Xclock_get_attributes
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		clock_flavor_t flavor;
+		mach_msg_type_number_t clock_attrCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__clock_get_attributes_t __Request;
+	typedef __Reply__clock_get_attributes_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__clock_get_attributes_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__clock_get_attributes_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(1001, "clock_get_attributes")
+	__BeforeRcvRpc(1001, "clock_get_attributes")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__clock_get_attributes_t__defined)
+	check_result = __MIG_check__Request__clock_get_attributes_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__clock_get_attributes_t__defined) */
+
+	OutP->clock_attrCnt = 1;
+	if (In0P->clock_attrCnt < OutP->clock_attrCnt)
+		OutP->clock_attrCnt = In0P->clock_attrCnt;
+
+	OutP->RetCode = clock_get_attributes(convert_port_to_clock(In0P->Head.msgh_request_port), In0P->flavor, OutP->clock_attr, &OutP->clock_attrCnt);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+	OutP->Head.msgh_size = (sizeof(Reply) - 4) + (_WALIGN_((4 * OutP->clock_attrCnt)));
+
+	__AfterRcvRpc(1001, "clock_get_attributes")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__clock_subsystem__
+#if !defined(__MIG_check__Request__clock_alarm_t__defined)
+#define __MIG_check__Request__clock_alarm_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__clock_alarm_t(__attribute__((__unused__)) __Request__clock_alarm_t *In0P)
+{
+
+	typedef __Request__clock_alarm_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->alarm_port.type != MACH_MSG_PORT_DESCRIPTOR)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__clock_alarm_t__defined) */
+#endif /* __MIG_check__Request__clock_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine clock_alarm */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t clock_alarm
+#if	defined(LINTLIBRARY)
+    (clock_serv, alarm_type, alarm_time, alarm_port, alarm_portPoly)
+	clock_serv_t clock_serv;
+	alarm_type_t alarm_type;
+	mach_timespec_t alarm_time;
+	clock_reply_t alarm_port;
+	mach_msg_type_name_t alarm_portPoly;
+{ return clock_alarm(clock_serv, alarm_type, alarm_time, alarm_port, alarm_portPoly); }
+#else
+(
+	clock_serv_t clock_serv,
+	alarm_type_t alarm_type,
+	mach_timespec_t alarm_time,
+	clock_reply_t alarm_port,
+	mach_msg_type_name_t alarm_portPoly
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine clock_alarm */
+mig_internal novalue _Xclock_alarm
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t alarm_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		alarm_type_t alarm_type;
+		mach_timespec_t alarm_time;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__clock_alarm_t __Request;
+	typedef __Reply__clock_alarm_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__clock_alarm_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__clock_alarm_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(1002, "clock_alarm")
+	__BeforeRcvRpc(1002, "clock_alarm")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__clock_alarm_t__defined)
+	check_result = __MIG_check__Request__clock_alarm_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__clock_alarm_t__defined) */
+
+	OutP->RetCode = clock_alarm(convert_port_to_clock(In0P->Head.msgh_request_port), In0P->alarm_type, In0P->alarm_time, In0P->alarm_port.name, In0P->alarm_port.disposition);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(1002, "clock_alarm")
+}
+
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+boolean_t clock_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+mig_routine_t clock_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+extern const struct clock_subsystem clock_subsystem;
+const struct clock_subsystem {
+	mig_server_routine_t 	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[3];
+} clock_subsystem = {
+	clock_server_routine,
+	1000,
+	1003,
+	(mach_msg_size_t)sizeof(union __ReplyUnion__clock_subsystem),
+	(vm_address_t)0,
+	{
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xclock_get_time, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__clock_get_time_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xclock_get_attributes, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__clock_get_attributes_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xclock_alarm, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__clock_alarm_t) },
+	}
+};
+
+mig_external boolean_t clock_server
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	register mig_routine_t routine;
+
+	OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0);
+	OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port;
+	/* Minimal size: routine() will update it if different */
+	OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t);
+	OutHeadP->msgh_local_port = MACH_PORT_NULL;
+	OutHeadP->msgh_id = InHeadP->msgh_id + 100;
+
+	if ((InHeadP->msgh_id > 1002) || (InHeadP->msgh_id < 1000) ||
+	    ((routine = clock_subsystem.routine[InHeadP->msgh_id - 1000].stub_routine) == 0)) {
+		((mig_reply_error_t *)OutHeadP)->NDR = NDR_record;
+		((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID;
+		return FALSE;
+	}
+	(*routine) (InHeadP, OutHeadP);
+	return TRUE;
+}
+
+mig_external mig_routine_t clock_server_routine
+	(mach_msg_header_t *InHeadP)
+{
+	register int msgh_id;
+
+	msgh_id = InHeadP->msgh_id - 1000;
+
+	if ((msgh_id > 2) || (msgh_id < 0))
+		return 0;
+
+	return clock_subsystem.routine[msgh_id].stub_routine;
+}


Property changes on: trunk/sys/compat/mach/clock_server.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/defs/clock.defs
===================================================================
--- trunk/sys/compat/mach/defs/clock.defs	                        (rev 0)
+++ trunk/sys/compat/mach/defs/clock.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/*
+ * 	File:		mach/clock.defs
+ *	Purpose:	Kernel clock subsystem definitions. This
+ *			file defines the clock request interface.
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+		       clock 1000;
+
+#include <sys/mach/std_types.defs>
+#include <sys/mach/mach_types.defs>
+#include <sys/mach/clock_types.defs>
+
+/*
+ * References to clock objects are returned by:
+ *	host_get_clock_service(host_t,...)
+ *	host_get_clock_control(host_priv_t,...) - Priviledged subclass
+ */
+
+/*
+ *	Get the clock time.
+ *	Available to all.
+ */
+routine	clock_get_time(
+		clock_serv	: clock_serv_t;
+	out	cur_time	: mach_timespec_t);
+
+/*
+ *	Get clock attributes.
+ *	Available to all.
+ */
+routine	clock_get_attributes(
+		clock_serv	: clock_serv_t;
+	in	flavor		: clock_flavor_t;
+	out	clock_attr	: clock_attr_t, CountInOut);
+
+/*
+ *	Setup a clock alarm.
+ *	Available to all.
+ */
+routine clock_alarm(
+		clock_serv	: clock_serv_t;
+		alarm_type	: alarm_type_t;
+		alarm_time	: mach_timespec_t;
+                alarm_port      : clock_reply_t =
+			MACH_MSG_TYPE_MAKE_SEND_ONCE|polymorphic);
+
+/* vim: set ft=c : */

Added: trunk/sys/compat/mach/defs/host_priv.defs
===================================================================
--- trunk/sys/compat/mach/defs/host_priv.defs	                        (rev 0)
+++ trunk/sys/compat/mach/defs/host_priv.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,375 @@
+/*
+ * Copyright (c) 2000-2004 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ *	Matchmaker definitions file for Mach kernel interface.
+ */
+subsystem
+#if	KERNEL_USER
+	  KernelUser
+#endif	/* KERNEL_USER */
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+		       host_priv 400;
+
+#ifdef	KERNEL_USER
+userprefix r_;
+#endif	/* KERNEL_USER */
+
+#include <sys/mach/std_types.defs>
+#include <sys/mach/mach_types.defs>
+#include <sys/mach/clock_types.defs>
+#include <sys/mach_debug/mach_debug_types.defs>
+uimport <sys/mach/vm_types.h>;
+/*
+ *      Get boot configuration information from kernel.
+ */
+routine host_get_boot_info(
+		host_priv	: host_priv_t;
+	out	boot_info	: kernel_boot_info_t);
+
+/*
+ *	Reboot this host.
+ *	Only available to privileged users.
+ */
+routine host_reboot(
+		host_priv	: host_priv_t;
+		options		: int);
+
+
+/*
+ *	Return privileged statistics from this host.
+ */
+routine host_priv_statistics(
+		host_priv	: host_priv_t;
+		flavor		: host_flavor_t;
+	out	host_info_out	: host_info_t, CountInOut);
+
+/*
+ *	Sets the default memory manager, the port to which
+ *	newly-created temporary memory objects are delivered.
+ *	[See (memory_object_default)memory_object_create.]
+ *	Also sets the default cluster size used for pagein/pageout
+ *	to this port.
+ *	The old memory manager port is returned.
+ */
+routine host_default_memory_manager(
+		host_priv	: host_priv_t;
+	inout	default_manager	: memory_object_default_t = 
+					MACH_MSG_TYPE_MAKE_SEND;
+		cluster_size	: memory_object_cluster_size_t);
+
+
+/*
+ *	Specify that the range of the virtual address space
+ *	of the target task must not cause page faults for
+ *	the indicated accesses.
+ *
+ *	[ To unwire the pages, specify VM_PROT_NONE. ]
+ */
+routine	vm_wire(
+		host_priv	: host_priv_t;
+		task		: mach_vm_map_t;
+		address		: vm_address_t;
+		size		: vm_size_t;
+		desired_access	: vm_prot_t);
+
+/*
+ *	Specify that the target thread must always be able
+ *	to run and to allocate memory.
+ */
+routine	thread_wire(
+		host_priv	: host_priv_t;
+		thread		: thread_act_t;
+		wired		: boolean_t);
+
+/*
+ *	Allocate zero-filled, wired, contiguous physical memory
+ *	in the address space of the target task, either at the
+ *	specified address, or wherever space can be found (if
+ *	anywhere is TRUE), of the specified size.  The address
+ *	at which the allocation actually took place is returned.
+ *	All pages will be entered into the task's pmap immediately,
+ *	with VM_PROT_ALL.
+ *
+ *	In addition to all the failure modes of its cousin,
+ *	vm_allocate, this call may also fail if insufficient
+ *	contiguous memory exists to satisfy the request.
+ *
+ *	Memory obtained from this call should be freed the
+ *	normal way, via vm_deallocate.
+ *
+ *	N.B.  This is an EXPERIMENTAL interface!
+ */
+routine	vm_allocate_cpm(
+		host_priv	: host_priv_t;
+		task		: mach_vm_map_t;
+	inout	address		: vm_address_t;
+		size		: vm_size_t;
+		flags		: int);
+
+/*
+ *	Get list of processors on this host.
+ */
+routine host_processors(
+		host_priv		: host_priv_t;
+	out	out_processor_list	: processor_array_t);
+
+
+/*
+ *	Get control port for a system-wide clock.
+ *	Privileged.
+ */
+routine host_get_clock_control(
+		host_priv	: host_priv_t;
+		clock_id	: clock_id_t;
+	out	clock_ctrl	: clock_ctrl_t);
+
+
+#ifdef SHOW_UNUSED
+/*
+ * kernel module interface (obsolete as of SnowLeopard)
+ * see mach/kmod.h
+ */
+/* kmod_ MIG calls now return KERN_NOT_SUPPORTED on PPC/i386/x86_64. */
+routine kmod_create(
+		host_priv	: host_priv_t;
+		info		: vm_address_t;
+	out	module		: kmod_t);
+
+routine kmod_destroy(
+		host_priv	: host_priv_t;
+		module		: kmod_t);
+
+routine	kmod_control(
+		host_priv	: host_priv_t;
+		module		: kmod_t;
+		flavor		: kmod_control_flavor_t;
+	inout	data		: kmod_args_t);
+#else
+skip;
+skip;
+skip;
+#endif
+
+/*
+ * 	Get a given special port for a given node.
+ * 	Special ports are defined in host_special_ports.h;
+ * 	examples include the master device port.
+ * 	There are a limited number of slots available for system servers.
+ */
+routine host_get_special_port(
+                host_priv       : host_priv_t;
+                node            : int;
+                which           : int;
+        out     port            : mach_port_t);
+
+/*
+ * 	Set a given special port for the local node.
+ * 	See host_get_special_port.
+ */
+routine host_set_special_port(
+                host_priv       : host_priv_t;
+                which           : int;
+                port            : mach_port_t);
+
+/*
+ * Set an exception handler for a host on one or more exception types.
+ * These handlers are invoked for all threads on the host if there are
+ * no task or thread-specific exception handlers or those handlers returned
+ * an error.
+ */
+routine	host_set_exception_ports(
+		host_priv	: host_priv_t;
+		exception_mask	: exception_mask_t;
+		new_port	: mach_port_t;
+		behavior	: exception_behavior_t;
+		new_flavor	: thread_state_flavor_t);
+
+
+/*
+ * Lookup some of the old exception handlers for a host
+ */
+routine	host_get_exception_ports(
+		host_priv	: host_priv_t;
+		exception_mask	: exception_mask_t;
+	  out	masks		: exception_mask_array_t;
+	  out	old_handlers	: exception_handler_array_t, SameCount;
+	  out	old_behaviors	: exception_behavior_array_t, SameCount;
+	  out	old_flavors	: exception_flavor_array_t, SameCount);
+
+
+/*
+ * Set an exception handler for a host on one or more exception types.
+ * At the same time, return the previously defined exception handlers for
+ * those types.
+ */
+routine	host_swap_exception_ports(
+		host_priv	: host_priv_t;
+		exception_mask	: exception_mask_t;
+		new_port	: mach_port_t;
+		behavior	: exception_behavior_t;
+		new_flavor	: thread_state_flavor_t;
+	  out	masks		: exception_mask_array_t;
+	  out	old_handlerss	: exception_handler_array_t, SameCount;
+	  out	old_behaviors	: exception_behavior_array_t, SameCount;
+	  out	old_flavors	: exception_flavor_array_t, SameCount);
+
+skip; /* old host_load_symbol_table */
+
+/*
+ *	Specify that the range of the virtual address space
+ *	of the target task must not cause page faults for
+ *	the indicated accesses.
+ *
+ *	[ To unwire the pages, specify VM_PROT_NONE. ]
+ */
+routine	mach_vm_wire(
+		host_priv	: host_priv_t;
+		task		: mach_vm_map_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		desired_access	: vm_prot_t);
+
+/*
+ * JMM - Keep all processor_set related items at the end for easy
+ * removal.
+ */
+/*
+ *	List all processor sets on host.
+ */
+routine host_processor_sets(
+		host_priv	: host_priv_t;
+	out	processor_sets	: processor_set_name_array_t);
+
+/*
+ *	Get control port for a processor set.
+ */
+routine host_processor_set_priv(
+		host_priv	: host_priv_t;
+		set_name	: processor_set_name_t;
+	out	set		: processor_set_t);
+
+/************************** Warning *************************************/
+/*       The following routines are going away in a future release	*/
+/*	use the appropriate variant of host_set_special_port instead	*/
+/************************************************************************/
+ 
+/*
+ *	Set the dynamic_pager control port. Other entities
+ *	can request a send right to this port to talk with
+ *	the dynamic_pager utility, setting behavioral parameters
+ *	within the dynamic pager and getting low/high backing store
+ *	resource notifications.
+ */
+routine set_dp_control_port(    
+		host		: host_priv_t;
+	in	control_port	: mach_port_t);
+
+/*
+ *	Get the dynamic_pager control port.  This port
+ *	allows the holder to talk directly with the dynamic
+ *	pager utility.
+ */
+routine get_dp_control_port(    
+		host		: host_priv_t;
+	out	contorl_port    :mach_port_t);
+
+/*
+ *	Set the UserNotification daemon access port for this host. 
+ *	If this value is already set, the kernel will discard its
+ *	reference to the previously registered port.
+ */
+routine host_set_UNDServer(    
+		host		: host_priv_t;
+	in	server		: UNDServerRef);
+
+/*
+ *	Get the UserNotification daemon access port for this host.
+ *	This can then be used to communicate with that daemon, which
+ *	in turn communicates with the User through whatever means
+ *	available (pop-up-menus for GUI systems, text for non-GUI, etc..).
+ *
+ *	Access to this port is restricted to privileged clients because
+ *	it is a special purpose port intended for kernel clients.  User
+ *	level clients should go directly to the CFUserNotifcation services.
+ */
+routine host_get_UNDServer(    
+		host		: host_priv_t;
+	out	server		: UNDServerRef);
+
+/*
+ * Perform an operation with a kernel extension, on the kext loading system,
+ * or request information about loaded kexts or the state of the kext loading
+ * system.
+ * Active operations (load, unload, disable/enable) require host_priv/root access.
+ * Info retrieval does not.
+ *
+ * WARNING: THIS ROUTINE IS PRIVATE TO THE KEXT-MANAGEMENT STACK AND IS
+ * SUBJECT TO CHANGE AT ANY TIME.
+ */
+routine kext_request(
+        host_priv      : host_priv_t;
+    in  user_log_flags : uint32_t;
+    in  request_data   : pointer_t;
+    out response_data  : pointer_t;
+    out log_data       : pointer_t;
+    out op_result      : kern_return_t);
+
+/* vim: set ft=c : */

Added: trunk/sys/compat/mach/defs/mach_host.defs
===================================================================
--- trunk/sys/compat/mach/defs/mach_host.defs	                        (rev 0)
+++ trunk/sys/compat/mach/defs/mach_host.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ * File:	mach/mach_host.defs
+ *
+ * Abstract:
+ *	Mach host operations support.  Includes processor allocation and
+ *	control.  
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+		       mach_host 200;
+
+/*
+ *	Basic types
+ */
+
+#include <sys/mach/std_types.defs>
+#include <sys/mach/mach_types.defs>
+#include <sys/mach/clock_types.defs>
+#include <sys/mach_debug/mach_debug_types.defs>
+
+/*
+ * References to host objects are returned by:
+ *	mach_host_self() - trap
+ */
+
+/*
+ *	Return information about this host.
+ */
+routine host_info(
+		host		: host_t;
+		flavor		: host_flavor_t;
+	out	host_info_out	: host_info_t, CountInOut);
+
+/*
+ *	Get string describing current kernel version.
+ */
+routine	host_kernel_version(
+		host		: host_t;
+	out	kernel_version	: kernel_version_t);
+
+/*
+ *      Get host page size
+ *	(compatibility for running old libraries on new kernels -
+ *	host_page_size() is now a library routine based on constants)
+ */
+#if KERNEL
+routine host_page_size(
+#else
+routine _host_page_size(
+#endif
+		host		: host_t;
+	out	out_page_size	: vm_size_t);
+
+/*
+ *	Allow pagers to create named entries that point to un-mapped
+ *	abstract memory object.  The named entries are generally mappable
+ *	and can be subsetted through the mach_make_memory_entry call
+ */
+routine mach_memory_object_memory_entry(
+		host		:host_t;
+		internal	:boolean_t;
+		size		:vm_size_t;
+		permission	:vm_prot_t;
+		pager		:memory_object_t;
+	out	entry_handle	:mach_port_move_send_t);
+
+
+/*
+ *      Get processor info for all the processors on this host.
+ *	The returned data is an OOL array of processor info.
+ */
+routine host_processor_info(
+		host			: host_t;
+                flavor          	: processor_flavor_t;
+	out	out_processor_count 	: natural_t;
+        out     out_processor_info  	: processor_info_array_t);
+
+#ifdef SHOW_UNUSED
+/*
+ * 	Return host IO master access port
+ */
+routine host_get_io_master(
+                host            : host_t;
+        out     io_master       : io_master_t);
+#else
+skip;
+#endif
+/*
+ *	Get service port for a processor set.
+ *	Available to all.
+ */
+routine host_get_clock_service(
+		host		: host_t;
+		clock_id	: clock_id_t;
+	out	clock_serv	: clock_serv_t);
+
+#ifdef SHOW_UNUSED
+/*
+ * kernel module interface (obsolete as of SnowLeopard)
+ * see mach/kmod.h
+ */
+/* kmod_ MIG calls now return KERN_NOT_SUPPORTED on PPC/i386/x86_64. */
+routine	kmod_get_info(
+		host		: host_t;
+	out	modules		: kmod_args_t);
+
+/*
+ *	Returns information about the memory allocation zones.
+ *      Supported in all kernels..
+ *
+ *	DEPRECATED!  Use mach_zone_info() instead.
+ */
+routine host_zone_info(
+		host		: host_priv_t;
+	out	names		: zone_name_array_t,
+					Dealloc;
+	out	info		: zone_info_array_t,
+					Dealloc);
+#else
+skip;
+skip;
+#endif
+
+/*
+ *	Returns information about the global VP table.
+ *      Only supported in MACH_VM_DEBUG kernels,
+ *      otherwise returns KERN_FAILURE.
+ */
+routine host_virtual_physical_table_info(
+		host		: host_t;
+	out	info		: hash_info_bucket_array_t,
+					Dealloc);
+
+
+skip; /* was host_ipc_hash_info */
+skip; /* was enable_bluebox */
+skip; /* was disable_bluebox */
+
+/*
+ * JMM - Keep processor_set related items at the end for easy
+ * removal.
+ */
+/*
+ *	Get default processor set for host.
+ */
+routine processor_set_default(
+		host		: host_t;
+	out	default_set	: processor_set_name_t);
+
+/*
+ *	Create new processor set.  Returns real port for manipulations,
+ *	and name port for obtaining information.
+ */
+routine processor_set_create(
+		host		: host_t;
+	out	new_set		: processor_set_t;
+	out	new_name	: processor_set_name_t);
+
+/*
+ * 	Temporary interfaces for conversion to 64 bit data path 
+ */
+
+routine mach_memory_object_memory_entry_64(
+		host		:host_t;
+		internal	:boolean_t;
+		size		:memory_object_size_t;
+		permission	:vm_prot_t;
+		pager		:memory_object_t;
+	out	entry_handle	:mach_port_move_send_t);
+
+/*
+ *	Return statistics from this host.
+ */
+routine host_statistics(
+		host_priv	: host_t;
+		flavor		: host_flavor_t;
+	out	host_info_out	: host_info_t, CountInOut);
+
+routine host_request_notification(
+		host		: host_t;
+		notify_type	: host_flavor_t;
+		notify_port	: mach_port_make_send_once_t);
+
+#ifdef SHOW_UNUSED
+routine host_lockgroup_info(
+		host		: host_t;
+	out	lockgroup_info	: lockgroup_info_array_t,
+					Dealloc);
+#else
+skip;
+#endif
+/*
+ *	Return 64-bit statistics from this host.
+ */
+routine host_statistics64(
+		host_priv	: host_t;
+		flavor		: host_flavor_t;
+	out	host_info64_out	: host_info64_t, CountInOut);
+
+/*
+ *	Returns information about the memory allocation zones.
+ *      Data returned is compatible with various caller and kernel
+ *	address space sizes (unlike host_zone_info()).
+ */
+routine mach_zone_info(
+		host		: host_priv_t;
+	out	names		: mach_zone_name_array_t,
+					Dealloc;
+	out	info		: mach_zone_info_array_t,
+					Dealloc);
+
+#ifdef PRIVATE
+/*
+ *	Forces a zone allocator garbage collections pass.
+ *	Pages with no in-use allocations are returned to
+ *	the VM system for re-use.
+ */    
+routine mach_zone_force_gc(
+		host		: host_t);
+#else
+skip;
+#endif
+
+/*
+ *	Create a new voucher by running a series of commands against
+ *	<key, previous-voucher> pairs of resource attributes.
+ */
+routine host_create_mach_voucher(
+		host		: host_t;
+		recipes		: mach_voucher_attr_raw_recipe_array_t;
+	out	voucher		: ipc_voucher_t);
+
+/*
+ *	Register a resource manager with the kernel.  A new key is selected.
+ */
+routine host_register_mach_voucher_attr_manager(
+		host		: host_t;
+		attr_manager	: mach_voucher_attr_manager_t;
+		default_value	: mach_voucher_attr_value_handle_t;
+	out	new_key		: mach_voucher_attr_key_t;
+	out	new_attr_control: ipc_voucher_attr_control_t);
+
+/*
+ *	Register a resource manager (with a well-known key value) with the kernel.
+ */
+routine host_register_well_known_mach_voucher_attr_manager(
+		host		: host_t;
+		attr_manager	: mach_voucher_attr_manager_t;
+		default_value	: mach_voucher_attr_value_handle_t;
+		key		: mach_voucher_attr_key_t;
+	out	new_attr_control: ipc_voucher_attr_control_t);
+
+/* vim: set ft=c : */

Added: trunk/sys/compat/mach/defs/mach_port.defs
===================================================================
--- trunk/sys/compat/mach/defs/mach_port.defs	                        (rev 0)
+++ trunk/sys/compat/mach/defs/mach_port.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,631 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_FREE_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/mach_port.defs
+ *	Author:	Rich Draves
+ *
+ *	Exported kernel calls.
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+	  mach_port 3200;
+
+#if !KERNEL && !LIBSYSCALL_INTERFACE
+	UserPrefix _kernelrpc_;
+#endif
+
+#include <sys/mach/std_types.defs>
+#include <sys/mach/mach_types.defs>
+#include <sys/mach_debug/mach_debug_types.defs>
+
+/*
+ *	Returns the set of port and port set names
+ *	to which the target task has access, along with
+ *	the type (set or port) for each name.
+ */
+
+routine mach_port_names(
+		task		: ipc_space_t;
+	out	names		: mach_port_name_array_t;
+	out	types		: mach_port_type_array_t);
+
+/*
+ *	Returns the type (set or port) for the port name
+ *	within the target task.  Also indicates whether
+ *	there is a dead-name request for the name.
+ */
+
+routine mach_port_type(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+	out	ptype		: mach_port_type_t);
+
+/*
+ *	Changes the name by which a port (or port set) is known to
+ *	the target task.  The new name can't be in use.  The
+ *	old name becomes available for recycling.
+ *
+ *	This interface is OBSOLETE and will always
+ *	return KERN_NOT_SUPPORTED.
+ */
+
+routine mach_port_rename(
+		task		: ipc_space_t;
+		old_name	: mach_port_name_t;
+		new_name	: mach_port_name_t);
+
+/*
+ *	Allocates the specified kind of object, with the given name.
+ *	The right must be one of
+ *		MACH_PORT_RIGHT_RECEIVE
+ *		MACH_PORT_RIGHT_PORT_SET
+ *		MACH_PORT_RIGHT_DEAD_NAME
+ *	New port sets are empty.  New ports don't have any
+ *	send/send-once rights or queued messages.  The make-send
+ *	count is zero and their queue limit is MACH_PORT_QLIMIT_DEFAULT.
+ *	New sets, ports, and dead names have one user reference.
+ */
+
+routine mach_port_allocate_name(
+		task		: ipc_space_t;
+		right		: mach_port_right_t;
+		name		: mach_port_name_t);
+
+#ifdef KERNEL
+/*
+ *	Allocates the specified kind of object.
+ *	The right must be one of
+ *		MACH_PORT_RIGHT_RECEIVE
+ *		MACH_PORT_RIGHT_PORT_SET
+ *		MACH_PORT_RIGHT_DEAD_NAME
+ *	Like port_allocate_name, but the kernel picks a name.
+ *	It can use any name not associated with a right.
+ */
+
+routine mach_port_allocate(
+		task		: ipc_space_t;
+		right		: mach_port_right_t;
+	out	name		: mach_port_name_t);
+
+/*
+ *	Releases one send/send-once/dead-name user ref.
+ *	Just like mach_port_mod_refs -1, but deduces the
+ *	correct type of right.  This allows a user task
+ *	to release a ref for a port without worrying
+ *	about whether the port has died or not.
+ */
+
+routine mach_port_deallocate(
+		task		: ipc_space_t;
+		name		: mach_port_name_t);
+
+
+/*
+ *	Inserts the specified rights into the target task,
+ *	using the specified name.  If inserting send/receive
+ *	rights and the task already has send/receive rights
+ *	for the port, then the names must agree.  In any case,
+ *	the task gains a user ref for the port.
+ */
+
+routine mach_port_insert_right(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		poly		: mach_port_poly_t);
+
+/*
+ *	Returns the specified right for the named port
+ *	in the target task, extracting that right from
+ *	the target task.  The target task loses a user
+ *	ref and the name may be available for recycling.
+ *	msgt_name must be one of
+ *		MACH_MSG_TYPE_MOVE_RECEIVE
+ *		MACH_MSG_TYPE_COPY_SEND
+ *		MACH_MSG_TYPE_MAKE_SEND
+ *		MACH_MSG_TYPE_MOVE_SEND
+ *		MACH_MSG_TYPE_MAKE_SEND_ONCE
+ *		MACH_MSG_TYPE_MOVE_SEND_ONCE
+ */
+
+routine mach_port_extract_right(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		msgt_name	: mach_msg_type_name_t;
+	out	poly		: mach_port_poly_t);
+
+/*
+ *	The delta is a signed change to the task's
+ *	user ref count for the right.  Only dead names
+ *	and send rights can have a positive delta.
+ *	The resulting user ref count can't be negative.
+ *	If it is zero, the right is deallocated.
+ *	If the name isn't a composite right, it becomes
+ *	available for recycling.  The right must be one of
+ *		MACH_PORT_RIGHT_RECEIVE
+ *		MACH_PORT_RIGHT_PORT_SET
+ *		MACH_PORT_RIGHT_DEAD_NAME
+ *		MACH_PORT_RIGHT_SEND
+ *		MACH_PORT_RIGHT_SEND_ONCE
+ */
+
+routine mach_port_mod_refs(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		right		: mach_port_right_t;
+		delta		: mach_port_delta_t);
+
+/*
+ *	Puts the member port (the task must have receive rights)
+ *	into the after port set.  If the port is already a member
+ *	of any set(s), it is atomically removed from those sets as
+ *	part of this operation.  (If after is MACH_PORT_NULL, the
+ *	port is still removed from all current sets).
+ */
+
+routine mach_port_move_member(
+		task		: ipc_space_t;
+		member		: mach_port_name_t;
+		after		: mach_port_name_t);
+
+#else
+skip;
+skip;
+skip;
+skip;
+skip;
+skip;
+#endif
+/*
+ *	Destroys all rights associated with the name and makes it
+ *	available for recycling immediately.  The name can be a
+ *	port (possibly with multiple user refs), a port set, or
+ *	a dead name (again, with multiple user refs).
+ */
+
+routine mach_port_destroy(
+		task		: ipc_space_t;
+		name		: mach_port_name_t);
+
+/*
+ *	A port set always has one user ref.
+ *	A send-once right always has one user ref.
+ *	A dead name always has one or more user refs.
+ *	A send right always has one or more user refs.
+ *	A receive right always has one user ref.
+ *	The right must be one of
+ *		MACH_PORT_RIGHT_RECEIVE
+ *		MACH_PORT_RIGHT_PORT_SET
+ *		MACH_PORT_RIGHT_DEAD_NAME
+ *		MACH_PORT_RIGHT_SEND
+ *		MACH_PORT_RIGHT_SEND_ONCE
+ */
+
+routine mach_port_get_refs(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		right		: mach_port_right_t;
+	out	refs		: mach_port_urefs_t);
+
+/*
+ *	Peek at the message queue for the specified receive
+ *	right and return info about the message with the
+ *	sequence number matching the input.  If zero is
+ *	specified as the seqno, the first message in the
+ *	queue will be peeked.
+ *
+ *	Only the following trailer types are currently supported:
+ *	     MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)
+ *
+ *		or'ed with one of these element types:
+ *	     MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_NULL)
+ *	     MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SEQNO)
+ *	     MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER)
+ *	     MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_AUDIT)
+ */
+routine mach_port_peek(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		trailer_type	: mach_msg_trailer_type_t;
+ inout		request_seqnop	: mach_port_seqno_t;
+ out		msg_sizep	: mach_msg_size_t;
+ out		msg_idp		: mach_msg_id_t;
+ out		trailer_infop	: mach_msg_trailer_info_t, CountInOut);		
+
+/*
+ *	Only valid for receive rights.
+ *	Sets the make-send count for the port.
+ */
+routine mach_port_set_mscount(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		mscount		: mach_port_mscount_t);
+
+/*
+ *	Only valid for port sets.  Returns a list of
+ *	the members.
+ */
+
+routine mach_port_get_set_status(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+	out	members		: mach_port_name_array_t);
+
+/*
+ *	Requests a notification from the kernel.  The request
+ *	must supply the send-once right which is used for
+ *	the notification.  If a send-once right was previously
+ *	registered, it is returned.  The msgid must be one of:
+ *		MACH_NOTIFY_PORT_DESTROYED (receive rights)
+ *		MACH_NOTIFY_DEAD_NAME (send/receive/send-once rights)
+ *		MACH_NOTIFY_SEND_POSSIBLE (send/receive/send-once rights)
+ *		MACH_NOTIFY_NO_SENDERS (receive rights)
+ *
+ *	The sync value specifies whether a notification should
+ *	get sent immediately, if appropriate.  The exact meaning
+ *	depends on the notification:
+ *		MACH_NOTIFY_PORT_DESTROYED: must be zero.
+ *		MACH_NOTIFY_DEAD_NAME: if non-zero, then name can be dead,
+ *			and the notification gets sent immediately.
+ *			If zero, then name can't be dead.
+ *		MACH_NOTIFY_SEND_POSSIBLE: if non-zero, will generate a	send-
+ *			possible notification as soon as it is possible to send
+ *			to the port. If zero, will generate a send-possible
+ *			notification only after a subsequent failed send
+ *			(with MACH_SEND_NOTIFY option to mach_msg call).  Can
+ *			generate a dead-name notification if name is already dead
+ *			or becomes dead before a send-possible notification fires.
+ *		MACH_NOTIFY_NO_SENDERS: the notification gets sent
+ *			immediately if the current mscount is greater
+ *			than or equal to the sync value and there are no
+ *			extant send rights.
+ *
+ * If the name is deleted before a successfully registered notification
+ * is delivered, it is replaced with a port-deleted notification.
+ */
+
+routine mach_port_request_notification(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		msgid		: mach_msg_id_t;
+		sync		: mach_port_mscount_t;
+		notify		: mach_port_send_once_t;
+	out	previous	: mach_port_move_send_once_t);
+
+/*
+ *	Only valid for receive rights.
+ *	Sets the sequence number for the port.
+ */
+
+routine mach_port_set_seqno(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		seqno		: mach_port_seqno_t);
+
+/*
+ *      Returns information about a port.
+ */
+
+routine mach_port_get_attributes(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		flavor		: mach_port_flavor_t;
+	out	port_info_out	: mach_port_info_t, CountInOut);
+
+/*
+ *      Set attributes of a port
+ */
+
+routine mach_port_set_attributes(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		flavor		: mach_port_flavor_t;
+		port_info	: mach_port_info_t);
+
+
+/*
+ *	Allocates the specified kind of object, qos version.
+ *	The right must be
+ *		MACH_PORT_RIGHT_RECEIVE
+ *	Like port_allocate_name, but the kernel picks a name.
+ *	It can use any name not associated with a right.
+ */
+
+routine mach_port_allocate_qos(
+		task		: ipc_space_t;
+		right		: mach_port_right_t;
+	inout	qos		: mach_port_qos_t;
+	out	name		: mach_port_name_t);
+
+
+/*
+ *	Generic interface to allocation various kinds of ports.
+ *	Should never be called directly by users (at least not
+ *	unless they are exceedingly masochistic).
+ */
+
+routine mach_port_allocate_full(
+		task		: ipc_space_t;
+		right		: mach_port_right_t;
+		proto		: mach_port_t;
+	inout	qos		: mach_port_qos_t;
+	inout	name		: mach_port_name_t);
+
+
+/*
+ *	Pre-expand task port name space.
+ */
+routine task_set_port_space(
+		task		: ipc_space_t;
+		table_entries	: int);
+
+
+/*
+ *	Returns the exact number of extant send rights
+ *	for the given receive right.
+ *      This call is only valid on MACH_IPC_DEBUG kernels.
+ *      Otherwise, KERN_FAILURE is returned.
+ */
+routine	mach_port_get_srights(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+	out	srights		: mach_port_rights_t);
+
+
+/*
+ *	Returns information about an IPC space.
+ *      This call is only valid on MACH_IPC_DEBUG kernels.
+ *      Otherwise, KERN_FAILURE is returned.
+ */
+routine mach_port_space_info(
+		task		: ipc_space_t;
+	out	space_info	: ipc_info_space_t;
+	out	table_info	: ipc_info_name_array_t;
+	out	tree_info	: ipc_info_tree_name_array_t);
+
+/*
+ *	Returns information about the dead-name requests
+ *	registered with the named receive right.
+ *      This call is only valid on MACH_IPC_DEBUG kernels.
+ *      Otherwise, KERN_FAILURE is returned.
+ */
+routine mach_port_dnrequest_info(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+	out	dnr_total	: unsigned;	/* total size of table */
+	out	dnr_used	: unsigned);	/* amount used */
+
+#ifdef SHOW_UNUSED
+/*
+ *	Return the type and address of the kernel object
+ *	that the given send/receive right represents.
+ *      This call is only valid on MACH_IPC_DEBUG kernels.
+ *      Otherwise, KERN_FAILURE is returned.
+ *
+ *	This interface is DEPRECATED in favor of the new
+ *	mach_port_kernel_object64() call (see below).
+ */
+routine	mach_port_kernel_object(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+	out	object_type	: unsigned;
+	out	object_addr	: unsigned);
+#else
+skip;
+#endif
+
+#ifdef KERNEL
+/*
+ *	Inserts the specified rights into the portset identified
+ *	by the <task, pset> pair.  The results of passing in the
+ *	Poly argument via the supplied disposition must yield a
+ *	receive right.
+ *
+ *	If the <task,pset> pair does not represent a valid portset
+ *	KERN_INVALID_RIGHT is returned.
+ *	
+ *	If the passed in name argument does not represent a receive
+ *	right, KERN_INVALID_CAPABILITY will be returned.
+ *
+ *	If the port represented by the receive right is already in
+ *	the portset, KERN_ALREADY_IN_SET is returned.
+ */
+routine mach_port_insert_member(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		pset		: mach_port_name_t);
+
+/*
+ *	Extracts the specified right from the named portset
+ *	in the target task.  
+ *	the target task.  The target task loses a user
+ *	ref and the name may be available for recycling.
+ *	msgt_name must be one of
+ *		MACH_MSG_TYPE_MOVE_RECEIVE
+ *		MACH_MSG_TYPE_COPY_SEND
+ *		MACH_MSG_TYPE_MAKE_SEND
+ *		MACH_MSG_TYPE_MOVE_SEND
+ *		MACH_MSG_TYPE_MAKE_SEND_ONCE
+ *		MACH_MSG_TYPE_MOVE_SEND_ONCE
+ */
+
+routine mach_port_extract_member(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		pset		: mach_port_name_t);
+#else
+skip;
+skip;
+#endif
+/*
+ * Only valid for receive rights.
+ * Gets the context pointer for the port.
+ */
+
+routine mach_port_get_context(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+#ifdef LIBSYSCALL_INTERFACE
+	out context		: mach_port_context_t
+#else
+	out context		: mach_vm_address_t
+#endif
+	);
+
+/*
+ * Only valid for receive rights.
+ * Sets the context pointer for the port.
+ */
+
+routine mach_port_set_context(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+#ifdef LIBSYSCALL_INTERFACE
+		context		: mach_port_context_t
+#else
+		context		: mach_vm_address_t
+#endif
+		);
+
+/*
+ *	Return the type and address of the kernel object
+ *	that the given send/receive right represents.
+ *      This call is only valid on MACH_IPC_DEBUG kernels.
+ *      Otherwise, KERN_FAILURE is returned.
+ */
+routine	mach_port_kobject(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+	out	object_type	: natural_t;
+	out	object_addr	: mach_vm_address_t);
+
+
+/*
+ *	Constructs a right based on the options passed
+ *	in. Also allows guarding the port as one of the
+ *	options if the requested right is a receive
+ *	right.
+ */
+routine mach_port_construct(
+		task		: ipc_space_t;
+		options		: mach_port_options_ptr_t;
+#ifdef LIBSYSCALL_INTERFACE
+		context		: mach_port_context_t;
+#else
+		context		: uint64_t;
+#endif
+	out	name		: mach_port_name_t);
+
+/*
+ *	Destroys a mach port using the guard provided
+ *	for guarded ports. Also reduces the user ref
+ *	count for send rights as specified by srdelta.
+ */
+routine mach_port_destruct(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		srdelta		: mach_port_delta_t;
+#ifdef LIBSYSCALL_INTERFACE
+		guard		: mach_port_context_t
+#else
+		guard		: uint64_t
+#endif		
+		);
+
+/*
+ *	Guard an already existing port. Allows guarding
+ *	receive rights only. Uses the context field in the
+ *	port structure to store the guard.
+ */
+routine mach_port_guard(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+#ifdef LIBSYSCALL_INTERFACE
+		guard		: mach_port_context_t;
+#else
+		guard		: uint64_t;
+#endif	
+		strict		: boolean_t);
+
+/*
+ *	Unguard a port guarded previously. For unguarded ports
+ *	or incorrect guards passed in it raises an exception
+ *	indicating guarding misbehavior.
+ */
+routine mach_port_unguard(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+#ifdef LIBSYSCALL_INTERFACE
+		guard		: mach_port_context_t
+#else
+		guard		: uint64_t
+#endif	
+		);
+
+/*
+ *	Returns basic information about an IPC space.
+ *      This call is only valid on MACH_IPC_DEBUG kernels.
+ *      Otherwise, KERN_FAILURE is returned.
+ */
+routine mach_port_space_basic_info(
+		task		: ipc_space_t;
+	out	basic_info	: ipc_info_space_basic_t);
+
+/* vim: set ft=c : */

Added: trunk/sys/compat/mach/defs/mach_vm.defs
===================================================================
--- trunk/sys/compat/mach/defs/mach_vm.defs	                        (rev 0)
+++ trunk/sys/compat/mach/defs/mach_vm.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,532 @@
+/*
+ * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_FREE_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/mach_vm.defs
+ *
+ *	Exported kernel VM calls (for any task on the platform).
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+	  mach_vm
+#else
+	  vm_map_lp64_local
+#endif
+	  4800;
+
+#include <sys/mach/std_types.defs>
+#include <sys/mach/mach_types.defs>
+#include <sys/mach_debug/mach_debug_types.defs>
+
+#if !KERNEL && !LIBSYSCALL_INTERFACE
+#define PREFIX(NAME) _kernelrpc_ ## NAME
+#else
+#define PREFIX(NAME) NAME
+#endif
+
+/*
+ *	Allocate zero-filled memory in the address space
+ *	of the target task, either at the specified address,
+ *	or wherever space can be found (controlled by flags),
+ *	of the specified size.  The address at which the
+ *	allocation actually took place is returned.
+ */
+#if defined(SHOW_UNUSED) && !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine PREFIX(mach_vm_allocate) (
+		target		: vm_task_entry_t;
+	inout	address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		flags		: int);
+
+#else
+
+#if !defined(SHOW_UNUSED) || (!KERNEL && !LIBSYSCALL_INTERFACE)
+skip;
+#else
+routine PREFIX(vm_allocate) (
+		target		: vm_task_entry_t;
+	inout	address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		flags		: int);
+
+#endif
+
+#endif
+
+
+/*
+ *	Deallocate the specified range from the virtual
+ *	address space of the target virtual memory map.
+ */
+#if defined(SHOW_UNUSED) && !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine PREFIX(mach_vm_deallocate) (
+		target		: vm_task_entry_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t);
+
+#else
+
+#if !defined(SHOW_UNUSED) || (!KERNEL && !LIBSYSCALL_INTERFACE)
+skip;
+#else
+routine PREFIX(vm_deallocate) (
+		target		: vm_task_entry_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t);
+#endif
+
+#endif
+
+/*
+ *	Set the current or maximum protection attribute
+ *	for the specified range of the virtual address
+ *	space of the target virtual memory map.  The current
+ *	protection limits the memory access rights of threads
+ *	within the map; the maximum protection limits the accesses
+ *	that may be given in the current protection.
+ *	Protections are specified as a set of {read, write, execute}
+ *	*permissions*.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine PREFIX(mach_vm_protect) (
+		target_task	: vm_task_entry_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		set_maximum	: boolean_t;
+		new_protection	: vm_prot_t);
+
+
+#else
+
+#if !KERNEL && !LIBSYSCALL_INTERFACE
+skip;
+#else
+
+routine PREFIX(vm_protect) (
+		target_task	: vm_task_entry_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		set_maximum	: boolean_t;
+		new_protection	: vm_prot_t);
+
+#endif
+
+#endif
+
+/*
+ *	Set the inheritance attribute for the specified range
+ *	of the virtual address space of the target address space.
+ *	The inheritance value is one of {none, copy, share}, and
+ *	specifies how the child address space should acquire
+ *	this memory at the time of a task_create call.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_inherit(
+#else
+routine vm_inherit(
+#endif
+		target_task	: vm_task_entry_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		new_inheritance	: vm_inherit_t);
+
+/*
+ *	Returns the contents of the specified range of the
+ *	virtual address space of the target task.  [The
+ *	range must be aligned on a virtual page boundary,
+ *	and must be a multiple of pages in extent.  The
+ *	protection on the specified range must permit reading.]
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine PREFIX(mach_vm_read) (
+#else
+routine PREFIX(vm_read) (
+#endif
+		target_task	: mach_vm_map_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+	out	data		: pointer_t);
+
+/* 
+ * List corrollary to vm_read, returns mapped contents of specified
+ * ranges within target address space.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_read_list(
+#else
+routine vm_read_list(
+#endif
+		target_task 	: mach_vm_map_t;
+	inout	data_list   	: mach_vm_read_entry_t;
+		count		: natural_t);
+
+/*
+ *	Writes the contents of the specified range of the
+ *	virtual address space of the target task.  [The
+ *	range must be aligned on a virtual page boundary,
+ *	and must be a multiple of pages in extent.  The
+ *	protection on the specified range must permit writing.]
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_write(
+#else
+routine vm_write(
+#endif
+		target_task	: mach_vm_map_t;
+		address		: mach_vm_address_t;
+		data		: pointer_t);
+
+/*
+ *	Copy the contents of the source range of the virtual
+ *	address space of the target task to the destination
+ *	range in that same address space.  [Both of the
+ *	ranges must be aligned on a virtual page boundary,
+ *	and must be multiples of pages in extent.  The
+ *	protection on the source range must permit reading,
+ *	and the protection on the destination range must
+ *	permit writing.]
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_copy(
+#else
+routine vm_copy(
+#endif
+		target_task	: mach_vm_map_t;
+		source_address	: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		dest_address	: mach_vm_address_t);
+
+/*
+ *	Returns the contents of the specified range of the
+ *	virtual address space of the target task.  [There
+ *	are no alignment restrictions, and the results will
+ *      overwrite the area pointed to by data - which must
+ *      already exist. The protection on the specified range
+ *	must permit reading.]
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_read_overwrite(
+#else
+routine vm_read_overwrite(
+#endif
+		target_task	: mach_vm_map_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		data		: mach_vm_address_t;
+	out	outsize		: mach_vm_size_t);
+
+
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_msync(
+#else
+routine vm_msync(
+#endif
+		target_task	: mach_vm_map_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		sync_flags	: vm_sync_t );
+
+/*
+ *	Set the paging behavior attribute for the specified range
+ *	of the virtual address space of the target task.
+ *	The behavior value is one of {default, random, forward 
+ *	sequential, reverse sequential} and indicates the expected
+ *	page reference pattern for the specified range.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_behavior_set(
+#else
+routine vm_behavior_set(
+#endif
+		target_task	: mach_vm_map_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		new_behavior	: vm_behavior_t);
+
+
+/*
+ *	Map a user-supplie memory object into the virtual address
+ *	space of the target task.  If desired (anywhere is TRUE),
+ *	the kernel will find a suitable address range of the
+ *	specified size; else, the specific address will be allocated.
+ *
+ *	The beginning address of the range will be aligned on a virtual
+ *	page boundary, be at or beyond the address specified, and
+ *	meet the mask requirements (bits turned on in the mask must not
+ *	be turned on in the result); the size of the range, in bytes,
+ *	will be rounded	up to an integral number of virtual pages.
+ *
+ *	The memory in the resulting range will be associated with the
+ *	specified memory object, with the beginning of the memory range
+ *	referring to the specified offset into the memory object.
+ *
+ *	The mapping will take the current and maximum protections and
+ *	the inheritance attributes specified; see the vm_protect and
+ *	vm_inherit calls for a description of these attributes.
+ *
+ *	If desired (copy is TRUE), the memory range will be filled
+ *	with a copy of the data from the memory object; this copy will
+ *	be private to this mapping in this target task.  Otherwise,
+ *	the memory in this mapping will be shared with other mappings
+ *	of the same memory object at the same offset (in this task or
+ *	in other tasks).  [The Mach kernel only enforces shared memory
+ *	consistency among mappings on one host with similar page alignments.
+ *	The user-defined memory manager for this object is responsible
+ *	for further consistency.]
+ */
+#if !defined(SHOW_UNUSED)
+skip;
+#else
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine PREFIX(mach_vm_map) (
+#else
+#if defined(__arm__) && !LIBSYSCALL_INTERFACE
+routine _vm_map_arm(
+#else
+routine PREFIX(vm_map) (
+#endif
+#endif
+		target_task	: vm_task_entry_t;
+	inout	address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		mask		: mach_vm_offset_t;
+		flags		: int;
+		object		: mem_entry_name_port_t;
+		offset		: memory_object_offset_t;
+		copy		: boolean_t;
+		cur_protection	: vm_prot_t;
+		max_protection	: vm_prot_t;
+		inheritance	: vm_inherit_t);
+#endif
+
+/*
+ *	Set/Get special properties of memory associated
+ *	to some virtual address range, such as cachability, 
+ *	migrability, replicability.  Machine-dependent.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_machine_attribute(
+#else
+routine vm_machine_attribute(
+#endif
+		target_task	: mach_vm_map_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		attribute	: vm_machine_attribute_t;
+	inout	value		: vm_machine_attribute_val_t);
+
+/*
+ *      Map portion of a task's address space.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine PREFIX(mach_vm_remap) (
+#else
+routine PREFIX(vm_remap) (
+#endif
+		target_task	: mach_vm_map_t;
+	inout	target_address	: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		mask		: mach_vm_offset_t;
+		flags		: int;
+		src_task	: mach_vm_map_t;
+		src_address	: mach_vm_address_t;
+		copy		: boolean_t;
+	out	cur_protection	: vm_prot_t;
+	out	max_protection	: vm_prot_t;
+		inheritance	: vm_inherit_t);
+
+/*
+ *      Give the caller information on the given location in a virtual
+ *      address space.  If a page is mapped return ref and dirty info.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_page_query(
+#else
+routine vm_map_page_query(
+#endif
+                target_map      :mach_vm_map_t;
+                offset          :mach_vm_offset_t;
+        out     disposition     :integer_t;
+        out     ref_count       :integer_t);
+
+
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_region_recurse(
+#else
+routine vm_region_recurse_64(
+#endif
+                target_task     : mach_vm_map_t;
+	inout	address		: mach_vm_address_t;
+        out     size            : mach_vm_size_t;
+	inout	nesting_depth	: natural_t;
+	out	info		: vm_region_recurse_info_t,CountInOut);
+
+/*
+ *      Returns information about the contents of the virtual
+ *      address space of the target task at the specified
+ *      address.  The returned protection, inheritance, sharing
+ *      and memory object values apply to the entire range described
+ *      by the address range returned; the memory object offset
+ *      corresponds to the beginning of the address range.
+ *      [If the specified address is not allocated, the next
+ *      highest address range is described.  If no addresses beyond
+ *      the one specified are allocated, the call returns KERN_NO_SPACE.]
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_region(
+#else
+routine vm_region_64(
+#endif
+                target_task     : mach_vm_map_t;
+	inout	address		: mach_vm_address_t;
+        out     size            : mach_vm_size_t;
+		flavor		: vm_region_flavor_t;
+	out	info		: vm_region_info_t, CountInOut;
+        out     object_name     : memory_object_name_t =
+                                        MACH_MSG_TYPE_MOVE_SEND
+                                        ctype: mach_port_t);
+
+/*
+ *	Allow application level processes to create named entries which
+ *	correspond to mapped portions of their address space.  These named
+ *	entries can then be manipulated, shared with other processes in
+ *	other address spaces and ultimately mapped in ohter address spaces
+ *
+ *	THIS INTERFACE IS STILL EVOLVING.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+#if !defined(__LP64__) || KERNEL_SERVER || XNU_KERNEL_PRIVATE || LIBSYSCALL_INTERFACE
+routine _mach_make_memory_entry(
+#else
+routine mach_make_memory_entry(
+#endif
+#else
+routine mach_make_memory_entry_64(
+#endif
+		target_task	:mach_vm_map_t;
+	inout	size		:memory_object_size_t;
+		offset		:memory_object_offset_t;
+		permission	:vm_prot_t;
+	out	object_handle	:mem_entry_name_port_move_send_t;
+		parent_handle	:mem_entry_name_port_t);
+
+/*
+ *	Control behavior and investigate state of a "purgable" object in
+ *	the virtual address space of the target task.  A purgable object is
+ *	created via a call to mach_vm_allocate() with VM_FLAGS_PURGABLE
+ *	specified.  See the routine implementation for a complete
+ *	definition of the routine.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_purgable_control(
+#else
+routine vm_purgable_control(
+#endif
+		target_task	: mach_vm_map_t;
+		address		: mach_vm_address_t;
+		control		: vm_purgable_t;
+	inout	state		: int);
+
+
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_page_info(
+			target_task		: mach_vm_map_t;
+			address			: mach_vm_address_t;
+			flavor			: vm_page_info_flavor_t;
+	out		info			: vm_page_info_t, CountInOut);
+#else
+skip;
+#endif
+
+/****************************** Legacy section ***************************/
+/*  The following definitions are exist to provide compatibility with    */
+/*  the legacy APIs.  They are no different.  We just need to produce    */
+/*  the user-level stub interface for them.                              */
+/****************************** Legacy section ***************************/
+
+
+/*
+ * These interfaces just aren't supported in the new (wide) model:
+ *
+ *	mach_vm_region_info() -
+ *	vm_map_pages_info() -
+ *		no user-level replacement for these MACH_DEBUG interfaces
+ *	vm_map_get_upl() -
+ *		no user-level replacement at the moment
+ *	vm_region_info() -
+ *		use mach_vm_region_info() or vm_region_info_64()
+ *	vm_region_recurse() -
+ *		use mach_vm_region_recurse() or vm_region_recurse_64()
+ */
+
+/*
+ * The following legacy interfaces are provides as macro wrappers to the new
+ * interfaces.  You should strive to use the new ones instead:
+ *
+ *	vm_map() -
+ *		use mach_vm_map() or vm_map_64()
+ *	vm_region() -
+ *		use mach_vm_region() or vm_region_64()
+ *	mach_make_memory_entry() -
+ *		use mach_vm_make_memory_entry() or mach_make_memory_entry_64()
+ */
+
+/* vim: set ft=c : */

Added: trunk/sys/compat/mach/defs/task.defs
===================================================================
--- trunk/sys/compat/mach/defs/task.defs	                        (rev 0)
+++ trunk/sys/compat/mach/defs/task.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,468 @@
+/*
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_FREE_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/mach_port.defs
+ *	Author:	Rich Draves
+ *
+ *	Exported kernel calls.
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+	  task 3400;
+
+#include <sys/mach/std_types.defs>
+#include <sys/mach/mach_types.defs>
+#include <sys/mach_debug/mach_debug_types.defs>
+
+#ifdef _KERNEL
+import <sys/mach/task.h>;
+#endif
+
+/*
+ *	Create a new task with an empty set of IPC rights,
+ *	and having an address space constructed from the
+ *	target task (or empty, if inherit_memory is FALSE).
+ */
+routine task_create(
+		target_task	: task_t;
+		ledgers		: ledger_array_t;
+		inherit_memory	: boolean_t;
+	out	child_task	: task_t);
+
+/*
+ *	Destroy the target task, causing all of its threads
+ *	to be destroyed, all of its IPC rights to be deallocated,
+ *	and all of its address space to be deallocated.
+ */
+routine task_terminate(
+		target_task	: task_t);
+
+/*
+ *	Returns the set of threads belonging to the target task.
+ */
+routine task_threads(
+		target_task	: task_t;
+	out	act_list	: thread_act_array_t);
+
+/*
+ *	Stash a handful of ports for the target task; child
+ *	tasks inherit this stash at task_create time.
+ */
+routine	mach_ports_register(
+		target_task	: task_t;
+		init_port_set	: mach_port_array_t =
+					^array[] of mach_port_t);
+
+/*
+ *	Retrieve the stashed ports for the target task.
+ */
+routine	mach_ports_lookup(
+		target_task	: task_t;
+	out	init_port_set	: mach_port_array_t =
+					^array[] of mach_port_t);
+
+/*
+ *      Returns information about the target task.
+ */
+routine task_info(
+                target_task     : task_name_t;
+                flavor          : task_flavor_t;
+        out     task_info_out   : task_info_t, CountInOut);
+
+/*
+ * Set task information.
+ */
+routine	task_set_info(
+		target_task	: task_t;
+		flavor		: task_flavor_t;
+		task_info_in	: task_info_t);
+
+/*
+ *	Increment the suspend count for the target task.
+ *	No threads within a task may run when the suspend
+ *	count for that task is non-zero.
+ */
+routine	task_suspend(
+		target_task	: task_t);
+
+
+/*
+ *	Decrement the suspend count for the target task,
+ *	if the count is currently non-zero.  If the resulting
+ *	suspend	count is zero, then threads within the task
+ *	that also have non-zero suspend counts may execute.
+ */
+routine	task_resume(
+		target_task	: task_t);
+
+/*
+ *	Returns the current value of the selected special port
+ *	associated with the target task.
+ */
+routine task_get_special_port(
+		task		: task_t;
+		which_port	: int;
+	out	special_port	: mach_port_t);
+
+/*
+ *	Set one of the special ports associated with the
+ *	target task.
+ */
+routine task_set_special_port(
+		task		: task_t;
+		which_port	: int;
+		special_port	: mach_port_t);
+
+/*
+ *	Create a new thread within the target task, returning
+ *	the port representing the first thr_act in that new thread.  The
+ *	initial execution state of the thread is undefined.
+ */
+routine
+#ifdef KERNEL_SERVER
+thread_create_from_user(
+#else
+thread_create(
+#endif
+		parent_task	: task_t;
+	out	child_act	: thread_act_t);
+
+/*
+ *      Create a new thread within the target task, returning
+ *      the port representing that new thread.  The new thread 
+ *	is not suspended; its initial execution state is given
+ *	by flavor and new_state. Returns the port representing 
+ *	the new thread.
+ */
+routine
+#ifdef KERNEL_SERVER
+thread_create_running_from_user(
+#else
+thread_create_running(
+#endif
+                parent_task     : task_t;
+                flavor          : thread_state_flavor_t;
+                new_state       : thread_state_t;
+        out     child_act       : thread_act_t);
+
+/*
+ * Set an exception handler for a task on one or more exception types.
+ * These handlers are invoked for all threads in the task if there are
+ * no thread-specific exception handlers or those handlers returned an
+ * error.
+ */
+routine	task_set_exception_ports(
+		task		: task_t;
+		exception_mask	: exception_mask_t;
+		new_port	: mach_port_t;
+		behavior	: exception_behavior_t;
+		new_flavor	: thread_state_flavor_t);
+
+
+/*
+ * Lookup some of the old exception handlers for a task
+ */
+routine	task_get_exception_ports(
+		task		: task_t;
+		exception_mask	: exception_mask_t;
+	  out	masks		: exception_mask_array_t;
+	  out	old_handlers	: exception_handler_array_t, SameCount;
+	  out	old_behaviors	: exception_behavior_array_t, SameCount;
+	  out	old_flavors	: exception_flavor_array_t, SameCount);
+
+
+/*
+ * Set an exception handler for a thread on one or more exception types.
+ * At the same time, return the previously defined exception handlers for
+ * those types.
+ */
+routine	task_swap_exception_ports(
+		task		: task_t;
+		exception_mask	: exception_mask_t;
+		new_port	: mach_port_t;
+		behavior	: exception_behavior_t;
+		new_flavor	: thread_state_flavor_t;
+	  out	masks		: exception_mask_array_t;
+	  out	old_handlerss	: exception_handler_array_t, SameCount;
+	  out	old_behaviors	: exception_behavior_array_t, SameCount;
+	  out	old_flavors	: exception_flavor_array_t, SameCount);
+
+#ifdef SHOW_UNUSED
+/*
+ * OBSOLETE interface.
+ */
+routine lock_set_create(
+		task		: task_t;
+	out	new_lock_set	: lock_set_t;
+		n_ulocks	: int;
+		policy		: int);
+
+/*
+ * OBSOLETE interface.
+ */
+routine lock_set_destroy(
+		task		: task_t;
+		lock_set	: lock_set_t);
+#else
+skip;
+skip;
+#endif
+/*
+ * Create and destroy semaphore synchronizers on a
+ * per-task basis (i.e. the task owns them).
+ */
+
+routine semaphore_create(
+		task		: task_t;
+	out	semaphore	: semaphore_t;
+		policy		: int;
+		value		: int);
+
+routine semaphore_destroy(
+		task		: task_t;
+		semaphore	: semaphore_consume_ref_t);
+
+/*
+ * Set/get policy information for a task.
+ * (Approved Mac OS X microkernel interface)
+ */
+
+routine task_policy_set(
+	task			: task_t;
+	flavor			: task_policy_flavor_t;
+	policy_info		: task_policy_t);
+
+routine task_policy_get(
+	task			: task_t;
+	flavor			: task_policy_flavor_t;
+out	policy_info		: task_policy_t, CountInOut;
+inout	get_default		: boolean_t);
+
+/*
+ *	Removed from the kernel.
+ */
+#if KERNEL_SERVER
+skip;
+#else
+routine task_sample(
+		task		: task_t;
+		reply		: mach_port_make_send_t);
+#endif
+
+/*
+ * JMM - Everything from here down is likely to go away soon
+ */
+/*
+ * OBSOLETE interface.
+ */
+routine task_policy(
+	task			: task_t;
+	policy			: policy_t;
+	base			: policy_base_t;
+	set_limit		: boolean_t;
+	change			: boolean_t);
+
+
+#ifdef SHOW_UNUSED
+/* nifty - but not needed on FreeBSD */
+/*
+ *	Establish a user-level handler for the specified
+ *	system call.
+ */
+routine task_set_emulation(
+		target_port	: task_t;
+		routine_entry_pt: vm_address_t;
+		routine_number  : int);	
+
+/*
+ *	Get user-level handler entry points for all
+ *	emulated system calls.
+ */
+routine task_get_emulation_vector(
+		task		: task_t;
+	out	vector_start	: int;
+	out	emulation_vector: emulation_vector_t);
+
+/*
+ *	Establish user-level handlers for the specified
+ *	system calls. Non-emulated system calls are specified
+ *	with emulation_vector[i] == EML_ROUTINE_NULL.
+ */
+routine task_set_emulation_vector(
+		task		: task_t;
+		vector_start	: int;
+		emulation_vector: emulation_vector_t);
+
+#else
+skip;
+skip;
+skip;
+#endif
+/*
+ *      Establish restart pc for interrupted atomic sequences.
+ */
+routine task_set_ras_pc(
+		target_task     : task_t;
+		basepc          : vm_address_t;
+		boundspc        : vm_address_t);
+
+
+/*
+ * Return zone info as seen/used by this task.
+ */
+routine task_zone_info(
+		target_task	: task_t;
+	out	names		: mach_zone_name_array_t,
+					Dealloc;
+	out	info		: task_zone_info_array_t,
+					Dealloc);
+
+
+/* 
+ * JMM - Want to eliminate processor_set so keep them at the end.
+ */
+
+/*
+ *	Assign task to processor set.
+ */
+routine task_assign(
+		task		: task_t;
+		new_set		: processor_set_t;
+		assign_threads	: boolean_t);
+
+/*
+ *	Assign task to default set.
+ */
+routine task_assign_default(
+		task		: task_t;
+		assign_threads	: boolean_t);
+
+/*
+ *	Get current assignment for task.
+ */
+routine task_get_assignment(
+		task		: task_t;
+	out	assigned_set	: processor_set_name_t);
+
+/*
+ * OBSOLETE interface.
+ */
+routine task_set_policy(
+	task			: task_t;
+	pset			: processor_set_t;
+	policy			: policy_t;
+	base			: policy_base_t;
+	limit			: policy_limit_t;
+	change			: boolean_t);
+
+/*
+ * Read the selected state which is to be installed on new 
+ * threads in the task as they are created.
+ */
+routine task_get_state(
+		task		: task_t;
+		flavor		: thread_state_flavor_t;
+	out	old_state	: thread_state_t, CountInOut);
+ 
+/*
+ * Set the selected state information to be installed on
+ * all subsequently created threads in the task.
+ */
+routine	task_set_state(
+		task		: task_t;
+		flavor		: thread_state_flavor_t;
+		new_state	: thread_state_t);
+
+/*
+ * Change the task's physical footprint limit (in MB).
+ */
+routine task_set_phys_footprint_limit(
+		task		: task_t;
+		new_limit	: int;
+	out old_limit	: int);
+
+routine task_suspend2(
+		target_task : task_t;
+	out suspend_token : task_suspension_token_t);
+
+routine task_resume2(
+		suspend_token : task_suspension_token_t);
+
+routine task_purgable_info(
+		task 		: task_t;
+	out	stats		: task_purgable_info_t);
+
+routine task_get_mach_voucher(
+		task		: task_t;
+		which		: mach_voucher_selector_t;
+	out	voucher		: ipc_voucher_t);
+
+routine task_set_mach_voucher(
+		task		: task_t;
+		voucher		: ipc_voucher_t);
+
+routine task_swap_mach_voucher(
+		task		: task_t;
+		new_voucher	: ipc_voucher_t;
+	inout	old_voucher	: ipc_voucher_t);
+
+/* vim: set ft=c : */
+

Added: trunk/sys/compat/mach/defs/vm_map.defs
===================================================================
--- trunk/sys/compat/mach/defs/vm_map.defs	                        (rev 0)
+++ trunk/sys/compat/mach/defs/vm_map.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,506 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_FREE_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/vm_map.defs
+ *
+ *	Exported (native-sized) kernel VM calls.
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+	  vm_map 3800;
+
+#include <sys/mach/std_types.defs>
+#include <sys/mach/mach_types.defs>
+#include <sys/mach_debug/mach_debug_types.defs>
+import <sys/mach/vm_types.h>;
+
+#if !KERNEL && !LIBSYSCALL_INTERFACE
+#define PREFIX(NAME) _kernelrpc_ ## NAME
+#else
+#define PREFIX(NAME) NAME
+#endif
+
+/*
+ *      Returns information about the contents of the virtual
+ *      address space of the target task at the specified
+ *      address.  The returned protection, inheritance, sharing
+ *      and memory object values apply to the entire range described
+ *      by the address range returned; the memory object offset
+ *      corresponds to the beginning of the address range.
+ *      [If the specified address is not allocated, the next
+ *      highest address range is described.  If no addresses beyond
+ *      the one specified are allocated, the call returns KERN_NO_SPACE.]
+ */
+routine vm_region(
+                target_task     : mach_vm_map_t;
+	inout	address		: vm_address_t;
+        out     size            : vm_size_t;
+		flavor		: vm_region_flavor_t;
+	out	info		: vm_region_info_t, CountInOut;
+        out     object_name     : memory_object_name_t =
+                                        MACH_MSG_TYPE_MOVE_SEND
+                                        ctype: mach_port_t);
+
+/*
+ *	Allocate zero-filled memory in the address space
+ *	of the target task, either at the specified address,
+ *	or wherever space can be found (if anywhere is TRUE),
+ *	of the specified size.  The address at which the
+ *	allocation actually took place is returned.
+ */
+
+#if !KERNEL 
+skip;
+#else
+routine PREFIX(vm_allocate)(
+		target_task	: vm_task_entry_t;
+	inout	address		: vm_address_t;
+		size		: vm_size_t;
+		flags		: int);
+
+#endif
+
+/*
+ *	Deallocate the specified range from the virtual
+ *	address space of the target task.
+ */
+
+#if !KERNEL 
+skip;
+#else
+routine PREFIX(vm_deallocate)(
+		target_task	: vm_task_entry_t;
+		address		: vm_address_t;
+		size		: vm_size_t);
+
+#endif
+
+/*
+ *	Set the current or maximum protection attribute
+ *	for the specified range of the virtual address
+ *	space of the target task.  The current protection
+ *	limits the memory access rights of threads within
+ *	the task; the maximum protection limits the accesses
+ *	that may be given in the current protection.
+ *	Protections are specified as a set of {read, write, execute}
+ *	*permissions*.
+ */
+
+#if !KERNEL && !LIBSYSCALL_INTERFACE
+skip;
+#else
+routine PREFIX(vm_protect)(
+		target_task	: vm_task_entry_t;
+		address		: vm_address_t;
+		size		: vm_size_t;
+		set_maximum	: boolean_t;
+		new_protection	: vm_prot_t);
+#endif
+
+/*
+ *	Set the inheritance attribute for the specified range
+ *	of the virtual address space of the target task.
+ *	The inheritance value is one of {none, copy, share}, and
+ *	specifies how the child address space should acquire
+ *	this memory at the time of a task_create call.
+ */
+routine vm_inherit(
+		target_task	: vm_task_entry_t;
+		address		: vm_address_t;
+		size		: vm_size_t;
+		new_inheritance	: vm_inherit_t);
+
+/*
+ *	Returns the contents of the specified range of the
+ *	virtual address space of the target task.  [The
+ *	range must be aligned on a virtual page boundary,
+ *	and must be a multiple of pages in extent.  The
+ *	protection on the specified range must permit reading.]
+ */
+routine PREFIX(vm_read) (
+		target_task	: mach_vm_map_t;
+		address		: vm_address_t;
+		size		: vm_size_t;
+	out	data		: pointer_t);
+
+/* 
+ * List corrollary to vm_read, returns mapped contents of specified
+ * ranges within target address space.
+ */
+routine vm_read_list(
+		target_task 	: mach_vm_map_t;
+	inout	data_list   	: vm_read_entry_t;
+		count		: natural_t);
+
+/*
+ *	Writes the contents of the specified range of the
+ *	virtual address space of the target task.  [The
+ *	range must be aligned on a virtual page boundary,
+ *	and must be a multiple of pages in extent.  The
+ *	protection on the specified range must permit writing.]
+ */
+routine vm_write(
+		target_task	: mach_vm_map_t;
+		address		: vm_address_t;
+		data		: pointer_t);
+
+/*
+ *	Copy the contents of the source range of the virtual
+ *	address space of the target task to the destination
+ *	range in that same address space.  [Both of the
+ *	ranges must be aligned on a virtual page boundary,
+ *	and must be multiples of pages in extent.  The
+ *	protection on the source range must permit reading,
+ *	and the protection on the destination range must
+ *	permit writing.]
+ */
+routine vm_copy(
+		target_task	: mach_vm_map_t;
+		source_address	: vm_address_t;
+		size		: vm_size_t;
+		dest_address	: vm_address_t);
+
+/*
+ *	Returns the contents of the specified range of the
+ *	virtual address space of the target task.  [There
+ *	are no alignment restrictions, and the results will
+ *      overwrite the area pointed to by data - which must
+ *      already exist. The protection on the specified range
+ *	must permit reading.]
+ */
+routine vm_read_overwrite(
+		target_task	: mach_vm_map_t;
+		address		: vm_address_t;
+		size		: vm_size_t;
+		data		: vm_address_t;
+	out	outsize		: vm_size_t);
+
+
+routine vm_msync(
+		target_task	: mach_vm_map_t;
+		address		: vm_address_t;
+		size		: vm_size_t;
+		sync_flags	: vm_sync_t );
+
+/*
+ *	Set the paging behavior attribute for the specified range
+ *	of the virtual address space of the target task.
+ *	The behavior value is one of {default, random, forward 
+ *	sequential, reverse sequential} and indicates the expected
+ *	page reference pattern for the specified range.
+ */
+routine vm_behavior_set(
+		target_task	: mach_vm_map_t;
+		address		: vm_address_t;
+		size		: vm_size_t;
+		new_behavior	: vm_behavior_t);
+
+
+/*
+ *	Map a user-defined memory object into the virtual address
+ *	space of the target task.  If desired (anywhere is TRUE),
+ *	the kernel will find a suitable address range of the
+ *	specified size; else, the specific address will be allocated.
+ *
+ *	The beginning address of the range will be aligned on a virtual
+ *	page boundary, be at or beyond the address specified, and
+ *	meet the mask requirements (bits turned on in the mask must not
+ *	be turned on in the result); the size of the range, in bytes,
+ *	will be rounded	up to an integral number of virtual pages.
+ *
+ *	The memory in the resulting range will be associated with the
+ *	specified memory object, with the beginning of the memory range
+ *	referring to the specified offset into the memory object.
+ *
+ *	The mapping will take the current and maximum protections and
+ *	the inheritance attributes specified; see the vm_protect and
+ *	vm_inherit calls for a description of these attributes.
+ *
+ *	If desired (copy is TRUE), the memory range will be filled
+ *	with a copy of the data from the memory object; this copy will
+ *	be private to this mapping in this target task.  Otherwise,
+ *	the memory in this mapping will be shared with other mappings
+ *	of the same memory object at the same offset (in this task or
+ *	in other tasks).  [The Mach kernel only enforces shared memory
+ *	consistency among mappings on one host with similar page alignments.
+ *	The user-defined memory manager for this object is responsible
+ *	for further consistency.]
+ */
+#ifdef SHOW_UNUSED
+routine PREFIX(vm_map) (
+		target_task	: vm_task_entry_t;
+	inout	address		: vm_address_t;
+		size		: vm_size_t;
+		mask		: vm_address_t;
+		flags		: int;
+		object		: mem_entry_name_port_t;
+		offset		: vm_offset_t;
+		copy		: boolean_t;
+		cur_protection	: vm_prot_t;
+		max_protection	: vm_prot_t;
+		inheritance	: vm_inherit_t);
+
+#else
+skip;
+#endif
+/*
+ *	Set/Get special properties of memory associated
+ *	to some virtual address range, such as cachability, 
+ *	migrability, replicability.  Machine-dependent.
+ */
+routine vm_machine_attribute(
+		target_task	: mach_vm_map_t;
+		address		: vm_address_t;
+		size		: vm_size_t;
+		attribute	: vm_machine_attribute_t;
+	inout	value		: vm_machine_attribute_val_t);
+
+/*
+ *      Map portion of a task's address space.
+ */
+routine PREFIX(vm_remap) (
+		target_task	: mach_vm_map_t;
+	inout	target_address	: vm_address_t;
+		size		: vm_size_t;
+		mask		: vm_address_t;
+		flags		: int;
+		src_task	: mach_vm_map_t;
+		src_address	: vm_address_t;
+		copy		: boolean_t;
+	out	cur_protection	: vm_prot_t;
+	out	max_protection	: vm_prot_t;
+		inheritance	: vm_inherit_t);
+
+/*
+ *	Require that all future virtual memory allocation
+ *	allocates wired memory.  Setting must_wire to FALSE
+ *	disables the wired future feature.
+ */
+routine task_wire(
+		target_task	: mach_vm_map_t;
+		must_wire	: boolean_t);
+
+	
+/*
+ *	Allow application level processes to create named entries which
+ *	correspond to mapped portions of their address space.  These named
+ *	entries can then be manipulated, shared with other processes in
+ *	other address spaces and ultimately mapped in ohter address spaces
+ */
+
+routine mach_make_memory_entry(
+		target_task	:mach_vm_map_t;
+	inout	size		:vm_size_t;
+		offset		:vm_offset_t;
+		permission	:vm_prot_t;
+	out	object_handle	:mem_entry_name_port_move_send_t;
+		parent_entry	:mem_entry_name_port_t);
+
+/*
+ *      Give the caller information on the given location in a virtual
+ *      address space.  If a page is mapped return ref and dirty info.
+ */
+routine vm_map_page_query(
+                target_map      :mach_vm_map_t;
+                offset          :vm_offset_t;
+        out     disposition     :integer_t;
+        out     ref_count       :integer_t);
+
+/*
+ *	Returns information about a region of memory.
+ *	Includes info about the chain of objects rooted at that region.
+ *      Only available in MACH_VM_DEBUG compiled kernels,
+ *      otherwise returns KERN_FAILURE.
+ */
+routine mach_vm_region_info(
+		task		: mach_vm_map_t;
+		address		: vm_address_t;
+	out	region		: vm_info_region_t;
+	out	objects		: vm_info_object_array_t);
+
+routine	vm_mapped_pages_info(
+		task		: mach_vm_map_t;
+	out	pages		: page_address_array_t);
+
+#ifdef SHOW_UNUSED
+/*
+ *    Allow application level processes to create named entries which
+ *    are backed by sub-maps which describe regions of address space.
+ *    These regions of space can have objects mapped into them and
+ *    in turn, can be mapped into target address spaces 
+ */
+
+routine	vm_region_object_create(
+		target_task	:mach_vm_map_t;
+	in	size		:vm_size_t;
+	out	region_object	:mach_port_move_send_t);
+#else
+skip; /* was vm_region_object_create */
+#endif
+
+/*
+ *	A recursive form of vm_region which probes submaps withint the
+ *	address space.
+ */
+routine vm_region_recurse(
+                target_task     : mach_vm_map_t;
+	inout	address		: vm_address_t;
+        out     size            : vm_size_t;
+	inout	nesting_depth	: natural_t;
+	out	info		: vm_region_recurse_info_t,CountInOut);
+
+
+/* 
+ *	The routines below are temporary, meant for transitional use
+ *	as their counterparts are moved from 32 to 64 bit data path
+ */
+
+
+routine vm_region_recurse_64(
+                target_task     : mach_vm_map_t;
+	inout	address		: vm_address_t;
+        out     size            : vm_size_t;
+	inout	nesting_depth	: natural_t;
+	out	info		: vm_region_recurse_info_t,CountInOut);
+
+routine mach_vm_region_info_64(
+		task		: mach_vm_map_t;
+		address		: vm_address_t;
+	out	region		: vm_info_region_64_t;
+	out	objects		: vm_info_object_array_t);
+
+routine vm_region_64(
+                target_task     : mach_vm_map_t;
+	inout	address		: vm_address_t;
+        out     size            : vm_size_t;
+		flavor		: vm_region_flavor_t;
+	out	info		: vm_region_info_t, CountInOut;
+        out     object_name     : memory_object_name_t =
+                                        MACH_MSG_TYPE_MOVE_SEND
+                                        ctype: mach_port_t);
+
+routine mach_make_memory_entry_64(
+		target_task	:mach_vm_map_t;
+	inout	size		:memory_object_size_t;
+		offset		:memory_object_offset_t;
+		permission	:vm_prot_t;
+	out	object_handle	:mach_port_move_send_t;
+		parent_entry	:mem_entry_name_port_t);
+
+
+#ifdef SHOW_UNUSED
+routine vm_map_64(
+		target_task	: vm_task_entry_t;
+	inout	address		: vm_address_t;
+		size		: vm_size_t;
+		mask		: vm_address_t;
+		flags		: int;
+		object		: mem_entry_name_port_t;
+		offset		: memory_object_offset_t;
+		copy		: boolean_t;
+		cur_protection	: vm_prot_t;
+		max_protection	: vm_prot_t;
+		inheritance	: vm_inherit_t);
+#else
+skip;
+#endif
+
+#if 0
+/*
+ * The UPL interfaces are not ready for user-level export.
+ */
+routine vm_map_get_upl(
+		target_task	: mach_vm_map_t;
+		address		: vm_map_offset_t;
+	inout	size		: vm_size_t;
+	out	upl		: upl_t;
+	out	page_info	: upl_page_info_array_t, CountInOut;
+	inout	flags		: integer_t;
+		force_data_sync	: integer_t);
+
+routine vm_upl_map(
+		target_task	: mach_vm_map_t;
+		upl		: upl_t;
+	inout	address		: vm_address_t);
+
+routine vm_upl_unmap(
+		target_task	: mach_vm_map_t;
+		upl		: upl_t);
+#else
+skip; /* was vm_map_get_upl */
+skip; /* was vm_upl_map */
+skip; /* was vm_upl_unmap */
+#endif		
+
+/*
+ *	Control behavior and investigate state of a "purgable" object in
+ *	the virtual address space of the target task.  A purgable object is
+ *	created via a call to vm_allocate() with VM_FLAGS_PURGABLE
+ *	specified.  See the routine implementation for a complete
+ *	definition of the routine.
+ */
+routine vm_purgable_control(
+		target_task	: mach_vm_map_t;
+		address		: vm_address_t;
+		control		: vm_purgable_t;
+	inout	state		: int);
+
+/* vim: set ft=c : */

Added: trunk/sys/compat/mach/host_priv_server.c
===================================================================
--- trunk/sys/compat/mach/host_priv_server.c	                        (rev 0)
+++ trunk/sys/compat/mach/host_priv_server.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,4022 @@
+/*
+ * IDENTIFICATION:
+ * stub generated Thu Jun 11 18:17:44 2015
+ * with a MiG generated Thu Jun 11 16:16:11 PDT 2015 by kmacy at serenity
+ * OPTIONS: 
+ *	KernelServer
+ */
+
+/* Module host_priv */
+
+#define	__MIG_check__Request__host_priv_subsystem__ 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#ifdef _KERNEL
+#include <sys/mach/ndr.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#else /* !_KERNEL */
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#endif /*_KERNEL */
+
+#include <sys/mach/std_types.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc_mig.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach_debug/mach_debug_types.h>
+
+#ifndef	mig_internal
+#define	mig_internal	static __inline__
+#endif	/* mig_internal */
+
+#ifndef	mig_external
+#define mig_external
+#endif	/* mig_external */
+
+#if	!defined(__MigTypeCheck) && defined(TypeCheck)
+#define	__MigTypeCheck		TypeCheck	/* Legacy setting */
+#endif	/* !defined(__MigTypeCheck) */
+
+#if	!defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
+#define	__MigKernelSpecificCode	_MIG_KERNEL_SPECIFIC_CODE_	/* Legacy setting */
+#endif	/* !defined(__MigKernelSpecificCode) */
+
+#ifndef	LimitCheck
+#define	LimitCheck 0
+#endif	/* LimitCheck */
+
+#ifndef	min
+#define	min(a,b)  ( ((a) < (b))? (a): (b) )
+#endif	/* min */
+
+#if !defined(_WALIGN_)
+#define _WALIGN_(x) (((x) + 7) & ~7)
+#endif /* !defined(_WALIGN_) */
+
+#if !defined(_WALIGNSZ_)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#endif /* !defined(_WALIGNSZ_) */
+
+#ifndef	UseStaticTemplates
+#define	UseStaticTemplates	1
+#endif	/* UseStaticTemplates */
+
+#define _WALIGN_(x) (((x) + 7) & ~7)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#ifndef	__DeclareRcvRpc
+#define	__DeclareRcvRpc(_NUM_, _NAME_)
+#endif	/* __DeclareRcvRpc */
+
+#ifndef	__BeforeRcvRpc
+#define	__BeforeRcvRpc(_NUM_, _NAME_)
+#endif	/* __BeforeRcvRpc */
+
+#ifndef	__AfterRcvRpc
+#define	__AfterRcvRpc(_NUM_, _NAME_)
+#endif	/* __AfterRcvRpc */
+
+#ifndef	__DeclareRcvSimple
+#define	__DeclareRcvSimple(_NUM_, _NAME_)
+#endif	/* __DeclareRcvSimple */
+
+#ifndef	__BeforeRcvSimple
+#define	__BeforeRcvSimple(_NUM_, _NAME_)
+#endif	/* __BeforeRcvSimple */
+
+#ifndef	__AfterRcvSimple
+#define	__AfterRcvSimple(_NUM_, _NAME_)
+#endif	/* __AfterRcvSimple */
+
+#define novalue void
+#if	__MigKernelSpecificCode
+#define msgh_request_port	msgh_remote_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_REMOTE(bits)
+#define msgh_reply_port		msgh_local_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#else
+#define msgh_request_port	msgh_local_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#define msgh_reply_port		msgh_remote_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_REMOTE(bits)
+#endif /* __MigKernelSpecificCode */
+
+#define MIG_RETURN_ERROR(X, code)	{\
+				((mig_reply_error_t *)X)->RetCode = code;\
+				((mig_reply_error_t *)X)->NDR = NDR_record;\
+				return;\
+				}
+
+/* typedefs for all requests */
+
+#ifndef __Request__host_priv_subsystem__defined
+#define __Request__host_priv_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__host_get_boot_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int options;
+	} __Request__host_reboot_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t flavor;
+		mach_msg_type_number_t host_info_outCnt;
+	} __Request__host_priv_statistics_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t default_manager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		memory_object_cluster_size_t cluster_size;
+	} __Request__host_default_memory_manager_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_prot_t desired_access;
+	} __Request__vm_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t thread;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t wired;
+	} __Request__thread_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		int flags;
+	} __Request__vm_allocate_cpm_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__host_processors_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		clock_id_t clock_id;
+	} __Request__host_get_clock_control_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int node;
+		int which;
+	} __Request__host_get_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int which;
+	} __Request__host_set_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+		exception_behavior_t behavior;
+		thread_state_flavor_t new_flavor;
+	} __Request__host_set_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+	} __Request__host_get_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+		exception_behavior_t behavior;
+		thread_state_flavor_t new_flavor;
+	} __Request__host_swap_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_prot_t desired_access;
+	} __Request__mach_vm_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__host_processor_sets_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t set_name;
+		/* end of the kernel processed data */
+	} __Request__host_processor_set_priv_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t control_port;
+		/* end of the kernel processed data */
+	} __Request__set_dp_control_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__get_dp_control_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t server;
+		/* end of the kernel processed data */
+	} __Request__host_set_UNDServer_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__host_get_UNDServer_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t request_data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		uint32_t user_log_flags;
+		mach_msg_type_number_t request_dataCnt;
+	} __Request__kext_request_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__host_priv_subsystem__defined */
+
+/* typedefs for all replies */
+
+#ifndef __Reply__host_priv_subsystem__defined
+#define __Reply__host_priv_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t boot_infoOffset; /* MiG doesn't use it */
+		mach_msg_type_number_t boot_infoCnt;
+		char boot_info[4096];
+	} __Reply__host_get_boot_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__host_reboot_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t host_info_outCnt;
+		integer_t host_info_out[68];
+	} __Reply__host_priv_statistics_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t default_manager;
+		/* end of the kernel processed data */
+	} __Reply__host_default_memory_manager_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__thread_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_address_t address;
+	} __Reply__vm_allocate_cpm_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_ports_descriptor_t out_processor_list;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t out_processor_listCnt;
+	} __Reply__host_processors_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t clock_ctrl;
+		/* end of the kernel processed data */
+	} __Reply__host_get_clock_control_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t port;
+		/* end of the kernel processed data */
+	} __Reply__host_get_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__host_set_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__host_set_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t old_handlers[32];
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t masksCnt;
+		exception_mask_t masks[32];
+		exception_behavior_t old_behaviors[32];
+		thread_state_flavor_t old_flavors[32];
+	} __Reply__host_get_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t old_handlerss[32];
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t masksCnt;
+		exception_mask_t masks[32];
+		exception_behavior_t old_behaviors[32];
+		thread_state_flavor_t old_flavors[32];
+	} __Reply__host_swap_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_vm_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_ports_descriptor_t processor_sets;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t processor_setsCnt;
+	} __Reply__host_processor_sets_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t set;
+		/* end of the kernel processed data */
+	} __Reply__host_processor_set_priv_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__set_dp_control_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t contorl_port;
+		/* end of the kernel processed data */
+	} __Reply__get_dp_control_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__host_set_UNDServer_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t server;
+		/* end of the kernel processed data */
+	} __Reply__host_get_UNDServer_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t response_data;
+		mach_msg_ool_descriptor_t log_data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t response_dataCnt;
+		mach_msg_type_number_t log_dataCnt;
+		kern_return_t op_result;
+	} __Reply__kext_request_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__host_priv_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__host_priv_subsystem__defined
+#define __ReplyUnion__host_priv_subsystem__defined
+union __ReplyUnion__host_priv_subsystem {
+	__Reply__host_get_boot_info_t Reply_host_get_boot_info;
+	__Reply__host_reboot_t Reply_host_reboot;
+	__Reply__host_priv_statistics_t Reply_host_priv_statistics;
+	__Reply__host_default_memory_manager_t Reply_host_default_memory_manager;
+	__Reply__vm_wire_t Reply_vm_wire;
+	__Reply__thread_wire_t Reply_thread_wire;
+	__Reply__vm_allocate_cpm_t Reply_vm_allocate_cpm;
+	__Reply__host_processors_t Reply_host_processors;
+	__Reply__host_get_clock_control_t Reply_host_get_clock_control;
+	__Reply__host_get_special_port_t Reply_host_get_special_port;
+	__Reply__host_set_special_port_t Reply_host_set_special_port;
+	__Reply__host_set_exception_ports_t Reply_host_set_exception_ports;
+	__Reply__host_get_exception_ports_t Reply_host_get_exception_ports;
+	__Reply__host_swap_exception_ports_t Reply_host_swap_exception_ports;
+	__Reply__mach_vm_wire_t Reply_mach_vm_wire;
+	__Reply__host_processor_sets_t Reply_host_processor_sets;
+	__Reply__host_processor_set_priv_t Reply_host_processor_set_priv;
+	__Reply__set_dp_control_port_t Reply_set_dp_control_port;
+	__Reply__get_dp_control_port_t Reply_get_dp_control_port;
+	__Reply__host_set_UNDServer_t Reply_host_set_UNDServer;
+	__Reply__host_get_UNDServer_t Reply_host_get_UNDServer;
+	__Reply__kext_request_t Reply_kext_request;
+};
+#endif /* __RequestUnion__host_priv_subsystem__defined */
+/* Forward Declarations */
+
+
+mig_internal novalue _Xhost_get_boot_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_reboot
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_priv_statistics
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_default_memory_manager
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_wire
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xthread_wire
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_allocate_cpm
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_processors
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_get_clock_control
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_get_special_port
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_set_special_port
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_set_exception_ports
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_get_exception_ports
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_swap_exception_ports
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_wire
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_processor_sets
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_processor_set_priv
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xset_dp_control_port
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xget_dp_control_port
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_set_UNDServer
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_get_UNDServer
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xkext_request
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_get_boot_info_t__defined)
+#define __MIG_check__Request__host_get_boot_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_get_boot_info_t(__attribute__((__unused__)) __Request__host_get_boot_info_t *In0P)
+{
+
+	typedef __Request__host_get_boot_info_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_get_boot_info_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_get_boot_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_boot_info
+#if	defined(LINTLIBRARY)
+    (host_priv, boot_info)
+	host_priv_t host_priv;
+	kernel_boot_info_t boot_info;
+{ return host_get_boot_info(host_priv, boot_info); }
+#else
+(
+	host_priv_t host_priv,
+	kernel_boot_info_t boot_info
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_boot_info */
+mig_internal novalue _Xhost_get_boot_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_get_boot_info_t __Request;
+	typedef __Reply__host_get_boot_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_get_boot_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_get_boot_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(400, "host_get_boot_info")
+	__BeforeRcvRpc(400, "host_get_boot_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_get_boot_info_t__defined)
+	check_result = __MIG_check__Request__host_get_boot_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_get_boot_info_t__defined) */
+
+	OutP->RetCode = host_get_boot_info(convert_port_to_host_priv(In0P->Head.msgh_request_port), OutP->boot_info);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+#ifdef __LP64__
+	{
+		size_t strLength = strlen(OutP->boot_info) + 1;
+		if (strLength > 0xffffffff)
+			MIG_RETURN_ERROR(OutP, MIG_BAD_ARGUMENTS);
+		OutP->boot_infoCnt = (mach_msg_type_number_t) strLength;
+	}
+#else
+	OutP->boot_infoCnt = (mach_msg_type_number_t) strlen(OutP->boot_info) + 1;
+#endif /* __LP64__ */
+	OutP->Head.msgh_size = (sizeof(Reply) - 4096) + (_WALIGN_((OutP->boot_infoCnt + 3) & ~3));
+
+	__AfterRcvRpc(400, "host_get_boot_info")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_reboot_t__defined)
+#define __MIG_check__Request__host_reboot_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_reboot_t(__attribute__((__unused__)) __Request__host_reboot_t *In0P)
+{
+
+	typedef __Request__host_reboot_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_reboot_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_reboot */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_reboot
+#if	defined(LINTLIBRARY)
+    (host_priv, options)
+	host_priv_t host_priv;
+	int options;
+{ return host_reboot(host_priv, options); }
+#else
+(
+	host_priv_t host_priv,
+	int options
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_reboot */
+mig_internal novalue _Xhost_reboot
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int options;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_reboot_t __Request;
+	typedef __Reply__host_reboot_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_reboot_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_reboot_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(401, "host_reboot")
+	__BeforeRcvRpc(401, "host_reboot")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_reboot_t__defined)
+	check_result = __MIG_check__Request__host_reboot_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_reboot_t__defined) */
+
+	OutP->RetCode = host_reboot(convert_port_to_host_priv(In0P->Head.msgh_request_port), In0P->options);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(401, "host_reboot")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_priv_statistics_t__defined)
+#define __MIG_check__Request__host_priv_statistics_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_priv_statistics_t(__attribute__((__unused__)) __Request__host_priv_statistics_t *In0P)
+{
+
+	typedef __Request__host_priv_statistics_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_priv_statistics_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_priv_statistics */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_priv_statistics
+#if	defined(LINTLIBRARY)
+    (host_priv, flavor, host_info_out, host_info_outCnt)
+	host_priv_t host_priv;
+	host_flavor_t flavor;
+	host_info_t host_info_out;
+	mach_msg_type_number_t *host_info_outCnt;
+{ return host_priv_statistics(host_priv, flavor, host_info_out, host_info_outCnt); }
+#else
+(
+	host_priv_t host_priv,
+	host_flavor_t flavor,
+	host_info_t host_info_out,
+	mach_msg_type_number_t *host_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_priv_statistics */
+mig_internal novalue _Xhost_priv_statistics
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t flavor;
+		mach_msg_type_number_t host_info_outCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_priv_statistics_t __Request;
+	typedef __Reply__host_priv_statistics_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_priv_statistics_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_priv_statistics_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(402, "host_priv_statistics")
+	__BeforeRcvRpc(402, "host_priv_statistics")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_priv_statistics_t__defined)
+	check_result = __MIG_check__Request__host_priv_statistics_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_priv_statistics_t__defined) */
+
+	OutP->host_info_outCnt = 68;
+	if (In0P->host_info_outCnt < OutP->host_info_outCnt)
+		OutP->host_info_outCnt = In0P->host_info_outCnt;
+
+	OutP->RetCode = host_priv_statistics(convert_port_to_host_priv(In0P->Head.msgh_request_port), In0P->flavor, OutP->host_info_out, &OutP->host_info_outCnt);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+	OutP->Head.msgh_size = (sizeof(Reply) - 272) + (_WALIGN_((4 * OutP->host_info_outCnt)));
+
+	__AfterRcvRpc(402, "host_priv_statistics")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_default_memory_manager_t__defined)
+#define __MIG_check__Request__host_default_memory_manager_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_default_memory_manager_t(__attribute__((__unused__)) __Request__host_default_memory_manager_t *In0P)
+{
+
+	typedef __Request__host_default_memory_manager_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->default_manager.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->default_manager.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_default_memory_manager_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_default_memory_manager */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_default_memory_manager
+#if	defined(LINTLIBRARY)
+    (host_priv, default_manager, cluster_size)
+	host_priv_t host_priv;
+	memory_object_default_t *default_manager;
+	memory_object_cluster_size_t cluster_size;
+{ return host_default_memory_manager(host_priv, default_manager, cluster_size); }
+#else
+(
+	host_priv_t host_priv,
+	memory_object_default_t *default_manager,
+	memory_object_cluster_size_t cluster_size
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_default_memory_manager */
+mig_internal novalue _Xhost_default_memory_manager
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t default_manager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		memory_object_cluster_size_t cluster_size;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_default_memory_manager_t __Request;
+	typedef __Reply__host_default_memory_manager_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_default_memory_manager_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_default_memory_manager_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t default_managerTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t default_managerTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 20,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	__DeclareRcvRpc(403, "host_default_memory_manager")
+	__BeforeRcvRpc(403, "host_default_memory_manager")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_default_memory_manager_t__defined)
+	check_result = __MIG_check__Request__host_default_memory_manager_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_default_memory_manager_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->default_manager = default_managerTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->default_manager.disposition = 17;
+#else
+	OutP->default_manager.disposition = 20;
+#endif /* __MigKernelSpecificCode */
+	OutP->default_manager.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = host_default_memory_manager(convert_port_to_host_priv(In0P->Head.msgh_request_port), &In0P->default_manager.name, In0P->cluster_size);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->default_manager.name = In0P->default_manager.name;
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(403, "host_default_memory_manager")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__vm_wire_t__defined)
+#define __MIG_check__Request__vm_wire_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_wire_t(__attribute__((__unused__)) __Request__vm_wire_t *In0P)
+{
+
+	typedef __Request__vm_wire_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->task.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->task.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_wire_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_wire */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_wire
+#if	defined(LINTLIBRARY)
+    (host_priv, task, address, size, desired_access)
+	host_priv_t host_priv;
+	vm_map_t task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_prot_t desired_access;
+{ return vm_wire(host_priv, task, address, size, desired_access); }
+#else
+(
+	host_priv_t host_priv,
+	vm_map_t task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_prot_t desired_access
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_wire */
+mig_internal novalue _Xvm_wire
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_prot_t desired_access;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_wire_t __Request;
+	typedef __Reply__vm_wire_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_wire_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_wire_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t task;
+
+	__DeclareRcvRpc(404, "vm_wire")
+	__BeforeRcvRpc(404, "vm_wire")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_wire_t__defined)
+	check_result = __MIG_check__Request__vm_wire_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_wire_t__defined) */
+
+	task = convert_port_to_map(In0P->task.name);
+
+	OutP->RetCode = vm_wire(convert_port_to_host_priv(In0P->Head.msgh_request_port), task, In0P->address, In0P->size, In0P->desired_access);
+	vm_map_deallocate(task);
+#if	__MigKernelSpecificCode
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	if (IP_VALID((ipc_port_t)In0P->task.name))
+		ipc_port_release_send((ipc_port_t)In0P->task.name);
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(404, "vm_wire")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__thread_wire_t__defined)
+#define __MIG_check__Request__thread_wire_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__thread_wire_t(__attribute__((__unused__)) __Request__thread_wire_t *In0P)
+{
+
+	typedef __Request__thread_wire_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->thread.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->thread.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__thread_wire_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine thread_wire */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t thread_wire
+#if	defined(LINTLIBRARY)
+    (host_priv, thread, wired)
+	host_priv_t host_priv;
+	thread_act_t thread;
+	boolean_t wired;
+{ return thread_wire(host_priv, thread, wired); }
+#else
+(
+	host_priv_t host_priv,
+	thread_act_t thread,
+	boolean_t wired
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine thread_wire */
+mig_internal novalue _Xthread_wire
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t thread;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t wired;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__thread_wire_t __Request;
+	typedef __Reply__thread_wire_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__thread_wire_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__thread_wire_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	thread_act_t thread;
+
+	__DeclareRcvRpc(405, "thread_wire")
+	__BeforeRcvRpc(405, "thread_wire")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__thread_wire_t__defined)
+	check_result = __MIG_check__Request__thread_wire_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__thread_wire_t__defined) */
+
+	thread = convert_port_to_thread(In0P->thread.name);
+
+	OutP->RetCode = thread_wire(convert_port_to_host_priv(In0P->Head.msgh_request_port), thread, In0P->wired);
+	thread_deallocate(thread);
+#if	__MigKernelSpecificCode
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	if (IP_VALID((ipc_port_t)In0P->thread.name))
+		ipc_port_release_send((ipc_port_t)In0P->thread.name);
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(405, "thread_wire")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__vm_allocate_cpm_t__defined)
+#define __MIG_check__Request__vm_allocate_cpm_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_allocate_cpm_t(__attribute__((__unused__)) __Request__vm_allocate_cpm_t *In0P)
+{
+
+	typedef __Request__vm_allocate_cpm_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->task.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->task.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_allocate_cpm_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_allocate_cpm */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_allocate_cpm
+#if	defined(LINTLIBRARY)
+    (host_priv, task, address, size, flags)
+	host_priv_t host_priv;
+	vm_map_t task;
+	vm_address_t *address;
+	vm_size_t size;
+	int flags;
+{ return vm_allocate_cpm(host_priv, task, address, size, flags); }
+#else
+(
+	host_priv_t host_priv,
+	vm_map_t task,
+	vm_address_t *address,
+	vm_size_t size,
+	int flags
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_allocate_cpm */
+mig_internal novalue _Xvm_allocate_cpm
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		int flags;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_allocate_cpm_t __Request;
+	typedef __Reply__vm_allocate_cpm_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_allocate_cpm_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_allocate_cpm_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t task;
+
+	__DeclareRcvRpc(406, "vm_allocate_cpm")
+	__BeforeRcvRpc(406, "vm_allocate_cpm")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_allocate_cpm_t__defined)
+	check_result = __MIG_check__Request__vm_allocate_cpm_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_allocate_cpm_t__defined) */
+
+	task = convert_port_to_map(In0P->task.name);
+
+	OutP->RetCode = vm_allocate_cpm(convert_port_to_host_priv(In0P->Head.msgh_request_port), task, &In0P->address, In0P->size, In0P->flags);
+	vm_map_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+
+	if (IP_VALID((ipc_port_t)In0P->task.name))
+		ipc_port_release_send((ipc_port_t)In0P->task.name);
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->address = In0P->address;
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(406, "vm_allocate_cpm")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_processors_t__defined)
+#define __MIG_check__Request__host_processors_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_processors_t(__attribute__((__unused__)) __Request__host_processors_t *In0P)
+{
+
+	typedef __Request__host_processors_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_processors_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_processors */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_processors
+#if	defined(LINTLIBRARY)
+    (host_priv, out_processor_list, out_processor_listCnt)
+	host_priv_t host_priv;
+	processor_array_t *out_processor_list;
+	mach_msg_type_number_t *out_processor_listCnt;
+{ return host_processors(host_priv, out_processor_list, out_processor_listCnt); }
+#else
+(
+	host_priv_t host_priv,
+	processor_array_t *out_processor_list,
+	mach_msg_type_number_t *out_processor_listCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_processors */
+mig_internal novalue _Xhost_processors
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_processors_t __Request;
+	typedef __Reply__host_processors_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_processors_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_processors_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_ports_descriptor_t out_processor_listTemplate = {
+		.address = (void *)0,
+		.count = 0,
+		.deallocate = FALSE,
+		/* copy is meaningful only in overwrite mode */
+		.copy = MACH_MSG_PHYSICAL_COPY,
+		.disposition = 17,
+		.type = MACH_MSG_OOL_PORTS_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_ports_descriptor_t out_processor_listTemplate = {
+		.address = (void *)0,
+		.count = 0,
+		.deallocate = FALSE,
+		/* copy is meaningful only in overwrite mode */
+		.copy = MACH_MSG_PHYSICAL_COPY,
+		.disposition = 19,
+		.type = MACH_MSG_OOL_PORTS_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	__DeclareRcvRpc(407, "host_processors")
+	__BeforeRcvRpc(407, "host_processors")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_processors_t__defined)
+	check_result = __MIG_check__Request__host_processors_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_processors_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->out_processor_list = out_processor_listTemplate;
+#else	/* UseStaticTemplates */
+#if	__MigKernelSpecificCode
+	OutP->out_processor_list.disposition = 17;
+#else
+	OutP->out_processor_list.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->out_processor_list.deallocate =  FALSE;
+	OutP->out_processor_list.type = MACH_MSG_OOL_PORTS_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = host_processors(convert_port_to_host_priv(In0P->Head.msgh_request_port), (processor_array_t *)&(OutP->out_processor_list.address), &OutP->out_processor_listCnt);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->out_processor_list.count = OutP->out_processor_listCnt;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(407, "host_processors")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_get_clock_control_t__defined)
+#define __MIG_check__Request__host_get_clock_control_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_get_clock_control_t(__attribute__((__unused__)) __Request__host_get_clock_control_t *In0P)
+{
+
+	typedef __Request__host_get_clock_control_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_get_clock_control_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_get_clock_control */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_clock_control
+#if	defined(LINTLIBRARY)
+    (host_priv, clock_id, clock_ctrl)
+	host_priv_t host_priv;
+	clock_id_t clock_id;
+	clock_ctrl_t *clock_ctrl;
+{ return host_get_clock_control(host_priv, clock_id, clock_ctrl); }
+#else
+(
+	host_priv_t host_priv,
+	clock_id_t clock_id,
+	clock_ctrl_t *clock_ctrl
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_clock_control */
+mig_internal novalue _Xhost_get_clock_control
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		clock_id_t clock_id;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_get_clock_control_t __Request;
+	typedef __Reply__host_get_clock_control_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_get_clock_control_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_get_clock_control_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t clock_ctrlTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t clock_ctrlTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	clock_ctrl_t clock_ctrl;
+
+	__DeclareRcvRpc(408, "host_get_clock_control")
+	__BeforeRcvRpc(408, "host_get_clock_control")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_get_clock_control_t__defined)
+	check_result = __MIG_check__Request__host_get_clock_control_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_get_clock_control_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->clock_ctrl = clock_ctrlTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->clock_ctrl.disposition = 17;
+#else
+	OutP->clock_ctrl.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->clock_ctrl.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = host_get_clock_control(convert_port_to_host_priv(In0P->Head.msgh_request_port), In0P->clock_id, &clock_ctrl);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->clock_ctrl.name = (mach_port_t)convert_clock_ctrl_to_port(clock_ctrl);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(408, "host_get_clock_control")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_get_special_port_t__defined)
+#define __MIG_check__Request__host_get_special_port_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_get_special_port_t(__attribute__((__unused__)) __Request__host_get_special_port_t *In0P)
+{
+
+	typedef __Request__host_get_special_port_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_get_special_port_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_get_special_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_special_port
+#if	defined(LINTLIBRARY)
+    (host_priv, node, which, port)
+	host_priv_t host_priv;
+	int node;
+	int which;
+	mach_port_t *port;
+{ return host_get_special_port(host_priv, node, which, port); }
+#else
+(
+	host_priv_t host_priv,
+	int node,
+	int which,
+	mach_port_t *port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_special_port */
+mig_internal novalue _Xhost_get_special_port
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int node;
+		int which;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_get_special_port_t __Request;
+	typedef __Reply__host_get_special_port_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_get_special_port_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_get_special_port_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t portTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t portTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	__DeclareRcvRpc(412, "host_get_special_port")
+	__BeforeRcvRpc(412, "host_get_special_port")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_get_special_port_t__defined)
+	check_result = __MIG_check__Request__host_get_special_port_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_get_special_port_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->port = portTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->port.disposition = 17;
+#else
+	OutP->port.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->port.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = host_get_special_port(convert_port_to_host_priv(In0P->Head.msgh_request_port), In0P->node, In0P->which, &OutP->port.name);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(412, "host_get_special_port")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_set_special_port_t__defined)
+#define __MIG_check__Request__host_set_special_port_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_set_special_port_t(__attribute__((__unused__)) __Request__host_set_special_port_t *In0P)
+{
+
+	typedef __Request__host_set_special_port_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->port.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->port.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_set_special_port_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_set_special_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_set_special_port
+#if	defined(LINTLIBRARY)
+    (host_priv, which, port)
+	host_priv_t host_priv;
+	int which;
+	mach_port_t port;
+{ return host_set_special_port(host_priv, which, port); }
+#else
+(
+	host_priv_t host_priv,
+	int which,
+	mach_port_t port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_set_special_port */
+mig_internal novalue _Xhost_set_special_port
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int which;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_set_special_port_t __Request;
+	typedef __Reply__host_set_special_port_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_set_special_port_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_set_special_port_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(413, "host_set_special_port")
+	__BeforeRcvRpc(413, "host_set_special_port")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_set_special_port_t__defined)
+	check_result = __MIG_check__Request__host_set_special_port_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_set_special_port_t__defined) */
+
+	OutP->RetCode = host_set_special_port(convert_port_to_host_priv(In0P->Head.msgh_request_port), In0P->which, In0P->port.name);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(413, "host_set_special_port")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_set_exception_ports_t__defined)
+#define __MIG_check__Request__host_set_exception_ports_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_set_exception_ports_t(__attribute__((__unused__)) __Request__host_set_exception_ports_t *In0P)
+{
+
+	typedef __Request__host_set_exception_ports_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->new_port.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->new_port.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_set_exception_ports_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_set_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_set_exception_ports
+#if	defined(LINTLIBRARY)
+    (host_priv, exception_mask, new_port, behavior, new_flavor)
+	host_priv_t host_priv;
+	exception_mask_t exception_mask;
+	mach_port_t new_port;
+	exception_behavior_t behavior;
+	thread_state_flavor_t new_flavor;
+{ return host_set_exception_ports(host_priv, exception_mask, new_port, behavior, new_flavor); }
+#else
+(
+	host_priv_t host_priv,
+	exception_mask_t exception_mask,
+	mach_port_t new_port,
+	exception_behavior_t behavior,
+	thread_state_flavor_t new_flavor
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_set_exception_ports */
+mig_internal novalue _Xhost_set_exception_ports
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+		exception_behavior_t behavior;
+		thread_state_flavor_t new_flavor;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_set_exception_ports_t __Request;
+	typedef __Reply__host_set_exception_ports_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_set_exception_ports_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_set_exception_ports_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(414, "host_set_exception_ports")
+	__BeforeRcvRpc(414, "host_set_exception_ports")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_set_exception_ports_t__defined)
+	check_result = __MIG_check__Request__host_set_exception_ports_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_set_exception_ports_t__defined) */
+
+	OutP->RetCode = host_set_exception_ports(convert_port_to_host_priv(In0P->Head.msgh_request_port), In0P->exception_mask, In0P->new_port.name, In0P->behavior, In0P->new_flavor);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(414, "host_set_exception_ports")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_get_exception_ports_t__defined)
+#define __MIG_check__Request__host_get_exception_ports_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_get_exception_ports_t(__attribute__((__unused__)) __Request__host_get_exception_ports_t *In0P)
+{
+
+	typedef __Request__host_get_exception_ports_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_get_exception_ports_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_get_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_exception_ports
+#if	defined(LINTLIBRARY)
+    (host_priv, exception_mask, masks, masksCnt, old_handlers, old_behaviors, old_flavors)
+	host_priv_t host_priv;
+	exception_mask_t exception_mask;
+	exception_mask_array_t masks;
+	mach_msg_type_number_t *masksCnt;
+	exception_handler_array_t old_handlers;
+	exception_behavior_array_t old_behaviors;
+	exception_flavor_array_t old_flavors;
+{ return host_get_exception_ports(host_priv, exception_mask, masks, masksCnt, old_handlers, old_behaviors, old_flavors); }
+#else
+(
+	host_priv_t host_priv,
+	exception_mask_t exception_mask,
+	exception_mask_array_t masks,
+	mach_msg_type_number_t *masksCnt,
+	exception_handler_array_t old_handlers,
+	exception_behavior_array_t old_behaviors,
+	exception_flavor_array_t old_flavors
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_exception_ports */
+mig_internal novalue _Xhost_get_exception_ports
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_get_exception_ports_t __Request;
+	typedef __Reply__host_get_exception_ports_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+	unsigned int msgh_size;
+	unsigned int msgh_size_delta;
+
+#ifdef	__MIG_check__Request__host_get_exception_ports_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_get_exception_ports_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t old_handlersTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t old_handlersTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	mach_msg_type_number_t masksCnt;
+	exception_handler_t old_handlers[32];
+	exception_behavior_t old_behaviors[32];
+	thread_state_flavor_t old_flavors[32];
+
+	__DeclareRcvRpc(415, "host_get_exception_ports")
+	__BeforeRcvRpc(415, "host_get_exception_ports")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_get_exception_ports_t__defined)
+	check_result = __MIG_check__Request__host_get_exception_ports_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_get_exception_ports_t__defined) */
+
+	{
+	    register	mach_msg_port_descriptor_t	*ptr;
+	    register int	i;
+
+	    ptr = &OutP->old_handlers[0];
+	    for (i = 0; i < 32; ptr++, i++) {
+#if	UseStaticTemplates
+		*ptr = old_handlersTemplate;
+#else	/* UseStaticTemplates */
+		ptr->name = MACH_PORT_NULL;
+#if __MigKernelSpecificCode
+		ptr->disposition = 17;
+#else
+		ptr->disposition = 19;
+#endif /* __MigKernelSpecificCode */
+		ptr->type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+	    }
+	}
+
+
+	masksCnt = 32;
+
+	RetCode = host_get_exception_ports(convert_port_to_host_priv(In0P->Head.msgh_request_port), In0P->exception_mask, OutP->masks, &masksCnt, old_handlers, old_behaviors, old_flavors);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	{
+	    register	mach_msg_port_descriptor_t	*ptr;
+	    register int	i, j;
+
+	    ptr = &OutP->old_handlers[0];
+	    j = min(32, masksCnt);
+	    for (i = 0; i < j; ptr++, i++) {
+		ptr->name = old_handlers[i];
+	    }
+	}
+
+
+	OutP->NDR = NDR_record;
+
+	OutP->masksCnt = masksCnt;
+	msgh_size_delta = _WALIGN_((4 * masksCnt));
+	msgh_size = (sizeof(Reply) - 384) + msgh_size_delta;
+	OutP = (Reply *) ((pointer_t) OutP + msgh_size_delta - 128);
+	(void)memcpy((char *) OutP->old_behaviors, (const char *) old_behaviors, 4 * masksCnt);
+	msgh_size_delta = _WALIGN_((4 * masksCnt));
+	msgh_size += msgh_size_delta;
+	OutP = (Reply *) ((pointer_t) OutP + msgh_size_delta - 128);
+	(void)memcpy((char *) OutP->old_flavors, (const char *) old_flavors, 4 * masksCnt);
+	msgh_size += _WALIGN_((4 * masksCnt));
+
+	OutP = (Reply *) OutHeadP;
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = msgh_size;
+	OutP->msgh_body.msgh_descriptor_count = 32;
+	__AfterRcvRpc(415, "host_get_exception_ports")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_swap_exception_ports_t__defined)
+#define __MIG_check__Request__host_swap_exception_ports_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_swap_exception_ports_t(__attribute__((__unused__)) __Request__host_swap_exception_ports_t *In0P)
+{
+
+	typedef __Request__host_swap_exception_ports_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->new_port.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->new_port.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_swap_exception_ports_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_swap_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_swap_exception_ports
+#if	defined(LINTLIBRARY)
+    (host_priv, exception_mask, new_port, behavior, new_flavor, masks, masksCnt, old_handlerss, old_behaviors, old_flavors)
+	host_priv_t host_priv;
+	exception_mask_t exception_mask;
+	mach_port_t new_port;
+	exception_behavior_t behavior;
+	thread_state_flavor_t new_flavor;
+	exception_mask_array_t masks;
+	mach_msg_type_number_t *masksCnt;
+	exception_handler_array_t old_handlerss;
+	exception_behavior_array_t old_behaviors;
+	exception_flavor_array_t old_flavors;
+{ return host_swap_exception_ports(host_priv, exception_mask, new_port, behavior, new_flavor, masks, masksCnt, old_handlerss, old_behaviors, old_flavors); }
+#else
+(
+	host_priv_t host_priv,
+	exception_mask_t exception_mask,
+	mach_port_t new_port,
+	exception_behavior_t behavior,
+	thread_state_flavor_t new_flavor,
+	exception_mask_array_t masks,
+	mach_msg_type_number_t *masksCnt,
+	exception_handler_array_t old_handlerss,
+	exception_behavior_array_t old_behaviors,
+	exception_flavor_array_t old_flavors
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_swap_exception_ports */
+mig_internal novalue _Xhost_swap_exception_ports
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+		exception_behavior_t behavior;
+		thread_state_flavor_t new_flavor;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_swap_exception_ports_t __Request;
+	typedef __Reply__host_swap_exception_ports_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+	unsigned int msgh_size;
+	unsigned int msgh_size_delta;
+
+#ifdef	__MIG_check__Request__host_swap_exception_ports_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_swap_exception_ports_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t old_handlerssTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t old_handlerssTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	mach_msg_type_number_t masksCnt;
+	exception_handler_t old_handlerss[32];
+	exception_behavior_t old_behaviors[32];
+	thread_state_flavor_t old_flavors[32];
+
+	__DeclareRcvRpc(416, "host_swap_exception_ports")
+	__BeforeRcvRpc(416, "host_swap_exception_ports")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_swap_exception_ports_t__defined)
+	check_result = __MIG_check__Request__host_swap_exception_ports_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_swap_exception_ports_t__defined) */
+
+	{
+	    register	mach_msg_port_descriptor_t	*ptr;
+	    register int	i;
+
+	    ptr = &OutP->old_handlerss[0];
+	    for (i = 0; i < 32; ptr++, i++) {
+#if	UseStaticTemplates
+		*ptr = old_handlerssTemplate;
+#else	/* UseStaticTemplates */
+		ptr->name = MACH_PORT_NULL;
+#if __MigKernelSpecificCode
+		ptr->disposition = 17;
+#else
+		ptr->disposition = 19;
+#endif /* __MigKernelSpecificCode */
+		ptr->type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+	    }
+	}
+
+
+	masksCnt = 32;
+
+	RetCode = host_swap_exception_ports(convert_port_to_host_priv(In0P->Head.msgh_request_port), In0P->exception_mask, In0P->new_port.name, In0P->behavior, In0P->new_flavor, OutP->masks, &masksCnt, old_handlerss, old_behaviors, old_flavors);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	{
+	    register	mach_msg_port_descriptor_t	*ptr;
+	    register int	i, j;
+
+	    ptr = &OutP->old_handlerss[0];
+	    j = min(32, masksCnt);
+	    for (i = 0; i < j; ptr++, i++) {
+		ptr->name = old_handlerss[i];
+	    }
+	}
+
+
+	OutP->NDR = NDR_record;
+
+	OutP->masksCnt = masksCnt;
+	msgh_size_delta = _WALIGN_((4 * masksCnt));
+	msgh_size = (sizeof(Reply) - 384) + msgh_size_delta;
+	OutP = (Reply *) ((pointer_t) OutP + msgh_size_delta - 128);
+	(void)memcpy((char *) OutP->old_behaviors, (const char *) old_behaviors, 4 * masksCnt);
+	msgh_size_delta = _WALIGN_((4 * masksCnt));
+	msgh_size += msgh_size_delta;
+	OutP = (Reply *) ((pointer_t) OutP + msgh_size_delta - 128);
+	(void)memcpy((char *) OutP->old_flavors, (const char *) old_flavors, 4 * masksCnt);
+	msgh_size += _WALIGN_((4 * masksCnt));
+
+	OutP = (Reply *) OutHeadP;
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = msgh_size;
+	OutP->msgh_body.msgh_descriptor_count = 32;
+	__AfterRcvRpc(416, "host_swap_exception_ports")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_wire_t__defined)
+#define __MIG_check__Request__mach_vm_wire_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_wire_t(__attribute__((__unused__)) __Request__mach_vm_wire_t *In0P)
+{
+
+	typedef __Request__mach_vm_wire_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->task.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->task.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_wire_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_wire */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_wire
+#if	defined(LINTLIBRARY)
+    (host_priv, task, address, size, desired_access)
+	host_priv_t host_priv;
+	vm_map_t task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_prot_t desired_access;
+{ return mach_vm_wire(host_priv, task, address, size, desired_access); }
+#else
+(
+	host_priv_t host_priv,
+	vm_map_t task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_prot_t desired_access
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_wire */
+mig_internal novalue _Xmach_vm_wire
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_prot_t desired_access;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_wire_t __Request;
+	typedef __Reply__mach_vm_wire_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_wire_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_wire_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t task;
+
+	__DeclareRcvRpc(418, "mach_vm_wire")
+	__BeforeRcvRpc(418, "mach_vm_wire")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_wire_t__defined)
+	check_result = __MIG_check__Request__mach_vm_wire_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_wire_t__defined) */
+
+	task = convert_port_to_map(In0P->task.name);
+
+	OutP->RetCode = mach_vm_wire(convert_port_to_host_priv(In0P->Head.msgh_request_port), task, In0P->address, In0P->size, In0P->desired_access);
+	vm_map_deallocate(task);
+#if	__MigKernelSpecificCode
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	if (IP_VALID((ipc_port_t)In0P->task.name))
+		ipc_port_release_send((ipc_port_t)In0P->task.name);
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(418, "mach_vm_wire")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_processor_sets_t__defined)
+#define __MIG_check__Request__host_processor_sets_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_processor_sets_t(__attribute__((__unused__)) __Request__host_processor_sets_t *In0P)
+{
+
+	typedef __Request__host_processor_sets_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_processor_sets_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_processor_sets */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_processor_sets
+#if	defined(LINTLIBRARY)
+    (host_priv, processor_sets, processor_setsCnt)
+	host_priv_t host_priv;
+	processor_set_name_array_t *processor_sets;
+	mach_msg_type_number_t *processor_setsCnt;
+{ return host_processor_sets(host_priv, processor_sets, processor_setsCnt); }
+#else
+(
+	host_priv_t host_priv,
+	processor_set_name_array_t *processor_sets,
+	mach_msg_type_number_t *processor_setsCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_processor_sets */
+mig_internal novalue _Xhost_processor_sets
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_processor_sets_t __Request;
+	typedef __Reply__host_processor_sets_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_processor_sets_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_processor_sets_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_ports_descriptor_t processor_setsTemplate = {
+		.address = (void *)0,
+		.count = 0,
+		.deallocate = FALSE,
+		/* copy is meaningful only in overwrite mode */
+		.copy = MACH_MSG_PHYSICAL_COPY,
+		.disposition = 17,
+		.type = MACH_MSG_OOL_PORTS_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_ports_descriptor_t processor_setsTemplate = {
+		.address = (void *)0,
+		.count = 0,
+		.deallocate = FALSE,
+		/* copy is meaningful only in overwrite mode */
+		.copy = MACH_MSG_PHYSICAL_COPY,
+		.disposition = 19,
+		.type = MACH_MSG_OOL_PORTS_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	__DeclareRcvRpc(419, "host_processor_sets")
+	__BeforeRcvRpc(419, "host_processor_sets")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_processor_sets_t__defined)
+	check_result = __MIG_check__Request__host_processor_sets_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_processor_sets_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->processor_sets = processor_setsTemplate;
+#else	/* UseStaticTemplates */
+#if	__MigKernelSpecificCode
+	OutP->processor_sets.disposition = 17;
+#else
+	OutP->processor_sets.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->processor_sets.deallocate =  FALSE;
+	OutP->processor_sets.type = MACH_MSG_OOL_PORTS_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = host_processor_sets(convert_port_to_host_priv(In0P->Head.msgh_request_port), (processor_set_name_array_t *)&(OutP->processor_sets.address), &OutP->processor_setsCnt);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->processor_sets.count = OutP->processor_setsCnt;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(419, "host_processor_sets")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_processor_set_priv_t__defined)
+#define __MIG_check__Request__host_processor_set_priv_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_processor_set_priv_t(__attribute__((__unused__)) __Request__host_processor_set_priv_t *In0P)
+{
+
+	typedef __Request__host_processor_set_priv_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->set_name.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->set_name.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_processor_set_priv_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_processor_set_priv */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_processor_set_priv
+#if	defined(LINTLIBRARY)
+    (host_priv, set_name, set)
+	host_priv_t host_priv;
+	processor_set_name_t set_name;
+	processor_set_t *set;
+{ return host_processor_set_priv(host_priv, set_name, set); }
+#else
+(
+	host_priv_t host_priv,
+	processor_set_name_t set_name,
+	processor_set_t *set
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_processor_set_priv */
+mig_internal novalue _Xhost_processor_set_priv
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t set_name;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_processor_set_priv_t __Request;
+	typedef __Reply__host_processor_set_priv_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_processor_set_priv_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_processor_set_priv_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t setTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t setTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	processor_set_name_t set_name;
+	processor_set_t set;
+
+	__DeclareRcvRpc(420, "host_processor_set_priv")
+	__BeforeRcvRpc(420, "host_processor_set_priv")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_processor_set_priv_t__defined)
+	check_result = __MIG_check__Request__host_processor_set_priv_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_processor_set_priv_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->set = setTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->set.disposition = 17;
+#else
+	OutP->set.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->set.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	set_name = convert_port_to_pset_name(In0P->set_name.name);
+
+	RetCode = host_processor_set_priv(convert_port_to_host_priv(In0P->Head.msgh_request_port), set_name, &set);
+	pset_deallocate(set_name);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+
+	if (IP_VALID((ipc_port_t)In0P->set_name.name))
+		ipc_port_release_send((ipc_port_t)In0P->set_name.name);
+#endif /* __MigKernelSpecificCode */
+	OutP->set.name = (mach_port_t)convert_pset_to_port(set);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(420, "host_processor_set_priv")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__set_dp_control_port_t__defined)
+#define __MIG_check__Request__set_dp_control_port_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__set_dp_control_port_t(__attribute__((__unused__)) __Request__set_dp_control_port_t *In0P)
+{
+
+	typedef __Request__set_dp_control_port_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->control_port.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->control_port.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__set_dp_control_port_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine set_dp_control_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t set_dp_control_port
+#if	defined(LINTLIBRARY)
+    (host, control_port)
+	host_priv_t host;
+	mach_port_t control_port;
+{ return set_dp_control_port(host, control_port); }
+#else
+(
+	host_priv_t host,
+	mach_port_t control_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine set_dp_control_port */
+mig_internal novalue _Xset_dp_control_port
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t control_port;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__set_dp_control_port_t __Request;
+	typedef __Reply__set_dp_control_port_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__set_dp_control_port_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__set_dp_control_port_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(421, "set_dp_control_port")
+	__BeforeRcvRpc(421, "set_dp_control_port")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__set_dp_control_port_t__defined)
+	check_result = __MIG_check__Request__set_dp_control_port_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__set_dp_control_port_t__defined) */
+
+	OutP->RetCode = set_dp_control_port(convert_port_to_host_priv(In0P->Head.msgh_request_port), In0P->control_port.name);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(421, "set_dp_control_port")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__get_dp_control_port_t__defined)
+#define __MIG_check__Request__get_dp_control_port_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__get_dp_control_port_t(__attribute__((__unused__)) __Request__get_dp_control_port_t *In0P)
+{
+
+	typedef __Request__get_dp_control_port_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__get_dp_control_port_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine get_dp_control_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t get_dp_control_port
+#if	defined(LINTLIBRARY)
+    (host, contorl_port)
+	host_priv_t host;
+	mach_port_t *contorl_port;
+{ return get_dp_control_port(host, contorl_port); }
+#else
+(
+	host_priv_t host,
+	mach_port_t *contorl_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine get_dp_control_port */
+mig_internal novalue _Xget_dp_control_port
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__get_dp_control_port_t __Request;
+	typedef __Reply__get_dp_control_port_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__get_dp_control_port_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__get_dp_control_port_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t contorl_portTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t contorl_portTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	__DeclareRcvRpc(422, "get_dp_control_port")
+	__BeforeRcvRpc(422, "get_dp_control_port")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__get_dp_control_port_t__defined)
+	check_result = __MIG_check__Request__get_dp_control_port_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__get_dp_control_port_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->contorl_port = contorl_portTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->contorl_port.disposition = 17;
+#else
+	OutP->contorl_port.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->contorl_port.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = get_dp_control_port(convert_port_to_host_priv(In0P->Head.msgh_request_port), &OutP->contorl_port.name);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(422, "get_dp_control_port")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_set_UNDServer_t__defined)
+#define __MIG_check__Request__host_set_UNDServer_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_set_UNDServer_t(__attribute__((__unused__)) __Request__host_set_UNDServer_t *In0P)
+{
+
+	typedef __Request__host_set_UNDServer_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->server.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->server.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_set_UNDServer_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_set_UNDServer */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_set_UNDServer
+#if	defined(LINTLIBRARY)
+    (host, server)
+	host_priv_t host;
+	UNDServerRef server;
+{ return host_set_UNDServer(host, server); }
+#else
+(
+	host_priv_t host,
+	UNDServerRef server
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_set_UNDServer */
+mig_internal novalue _Xhost_set_UNDServer
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t server;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_set_UNDServer_t __Request;
+	typedef __Reply__host_set_UNDServer_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_set_UNDServer_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_set_UNDServer_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(423, "host_set_UNDServer")
+	__BeforeRcvRpc(423, "host_set_UNDServer")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_set_UNDServer_t__defined)
+	check_result = __MIG_check__Request__host_set_UNDServer_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_set_UNDServer_t__defined) */
+
+	OutP->RetCode = host_set_UNDServer(convert_port_to_host_priv(In0P->Head.msgh_request_port), In0P->server.name);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(423, "host_set_UNDServer")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__host_get_UNDServer_t__defined)
+#define __MIG_check__Request__host_get_UNDServer_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_get_UNDServer_t(__attribute__((__unused__)) __Request__host_get_UNDServer_t *In0P)
+{
+
+	typedef __Request__host_get_UNDServer_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_get_UNDServer_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_get_UNDServer */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_UNDServer
+#if	defined(LINTLIBRARY)
+    (host, server)
+	host_priv_t host;
+	UNDServerRef *server;
+{ return host_get_UNDServer(host, server); }
+#else
+(
+	host_priv_t host,
+	UNDServerRef *server
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_UNDServer */
+mig_internal novalue _Xhost_get_UNDServer
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_get_UNDServer_t __Request;
+	typedef __Reply__host_get_UNDServer_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_get_UNDServer_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_get_UNDServer_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t serverTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t serverTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	__DeclareRcvRpc(424, "host_get_UNDServer")
+	__BeforeRcvRpc(424, "host_get_UNDServer")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_get_UNDServer_t__defined)
+	check_result = __MIG_check__Request__host_get_UNDServer_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_get_UNDServer_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->server = serverTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->server.disposition = 17;
+#else
+	OutP->server.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->server.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = host_get_UNDServer(convert_port_to_host_priv(In0P->Head.msgh_request_port), &OutP->server.name);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(424, "host_get_UNDServer")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__host_priv_subsystem__
+#if !defined(__MIG_check__Request__kext_request_t__defined)
+#define __MIG_check__Request__kext_request_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__kext_request_t(__attribute__((__unused__)) __Request__kext_request_t *In0P)
+{
+
+	typedef __Request__kext_request_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->request_data.type != MACH_MSG_OOL_DESCRIPTOR)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+#if __MigTypeCheck
+	if (In0P->request_data.size != In0P->request_dataCnt)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__kext_request_t__defined) */
+#endif /* __MIG_check__Request__host_priv_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine kext_request */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t kext_request
+#if	defined(LINTLIBRARY)
+    (host_priv, user_log_flags, request_data, request_dataCnt, response_data, response_dataCnt, log_data, log_dataCnt, op_result)
+	host_priv_t host_priv;
+	uint32_t user_log_flags;
+	vm_offset_t request_data;
+	mach_msg_type_number_t request_dataCnt;
+	vm_offset_t *response_data;
+	mach_msg_type_number_t *response_dataCnt;
+	vm_offset_t *log_data;
+	mach_msg_type_number_t *log_dataCnt;
+	kern_return_t *op_result;
+{ return kext_request(host_priv, user_log_flags, request_data, request_dataCnt, response_data, response_dataCnt, log_data, log_dataCnt, op_result); }
+#else
+(
+	host_priv_t host_priv,
+	uint32_t user_log_flags,
+	vm_offset_t request_data,
+	mach_msg_type_number_t request_dataCnt,
+	vm_offset_t *response_data,
+	mach_msg_type_number_t *response_dataCnt,
+	vm_offset_t *log_data,
+	mach_msg_type_number_t *log_dataCnt,
+	kern_return_t *op_result
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine kext_request */
+mig_internal novalue _Xkext_request
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t request_data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		uint32_t user_log_flags;
+		mach_msg_type_number_t request_dataCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__kext_request_t __Request;
+	typedef __Reply__kext_request_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__kext_request_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__kext_request_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t response_dataTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t log_dataTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t response_dataTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t log_dataTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	__DeclareRcvRpc(425, "kext_request")
+	__BeforeRcvRpc(425, "kext_request")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__kext_request_t__defined)
+	check_result = __MIG_check__Request__kext_request_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__kext_request_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->response_data = response_dataTemplate;
+#else	/* UseStaticTemplates */
+	OutP->response_data.deallocate =  FALSE;
+	OutP->response_data.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->response_data.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+#if	UseStaticTemplates
+	OutP->log_data = log_dataTemplate;
+#else	/* UseStaticTemplates */
+	OutP->log_data.deallocate =  FALSE;
+	OutP->log_data.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->log_data.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = kext_request(convert_port_to_host_priv(In0P->Head.msgh_request_port), In0P->user_log_flags, (vm_offset_t)(In0P->request_data.address), In0P->request_dataCnt, (vm_offset_t *)&(OutP->response_data.address), &OutP->response_dataCnt, (vm_offset_t *)&(OutP->log_data.address), &OutP->log_dataCnt, &OutP->op_result);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->response_data.size = OutP->response_dataCnt;
+
+	OutP->log_data.size = OutP->log_dataCnt;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 2;
+	__AfterRcvRpc(425, "kext_request")
+}
+
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+boolean_t host_priv_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+mig_routine_t host_priv_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+extern const struct host_priv_subsystem host_priv_subsystem;
+const struct host_priv_subsystem {
+	mig_server_routine_t 	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[26];
+} host_priv_subsystem = {
+	host_priv_server_routine,
+	400,
+	426,
+	(mach_msg_size_t)sizeof(union __ReplyUnion__host_priv_subsystem),
+	(vm_address_t)0,
+	{
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_get_boot_info, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_get_boot_info_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_reboot, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_reboot_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_priv_statistics, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_priv_statistics_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_default_memory_manager, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_default_memory_manager_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_wire, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_wire_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xthread_wire, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__thread_wire_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_allocate_cpm, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_allocate_cpm_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_processors, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_processors_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_get_clock_control, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_get_clock_control_t) },
+		{0, 0, 0, 0, 0, 0},
+		{0, 0, 0, 0, 0, 0},
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_get_special_port, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_get_special_port_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_set_special_port, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_set_special_port_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_set_exception_ports, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_set_exception_ports_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_get_exception_ports, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_get_exception_ports_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_swap_exception_ports, 10, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_swap_exception_ports_t) },
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_wire, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_wire_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_processor_sets, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_processor_sets_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_processor_set_priv, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_processor_set_priv_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xset_dp_control_port, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__set_dp_control_port_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xget_dp_control_port, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__get_dp_control_port_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_set_UNDServer, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_set_UNDServer_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_get_UNDServer, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_get_UNDServer_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xkext_request, 9, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__kext_request_t) },
+	}
+};
+
+mig_external boolean_t host_priv_server
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	register mig_routine_t routine;
+
+	OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0);
+	OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port;
+	/* Minimal size: routine() will update it if different */
+	OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t);
+	OutHeadP->msgh_local_port = MACH_PORT_NULL;
+	OutHeadP->msgh_id = InHeadP->msgh_id + 100;
+
+	if ((InHeadP->msgh_id > 425) || (InHeadP->msgh_id < 400) ||
+	    ((routine = host_priv_subsystem.routine[InHeadP->msgh_id - 400].stub_routine) == 0)) {
+		((mig_reply_error_t *)OutHeadP)->NDR = NDR_record;
+		((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID;
+		return FALSE;
+	}
+	(*routine) (InHeadP, OutHeadP);
+	return TRUE;
+}
+
+mig_external mig_routine_t host_priv_server_routine
+	(mach_msg_header_t *InHeadP)
+{
+	register int msgh_id;
+
+	msgh_id = InHeadP->msgh_id - 400;
+
+	if ((msgh_id > 25) || (msgh_id < 0))
+		return 0;
+
+	return host_priv_subsystem.routine[msgh_id].stub_routine;
+}


Property changes on: trunk/sys/compat/mach/host_priv_server.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/init_sysent.c
===================================================================
--- trunk/sys/compat/mach/init_sysent.c	                        (rev 0)
+++ trunk/sys/compat/mach/init_sysent.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,5 @@
+/*
+ * System call switch table.
+ *
+ * DO NOT EDIT-- this file is automatically generated.
+ * $FreeBSD$


Property changes on: trunk/sys/compat/mach/init_sysent.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/ipc_entry.c
===================================================================
--- trunk/sys/compat/mach/ipc/ipc_entry.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/ipc_entry.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,902 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.7  91/10/09  16:08:15  af
+ * 	 Revision 2.6.2.1  91/09/16  10:15:30  rpd
+ * 	 	Added <ipc/ipc_hash.h>.
+ * 	 	[91/09/02            rpd]
+ * 
+ * Revision 2.6.2.1  91/09/16  10:15:30  rpd
+ * 	Added <ipc/ipc_hash.h>.
+ * 	[91/09/02            rpd]
+ * 
+ * Revision 2.6  91/05/14  16:31:38  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.5  91/03/16  14:47:45  rpd
+ * 	Fixed ipc_entry_grow_table to use it_entries_realloc.
+ * 	[91/03/05            rpd]
+ * 
+ * Revision 2.4  91/02/05  17:21:17  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:44:19  mrt]
+ * 
+ * Revision 2.3  91/01/08  15:12:58  rpd
+ * 	Removed MACH_IPC_GENNOS.
+ * 	[90/11/08            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:49:36  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  20:54:27  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_entry.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Primitive functions to manipulate translation entries.
+ */
+
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+//TODO: LAH include "opt_capsicum.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/eventhandler.h>
+// TODO: LAH include <sys/capsicum.h>
+#include <sys/file.h>
+#include <sys/filedesc.h>
+#include <sys/fcntl.h>
+#include <sys/kernel.h>
+#include <sys/syscallsubr.h>
+#include <sys/stat.h>
+#include <sys/syslog.h>
+#include <sys/user.h>
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/port.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mach_port_server.h>
+#include <vm/uma.h>
+#include <sys/mach/ipc/port.h>
+#include <sys/mach/ipc/ipc_entry.h>
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_hash.h>
+#include <sys/mach/ipc/ipc_table.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_pset.h>
+#include <sys/mach/thread.h>
+
+#include <security/audit/audit.h>
+
+static void fdunused(struct filedesc *fdp, int fd);
+static int kern_fdalloc(struct thread *td, int minfd, int *result);
+static void kern_fddealloc(struct thread *td, int fd);
+static inline void kern_fdfree(struct filedesc *fdp, int fd);
+static int kern_finstall(struct thread *td, struct file *fp, int *fd, int flags,
+			 struct filecaps *fcaps);
+
+#define MODERN (__FreeBSD_version >= 1100000)
+#define FNOFDALLOC    0x80000000
+
+static void
+ipc_entry_hash_delete(
+	ipc_space_t space,
+	ipc_entry_t entry)
+{
+	mach_port_index_t idx;
+	ipc_entry_t entryp;
+
+	if ((idx = entry->ie_index) == UINT_MAX)
+		return;
+	if ((entry->ie_bits & (MACH_PORT_TYPE_DEAD_NAME | MACH_PORT_TYPE_SEND)) !=
+		MACH_PORT_TYPE_SEND)
+		return;
+	if (idx >= space->is_table_size)
+		return;
+
+	entryp = space->is_table[idx];
+	assert(entryp);
+
+	if (entryp == entry) {
+		space->is_table[idx] = entry->ie_link;
+		entry->ie_link = NULL;
+		entry->ie_index = UINT_MAX;
+	} else {
+		while (entryp->ie_link != NULL) {
+			if (entryp->ie_link == entry) {
+				entryp->ie_link = entry->ie_link;
+				entry->ie_link = NULL;
+				entry->ie_index = UINT_MAX;
+				break;
+			}
+			entryp = entryp->ie_link;
+		}
+	}
+	/* assert that it was found */
+	MPASS(entry->ie_index == UINT_MAX);
+}
+
+static fo_close_t mach_port_close;
+static fo_stat_t mach_port_stat;
+#if MODERN
+static fo_fill_kinfo_t mach_port_fill_kinfo;
+#endif
+
+struct fileops mach_fileops  = {
+	.fo_close = mach_port_close,
+	.fo_stat = mach_port_stat,
+#if MODERN
+	.fo_fill_kinfo = mach_port_fill_kinfo,
+#endif
+	.fo_flags = 0,
+};
+
+static int
+mach_port_close(struct file *fp, struct thread *td)
+{
+	ipc_entry_t entry;
+	ipc_object_t object;
+	ipc_pset_t pset;
+	ipc_port_t port;
+
+	MACH_VERIFY(fp->f_data != NULL, ("expected fp->f_data != NULL - got NULL\n"));
+	if ((entry = fp->f_data) == NULL)
+		return (0);
+	if ((entry->ie_bits & MACH_PORT_TYPE_PORT_SET)  == 0)
+		ipc_entry_hash_delete(entry->ie_space, entry);
+	MPASS(entry->ie_link == NULL);
+	PROC_LOCK(td->td_proc);
+	LIST_REMOVE(entry, ie_space_link);
+	PROC_UNLOCK(td->td_proc);
+	if ((object = entry->ie_object) != NULL) {
+		if (entry->ie_bits & MACH_PORT_TYPE_PORT_SET) {
+			pset = (ipc_pset_t)object;
+			ips_lock(pset);
+			ipc_pset_destroy(pset);
+		} else {
+			port = (ipc_port_t)object;
+			if (port->ip_receiver == current_space()) {
+				ip_lock(port);
+				ipc_port_clear_receiver(port);
+				ipc_port_destroy(port);
+			} else {
+				ip_release(port);
+			}
+		}
+		entry->ie_object = NULL;
+	}
+	free(entry, M_MACH_IPC_ENTRY);
+	fp->f_data = NULL;
+
+	return (0);
+}
+
+static int
+mach_port_stat(struct file *fp __unused, struct stat *sb,
+			   struct ucred *active_cred __unused, struct thread *td __unused)
+{
+	ipc_entry_t entry;
+
+	bzero((caddr_t)sb, sizeof(*sb));
+
+	entry = fp->f_data;
+	if (entry->ie_bits & MACH_PORT_TYPE_PORT_SET) {
+		sb->st_mode = S_IFPSET;
+	} else {
+		sb->st_mode = S_IFPORT;
+	}
+	return (0);
+}
+
+#if MODERN
+static int
+mach_port_fill_kinfo(struct file *fp, struct kinfo_file *kif,
+					 struct filedesc *fdp __unused)
+{
+	ipc_entry_t entry;
+
+	/* assume it's a port first */
+	kif->kf_type = KF_TYPE_PORT;
+
+	if ((entry = fp->f_data) == NULL)
+		return (0);
+	/* What else do we want from it? */
+	if (entry->ie_bits & MACH_PORT_TYPE_PORT_SET) {
+		kif->kf_type = KF_TYPE_PORTSET;
+	}
+
+	return (0);
+}
+#endif
+
+/*
+ *	Routine:	ipc_entry_release
+ *	Purpose:
+ *		Drops a reference to an entry.
+ *	Conditions:
+ *		The space must be locked.
+ */
+
+void
+ipc_entry_release(ipc_entry_t entry)
+{
+
+	fdrop(entry->ie_fp, curthread);
+}
+
+/*
+ *	Routine:	ipc_entry_lookup
+ *	Purpose:
+ *		Searches for an entry, given its name.
+ *	Conditions:
+ *		The space must be active.
+ */
+
+extern void kdb_backtrace(void);
+ipc_entry_t
+ipc_entry_lookup(ipc_space_t space, mach_port_name_t name)
+{
+	struct file *fp;
+	ipc_entry_t entry;
+
+	assert(space->is_active);
+
+	if (curthread->td_proc->p_fd == NULL)
+		return (NULL);
+
+	if (fget(curthread, name, NULL, &fp) != 0) {
+		log(LOG_DEBUG, "%s:%d entry for port name: %d not found\n", curproc->p_comm, curproc->p_pid, name);
+		return (NULL);
+	}
+	if (fp->f_type != DTYPE_MACH_IPC) {
+		kdb_backtrace();
+		log(LOG_DEBUG, "%s:%d port name: %d is not MACH\n", curproc->p_comm, curproc->p_pid, name);
+		fdrop(fp, curthread);
+		return (NULL);
+	}
+	entry = fp->f_data;
+	fdrop(fp, curthread);
+	return (entry);
+}
+
+kern_return_t
+ipc_entry_file_to_port(ipc_space_t space, mach_port_name_t name, ipc_object_t *objectp)
+{
+	struct file *fp;
+	ipc_port_t port;
+
+	assert(space->is_active);
+
+	if (curthread->td_proc->p_fd == NULL)
+		return (KERN_INVALID_ARGUMENT);
+
+	if (fget(curthread, name, NULL, &fp) != 0) {
+		log(LOG_DEBUG, "%s:%d entry for port name: %d not found\n", curproc->p_comm, curproc->p_pid, name);
+		return (KERN_INVALID_ARGUMENT);
+	}
+	if (fp->f_type == DTYPE_MACH_IPC) {
+		fdrop(fp, curthread);
+		return (KERN_INVALID_ARGUMENT);
+	}
+	if ((port = ipc_port_alloc_special(space)) == NULL)
+		return (KERN_RESOURCE_SHORTAGE);
+
+	port->ip_context = (mach_vm_address_t) fp;
+	port->ip_flags = IP_CONTEXT_FILE;
+	port->ip_receiver = space;
+	port->ip_receiver_name = name;
+
+	*objectp = (ipc_object_t)port;
+	return (KERN_SUCCESS);
+}
+
+kern_return_t
+ipc_entry_port_to_file(ipc_space_t space, mach_port_name_t *namep, ipc_object_t object)
+{
+	ipc_port_t port;
+	struct file *fp;
+
+	port = (ipc_port_t)object;
+	MPASS(object != NULL);
+	MPASS(port->ip_flags & IP_CONTEXT_FILE);
+	fp = (void *)port->ip_context;
+	ipc_port_dealloc_special(port, space);
+
+	/* Are sent file O_CLOEXEC? */
+	if (kern_finstall(curthread, fp, namep, 0, NULL) != 0) {
+		fdrop(fp, curthread);
+		printf("finstall failed\n");
+		return (KERN_RESOURCE_SHORTAGE);
+	}
+	printf(" installing received file *fp=%p at %d\n", fp, *namep);
+	return (KERN_SUCCESS);
+}
+
+/*
+ *	Routine:	ipc_entry_get
+ *	Purpose:
+ *		Tries to allocate an entry out of the space.
+ *	Conditions:
+ *		The space is active throughout.
+ *		An object may be locked.  Will try to allocate memory.
+ *	Returns:
+ *		KERN_SUCCESS		A free entry was found.
+ *		KERN_NO_SPACE		No entry allocated.
+ */
+
+kern_return_t
+ipc_entry_get(
+	ipc_space_t	space,
+	boolean_t	is_send_once,
+	mach_port_name_t	*namep,
+	ipc_entry_t	*entryp)
+{	
+	ipc_entry_t free_entry;
+	int fd;
+	struct file *fp;
+	struct thread *td;
+
+	assert(space->is_active);
+
+	td  = curthread;
+	if ((free_entry = malloc(sizeof(*free_entry), M_MACH_IPC_ENTRY, M_WAITOK|M_ZERO)) == NULL)
+		return KERN_RESOURCE_SHORTAGE;
+
+	if (kern_fdalloc(td, 16, &fd)) {
+		log(LOG_WARNING, "%s:%d failed to allocate fd\n", __FILE__, __LINE__);
+		return (KERN_RESOURCE_SHORTAGE);
+	}
+	if (falloc_noinstall(td, &fp)) {
+		kern_fddealloc(td, fd);
+		log(LOG_WARNING, "%s:%d failed to allocate fp\n", __FILE__, __LINE__);
+		return (KERN_RESOURCE_SHORTAGE);
+	}
+	if (kern_finstall(td, fp, &fd, FNOFDALLOC, NULL)) {
+		log(LOG_WARNING, "%s:%d failed to allocate fp:%p at fd:%d \n", __FILE__, __LINE__, fp, fd);
+		kern_fddealloc(td, fd);
+		fdrop(fp, td);
+		return (KERN_RESOURCE_SHORTAGE);
+	}
+
+	free_entry->ie_bits = 0;
+	free_entry->ie_request = 0;
+	free_entry->ie_name = fd;
+	free_entry->ie_fp = fp;
+	free_entry->ie_index = UINT_MAX;
+	free_entry->ie_link = NULL;
+	free_entry->ie_space = space;
+	PROC_LOCK(curproc);
+	LIST_INSERT_HEAD(&space->is_entry_list, free_entry, ie_space_link);
+	PROC_UNLOCK(curproc);
+	finit(fp, 0, DTYPE_MACH_IPC, free_entry, &mach_fileops);
+	fdrop(fp, td);
+	assert(fp->f_count == 1);
+	*namep = fd;
+	*entryp = free_entry;
+
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_entry_alloc
+ *	Purpose:
+ *		Allocate an entry out of the space.
+ *	Conditions:
+ *		The space is not locked before, but it is write-locked after
+ *		if the call is successful.  May allocate memory.
+ *	Returns:
+ *		KERN_SUCCESS		An entry was allocated.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_NO_SPACE		No room for an entry in the space.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory for an entry.
+ */
+
+kern_return_t
+ipc_entry_alloc(
+	ipc_space_t	space,
+	boolean_t	is_send_once,
+	mach_port_name_t	*namep,
+	ipc_entry_t	*entryp)
+{
+	kern_return_t kr;
+
+	if (!space->is_active)
+		return (KERN_INVALID_TASK);
+
+	*namep = MACH_PORT_NAME_NULL;
+	if ((kr = ipc_entry_get(space, is_send_once, namep, entryp)) != KERN_SUCCESS)
+		return (kr);
+
+	is_write_lock(space);
+	return (0);
+}
+
+/*
+ *	Routine:	ipc_entry_alloc_name
+ *	Purpose:
+ *		Allocates/finds an entry with a specific name.
+ *		If an existing entry is returned, its type will be nonzero.
+ *	Conditions:
+ *		The space is not locked before, but it is write-locked after
+ *		if the call is successful.  May allocate memory.
+ *	Returns:
+ *		KERN_SUCCESS		Found existing entry with same name.
+ *		KERN_SUCCESS		Allocated a new entry.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+ipc_entry_alloc_name(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	*entryp)
+{
+	mach_port_name_t newname;
+	struct file *fp;
+	kern_return_t kr;
+	struct thread *td = curthread;
+
+	if (!space->is_active) {
+		return (KERN_INVALID_TASK);
+	}
+	assert(MACH_PORT_NAME_VALID(name));
+	is_write_lock(space);
+	if ((*entryp = ipc_entry_lookup(space, name)) != NULL)
+		return (KERN_SUCCESS);
+
+	is_write_unlock(space);
+
+	/* name could technically be a ridiculously large value */
+	if (kern_fdalloc(td, name, &newname)) {
+		log(LOG_WARNING, "%s:%d failed to allocate %d\n", __FILE__, __LINE__, name);
+		return (KERN_RESOURCE_SHORTAGE);
+	}
+	if (newname != name) {
+		kern_fddealloc(td, newname);
+		return (KERN_NAME_EXISTS);
+	}
+	if (falloc_noinstall(td, &fp)) {
+		kern_fddealloc(td, newname);
+		return (KERN_RESOURCE_SHORTAGE);
+	}
+	if (kern_finstall(td, fp, &name, FNOFDALLOC, NULL)) {
+		kern_fddealloc(td, newname);
+		fdrop(fp, td);
+		return (KERN_RESOURCE_SHORTAGE);
+	}
+	kr = ipc_entry_get(space, 0, &name, entryp);
+	if (kr != KERN_SUCCESS) {
+		kern_fddealloc(td, newname);
+		return (KERN_INVALID_TASK);
+	}
+	is_write_lock(space);
+	return (kr);
+}
+
+void
+ipc_entry_close(
+	ipc_space_t space,
+	mach_port_name_t fd)
+{
+	struct filedesc *fdp;
+	struct file *fp;
+	struct thread *td;
+
+	td = curthread;
+	fdp = td->td_proc->p_fd;
+
+	AUDIT_SYSCLOSE(td, fd);
+
+	FILEDESC_XLOCK(fdp);
+	if ((fp = fget_locked(fdp, fd)) == NULL) {
+		FILEDESC_XUNLOCK(fdp);
+		return;
+	}
+	/* we deliberately skip closing the knote so that it will
+	 * have the last reference to the fp
+	 */
+	kern_fdfree(fdp, fd);
+	FILEDESC_XUNLOCK(fdp);
+	fdrop(fp, td);
+}
+
+int
+ipc_entry_refs(
+	ipc_entry_t entry)
+{
+
+	return (entry->ie_fp->f_count);
+}
+
+void
+ipc_entry_add_refs(
+	ipc_entry_t entry,
+	int delta)
+{
+
+	atomic_add_acq_int(&entry->ie_fp->f_count, delta);
+}
+
+void
+ipc_entry_hold(ipc_entry_t entry)
+{
+
+	fhold(entry->ie_fp);
+}
+
+/*
+ *	Routine:	ipc_entry_dealloc
+ *	Purpose:
+ *		Deallocates an entry from a space.
+ *	Conditions:
+ *		The space must be write-locked.
+ *		The space is unlocked on return.
+ *		The space must be active.
+ */
+
+void
+ipc_entry_dealloc(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	entry)
+{
+	assert(space->is_active);
+	assert(entry->ie_object == IO_NULL);
+	assert(entry->ie_request == 0);
+
+	if (space != entry->ie_space) {
+		is_write_unlock(space);
+		is_write_lock(entry->ie_space);
+	}
+	ipc_entry_hash_delete(space, entry);
+	if (space != entry->ie_space) {
+		is_write_unlock(entry->ie_space);
+	} else {
+		is_write_unlock(space);
+	}
+	MPASS(entry->ie_link == NULL);
+
+	ipc_entry_close(space, name);
+}
+
+static void
+kern_last_close(struct thread *td, struct file *fp, struct filedesc *fdp, int fd)
+{
+
+	FILEDESC_XLOCK(fdp);
+	knote_fdclose(td, fd);
+	kern_fdfree(fdp, fd);
+	FILEDESC_XUNLOCK(fdp);
+	fdrop(fp, td);
+}
+
+static void
+ipc_entry_list_close(void *arg __unused, struct proc *p)
+{
+	struct filedesc *fdp;
+	struct filedescent *fde;
+	struct file *fp;
+	struct thread *td;
+#if 0
+	ipc_port_t port;
+	ipc_pset_t pset;
+	ipc_entry_t entry_tmp;
+#endif
+	ipc_entry_t entry;
+	ipc_space_t space;
+	int i;
+
+	fdp = p->p_fd;
+	td = curthread;
+	space = current_space();
+
+	/* do we want to just return if the refcount is > 1 or should we
+	 * bar this from happening in the first place?
+	 **/
+	KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared"));
+
+	for (i = 0; i <= fdp->fd_lastfile; i++) {
+		fde = &fdp->fd_ofiles[i];
+		fp = fde->fde_file;
+		if (fp == NULL || (fp->f_type != DTYPE_MACH_IPC))
+			continue;
+		MPASS(fp->f_count > 0);
+
+		if (fp->f_data == NULL) {
+			log(LOG_WARNING, "%s:%d fd: %d has NULL f_data\n", p->p_comm, p->p_pid, i);
+			kern_last_close(td, fp, fdp, i);
+			continue;
+		}
+		entry = fp->f_data;
+		MPASS(entry->ie_bits != 0xdeadc0de);
+		if ((entry->ie_bits & MACH_PORT_TYPE_PORT_SET) == 0)
+			continue;
+		kern_last_close(td, fp, fdp, i);
+	}
+
+	for (i = 0; i <= fdp->fd_lastfile; i++) {
+
+		fde = &fdp->fd_ofiles[i];
+		fp = fde->fde_file;
+		if (fp == NULL || (fp->f_type != DTYPE_MACH_IPC))
+			continue;
+		MPASS(fp->f_count > 0);
+
+		entry = fp->f_data;
+#if 0
+		if (fp->f_count > 1) {
+			int ispset = (entry->ie_bits & MACH_PORT_TYPE_PORT_SET);
+			log(LOG_WARNING, "%s:%d fd: %d %s refcount: %d\n", p->p_comm, p->p_pid, i,
+				ispset ? "pset" : "port", fp->f_count);
+		}
+#endif
+		kern_last_close(td, fp, fdp, i);
+	}
+
+#ifdef INVARIANTS
+	for (i = 0; i <= fdp->fd_lastfile; i++) {
+		fde = &fdp->fd_ofiles[i];
+		fp = fde->fde_file;
+		if (fp != NULL)
+			MPASS(fp->f_type != DTYPE_MACH_IPC);
+	}
+#endif
+	/* free unreferenced ipc_entrys */
+	i = 0;
+	while(!LIST_EMPTY(&space->is_entry_list)) {
+		entry = LIST_FIRST(&space->is_entry_list);
+		/* mach_port_close removes the entry */
+		fp = entry->ie_fp;
+		MPASS(fp->f_count > 0);
+		fp->f_count = 1;
+		fdrop(fp, td);
+		/* ensure no infinite loop */
+		MPASS(i++ < 10000);
+	}
+}
+
+
+static void
+ipc_entry_sysinit(void *arg __unused)
+{
+
+	EVENTHANDLER_REGISTER(process_exit, ipc_entry_list_close, NULL, EVENTHANDLER_PRI_ANY);
+	EVENTHANDLER_REGISTER(process_exec, ipc_entry_list_close, NULL, EVENTHANDLER_PRI_ANY);
+}
+
+SYSINIT(ipc_entry, SI_SUB_KLD, SI_ORDER_ANY, ipc_entry_sysinit, NULL);
+
+
+#define NDFILE		20
+#define NDSLOTSIZE	sizeof(NDSLOTTYPE)
+#define	NDENTRIES	(NDSLOTSIZE * __CHAR_BIT)
+#define NDSLOT(x)	((x) / NDENTRIES)
+#define NDBIT(x)	((NDSLOTTYPE)1 << ((x) % NDENTRIES))
+#define	NDSLOTS(x)	(((x) + NDENTRIES - 1) / NDENTRIES)
+
+
+/*
+ * Find the highest non-zero bit in the given bitmap, starting at 0 and
+ * not exceeding size - 1. Return -1 if not found.
+ */
+static int
+fd_last_used(struct filedesc *fdp, int size)
+{
+	NDSLOTTYPE *map = fdp->fd_map;
+	NDSLOTTYPE mask;
+	int off, minoff;
+
+	off = NDSLOT(size);
+	if (size % NDENTRIES) {
+		mask = ~(~(NDSLOTTYPE)0 << (size % NDENTRIES));
+		if ((mask &= map[off]) != 0)
+			return (off * NDENTRIES + flsl(mask) - 1);
+		--off;
+	}
+	for (minoff = NDSLOT(0); off >= minoff; --off)
+		if (map[off] != 0)
+			return (off * NDENTRIES + flsl(map[off]) - 1);
+	return (-1);
+}
+
+static int
+fdisused(struct filedesc *fdp, int fd)
+{
+
+	FILEDESC_LOCK_ASSERT(fdp);
+
+	KASSERT(fd >= 0 && fd < fdp->fd_nfiles,
+	    ("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfiles));
+
+	return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0);
+}
+
+/*
+ * Mark a file descriptor as unused.
+ */
+static void
+fdunused(struct filedesc *fdp, int fd)
+{
+
+	FILEDESC_XLOCK_ASSERT(fdp);
+
+	KASSERT(fdisused(fdp, fd), ("fd=%d is already unused", fd));
+	KASSERT(fdp->fd_ofiles[fd].fde_file == NULL,
+	    ("fd=%d is still in use", fd));
+
+	fdp->fd_map[NDSLOT(fd)] &= ~NDBIT(fd);
+	if (fd < fdp->fd_freefile)
+		fdp->fd_freefile = fd;
+	if (fd == fdp->fd_lastfile)
+		fdp->fd_lastfile = fd_last_used(fdp, fd);
+}
+
+static int
+kern_fdalloc(struct thread *td, int minfd, int *result)
+{
+	struct proc *p = td->td_proc;
+	struct filedesc *fdp = p->p_fd;
+	int rc;
+	FILEDESC_XLOCK(fdp);
+	rc = fdalloc(td, minfd, result);
+	FILEDESC_XUNLOCK(fdp);
+	return (rc);
+}
+
+static void
+kern_fddealloc(struct thread *td, int fd)
+{
+	struct proc *p = td->td_proc;
+	struct filedesc *fdp = p->p_fd;
+	FILEDESC_XLOCK(fdp);
+	fdunused(fdp, fd);
+	FILEDESC_XUNLOCK(fdp);
+}
+
+static inline void
+kern_fdfree(struct filedesc *fdp, int fd)
+{
+	struct filedescent *fde;
+
+	fde = &fdp->fd_ofiles[fd];
+#ifdef CAPABILITIES
+	seq_write_begin(&fde->fde_seq);
+#endif
+	bzero(fde, fde_change_size);
+	fdunused(fdp, fd);
+#ifdef CAPABILITIES
+	seq_write_end(&fde->fde_seq);
+#endif
+}
+
+static void
+filecaps_fill(struct filecaps *fcaps)
+{
+
+	CAP_ALL(&fcaps->fc_rights);
+	fcaps->fc_ioctls = NULL;
+	fcaps->fc_nioctls = -1;
+	fcaps->fc_fcntls = CAP_FCNTL_ALL;
+}
+
+/*
+ * Install a file in a file descriptor table.
+ */
+static int
+kern_finstall(struct thread *td, struct file *fp, int *fd, int flags,
+    struct filecaps *fcaps)
+{
+	struct filedesc *fdp = td->td_proc->p_fd;
+	struct filedescent *fde;
+	int error, min;
+
+	KASSERT(fd != NULL, ("%s: fd == NULL", __func__));
+	KASSERT(fp != NULL, ("%s: fp == NULL", __func__));
+
+	min = 16;
+
+	FILEDESC_XLOCK(fdp);
+	if (!(flags & FNOFDALLOC)) {
+		if ((error = fdalloc(td, min, fd))) {
+			FILEDESC_XUNLOCK(fdp);
+			return (error);
+		}
+	}
+	fhold(fp);
+	fde = &fdp->fd_ofiles[*fd];
+#ifdef CAPABILITIES
+	seq_write_begin(&fde->fde_seq);
+#endif
+	fde->fde_file = fp;
+	if ((flags & O_CLOEXEC) != 0)
+		fde->fde_flags |= UF_EXCLOSE;
+	filecaps_fill(&fde->fde_caps);
+#ifdef CAPABILITIES
+	seq_write_end(&fde->fde_seq);
+#endif
+	FILEDESC_XUNLOCK(fdp);
+	return (0);
+}
+ 
+#if	MACH_KDB
+#include <ddb/db_output.h>
+#define	printf	kdbprintf
+
+ipc_entry_t	db_ipc_object_by_name(
+			task_t		task,
+			mach_port_name_t	name);
+
+
+ipc_entry_t
+db_ipc_object_by_name(
+	task_t		task,
+	mach_port_name_t	name)
+{
+        ipc_space_t space = task->itk_space;
+        ipc_entry_t entry;
+ 
+ 
+        entry = ipc_entry_lookup(space, name);
+        if(entry != IE_NULL) {
+                iprintf("(task 0x%x, name 0x%x) ==> object 0x%x\n",
+			task, name, entry->ie_object);
+                return (ipc_entry_t) entry->ie_object;
+        }
+        return entry;
+}
+#endif	/* MACH_KDB */


Property changes on: trunk/sys/compat/mach/ipc/ipc_entry.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/ipc_hash.c
===================================================================
--- trunk/sys/compat/mach/ipc/ipc_hash.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/ipc_hash.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,407 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5.3.1  92/03/03  16:18:21  jeffreyh
+ * 	Changes from TRUNK
+ * 	[92/02/26  11:40:47  jeffreyh]
+ * 
+ * Revision 2.6  92/01/14  16:44:15  rpd
+ * 	Changed ipc_hash_info for CountInOut.
+ * 	[92/01/14            rpd]
+ * 
+ * Revision 2.5  91/05/14  16:32:08  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:21:29  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:44:42  mrt]
+ * 
+ * Revision 2.3  91/01/08  15:13:20  rpd
+ * 	Changed ipc_info_bucket_t to hash_info_bucket_t.
+ * 	[91/01/02            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:49:47  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  20:54:50  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_hash.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Entry hash table operations.
+ */
+#include <sys/mach/mach_types.h>
+#include <sys/mach/port.h>
+#include <sys/mach/ipc/port.h>
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_entry.h>
+#include <sys/mach/ipc/ipc_hash.h>
+#include <sys/mach/ipc/ipc_init.h>
+#if 0
+#include <mach_ipc_debug.h>
+#endif
+#if	MACH_IPC_DEBUG
+#include <mach/kern_return.h>
+#include <mach_debug/hash_info.h>
+#include <vm/vm_map.h>
+#include <vm/vm_kern.h>
+#include <vm/vm_user.h>
+#endif	/* MACH_IPC_DEBUG */
+
+/*
+ * Forward declarations 
+ */
+/* Lookup (space, obj) in local hash table */
+boolean_t ipc_hash_local_lookup(
+       ipc_space_t             space,
+       ipc_object_t            obj,
+       mach_port_name_t                *namep,
+       ipc_entry_t             *entryp);
+
+
+
+/* Insert an entry into the global reverse hash table */
+void ipc_hash_local_insert(
+	ipc_space_t		space,
+	ipc_object_t		obj,
+	mach_port_name_t		name,
+	ipc_entry_t	entry);
+
+/* Delete an entry from the local reverse hash table */
+void ipc_hash_local_delete(
+	ipc_space_t		space,
+	ipc_object_t		obj,
+	mach_port_index_t	index,
+	ipc_entry_t		entry);
+
+/*
+ *	Routine:	ipc_hash_lookup
+ *	Purpose:
+ *		Converts (space, obj) -> (name, entry).
+ *		Returns TRUE if an entry was found.
+ *	Conditions:
+ *		The space must be locked (read or write) throughout.
+ */
+
+boolean_t
+ipc_hash_lookup(
+	ipc_space_t	space,
+	ipc_object_t	obj,
+	mach_port_name_t	*namep,
+	ipc_entry_t	*entryp)
+{
+	boolean_t 	rv;
+
+	rv = ipc_hash_local_lookup(space, obj, namep, entryp);
+	return (rv);
+}
+
+/*
+ *	Routine:	ipc_hash_insert
+ *	Purpose:
+ *		Inserts an entry into the appropriate reverse hash table,
+ *		so that ipc_hash_lookup will find it.
+ *	Conditions:
+ *		The space must be write-locked.
+ */
+
+void
+ipc_hash_insert(
+	ipc_space_t	space,
+	ipc_object_t	obj,
+	mach_port_name_t	name,
+	ipc_entry_t	entry)
+{
+
+	ipc_hash_local_insert(space, obj, name, entry);
+}
+
+/*
+ *	Routine:	ipc_hash_delete
+ *	Purpose:
+ *		Deletes an entry from the appropriate reverse hash table.
+ *	Conditions:
+ *		The space must be write-locked.
+ */
+
+void
+ipc_hash_delete(
+	ipc_space_t	space,
+	ipc_object_t	obj,
+	mach_port_name_t	name,
+	ipc_entry_t	entry)
+{
+
+	ipc_hash_local_delete(space, obj, name, entry);
+}
+
+/*
+ *	The global reverse hash table holds splay tree entries.
+ *	It is a simple open-chaining hash table with singly-linked buckets.
+ *	Each bucket is locked separately, with an exclusive lock.
+ *	Within each bucket, move-to-front is used.
+ */
+
+typedef natural_t ipc_hash_index_t;
+
+
+/*
+ *	Each space has a local reverse hash table, which holds
+ *	entries from the space's table.  In fact, the hash table
+ *	just uses a field (ie_index) in the table itself.
+ *
+ *	The local hash table is an open-addressing hash table,
+ *	which means that when a collision occurs, instead of
+ *	throwing the entry into a bucket, the entry is rehashed
+ *	to another position in the table.  In this case the rehash
+ *	is very simple: linear probing (ie, just increment the position).
+ *	This simple rehash makes deletions tractable (they're still a pain),
+ *	but it means that collisions tend to build up into clumps.
+ *
+ *	Because at least one entry in the table (index 0) is always unused,
+ *	there will always be room in the reverse hash table.  If a table
+ *	with n slots gets completely full, the reverse hash table will
+ *	have one giant clump of n-1 slots and one free slot somewhere.
+ *	Because entries are only entered into the reverse table if they
+ *	are pure send rights (not receive, send-once, port-set,
+ *	or dead-name rights), and free entries of course aren't entered,
+ *	I expect the reverse hash table won't get unreasonably full.
+ *
+ *	Ordered hash tables (Amble & Knuth, Computer Journal, v. 17, no. 2,
+ *	pp. 135-142.) may be desirable here.  They can dramatically help
+ *	unsuccessful lookups.  But unsuccessful lookups are almost always
+ *	followed by insertions, and those slow down somewhat.  They
+ *	also can help deletions somewhat.  Successful lookups aren't affected.
+ *	So possibly a small win; probably nothing significant.
+ */
+
+#define	IH_LOCAL_HASH(obj, size)				\
+		((((mach_port_index_t) (obj)) >> 6) % (size))
+
+/*
+ *	Routine:	ipc_hash_local_lookup
+ *	Purpose:
+ *		Converts (space, obj) -> (name, entry).
+ *		Looks in the space's local table, for table entries.
+ *		Returns TRUE if an entry was found.
+ *	Conditions:
+ *		The space must be locked (read or write) throughout.
+ */
+
+boolean_t
+ipc_hash_local_lookup(
+	ipc_space_t	space,
+	ipc_object_t	obj,
+	mach_port_name_t	*namep,
+	ipc_entry_t	*entryp)
+{
+	ipc_entry_t *table, entry;
+	ipc_entry_num_t size;
+	mach_port_index_t hindex;
+
+	assert(space != IS_NULL);
+	assert(obj != IO_NULL);
+
+	table = space->is_table;
+	size = space->is_table_size;
+	hindex = IH_LOCAL_HASH(obj, size);
+
+	entry = table[hindex];
+	while (entry != NULL) {
+		if (entry->ie_object == obj) {
+			*namep = entry->ie_name;
+			*entryp = entry;
+			return TRUE;
+		}
+
+		entry = entry->ie_link;
+	}
+
+	return FALSE;
+}
+
+/*
+ *	Routine:	ipc_hash_local_insert
+ *	Purpose:
+ *		Inserts an entry into the space's reverse hash table.
+ *	Conditions:
+ *		The space must be write-locked.
+ */
+
+void
+ipc_hash_local_insert(
+	ipc_space_t		space,
+	ipc_object_t		obj,
+	mach_port_index_t	index __unused,
+	ipc_entry_t		entry)
+{
+	ipc_entry_t *table, entryp;
+	ipc_entry_num_t size;
+	mach_port_index_t hindex;
+
+	assert(space != IS_NULL);
+	assert(obj != IO_NULL);
+
+	table = space->is_table;
+	size = space->is_table_size;
+	hindex = IH_LOCAL_HASH(obj, size);
+
+	assert(entry->ie_object == obj);
+
+	if ((entryp = table[hindex]) != NULL)
+		entry->ie_link = entryp;
+
+	table[hindex] = entry;
+	entry->ie_index = hindex;
+}
+
+/*
+ *	Routine:	ipc_hash_local_delete
+ *	Purpose:
+ *		Deletes an entry from the space's reverse hash table.
+ *	Conditions:
+ *		The space must be write-locked.
+ */
+
+void
+ipc_hash_local_delete(
+	ipc_space_t		space,
+	ipc_object_t		obj,
+	mach_port_index_t	index __unused,
+	ipc_entry_t		entry)
+{
+	ipc_entry_t *table, entryp;
+	ipc_entry_num_t size;
+	mach_port_index_t hindex;
+
+	assert(index != MACH_PORT_NAME_NULL);
+	assert(space != IS_NULL);
+	assert(obj != IO_NULL);
+
+	table = space->is_table;
+	size = space->is_table_size;
+	hindex = IH_LOCAL_HASH(obj, size);
+
+	assert(entry->ie_object == obj);
+
+	if ((entryp = table[hindex]) == entry) {
+		table[hindex] = entry->ie_link;
+		return;
+	}
+	while (entryp->ie_link != NULL) {
+		if (entryp->ie_link == entry) {
+			entryp->ie_link = entry->ie_link;
+			break;
+		}
+		entryp = entryp->ie_link;
+	}
+}
+
+/*
+ *	Routine:	ipc_hash_init
+ *	Purpose:
+ *		Initialize the global reverse hash table implementation.
+ */
+
+void
+ipc_hash_init(void)
+{
+}
+
+#if	MACH_IPC_DEBUG
+
+/*
+ *	Routine:	ipc_hash_info
+ *	Purpose:
+ *		Return information about the global reverse hash table.
+ *		Fills the buffer with as much information as possible
+ *		and returns the desired size of the buffer.
+ *	Conditions:
+ *		Nothing locked.  The caller should provide
+ *		possibly-pageable memory.
+ */
+
+
+ipc_hash_index_t
+ipc_hash_info(
+	hash_info_bucket_t	*info,
+	mach_msg_type_number_t count)
+{
+	ipc_hash_index_t i;
+
+	if (ipc_hash_global_size < count)
+		count = ipc_hash_global_size;
+
+	for (i = 0; i < count; i++) {
+		ipc_hash_global_bucket_t bucket = &ipc_hash_global_table[i];
+		unsigned int bucket_count = 0;
+		ipc_tree_entry_t entry;
+
+		ihgb_lock(bucket);
+		for (entry = bucket->ihgb_head;
+		     entry != ITE_NULL;
+		     entry = entry->ite_next)
+			bucket_count++;
+		ihgb_unlock(bucket);
+
+		/* don't touch pageable memory while holding locks */
+		info[i].hib_count = bucket_count;
+	}
+
+	return ipc_hash_global_size;
+}
+
+#endif	/* MACH_IPC_DEBUG */


Property changes on: trunk/sys/compat/mach/ipc/ipc_hash.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/ipc_init.c
===================================================================
--- trunk/sys/compat/mach/ipc/ipc_init.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/ipc_init.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,274 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.12.2.2  92/03/03  16:18:29  jeffreyh
+ * 	19-Feb-92 David L. Black (dlb) at Open Software Foundation
+ * 	Don't make port zone exhaustible.  Kernel panics when
+ * 	it fails to allocate an internal port after exhaustion.
+ * 	[92/02/26  11:41:12  jeffreyh]
+ * 
+ * Revision 2.12.2.1  92/01/03  16:34:52  jsb
+ * 	Corrected log.
+ * 	[91/12/24  14:18:23  jsb]
+ * 
+ * Revision 2.12  91/12/10  13:25:41  jsb
+ * 	Removed reference counting bug workaround.
+ * 	[91/12/10  11:17:21  jsb]
+ * 
+ * Revision 2.11  91/11/19  09:54:12  rvb
+ * 	Added reference counting bug workaround.
+ * 	[91/11/00            jsb]
+ * 
+ * Revision 2.10  91/08/03  18:18:12  jsb
+ * 	Removed call to ipc_clport_init.
+ * 	[91/07/24  22:11:04  jsb]
+ * 
+ * Revision 2.9  91/06/17  15:46:00  jsb
+ * 	Renamed NORMA conditionals.
+ * 	[91/06/17  10:45:48  jsb]
+ * 
+ * Revision 2.8  91/06/06  17:05:46  jsb
+ * 	Added call to ipc_clport_init.
+ * 	[91/05/13  17:17:10  jsb]
+ * 
+ * Revision 2.7  91/05/14  16:32:33  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.6  91/02/05  17:21:37  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:45:02  mrt]
+ * 
+ * Revision 2.5  91/01/08  15:13:40  rpd
+ * 	Changed zchange calls to make the IPC zones non-collectable.
+ * 	[90/12/29            rpd]
+ * 
+ * Revision 2.4  90/12/20  16:38:41  jeffreyh
+ * 	Changes to zchange to account for new collectable field. Made all
+ * 	ipc zones collectable.
+ * 	[90/12/11            jeffreyh]
+ * 
+ * Revision 2.3  90/09/28  16:54:44  jsb
+ * 	Added NORMA_IPC support.
+ * 	[90/09/28  14:02:05  jsb]
+ * 
+ * Revision 2.2  90/06/02  14:49:55  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  20:55:13  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_init.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Functions to initialize the IPC system.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+
+#include <sys/mach/kern_return.h>
+#include <sys/mach/mach_param.h>
+#include <sys/mach/mach_types.h>
+
+#include <sys/mach/ipc/ipc_entry.h>
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_pset.h>
+#include <sys/mach/ipc/ipc_notify.h>
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/ipc/ipc_hash.h>
+#include <sys/mach/ipc/ipc_init.h>
+#include <sys/mach/ndr_def.h>   /* NDR_record */
+
+vm_map_t ipc_kernel_map;
+vm_size_t ipc_kernel_map_size = 1024 * 1024;
+
+vm_map_t ipc_kernel_copy_map;
+#define IPC_KERNEL_COPY_MAP_SIZE (8 * 1024 * 1024)
+vm_size_t ipc_kernel_copy_map_size = IPC_KERNEL_COPY_MAP_SIZE;
+vm_size_t ipc_kmsg_max_vm_space = (IPC_KERNEL_COPY_MAP_SIZE * 7)/8;
+
+uma_zone_t ipc_kmsg_zone;
+
+
+/*
+ * values to limit inline message body handling
+ * avoid copyin/out limits - even after accounting for maximum descriptor expansion.
+ */
+#define IPC_KMSG_MAX_SPACE (64 * 1024 * 1024) /* keep in sync with COPYSIZELIMIT_PANIC */
+vm_size_t ipc_kmsg_max_body_space = ((IPC_KMSG_MAX_SPACE * 3)/4 - MAX_TRAILER_SIZE);
+
+int ipc_space_max = SPACE_MAX;
+int ipc_port_max = PORT_MAX;
+int ipc_pset_max = SET_MAX;
+
+
+#define MSG_OOL_SIZE_SMALL 16385
+vm_size_t msg_ool_size_small;
+
+
+extern void mig_init(void);
+
+/*
+ *	Routine:	ipc_bootstrap
+ *	Purpose:
+ *		Initialization needed before the kernel task
+ *		can be created.
+ */
+
+static void
+ipc_bootstrap_sysinit(void *arg __unused)
+{
+	kern_return_t kr;
+
+	ipc_port_multiple_lock_init();
+
+	ipc_port_timestamp_lock_init();
+	ipc_port_timestamp_data = 0;
+
+	/* all IPC zones should be exhaustible */
+
+	ipc_space_zone = uma_zcreate("ipc_space_zone", sizeof(struct ipc_space),
+								 NULL, NULL, NULL, NULL, 1, 0);
+	ipc_kmsg_zone = uma_zcreate("ipc_kmsg_zone", IKM_SAVED_MSG_SIZE,
+								NULL, NULL, NULL, NULL, 1, 0);
+    /*
+	 * populate all port(set) zones
+	 */
+	ipc_object_zones[IOT_PORT] =
+		zinit(sizeof(struct ipc_port),
+		      ipc_port_max * sizeof(struct ipc_port),
+		      sizeof(struct ipc_port),
+		      "ipc ports");
+	/*
+	 * XXX  Can't make the port zone exhaustible because the kernel
+	 * XXX	panics when port allocation for an internal object fails.
+	 *zone_change(ipc_object_zones[IOT_PORT], Z_EXHAUST, TRUE);
+	 */
+
+	ipc_object_zones[IOT_PORT_SET] =
+		zinit(sizeof(struct ipc_pset),
+		      ipc_pset_max * sizeof(struct ipc_pset),
+		      sizeof(struct ipc_pset),
+		      "ipc port sets");
+	/* make it exhaustible */
+	zone_change(ipc_object_zones[IOT_PORT_SET], Z_EXHAUST, TRUE);
+
+	/* create special spaces */
+
+	kr = ipc_space_create_special(&ipc_space_kernel);
+	assert(kr == KERN_SUCCESS);
+
+
+	kr = ipc_space_create_special(&ipc_space_reply);
+	assert(kr == KERN_SUCCESS);
+
+	/* initialize modules with hidden data structures */
+
+	mig_init();
+	ipc_table_init();
+	ipc_notify_init();
+	ipc_hash_init();
+	msg_ool_size_small = MSG_OOL_SIZE_SMALL;
+}
+
+
+/*
+ *	Routine:	ipc_init
+ *	Purpose:
+ *		Final initialization of the IPC system.
+ */
+
+void
+ipc_init(void)
+{
+#if 0	
+	kern_return_t retval;
+	vm_offset_t min, max;
+	extern vm_size_t kalloc_max_prerounded;
+
+	retval = kmem_suballoc(kernel_map, &min, ipc_kernel_map_size,
+			       TRUE, TRUE, &ipc_kernel_map);
+	if (retval != KERN_SUCCESS)
+		panic("ipc_init: kmem_suballoc of ipc_kernel_map failed");
+
+	retval = kmem_suballoc(kernel_map, &min, ipc_kernel_copy_map_size,
+			       TRUE, TRUE, &ipc_kernel_copy_map);
+	if (retval != KERN_SUCCESS)
+		panic("ipc_init: kmem_suballoc of ipc_kernel_copy_map failed");
+
+	ipc_kernel_copy_map->no_zero_fill = TRUE;
+	ipc_kernel_copy_map->wait_for_space = TRUE;
+
+	/*
+	 * As an optimization, 'small' out of line data regions using a 
+	 * physical copy strategy are copied into kalloc'ed buffers.
+	 * The value of 'small' is determined here.  Requests kalloc()
+	 * with sizes greater or equal to kalloc_max_prerounded may fail.
+	 */
+	if (kalloc_max_prerounded <=  MSG_OOL_SIZE_SMALL) {
+		msg_ool_size_small = kalloc_max_prerounded;
+	}
+	else {
+	}
+#endif
+
+}
+
+/* before SI_SUB_INTRINSIC and after SI_SUB_EVENTHANDLER */
+SYSINIT(ipc_space, SI_SUB_KLD, SI_ORDER_ANY, ipc_bootstrap_sysinit, NULL);


Property changes on: trunk/sys/compat/mach/ipc/ipc_init.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/ipc_kmsg.c
===================================================================
--- trunk/sys/compat/mach/ipc/ipc_kmsg.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/ipc_kmsg.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,3351 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.22.1.4  92/04/08  15:44:20  jeffreyh
+ * 	Temporary debugging logic.
+ * 	[92/04/06            dlb]
+ * 
+ * Revision 2.22.1.3  92/03/03  16:18:34  jeffreyh
+ * 	Picked up changes from Joe's branch
+ * 	[92/03/03  10:08:49  jeffreyh]
+ * 
+ * 	Eliminate keep_wired argument from vm_map_copyin().
+ * 	[92/02/21  10:12:26  dlb]
+ * 	Changes from TRUNK
+ * 	[92/02/26  11:41:33  jeffreyh]
+ * 
+ * Revision 2.22.1.2.2.1  92/03/01  22:24:38  jsb
+ * 	Added use_page_lists logic to ipc_kmsg_copyin_compat.
+ * 
+ * Revision 2.23  92/01/14  16:44:23  rpd
+ * 	Fixed ipc_kmsg_copyin, ipc_kmsg_copyout, etc
+ * 	to use copyinmap and copyoutmap for out-of-line ports.
+ * 	[91/12/16            rpd]
+ * 
+ * Revision 2.22.1.2  92/02/21  11:23:22  jsb
+ * 	Moved ipc_kmsg_copyout_to_network to norma/ipc_output.c.
+ * 	Moved ipc_kmsg_uncopyout_to_network to norma/ipc_clean.c.
+ * 	[92/02/21  10:34:46  jsb]
+ * 
+ * 	We no longer convert to network format directly from user format;
+ * 	this greatly simplifies kmsg cleaning issues. Added code to detect
+ * 	and recover from vm_map_convert_to_page_list failure.
+ * 	Streamlined and fixed ipc_kmsg_copyout_to_network.
+ * 	[92/02/21  09:01:52  jsb]
+ * 
+ * 	Modified for new form of norma_ipc_send_port which returns uid.
+ * 	[92/02/20  17:11:17  jsb]
+ * 
+ * Revision 2.22.1.1  92/01/03  16:34:59  jsb
+ * 	Mark out-of-line ports as COMPLEX_DATA.
+ * 	[92/01/02  13:53:15  jsb]
+ * 
+ * 	In ipc_kmsg_uncopyout_to_network: don't process local or remote port.
+ * 	Do clear the migrate bit as well as the complex_{data,ports} bits.
+ * 	[91/12/31  11:42:07  jsb]
+ * 
+ * 	Added ipc_kmsg_uncopyout_to_network().
+ * 	[91/12/29  21:05:29  jsb]
+ * 
+ * 	Added support in ipc_kmsg_print for MACH_MSGH_BITS_MIGRATED.
+ * 	[91/12/26  19:49:16  jsb]
+ * 
+ * 	Made clean_kmsg routines aware of norma uids.
+ * 	Cleaned up ipc_{msg,kmsg}_print. Corrected log.
+ * 	[91/12/24  13:59:49  jsb]
+ * 
+ * Revision 2.22  91/12/15  10:37:53  jsb
+ * 	Improved ddb 'show kmsg' support.
+ * 
+ * Revision 2.21  91/12/14  14:26:03  jsb
+ * 	Removed ipc_fields.h hack.
+ * 	Made ipc_kmsg_clean_{body,partial} aware of remote ports.
+ * 	They don't yet clean up remote ports, but at least they
+ * 	no longer pass port uids to ipc_object_destroy.
+ * 
+ * Revision 2.20  91/12/13  13:51:58  jsb
+ * 	Use norma_ipc_copyin_page_list when sending to remote port.
+ * 
+ * Revision 2.19  91/12/10  13:25:46  jsb
+ * 	Added ipc_kmsg_copyout_to_network, as required by ipc_kserver.c.
+ * 	Picked up vm_map_convert_to_page_list call changes from dlb.
+ * 	Changed NORMA_VM conditional for ipc_kmsg_copyout_to_kernel
+ * 	to NORMA_IPC.
+ * 	[91/12/10  11:20:36  jsb]
+ * 
+ * Revision 2.18  91/11/14  16:55:57  rpd
+ * 	Picked up mysterious norma changes.
+ * 	[91/11/14            rpd]
+ * 
+ * Revision 2.17  91/10/09  16:09:08  af
+ * 	Changed msgh_kind to msgh_seqno in ipc_msg_print.
+ * 	[91/10/05            rpd]
+ * 
+ * Revision 2.16  91/08/28  11:13:20  jsb
+ * 	Changed msgh_kind to msgh_seqno.
+ * 	[91/08/09            rpd]
+ * 	Changed for new vm_map_copyout failure behavior.
+ * 	[91/08/03            rpd]
+ * 	Update page list discriminant logic to allow use of page list for
+ * 	kernel objects that do not require page stealing (devices).
+ * 	[91/07/31  15:00:55  dlb]b
+ * 
+ * 	Add arg to vm_map_copyin_page_list.
+ * 	[91/07/30  14:10:38  dlb]
+ * 
+ * 	Turn page lists on by default.
+ * 	[91/07/03  14:01:00  dlb]
+ * 	Renamed clport fields in struct ipc_port to ip_norma fields.
+ * 	Added checks for sending receive rights remotely.
+ * 	[91/08/15  08:22:20  jsb]
+ * 
+ * Revision 2.15  91/08/03  18:18:16  jsb
+ * 	Added support for ddb commands ``show msg'' and ``show kmsg''.
+ * 	Made changes for elimination of intermediate clport structure.
+ * 	[91/07/27  22:25:06  jsb]
+ * 
+ * 	Moved MACH_MSGH_BITS_COMPLEX_{PORTS,DATA} to mach/message.h.
+ * 	Removed complex_data_hint_xxx[] garbage.
+ * 	Adopted new vm_map_copy_t page_list technology.
+ * 	[91/07/04  13:09:45  jsb]
+ * 
+ * Revision 2.14  91/07/01  08:24:34  jsb
+ * 	From David Black at OSF: generalized page list support.
+ * 	[91/06/29  16:29:29  jsb]
+ * 
+ * Revision 2.13  91/06/17  15:46:04  jsb
+ * 	Renamed NORMA conditionals.
+ * 	[91/06/17  10:45:05  jsb]
+ * 
+ * Revision 2.12  91/06/06  17:05:52  jsb
+ * 	More NORMA_IPC stuff. Cleanup will follow.
+ * 	[91/06/06  16:00:08  jsb]
+ * 
+ * Revision 2.11  91/05/14  16:33:01  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.10  91/03/16  14:47:57  rpd
+ * 	Replaced ith_saved with ipc_kmsg_cache.
+ * 	[91/02/16            rpd]
+ * 
+ * Revision 2.9  91/02/05  17:21:52  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:45:30  mrt]
+ * 
+ * Revision 2.8  91/01/08  15:13:49  rpd
+ * 	Added ipc_kmsg_free.
+ * 	[91/01/05            rpd]
+ * 	Optimized ipc_kmsg_copyout_object for send rights.
+ * 	[90/12/21            rpd]
+ * 	Changed to use new copyinmsg/copyoutmsg operations.
+ * 	Changed ipc_kmsg_get to check that the size is multiple of four.
+ * 	[90/12/05            rpd]
+ * 	Removed MACH_IPC_GENNOS.
+ * 	[90/11/08            rpd]
+ * 
+ * Revision 2.7  90/11/05  14:28:36  rpd
+ * 	Changed ip_reference to ipc_port_reference.
+ * 	Changed ip_release to ipc_port_release.
+ * 	Use new io_reference and io_release.
+ * 	Use new ip_reference and ip_release.
+ * 	[90/10/29            rpd]
+ * 
+ * Revision 2.6  90/09/09  14:31:50  rpd
+ * 	Fixed ipc_kmsg_copyin_compat to clear unused bits instead
+ * 	of returning an error when they are non-zero.
+ * 	[90/09/08            rpd]
+ * 
+ * Revision 2.5  90/08/06  17:05:53  rpd
+ * 	Fixed ipc_kmsg_copyout_body to turn off msgt_deallocate
+ * 	for in-line data.  It might be on if the compatibility mode
+ * 	generated the message.
+ * 
+ * 	Fixed ipc_kmsg_copyin, ipc_kmsg_copyin_compat to check
+ * 	that msgt_name, msgt_size, msgt_number are zero
+ * 	in long-form type descriptors.
+ * 	[90/08/04            rpd]
+ * 
+ * 	Fixed atomicity bug in ipc_kmsg_copyout_header,
+ * 	when the destination and reply ports are the same.
+ * 	[90/08/02            rpd]
+ * 
+ * Revision 2.4  90/08/06  15:07:31  rwd
+ * 	Fixed ipc_kmsg_clean_partial to deallocate correctly
+ * 	the OOL memory in the last type spec.
+ * 	Removed debugging panic in ipc_kmsg_put.
+ * 	[90/06/21            rpd]
+ * 
+ * Revision 2.3  90/06/19  22:58:03  rpd
+ * 	For debugging: added panic to ipc_kmsg_put.
+ * 	[90/06/04            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:50:05  rpd
+ * 	Changed ocurrences of inline; it is a gcc keyword.
+ * 	[90/06/02            rpd]
+ * 
+ * 	For out-of-line memory, if length is zero allow any address.
+ * 	This is more compatible with old IPC.
+ * 	[90/04/23            rpd]
+ * 	Created for new IPC.
+ * 	[90/03/26  20:55:45  rpd]
+ * 
+ * Revision 2.16.2.1  91/09/16  10:15:35  rpd
+ * 	Removed unused variables.  Added <ipc/ipc_notify.h>.
+ * 	[91/09/02            rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_kmsg.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Operations on kernel messages.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/limits.h>
+#include <sys/syslog.h>
+#include <sys/proc.h>
+
+#include <vm/vm.h>
+#include <vm/vm_extern.h>
+#include <vm/vm_kern.h>
+
+#include <sys/mach/kern_return.h>
+#include <sys/mach/message.h>
+#include <sys/mach/port.h>
+
+#include <sys/syscallsubr.h>
+#include <sys/mach/ipc/port.h>
+#include <sys/mach/ipc/ipc_entry.h>
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/ipc/ipc_thread.h>
+#include <sys/mach/ipc/ipc_notify.h>
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_right.h>
+#include <sys/mach/ipc/ipc_hash.h>
+#include <sys/mach/ipc/ipc_table.h>
+#include <sys/mach/sched_prim.h>
+#include <sys/mach/ipc_kobject.h>
+#include <sys/mach/thread.h>
+
+#pragma pack(4)
+
+typedef	struct
+{
+	mach_msg_bits_t		msgh_bits;
+	mach_msg_size_t		msgh_size;
+	mach_port_name_t	msgh_remote_port;
+	mach_port_name_t	msgh_local_port;
+	mach_port_name_t	msgh_voucher_port;
+	mach_msg_id_t		msgh_id;
+} mach_msg_legacy_header_t;
+
+typedef struct
+{
+	mach_msg_legacy_header_t header;
+	mach_msg_body_t          body;
+} mach_msg_legacy_base_t;
+
+typedef struct
+{
+  mach_port_name_t				name;
+  mach_msg_size_t				pad1;
+  uint32_t						pad2 : 16;
+  mach_msg_type_name_t			disposition : 8;
+  mach_msg_descriptor_type_t	type : 8;
+} mach_msg_legacy_port_descriptor_t;
+
+
+typedef union
+{
+  mach_msg_legacy_port_descriptor_t			port;
+  mach_msg_ool_descriptor32_t		out_of_line32;
+  mach_msg_ool_ports_descriptor32_t	ool_ports32;
+  mach_msg_type_descriptor_t			type;
+} mach_msg_legacy_descriptor_t;
+
+#pragma pack()
+
+#define LEGACY_HEADER_SIZE_DELTA ((mach_msg_size_t)(sizeof(mach_msg_header_t) - sizeof(mach_msg_legacy_header_t)))
+
+
+extern vm_size_t	ipc_kmsg_max_space;
+extern vm_size_t	ipc_kmsg_max_vm_space;
+extern vm_size_t	ipc_kmsg_max_body_space;
+extern vm_size_t	msg_ool_size_small;
+
+#define MSG_OOL_SIZE_SMALL	msg_ool_size_small
+#define DESC_SIZE_ADJUSTMENT	((mach_msg_size_t)(sizeof(mach_msg_ool_descriptor64_t) - \
+				 sizeof(mach_msg_ool_descriptor32_t)))
+/*
+ * Forward declarations
+ */
+
+void ipc_kmsg_clean(
+	ipc_kmsg_t	kmsg);
+
+void ipc_kmsg_clean_body(
+	ipc_kmsg_t	kmsg __unused,
+	mach_msg_type_number_t	number,
+	mach_msg_descriptor_t *desc);
+
+void ipc_kmsg_clean_partial(
+	ipc_kmsg_t		kmsg,
+	mach_msg_type_number_t	number,
+	mach_msg_descriptor_t *desc,
+	vm_offset_t		paddr,
+	vm_size_t		length);
+
+mach_msg_return_t ipc_kmsg_copyin_body(
+	ipc_kmsg_t		kmsg,
+	ipc_space_t		space,
+	vm_map_t		map);
+
+void ikm_cache_init(void);
+
+
+/*
+ *	Routine:	ipc_kmsg_alloc
+ *	Purpose:
+ *		Allocate a kernel message structure.
+ *	Conditions:
+ *		Nothing locked.
+ */
+ipc_kmsg_t
+ipc_kmsg_alloc(
+	mach_msg_size_t msg_and_trailer_size)
+{
+	mach_msg_size_t max_expanded_size;
+	ipc_kmsg_t kmsg;
+	int mflags;
+	mach_msg_size_t min_msg_size = 0;
+	if (msg_and_trailer_size > MAX_TRAILER_SIZE)
+		min_msg_size = msg_and_trailer_size - MAX_TRAILER_SIZE;
+#ifdef INVARIANTS
+	mflags = M_NOWAIT|M_ZERO;
+#else
+	mflags = M_NOWAIT;
+#endif
+	/* compare against implementation upper limit for the body */
+	if (min_msg_size > ipc_kmsg_max_body_space) {
+		return IKM_NULL;
+	}
+	if (min_msg_size > sizeof(mach_msg_base_t)) {
+		mach_msg_size_t max_desc = (mach_msg_size_t)(((min_msg_size - sizeof(mach_msg_base_t)) /
+				           sizeof(mach_msg_ool_descriptor32_t)) *
+				           DESC_SIZE_ADJUSTMENT);
+
+		/* make sure expansion won't cause wrap */
+		if (msg_and_trailer_size > MACH_MSG_SIZE_MAX - max_desc) {
+			printf("expansion would cause wrap! - return IKM_NULL\n");
+			return IKM_NULL;
+		}
+		max_expanded_size = msg_and_trailer_size + max_desc;
+	} else
+		max_expanded_size = msg_and_trailer_size;
+	/* fudge factor */
+	kmsg = malloc(ikm_plus_overhead(max_expanded_size) + MAX_TRAILER_SIZE, M_MACH_IPC_KMSG, mflags);
+	if (kmsg != IKM_NULL) {
+		ikm_init(kmsg, max_expanded_size);
+		ikm_set_header(kmsg, msg_and_trailer_size);
+	}
+	return (kmsg);
+}
+
+
+/*
+ *	Routine:	ipc_kmsg_enqueue
+ *	Purpose:
+ *		Enqueue a kmsg.
+ */
+
+void
+ipc_kmsg_enqueue(
+	ipc_kmsg_queue_t	queue,
+	ipc_kmsg_t		kmsg)
+{
+	ipc_kmsg_enqueue_macro(queue, kmsg);
+}
+
+/*
+ *	Routine:	ipc_kmsg_dequeue
+ *	Purpose:
+ *		Dequeue and return a kmsg.
+ */
+
+ipc_kmsg_t
+ipc_kmsg_dequeue(
+	ipc_kmsg_queue_t	queue)
+{
+	ipc_kmsg_t first;
+
+	first = ipc_kmsg_queue_first(queue);
+
+	if (first != IKM_NULL)
+		ipc_kmsg_rmqueue_first_macro(queue, first);
+
+	return first;
+}
+
+/*
+ *	Routine:	ipc_kmsg_rmqueue
+ *	Purpose:
+ *		Pull a kmsg out of a queue.
+ */
+
+void
+ipc_kmsg_rmqueue(
+	ipc_kmsg_queue_t	queue,
+	ipc_kmsg_t		kmsg)
+{
+	ipc_kmsg_t next, prev;
+
+	assert(queue->ikmq_base != IKM_NULL);
+
+	next = kmsg->ikm_next;
+	prev = kmsg->ikm_prev;
+
+	if (next == kmsg) {
+		assert(prev == kmsg);
+		assert(queue->ikmq_base == kmsg);
+
+		queue->ikmq_base = IKM_NULL;
+	} else {
+		if (queue->ikmq_base == kmsg)
+			queue->ikmq_base = next;
+
+		next->ikm_prev = prev;
+		prev->ikm_next = next;
+	}
+	/* XXX Temporary debug logic */
+	kmsg->ikm_next = IKM_BOGUS;
+	kmsg->ikm_prev = IKM_BOGUS;
+}
+
+/*
+ *	Routine:	ipc_kmsg_queue_next
+ *	Purpose:
+ *		Return the kmsg following the given kmsg.
+ *		(Or IKM_NULL if it is the last one in the queue.)
+ */
+
+ipc_kmsg_t
+ipc_kmsg_queue_next(
+	ipc_kmsg_queue_t	queue,
+	ipc_kmsg_t		kmsg)
+{
+	ipc_kmsg_t next;
+
+	assert(queue->ikmq_base != IKM_NULL);
+
+	next = kmsg->ikm_next;
+	if (queue->ikmq_base == next)
+		next = IKM_NULL;
+
+	return next;
+}
+
+/*
+ *	Routine:	ipc_kmsg_delayed_destroy
+ *	Purpose:
+ *		Enqueues a kernel message for deferred destruction.
+ *	Returns:
+ *		Boolean indicator that the caller is responsible to reap
+ *		deferred messages.
+ */
+
+static boolean_t
+ipc_kmsg_delayed_destroy(
+	ipc_kmsg_t kmsg)
+{
+	ipc_kmsg_queue_t queue = &(current_thread()->ith_messages);
+	boolean_t first = ipc_kmsg_queue_empty(queue);
+
+	ipc_kmsg_enqueue(queue, kmsg);
+	return first;
+}
+
+
+
+/*
+ *	Routine:	ipc_kmsg_reap_delayed
+ *	Purpose:
+ *		Destroys messages from the per-thread
+ *		deferred free queue.
+ *	Conditions:
+ *		No locks held.
+ */
+
+static void
+ipc_kmsg_reap_delayed(void)
+{
+	ipc_kmsg_queue_t queue = &(current_thread()->ith_messages);
+	ipc_kmsg_t kmsg;
+
+	/*
+	 * must leave kmsg in queue while cleaning it to assure
+	 * no nested calls recurse into here.
+	 */
+	while ((kmsg = ipc_kmsg_queue_first(queue)) != IKM_NULL) {
+		ipc_kmsg_clean(kmsg);
+		ipc_kmsg_rmqueue(queue, kmsg);
+		ipc_kmsg_free(kmsg);
+	}
+}
+
+/*
+ *	Routine:	ipc_kmsg_destroy
+ *	Purpose:
+ *		Destroys a kernel message.  Releases all rights,
+ *		references, and memory held by the message.
+ *		Frees the message.
+ *	Conditions:
+ *		No locks held.
+ */
+
+void
+ipc_kmsg_destroy(ipc_kmsg_t	kmsg)
+{
+
+	/*
+	 *	ipc_kmsg_clean can cause more messages to be destroyed.
+	 *	Curtail recursion by queueing messages.  If a message
+	 *	is already queued, then this is a recursive call.
+	 */
+	if (ipc_kmsg_delayed_destroy(kmsg))
+		ipc_kmsg_reap_delayed();
+}
+
+
+/*
+ *	Routine:	ipc_kmsg_clean_body
+ *	Purpose:
+ *		Cleans the body of a kernel message.
+ *		Releases all rights, references, and memory.
+ *
+ *	Conditions:
+ *		No locks held.
+ */
+
+void
+ipc_kmsg_clean_body(
+	ipc_kmsg_t	kmsg __unused,
+	mach_msg_type_number_t	number,
+	mach_msg_descriptor_t *saddr)
+{
+	mach_msg_type_number_t i;
+
+    if ( number == 0 )
+	return;
+
+    for (i = 0; i < number; i++, saddr++ ) {
+	
+	switch (saddr->type.type) {
+	    
+	    case MACH_MSG_PORT_DESCRIPTOR: {
+		mach_msg_port_descriptor_t *dsc;
+
+		dsc = &saddr->port;
+
+		/* 
+		 * Destroy port rights carried in the message 
+		 */
+		if (!IO_VALID((ipc_object_t) dsc->name))
+		    continue;
+		ipc_object_destroy((ipc_object_t) dsc->name, dsc->disposition);
+		break;
+	    }
+	    case MACH_MSG_OOL_VOLATILE_DESCRIPTOR:
+	    case MACH_MSG_OOL_DESCRIPTOR : {
+		mach_msg_ool_descriptor_t *dsc;
+
+		dsc = &saddr->out_of_line;
+		
+		/* 
+		 * Destroy memory carried in the message 
+		 */
+		if (dsc->size == 0) {
+		    assert(dsc->address == (void *) 0);
+		} else {
+		    if (dsc->copy == MACH_MSG_PHYSICAL_COPY &&
+			    dsc->size < MSG_OOL_SIZE_SMALL) {
+			    free(dsc->address, M_MACH_VM);
+		    } else {
+		    	vm_map_copy_discard((vm_map_copy_t) dsc->address);
+		    }
+		}
+		break;
+	    }
+	    case MACH_MSG_OOL_PORTS_DESCRIPTOR : {
+		ipc_object_t             	*objects;
+		mach_msg_type_number_t   	j;
+		mach_msg_ool_ports_descriptor_t	*dsc;
+
+		dsc = &saddr->ool_ports;
+		objects = (ipc_object_t *) dsc->address;
+
+		if (dsc->count == 0) {
+			break;
+		}
+
+		assert(objects != (ipc_object_t *) 0);
+		
+		/* destroy port rights carried in the message */
+		
+		for (j = 0; j < dsc->count; j++) {
+		    ipc_object_t object = objects[j];
+		    
+		    if (!IO_VALID(object))
+			continue;
+		    
+		    ipc_object_destroy(object, dsc->disposition);
+		}
+
+		/* destroy memory carried in the message */
+
+		assert(dsc->count != 0);
+
+		KFREE((vm_offset_t) dsc->address, 
+		     (vm_size_t) dsc->count * sizeof(mach_port_name_t),
+		     rt);
+		break;
+	    }
+	    default : {
+		printf("cleanup: don't understand this type of descriptor\n");
+	    }
+	}
+    }
+}
+
+/*
+ *	Routine:	ipc_kmsg_clean_partial
+ *	Purpose:
+ *		Cleans a partially-acquired kernel message.
+ *		number is the index of the type descriptor
+ *		in the body of the message that contained the error.
+ *		If dolast, the memory and port rights in this last
+ *		type spec are also cleaned.  In that case, number
+ *		specifies the number of port rights to clean.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_kmsg_clean_partial(
+	ipc_kmsg_t		kmsg,
+	mach_msg_type_number_t	number,
+	mach_msg_descriptor_t *desc,
+	vm_offset_t		paddr,
+	vm_size_t		length)
+{
+	ipc_object_t object;
+	mach_msg_bits_t mbits = kmsg->ikm_header->msgh_bits;
+
+	object = (ipc_object_t) kmsg->ikm_header->msgh_remote_port;
+	assert(IO_VALID(object));
+	ipc_object_destroy(object, MACH_MSGH_BITS_REMOTE(mbits));
+
+	object = (ipc_object_t) kmsg->ikm_header->msgh_local_port;
+	if (IO_VALID(object))
+		ipc_object_destroy(object, MACH_MSGH_BITS_LOCAL(mbits));
+
+	if (paddr) {
+		free((void *)paddr, M_MACH_TMP);
+	}
+
+	ipc_kmsg_clean_body(kmsg, number, desc);
+}
+
+/*
+ *	Routine:	ipc_kmsg_clean
+ *	Purpose:
+ *		Cleans a kernel message.  Releases all rights,
+ *		references, and memory held by the message.
+ *	Conditions:
+ *		No locks held.
+ */
+
+void
+ipc_kmsg_clean(
+	ipc_kmsg_t	kmsg)
+{
+	ipc_object_t object;
+	mach_msg_bits_t mbits;
+
+
+	mbits = kmsg->ikm_header->msgh_bits;
+	object = (ipc_object_t) kmsg->ikm_header->msgh_remote_port;
+	if (IO_VALID(object))
+		ipc_object_destroy(object, MACH_MSGH_BITS_REMOTE(mbits));
+
+	object = (ipc_object_t) kmsg->ikm_header->msgh_local_port;
+	if (IO_VALID(object))
+		ipc_object_destroy(object, MACH_MSGH_BITS_LOCAL(mbits));
+
+	if (mbits & MACH_MSGH_BITS_COMPLEX) {
+		mach_msg_body_t *body;
+
+		body = (mach_msg_body_t *) (kmsg->ikm_header + 1);
+		ipc_kmsg_clean_body(kmsg, body->msgh_descriptor_count,
+							(mach_msg_descriptor_t *)(body + 1));
+	}
+}
+
+/*
+ *	Routine:	ipc_kmsg_free
+ *	Purpose:
+ *		Free a kernel message buffer.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_kmsg_free(ipc_kmsg_t	kmsg)
+{
+
+#ifdef notyet	
+	if (kmsg->ikm_size <= IKM_SAVED_MSG_SIZE)
+		uma_zfree(ipc_kmsg_zone, kmsg);
+	else
+#endif
+		free(kmsg, M_MACH_IPC_KMSG);
+}
+
+/*
+ *	Routine:	ipc_kmsg_get
+ *	Purpose:
+ *		Allocates a kernel message buffer.
+ *		Copies a user message to the message buffer.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	Acquired a message buffer.
+ *		MACH_SEND_MSG_TOO_SMALL	Message smaller than a header.
+ *		MACH_SEND_MSG_TOO_SMALL	Message size not long-word multiple.
+ *		MACH_SEND_NO_BUFFER	Couldn't allocate a message buffer.
+ *		MACH_SEND_INVALID_DATA	Couldn't copy message data.
+ */
+
+mach_msg_return_t
+ipc_kmsg_get(
+	mach_msg_header_t	*msg,
+	mach_msg_size_t		size,
+	ipc_kmsg_t		*kmsgp,
+	ipc_space_t		space)
+{
+	mach_msg_size_t		msg_and_trailer_size;
+	ipc_kmsg_t 			kmsg;
+	mach_msg_max_trailer_t 	*trailer;
+	mach_msg_legacy_base_t	    legacy_base;
+	mach_msg_size_t		len_copied;
+	task_t task;
+	caddr_t msg_addr = (caddr_t)msg;
+
+	legacy_base.body.msgh_descriptor_count = 0;
+	if ((size < sizeof(mach_msg_legacy_header_t)) || (size & 3))
+		return MACH_SEND_MSG_TOO_SMALL;
+
+	if (size > ipc_kmsg_max_body_space)
+		return MACH_SEND_TOO_LARGE;
+
+	if(size == sizeof(mach_msg_legacy_header_t))
+		len_copied = sizeof(mach_msg_legacy_header_t);
+	else
+		len_copied = sizeof(mach_msg_legacy_base_t);
+
+	if (copyinmsg((char *) msg, (char *) &legacy_base, len_copied))
+		return MACH_SEND_INVALID_DATA;
+
+	msg_addr += sizeof(legacy_base.header);
+#if defined(__LP64__)
+	size += LEGACY_HEADER_SIZE_DELTA;
+#endif
+	msg_and_trailer_size = size + MAX_TRAILER_SIZE;
+	if ((kmsg = ipc_kmsg_alloc(msg_and_trailer_size)) == IKM_NULL)
+		return MACH_SEND_NO_BUFFER;
+
+	kmsg->ikm_header->msgh_size = size;
+	kmsg->ikm_header->msgh_bits			= legacy_base.header.msgh_bits;
+	kmsg->ikm_header->msgh_remote_port	= CAST_MACH_NAME_TO_PORT(legacy_base.header.msgh_remote_port);
+	kmsg->ikm_header->msgh_local_port	= CAST_MACH_NAME_TO_PORT(legacy_base.header.msgh_local_port);
+	kmsg->ikm_header->msgh_voucher_port		= legacy_base.header.msgh_voucher_port;
+	kmsg->ikm_header->msgh_id			= legacy_base.header.msgh_id;
+
+	/* ipc_kmsg_print(kmsg);*/
+	if (copyinmsg(msg_addr, (caddr_t)(kmsg->ikm_header + 1), size - (mach_msg_size_t)sizeof(mach_msg_header_t))) {
+		ipc_kmsg_free(kmsg);
+		return MACH_SEND_INVALID_DATA;
+	}
+	/* 
+	 * I reserve for the trailer the largest space (MAX_TRAILER_SIZE)
+	 * However, the internal size field of the trailer (msgh_trailer_size)
+	 * is initialized to the minimum (sizeof(mach_msg_trailer_t)), to optimize
+	 * the cases where no implicit data is requested.
+	 */
+	trailer = (mach_msg_max_trailer_t *) (((caddr_t)(kmsg->ikm_header)) + size);
+	task = current_task();
+	trailer->msgh_trailer_type = MACH_MSG_TRAILER_FORMAT_0;
+	trailer->msgh_trailer_size = MACH_MSG_TRAILER_MINIMUM_SIZE;
+	trailer->msgh_sender = task->sec_token;
+	trailer->msgh_audit = task->audit_token;
+	*kmsgp = kmsg;
+	return MACH_MSG_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_kmsg_get_from_kernel
+ *	Purpose:
+ *		Allocates a kernel message buffer.
+ *		Copies a kernel message to the message buffer.
+ *		Only resource errors are allowed.
+ *	Conditions:
+ *		Nothing locked.
+ *		Ports in header are ipc_port_t.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	Acquired a message buffer.
+ *		MACH_SEND_NO_BUFFER	Couldn't allocate a message buffer.
+ */
+
+extern mach_msg_return_t
+ipc_kmsg_get_from_kernel(
+	mach_msg_header_t	*msg,
+	mach_msg_size_t		size,
+	ipc_kmsg_t		*kmsgp)
+{
+	ipc_kmsg_t 	kmsg;
+	mach_msg_size_t	msg_and_trailer_size;
+	mach_msg_max_trailer_t *trailer;
+
+	assert(size >= sizeof(mach_msg_header_t));
+	assert((size & 3) == 0);
+
+	/* round up for ikm_cache */
+	msg_and_trailer_size = size + MAX_TRAILER_SIZE;
+	if (msg_and_trailer_size < IKM_SAVED_MSG_SIZE)
+	    msg_and_trailer_size = IKM_SAVED_MSG_SIZE;
+
+	assert(IP_VALID((ipc_port_t) msg->msgh_remote_port));
+	
+	if ((kmsg = ipc_kmsg_alloc(msg_and_trailer_size)) == NULL)
+		return MACH_SEND_NO_BUFFER;
+	(void) memcpy((void *) kmsg->ikm_header, (const void *) msg, size);
+
+	kmsg->ikm_header->msgh_size = size;
+	/* 
+	 * I reserve for the trailer the largest space (MAX_TRAILER_SIZE)
+	 * However, the internal size field of the trailer (msgh_trailer_size)
+	 * is initialized to the minimum (sizeof(mach_msg_trailer_t)), to optimize
+	 * the cases where no implicit data is requested.
+	 */
+	trailer = (mach_msg_max_trailer_t *) ((vm_offset_t)kmsg->ikm_header + size);
+	trailer->msgh_sender = KERNEL_SECURITY_TOKEN;
+	trailer->msgh_audit = KERNEL_AUDIT_TOKEN;
+	trailer->msgh_trailer_type = MACH_MSG_TRAILER_FORMAT_0;
+	trailer->msgh_trailer_size = MACH_MSG_TRAILER_MINIMUM_SIZE;
+
+	*kmsgp = kmsg;
+	return MACH_MSG_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_kmsg_put
+ *	Purpose:
+ *		Copies a message buffer to a user message.
+ *		Copies only the specified number of bytes.
+ *		Frees the message buffer.
+ *	Conditions:
+ *		Nothing locked.  The message buffer must have clean
+ *		header fields.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	Copied data out of message buffer.
+ *		MACH_RCV_INVALID_DATA	Couldn't copy to user message.
+ */
+
+mach_msg_return_t
+ipc_kmsg_put(
+	mach_msg_header_t	*msg,
+	ipc_kmsg_t		kmsg,
+	mach_msg_size_t		size)
+{
+	mach_msg_return_t mr;
+
+	ikm_check_initialized(kmsg, kmsg->ikm_size);
+
+	MDPRINTF(("doing kmsg_put size=%d to addr=%p", size, msg));
+#if defined(__LP64__)
+	if (current_task() != kernel_task) { /* don't if receiver expects fully-cooked in-kernel msg; ux_exception */
+		mach_msg_legacy_header_t *legacy_header =
+			(mach_msg_legacy_header_t *)((vm_offset_t)(kmsg->ikm_header) + LEGACY_HEADER_SIZE_DELTA);
+
+		mach_msg_bits_t		bits		= kmsg->ikm_header->msgh_bits;
+		mach_msg_size_t		msg_size	= kmsg->ikm_header->msgh_size;
+		mach_port_name_t	remote_port	= CAST_MACH_PORT_TO_NAME(kmsg->ikm_header->msgh_remote_port);
+		mach_port_name_t	local_port	= CAST_MACH_PORT_TO_NAME(kmsg->ikm_header->msgh_local_port);
+		mach_port_name_t	voucher_port	= kmsg->ikm_header->msgh_voucher_port;
+		mach_msg_id_t		id			= kmsg->ikm_header->msgh_id;
+
+		legacy_header->msgh_id			= id;
+		legacy_header->msgh_local_port = local_port;
+		legacy_header->msgh_remote_port = remote_port;
+		legacy_header->msgh_voucher_port = voucher_port;
+		legacy_header->msgh_size		= msg_size - LEGACY_HEADER_SIZE_DELTA;
+		legacy_header->msgh_bits		= bits;
+
+		MDPRINTF((" msg_size=%d", msg_size));
+
+		size -= LEGACY_HEADER_SIZE_DELTA;
+		kmsg->ikm_header = (mach_msg_header_t *)legacy_header;
+	}
+#endif
+	MDPRINTF(("\n"));
+	if (copyoutmsg((const char *) kmsg->ikm_header, (char *) msg, size))
+		mr = MACH_RCV_INVALID_DATA;
+	else
+		mr = MACH_MSG_SUCCESS;
+
+	ikm_free(kmsg);
+
+	return mr;
+}
+
+extern void kdb_backtrace(void);
+/*
+ *	Routine:	ipc_kmsg_put_to_kernel
+ *	Purpose:
+ *		Copies a message buffer to a kernel message.
+ *		Frees the message buffer.
+ *		No errors allowed.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_kmsg_put_to_kernel(
+	mach_msg_header_t	*msg,
+	ipc_kmsg_t		kmsg,
+	mach_msg_size_t		size)
+{
+
+	(void) memcpy((void *) msg, (const void *) kmsg->ikm_header, size);
+
+	ikm_free(kmsg);
+}
+
+/*
+ *	Routine:	ipc_kmsg_copyin_header
+ *	Purpose:
+ *		"Copy-in" port rights in the header of a message.
+ *		Operates atomically; if it doesn't succeed the
+ *		message header and the space are left untouched.
+ *		If it does succeed the remote/local port fields
+ *		contain object pointers instead of port names,
+ *		and the bits field is updated.  The destination port
+ *		will be a valid port pointer.
+ *
+ *		The notify argument implements the MACH_SEND_CANCEL option.
+ *		If it is not MACH_PORT_NULL, it should name a receive right.
+ *		If the processing of the destination port would generate
+ *		a port-deleted notification (because the right for the
+ *		destination port is destroyed and it had a request for
+ *		a dead-name notification registered), and the port-deleted
+ *		notification would be sent to the named receive right,
+ *		then it isn't sent and the send-once right for the notify
+ *		port is quietly destroyed.
+ *
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	Successful copyin.
+ *		MACH_SEND_INVALID_HEADER
+ *			Illegal value in the message header bits.
+ *		MACH_SEND_INVALID_DEST	The space is dead.
+ *		MACH_SEND_INVALID_NOTIFY
+ *			Notify is non-null and doesn't name a receive right.
+ *			(Either KERN_INVALID_NAME or KERN_INVALID_RIGHT.)
+ *		MACH_SEND_INVALID_DEST	Can't copyin destination port.
+ *			(Either KERN_INVALID_NAME or KERN_INVALID_RIGHT.)
+ *		MACH_SEND_INVALID_REPLY	Can't copyin reply port.
+ *			(Either KERN_INVALID_NAME or KERN_INVALID_RIGHT.)
+ */
+
+mach_msg_return_t
+ipc_kmsg_copyin_header(
+	ipc_kmsg_t		kmsg,
+	ipc_space_t		space,
+	mach_port_name_t		notify_name)
+{
+	mach_msg_header_t *msg  = kmsg->ikm_header;
+	mach_msg_bits_t mbits = msg->msgh_bits &~ MACH_MSGH_BITS_CIRCULAR;
+	mach_msg_type_name_t dest_type = MACH_MSGH_BITS_REMOTE(mbits);
+	mach_msg_type_name_t reply_type = MACH_MSGH_BITS_LOCAL(mbits);
+	ipc_object_t dest_port, reply_port;
+	ipc_port_t dest_soright, reply_soright;
+	ipc_port_t notify_port;
+	kern_return_t kr;
+
+	dest_port = reply_port = NULL;
+	dest_soright = reply_soright = notify_port = NULL;
+	/* Here we know that the value is coming from userspace so the cast is safe
+	* because we've been passed a 32-bit name
+	*/
+	mach_port_name_t dest_name = CAST_MACH_PORT_TO_NAME(msg->msgh_remote_port);
+	mach_port_name_t reply_name = CAST_MACH_PORT_TO_NAME(msg->msgh_local_port);
+
+	if (!MACH_MSG_TYPE_PORT_ANY_SEND(dest_type))
+		return MACH_SEND_INVALID_HEADER;
+
+	if ((reply_type == 0) ?
+	    (reply_name != MACH_PORT_NAME_NULL) :
+	    !MACH_MSG_TYPE_PORT_ANY_SEND(reply_type))
+		return MACH_SEND_INVALID_HEADER;
+
+	is_write_lock(space);
+	if (!space->is_active) {
+		printf("space not active");
+		goto invalid_dest;
+	}
+	if (notify_name != MACH_PORT_NAME_NULL) {
+		ipc_entry_t entry;
+
+		if (((entry = ipc_entry_lookup(space, notify_name)) == IE_NULL) ||
+		    ((entry->ie_bits & MACH_PORT_TYPE_RECEIVE) == 0)) {
+			is_write_unlock(space);
+			return MACH_SEND_INVALID_NOTIFY;
+		}
+
+		notify_port = (ipc_port_t) entry->ie_object;
+	}
+
+	if (dest_name == reply_name) {
+		ipc_entry_t entry;
+		mach_port_name_t name = dest_name;
+
+		/*
+		 *	Destination and reply ports are the same!
+		 *	This is a little tedious to make atomic, because
+		 *	there are 25 combinations of dest_type/reply_type.
+		 *	However, most are easy.  If either is move-sonce,
+		 *	then there must be an error.  If either are
+		 *	make-send or make-sonce, then we must be looking
+		 *	at a receive right so the port can't die.
+		 *	The hard cases are the combinations of
+		 *	copy-send and make-send.
+		 */
+
+		entry = ipc_entry_lookup(space, name);
+		if (entry == IE_NULL) {
+			printf("name=%d not found\n", name);
+			goto invalid_dest;
+		}
+			
+		assert(reply_type != 0); /* because name not null */
+
+		if (!ipc_right_copyin_check(space, name, entry, reply_type))
+			goto invalid_reply;
+
+		if ((dest_type == MACH_MSG_TYPE_MOVE_SEND_ONCE) ||
+		    (reply_type == MACH_MSG_TYPE_MOVE_SEND_ONCE)) {
+			/*
+			 *	Why must there be an error?  To get a valid
+			 *	destination, this entry must name a live
+			 *	port (not a dead name or dead port).  However
+			 *	a successful move-sonce will destroy a
+			 *	live entry.  Therefore the other copyin,
+			 *	whatever it is, would fail.  We've already
+			 *	checked for reply port errors above,
+			 *	so report a destination error.
+			 */
+			printf("dest_type or reply_type is SEND_ONCE\n");
+			
+			goto invalid_dest;
+		} else if ((dest_type == MACH_MSG_TYPE_MAKE_SEND) ||
+			   (dest_type == MACH_MSG_TYPE_MAKE_SEND_ONCE) ||
+			   (reply_type == MACH_MSG_TYPE_MAKE_SEND) ||
+			   (reply_type == MACH_MSG_TYPE_MAKE_SEND_ONCE)) {
+			kr = ipc_right_copyin(space, name, entry,
+					      dest_type, FALSE,
+					      &dest_port, &dest_soright);
+			if (kr != KERN_SUCCESS) {
+				printf("ipc_right_copyin failed kr=%d %s:%d\n", kr, __FILE__, __LINE__);
+				goto invalid_dest;
+			}
+
+			/*
+			 *	Either dest or reply needs a receive right.
+			 *	We know the receive right is there, because
+			 *	of the copyin_check and copyin calls.  Hence
+			 *	the port is not in danger of dying.  If dest
+			 *	used the receive right, then the right needed
+			 *	by reply (and verified by copyin_check) will
+			 *	still be there.
+			 */
+
+			assert(IO_VALID(dest_port));
+			assert(entry->ie_bits & MACH_PORT_TYPE_RECEIVE);
+			assert(dest_soright == IP_NULL);
+
+			kr = ipc_right_copyin(space, name, entry,
+					      reply_type, TRUE,
+					      &reply_port, &reply_soright);
+
+			assert(kr == KERN_SUCCESS);
+			assert(reply_port == dest_port);
+			assert(entry->ie_bits & MACH_PORT_TYPE_RECEIVE);
+			assert(reply_soright == IP_NULL);
+		} else if ((dest_type == MACH_MSG_TYPE_COPY_SEND) &&
+			   (reply_type == MACH_MSG_TYPE_COPY_SEND)) {
+			/*
+			 *	To make this atomic, just do one copy-send,
+			 *	and dup the send right we get out.
+			 */
+
+			kr = ipc_right_copyin(space, name, entry,
+					      dest_type, FALSE,
+					      &dest_port, &dest_soright);
+			if (kr != KERN_SUCCESS) {
+				printf("ipc_right_copyin failed kr=%d %s:%d\n", kr, __FILE__, __LINE__);
+				goto invalid_dest;
+			}
+			assert(entry->ie_bits & MACH_PORT_TYPE_SEND);
+			assert(dest_soright == IP_NULL);
+
+			/*
+			 *	It's OK if the port we got is dead now,
+			 *	so reply_port is IP_DEAD, because the msg
+			 *	won't go anywhere anyway.
+			 */
+
+			reply_port = (ipc_object_t)
+				ipc_port_copy_send((ipc_port_t) dest_port);
+			reply_soright = IP_NULL;
+		} else if ((dest_type == MACH_MSG_TYPE_MOVE_SEND) &&
+			   (reply_type == MACH_MSG_TYPE_MOVE_SEND)) {
+			/*
+			 *	This is an easy case.  Just use our
+			 *	handy-dandy special-purpose copyin call
+			 *	to get two send rights for the price of one.
+			 */
+
+			kr = ipc_right_copyin_two(space, name, entry,
+						  &dest_port, &dest_soright);
+			if (kr != KERN_SUCCESS) {
+				printf("ipc_right_copyin_two failed kr=%d %s:%d\n", kr, __FILE__, __LINE__);
+				goto invalid_dest;
+			}
+			/* the entry might need to be deallocated */
+
+			if (IE_BITS_TYPE(entry->ie_bits) == MACH_PORT_TYPE_NONE) {
+				is_write_unlock(space);
+				ipc_entry_close(space, name);
+				is_write_lock(space);
+			}
+			reply_port = dest_port;
+			reply_soright = IP_NULL;
+		} else {
+			ipc_port_t soright;
+
+			assert(((dest_type == MACH_MSG_TYPE_COPY_SEND) &&
+				(reply_type == MACH_MSG_TYPE_MOVE_SEND)) ||
+			       ((dest_type == MACH_MSG_TYPE_MOVE_SEND) &&
+				(reply_type == MACH_MSG_TYPE_COPY_SEND)));
+
+			/*
+			 *	To make this atomic, just do a move-send,
+			 *	and dup the send right we get out.
+			 */
+
+			kr = ipc_right_copyin(space, name, entry,
+					      MACH_MSG_TYPE_MOVE_SEND, FALSE,
+					      &dest_port, &soright);
+			if (kr != KERN_SUCCESS) {
+				printf("ipc_right_copyin failed kr=%d %s:%d\n", kr, __FILE__, __LINE__);
+				goto invalid_dest;
+			}
+			/* the entry might need to be deallocated */
+
+			if (IE_BITS_TYPE(entry->ie_bits) == MACH_PORT_TYPE_NONE) {
+				is_write_unlock(space);
+				ipc_entry_close(space, name);
+				is_write_lock(space);
+			}
+			/*
+			 *	It's OK if the port we got is dead now,
+			 *	so reply_port is IP_DEAD, because the msg
+			 *	won't go anywhere anyway.
+			 */
+
+			reply_port = (ipc_object_t)
+				ipc_port_copy_send((ipc_port_t) dest_port);
+
+			if (dest_type == MACH_MSG_TYPE_MOVE_SEND) {
+				dest_soright = soright;
+				reply_soright = IP_NULL;
+			} else {
+				dest_soright = IP_NULL;
+				reply_soright = soright;
+			}
+		}
+	} else if (!MACH_PORT_NAME_VALID(reply_name)) {
+		ipc_entry_t entry;
+
+		/*
+		 *	No reply port!  This is an easy case
+		 *	to make atomic.  Just copyin the destination.
+		 */
+
+		entry = ipc_entry_lookup(space, dest_name);
+		if (entry == IE_NULL) {
+			printf("ipc_entry_lookup failed on dest_name=%d\n", dest_name);
+			goto invalid_dest;
+		}
+		kr = ipc_right_copyin(space, dest_name, entry,
+				      dest_type, FALSE,
+				      &dest_port, &dest_soright);
+		if (kr != KERN_SUCCESS) {
+			printf("ipc_right_copyin failed kr=%d %s:%d\n", kr, __FILE__, __LINE__);
+			goto invalid_dest;
+		}
+		/* the entry might need to be deallocated */
+
+		if (IE_BITS_TYPE(entry->ie_bits) == MACH_PORT_TYPE_NONE) {
+			is_write_unlock(space);
+			ipc_entry_close(space, dest_name);
+			is_write_lock(space);
+		}
+
+		reply_port = (ipc_object_t)CAST_MACH_NAME_TO_PORT(reply_name);
+		reply_soright = IP_NULL;
+	} else {
+		ipc_entry_t dest_entry, reply_entry;
+		ipc_port_t saved_reply;
+
+		/*
+		 *	This is the tough case to make atomic.
+		 *	The difficult problem is serializing with port death.
+		 *	At the time we copyin dest_port, it must be alive.
+		 *	If reply_port is alive when we copyin it, then
+		 *	we are OK, because we serialize before the death
+		 *	of both ports.  Assume reply_port is dead at copyin.
+		 *	Then if dest_port dies/died after reply_port died,
+		 *	we are OK, because we serialize between the death
+		 *	of the two ports.  So the bad case is when dest_port
+		 *	dies after its copyin, reply_port dies before its
+		 *	copyin, and dest_port dies before reply_port.  Then
+		 *	the copyins operated as if dest_port was alive
+		 *	and reply_port was dead, which shouldn't have happened
+		 *	because they died in the other order.
+		 *
+		 *	We handle the bad case by undoing the copyins
+		 *	(which is only possible because the ports are dead)
+		 *	and failing with MACH_SEND_INVALID_DEST, serializing
+		 *	after the death of the ports.
+		 *
+		 *	Note that it is easy for a user task to tell if
+		 *	a copyin happened before or after a port died.
+		 *	For example, suppose both dest and reply are
+		 *	send-once rights (types are both move-sonce) and
+		 *	both rights have dead-name requests registered.
+		 *	If a port dies before copyin, a dead-name notification
+		 *	is generated and the dead name's urefs are incremented,
+		 *	and if the copyin happens first, a port-deleted
+		 *	notification is generated.
+		 *
+		 *	Note that although the entries are different,
+		 *	dest_port and reply_port might still be the same.
+		 */
+		dest_entry = ipc_entry_lookup(space, dest_name);
+		if (dest_entry == IE_NULL) {
+			printf("ipc_entry_lookup failed on %d %s:%d\n", dest_name, __FILE__, __LINE__);
+			goto invalid_dest;
+		}
+		reply_entry = ipc_entry_lookup(space, reply_name);
+		if (reply_entry == IE_NULL)
+			goto invalid_reply;
+
+		assert(dest_entry != reply_entry); /* names are not equal */
+		assert(reply_type != 0); /* because reply_name not null */
+
+		if (ipc_right_copyin_check(space, reply_name, reply_entry,
+					    reply_type) == FALSE)
+			goto invalid_reply;
+
+		kr = ipc_right_copyin(space, dest_name, dest_entry,
+				      dest_type, FALSE,
+				      &dest_port, &dest_soright);
+		if (kr != KERN_SUCCESS) {
+			printf("ipc_right_copyin failed kr=%d %s:%d\n", kr, __FILE__, __LINE__);
+			goto invalid_dest;
+		}
+		assert(IO_VALID(dest_port));
+
+		saved_reply = (ipc_port_t) reply_entry->ie_object;
+		/* might be IP_NULL, if this is a dead name */
+		if (saved_reply != IP_NULL)
+			ipc_port_reference(saved_reply);
+
+		kr = ipc_right_copyin(space, reply_name, reply_entry,
+				      reply_type, TRUE,
+				      &reply_port, &reply_soright);
+		assert(kr == KERN_SUCCESS);
+
+		if ((saved_reply != IP_NULL) && (reply_port == IO_DEAD)) {
+			ipc_port_t dest = (ipc_port_t) dest_port;
+			ipc_port_timestamp_t timestamp;
+			boolean_t must_undo;
+
+			/*
+			 *	The reply port died before copyin.
+			 *	Check if dest port died before reply.
+			 */
+
+			ip_lock(saved_reply);
+			assert(!ip_active(saved_reply));
+			timestamp = saved_reply->ip_timestamp;
+			ip_unlock(saved_reply);
+
+			ip_lock(dest);
+			must_undo = (!ip_active(dest) &&
+				     IP_TIMESTAMP_ORDER(dest->ip_timestamp,
+							timestamp));
+			ip_unlock(dest);
+
+			if (must_undo) {
+				/*
+				 *	Our worst nightmares are realized.
+				 *	Both destination and reply ports
+				 *	are dead, but in the wrong order,
+				 *	so we must undo the copyins and
+				 *	possibly generate a dead-name notif.
+				 */
+
+				ipc_right_copyin_undo(
+						space, dest_name, dest_entry,
+						dest_type, dest_port,
+						dest_soright);
+				/* dest_entry may be deallocated now */
+
+				ipc_right_copyin_undo(
+						space, reply_name, reply_entry,
+						reply_type, reply_port,
+						reply_soright);
+				/* reply_entry may be deallocated now */
+
+				is_write_unlock(space);
+
+				if (dest_soright != IP_NULL)
+					ipc_notify_dead_name(dest_soright,
+							     dest_name);
+				assert(reply_soright == IP_NULL);
+
+				ipc_port_release(saved_reply);
+				printf("%s:%d\n", __FUNCTION__, __LINE__);
+				return MACH_SEND_INVALID_DEST;
+			}
+		}
+
+		/* the entries might need to be deallocated */
+
+		if (IE_BITS_TYPE(reply_entry->ie_bits) == MACH_PORT_TYPE_NONE) {
+			is_write_unlock(space);
+			ipc_entry_close(space, reply_name);
+			is_write_lock(space);
+		}
+		if (IE_BITS_TYPE(dest_entry->ie_bits) == MACH_PORT_TYPE_NONE) {
+			is_write_unlock(space);
+			ipc_entry_close(space, dest_name);
+			is_write_lock(space);
+		}
+		if (saved_reply != IP_NULL)
+			ipc_port_release(saved_reply);
+	}
+
+	/*
+	 *	At this point, dest_port, reply_port,
+	 *	dest_soright, reply_soright are all initialized.
+	 *	Any defunct entries have been deallocated.
+	 *	The space is still write-locked, and we need to
+	 *	make the MACH_SEND_CANCEL check.  The notify_port pointer
+	 *	is still usable, because the copyin code above won't ever
+	 *	deallocate a receive right, so its entry still exists
+	 *	and holds a ref.  Note notify_port might even equal
+	 *	dest_port or reply_port.
+	 */
+	if ((notify_name != MACH_PORT_NAME_NULL) &&
+	    (dest_soright == notify_port)) {
+		ipc_port_release_sonce(dest_soright);
+		dest_soright = IP_NULL;
+	}
+	is_write_unlock(space);
+
+	if (dest_soright != IP_NULL)
+		ipc_notify_port_deleted(dest_soright, dest_name);
+
+	if (reply_soright != IP_NULL)
+		ipc_notify_port_deleted(reply_soright, reply_name);
+
+	dest_type = ipc_object_copyin_type(dest_type);
+	reply_type = ipc_object_copyin_type(reply_type);
+
+	msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
+			  MACH_MSGH_BITS(dest_type, reply_type));
+	msg->msgh_remote_port = (mach_port_t) dest_port;
+	msg->msgh_local_port = (mach_port_t) reply_port;
+	return MACH_MSG_SUCCESS;
+
+    invalid_dest:
+is_write_unlock(space);
+kdb_backtrace();
+	printf("%s:%d - MACH_SEND_INVALID_DEST dest_name: 0x%x reply_name: 0x%x \n", curproc->p_comm, curproc->p_pid, dest_name, reply_name);
+	return MACH_SEND_INVALID_DEST;
+
+    invalid_reply:
+	is_write_unlock(space);
+	printf("%s:%d - MACH_SEND_INVALID_REPLY dest_name: 0x%x reply_name: 0x%x \n", curproc->p_comm, curproc->p_pid, dest_name, reply_name);	return MACH_SEND_INVALID_REPLY;
+}
+
+#ifdef INVARIANTS
+#define ERIGHTLOG printf("MACH_SEND_INVALID_RIGHT: %s:%s:%d\n", __FUNCTION__, __FILE__, __LINE__)
+#else
+#define ERIGHTLOG
+#endif
+
+
+mach_msg_descriptor_t *ipc_kmsg_copyin_port_descriptor(
+        volatile mach_msg_port_descriptor_t *dsc,
+        mach_msg_legacy_port_descriptor_t *user_dsc,
+        ipc_space_t space,
+        ipc_object_t dest,
+        ipc_kmsg_t kmsg,
+        mach_msg_return_t *mr);
+
+mach_msg_descriptor_t *
+ipc_kmsg_copyin_port_descriptor(
+        volatile mach_msg_port_descriptor_t *dsc,
+        mach_msg_legacy_port_descriptor_t *user_dsc_in,
+        ipc_space_t space,
+        ipc_object_t dest,
+        ipc_kmsg_t kmsg,
+        mach_msg_return_t *mr)
+{
+    volatile mach_msg_legacy_port_descriptor_t *user_dsc = user_dsc_in;
+    mach_msg_type_name_t 	user_disp;
+    mach_msg_type_name_t	result_disp;
+    mach_port_name_t		name;
+    ipc_object_t 			object;
+
+    user_disp = user_dsc->disposition;
+    result_disp = ipc_object_copyin_type(user_disp);
+
+    name = (mach_port_name_t)user_dsc->name;
+    if (MACH_PORT_NAME_VALID(name)) {
+        kern_return_t kr = ipc_object_copyin(space, name, user_disp, &object);
+        if (kr != KERN_SUCCESS) {
+            *mr = MACH_SEND_INVALID_RIGHT;
+			ERIGHTLOG;
+            return NULL;
+        }
+
+        if ((result_disp == MACH_MSG_TYPE_PORT_RECEIVE) &&
+                ipc_port_check_circularity((ipc_port_t) object,
+                    (ipc_port_t) dest)) {
+            kmsg->ikm_header->msgh_bits |= MACH_MSGH_BITS_CIRCULAR;
+        }
+		dsc->name = (ipc_port_t) object;
+    } else {
+        dsc->name = CAST_MACH_NAME_TO_PORT(name);
+    }
+    dsc->disposition = result_disp;
+    dsc->type = MACH_MSG_PORT_DESCRIPTOR;
+
+    return (mach_msg_descriptor_t *)(user_dsc_in+1);
+}
+
+mach_msg_descriptor_t * ipc_kmsg_copyin_ool_descriptor(
+	mach_msg_ool_descriptor_t *dsc,
+	mach_msg_descriptor_t *user_dsc,
+	int is_64bit,
+	vm_offset_t *paddr,
+	vm_map_copy_t *copy,
+	vm_size_t *space_needed,
+	vm_map_t map,
+	mach_msg_return_t *mr);
+mach_msg_descriptor_t *
+ipc_kmsg_copyin_ool_descriptor(
+	mach_msg_ool_descriptor_t *dsc,
+	mach_msg_descriptor_t *user_dsc,
+	int is_64bit __unused,
+	vm_offset_t *paddr,
+	vm_map_copy_t *copy,
+	vm_size_t *space_needed,
+	vm_map_t map,
+	mach_msg_return_t *mr)
+{
+	vm_size_t            		length;
+	boolean_t            		dealloc;
+	vm_offset_t          		addr;
+	mach_msg_copy_options_t		copy_options;
+	mach_msg_descriptor_type_t	dsc_type;
+	mach_msg_ool_descriptor_t *user_ool_dsc;
+
+	user_ool_dsc = (mach_msg_ool_descriptor_t *)user_dsc;
+	addr = (vm_offset_t)user_ool_dsc->address;
+	length = user_ool_dsc->size;
+	dealloc = user_ool_dsc->deallocate;
+	copy_options = user_ool_dsc->copy;
+	dsc_type = user_ool_dsc->type;
+
+	user_dsc = (mach_msg_descriptor_t *)(user_ool_dsc + 1);
+
+	dsc->size = length;
+	dsc->deallocate = dealloc;
+	dsc->copy = copy_options;
+	dsc->type = dsc_type;
+
+	if (length == 0) {
+		dsc->address = NULL;
+	} else if ((length >= MSG_OOL_SIZE_SMALL) &&
+			   (copy_options == MACH_MSG_PHYSICAL_COPY) && !dealloc) {
+
+		/*
+		 * If the request is a physical copy and the source
+		 * is not being deallocated, then allocate space
+		 * in the kernel's pageable ipc copy map and copy
+		 * the data in.  The semantics guarantee that the
+		 * data will have been physically copied before
+		 * the send operation terminates.  Thus if the data
+		 * is not being deallocated, we must be prepared
+		 * to page if the region is sufficiently large.
+		 */
+		MPASS(*space_needed >= length);
+
+		if (copyin((const char *) addr, (char *) *paddr,
+				   length)) {
+			*mr = MACH_SEND_INVALID_MEMORY;
+			return NULL;
+		}
+
+		if (vm_map_copyin(kernel_map, *paddr, length,
+						  TRUE, copy) != KERN_SUCCESS) {
+			*mr = MACH_MSG_VM_KERNEL;
+			return NULL;
+		}
+		dsc->address = (void *) *copy;
+		*paddr += length;
+		*space_needed -= length;
+	} else {
+		/*
+		 * Make a virtual copy of the of the data if requested
+		 * or if a physical copy was requested but the source
+		 * is being deallocated.  This is an invalid
+		 * path if RT.
+		 */
+		if (vm_map_copyin(map, addr, length,
+						  dealloc, copy) != KERN_SUCCESS) {
+			*mr = MACH_SEND_INVALID_MEMORY;
+			return NULL;
+		}
+		dsc->address = (void *) *copy;
+	}
+	return user_dsc;
+}
+
+
+mach_msg_descriptor_t * ipc_kmsg_copyin_ool_ports_descriptor(
+	mach_msg_ool_ports_descriptor_t *dsc,
+	mach_msg_descriptor_t *user_dsc,
+	int is_64bit,
+	vm_map_t map,
+	ipc_space_t space,
+	ipc_object_t dest,
+	ipc_kmsg_t kmsg,
+	mach_msg_return_t *mr);
+mach_msg_descriptor_t *
+ipc_kmsg_copyin_ool_ports_descriptor(
+	mach_msg_ool_ports_descriptor_t *dsc,
+	mach_msg_descriptor_t *user_dsc,
+	int is_64bit,
+	vm_map_t map,
+	ipc_space_t space,
+	ipc_object_t dest,
+	ipc_kmsg_t kmsg,
+	mach_msg_return_t *mr)
+{
+	vm_size_t            		plength, pnlength;
+	kern_return_t          		kr;
+	boolean_t            		dealloc;
+	vm_offset_t          		addr;
+	mach_msg_copy_options_t		copy_options;
+	mach_msg_descriptor_type_t	typename;
+	mach_msg_type_name_t		user_disp, result_disp;
+	ipc_object_t            		*objects;
+	void						*data;
+	int					count, j, iskernel;
+	mach_msg_ool_ports_descriptor_t *user_ool_dsc;
+
+	user_ool_dsc = (mach_msg_ool_ports_descriptor_t *)user_dsc;
+	addr = (vm_offset_t) user_ool_dsc->address;
+	count = user_ool_dsc->count;
+	dealloc = user_ool_dsc->deallocate;
+	copy_options = user_ool_dsc->copy;
+	/* this is really the type SEND, SEND_ONCE, etc. */
+	typename = user_ool_dsc->type;
+	user_disp = user_ool_dsc->disposition;
+	iskernel = (kmsg->ikm_header->msgh_remote_port->ip_receiver == ipc_space_kernel);
+
+	user_dsc = (mach_msg_descriptor_t *)(user_ool_dsc + 1);
+
+	dsc->deallocate = dealloc;
+	dsc->copy = copy_options;
+	dsc->type = typename;
+	dsc->count = count;
+	dsc->address = NULL;
+
+	result_disp = ipc_object_copyin_type(user_disp);
+	dsc->disposition = result_disp;
+
+	if (count == 0)
+		return user_dsc;
+
+	if (count > (INT_MAX / sizeof(mach_port_t))) {
+        *mr = MACH_SEND_TOO_LARGE;
+        return NULL;
+    }
+
+	plength = count * sizeof(mach_port_t);
+    pnlength = count * sizeof(mach_port_name_t);
+
+	data = malloc(plength, M_MACH_TMP, M_NOWAIT);
+
+	if (data == NULL) {
+		*mr = MACH_SEND_NO_BUFFER;
+		return NULL;
+	}
+#ifdef __LP64__
+    mach_port_name_t *names = &((mach_port_name_t *)data)[count];
+#else
+    mach_port_name_t *names = ((mach_port_name_t *)data);
+#endif
+
+	if (copyinmap(map, addr, names, pnlength)) {
+		free(data, M_MACH_TMP);
+		*mr = MACH_SEND_INVALID_MEMORY;
+		return (NULL);
+	}
+
+	if (dsc->deallocate) {
+		(void) mach_vm_deallocate(map, addr, plength);
+	}
+
+	dsc->address = (void *) data;
+	objects = (ipc_object_t *) data;
+
+	for (j = 0; j < count; j++) {
+		mach_port_name_t name;
+		ipc_object_t object;
+
+		name = names[j];
+		if (!MACH_PORT_NAME_VALID(name)) {
+			objects[j] = (ipc_object_t)CAST_MACH_NAME_TO_PORT(name);
+			continue;
+		}
+		kr = ipc_object_copyin(space, name, user_disp, &object);
+		if (kr != KERN_SUCCESS) {
+			int k;
+
+			printf("right: %d failed %x user_disp: %d\n", name, kr, user_disp);
+			for(k = 0; k < j; k++) {
+				object = objects[k];
+				if (IPC_OBJECT_VALID(object))
+					ipc_object_destroy(object, result_disp);
+			}
+			free(data, M_MACH_TMP);
+			dsc->address = NULL;
+			*mr = MACH_SEND_INVALID_RIGHT;
+			return NULL;
+		}
+		if ((dsc->disposition == MACH_MSG_TYPE_PORT_RECEIVE) &&
+			ipc_port_check_circularity(
+				(ipc_port_t) object,
+				(ipc_port_t) dest))
+			kmsg->ikm_header->msgh_bits |= MACH_MSGH_BITS_CIRCULAR;
+
+		objects[j] = object;
+	}
+	return user_dsc;
+}
+
+/*
+ *	Routine:	ipc_kmsg_copyin_body
+ *	Purpose:
+ *		"Copy-in" port rights and out-of-line memory
+ *		in the message body.
+ *
+ *		In all failure cases, the message is left holding
+ *		no rights or memory.  However, the message buffer
+ *		is not deallocated.  If successful, the message
+ *		contains a valid destination port.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	Successful copyin.
+ *		MACH_SEND_INVALID_MEMORY	Can't grab out-of-line memory.
+ *		MACH_SEND_INVALID_RIGHT	Can't copyin port right in body.
+ *		MACH_SEND_INVALID_TYPE	Bad type specification.
+ *		MACH_SEND_MSG_TOO_SMALL	Body is too small for types/data.
+ *		MACH_SEND_INVALID_RT_OOL_SIZE OOL Buffer too large for RT
+ *		MACH_MSG_INVALID_RT_DESCRIPTOR Dealloc and RT are incompatible
+ */
+
+#define KERN_DESC_SIZE 16
+
+mach_msg_return_t
+ipc_kmsg_copyin_body(
+	ipc_kmsg_t	kmsg,
+	ipc_space_t	space,
+	vm_map_t	map)
+{
+    ipc_object_t       		dest;
+    mach_msg_body_t		*body;
+    mach_msg_descriptor_t	*naddr, *daddr;
+	mach_msg_descriptor_t	*user_addr, *kern_addr;
+    vm_map_copy_t		copy = VM_MAP_COPY_NULL;
+    boolean_t 			complex;
+    int				i, dsc_count, is_task_64bit;
+    vm_size_t			space_needed = 0;
+    vm_offset_t			paddr = 0;
+    kern_return_t		mr = 0;
+	vm_size_t           size, descriptor_size = 0;
+
+    /*
+     * Determine if the target is a kernel port.
+     */
+    dest = (ipc_object_t) kmsg->ikm_header->msgh_remote_port;
+    body = (mach_msg_body_t *) (kmsg->ikm_header + 1);
+    naddr = (mach_msg_descriptor_t *) (body + 1);
+
+    dsc_count = body->msgh_descriptor_count;
+    if (dsc_count == 0)
+		return MACH_MSG_SUCCESS;
+    /*
+     * Make an initial pass to determine kernal VM space requirements for
+     * physical copies.
+     */
+#if defined(__LP64__)
+	is_task_64bit = 1;
+#else
+	is_task_64bit = 0;
+#endif
+	for (i = 0; i < dsc_count; i++) {
+		daddr = naddr;
+
+#if defined(__LP64__)
+	    switch (daddr->type.type) {
+	    case MACH_MSG_OOL_DESCRIPTOR:
+	    case MACH_MSG_OOL_VOLATILE_DESCRIPTOR:
+	    case MACH_MSG_OOL_PORTS_DESCRIPTOR:
+		    descriptor_size += 16;
+            naddr = (mach_msg_descriptor_t *)((vm_offset_t)daddr + 16);
+            break;
+	    default:
+		    descriptor_size += 12;
+            naddr = (mach_msg_descriptor_t *)((vm_offset_t)daddr + 12);
+            break;
+	    }
+#else
+        descriptor_size += 12;
+        naddr = (mach_msg_descriptor_t *)((vm_offset_t)daddr + 12);
+#endif
+    /* make sure the message does not ask for more msg descriptors
+     * than the message can hold.
+     */
+		if (naddr > (mach_msg_descriptor_t *)
+			((vm_offset_t)kmsg->ikm_header + kmsg->ikm_header->msgh_size)) {
+			ipc_kmsg_clean_partial(kmsg, 0, NULL, 0, 0);
+			mr = MACH_SEND_MSG_TOO_SMALL;
+			goto out;
+		}
+
+		switch (daddr->type.type) {
+		case MACH_MSG_OOL_DESCRIPTOR:
+		case MACH_MSG_OOL_VOLATILE_DESCRIPTOR:
+#if defined(__LP64__)
+			size = ((mach_msg_ool_descriptor64_t *)daddr)->size;
+#else
+			size = daddr->out_of_line.size;
+#endif
+			if (daddr->out_of_line.copy != MACH_MSG_PHYSICAL_COPY &&
+				daddr->out_of_line.copy != MACH_MSG_VIRTUAL_COPY) {
+				ipc_kmsg_clean_partial(kmsg, 0, NULL, 0, 0);
+				mr = MACH_SEND_INVALID_TYPE;
+				goto out;
+			}
+			if ((size >= MSG_OOL_SIZE_SMALL) &&
+				(daddr->out_of_line.copy == MACH_MSG_PHYSICAL_COPY) &&
+				!(daddr->out_of_line.deallocate)) {
+				space_needed += size;
+				if (space_needed > ipc_kmsg_max_vm_space) {
+					ipc_kmsg_clean_partial(kmsg, 0, NULL, 0, 0);
+					mr = MACH_MSG_VM_KERNEL;
+					goto out;
+				}
+			}
+		}
+	}
+	if (space_needed && (paddr = (vm_offset_t)malloc(space_needed, M_MACH_VM, M_NOWAIT| M_NODUMP | M_ZERO)) == 0) {
+		ipc_kmsg_clean_partial(kmsg, 0, NULL, 0, 0);
+		mr = MACH_MSG_VM_KERNEL;
+		goto out;
+	}
+
+	/* user_addr = just after base as it was copied in */
+    user_addr = (mach_msg_descriptor_t *)((vm_offset_t)kmsg->ikm_header + sizeof(mach_msg_base_t));
+
+    /* Shift the mach_msg_base_t down to make room for dsc_count*16bytes of descriptors */
+    if(descriptor_size != KERN_DESC_SIZE*dsc_count) {
+        vm_offset_t dsc_adjust = KERN_DESC_SIZE*dsc_count - descriptor_size;
+
+        memmove((char *)(((vm_offset_t)kmsg->ikm_header) - dsc_adjust), kmsg->ikm_header, sizeof(mach_msg_base_t));
+        kmsg->ikm_header = (mach_msg_header_t *)((vm_offset_t)kmsg->ikm_header - dsc_adjust);
+
+        /* Update the message size for the larger in-kernel representation */
+        kmsg->ikm_header->msgh_size += (mach_msg_size_t)dsc_adjust;
+    }
+
+    /* kern_addr = just after base after it has been (conditionally) moved */
+    kern_addr = (mach_msg_descriptor_t *)((vm_offset_t)kmsg->ikm_header + sizeof(mach_msg_base_t));
+
+	/* handle the OOL regions and port descriptors. */
+    for(i=0;i<dsc_count;i++) {
+        switch (user_addr->type.type) {
+		case MACH_MSG_PORT_DESCRIPTOR:
+			user_addr = ipc_kmsg_copyin_port_descriptor((mach_msg_port_descriptor_t *)kern_addr,
+							(mach_msg_legacy_port_descriptor_t *)user_addr, space, dest, kmsg, &mr);
+
+			kern_addr++;
+			complex = TRUE;
+			break;
+		case MACH_MSG_OOL_VOLATILE_DESCRIPTOR:
+		case MACH_MSG_OOL_DESCRIPTOR:
+			user_addr = ipc_kmsg_copyin_ool_descriptor((mach_msg_ool_descriptor_t *)kern_addr,
+													   user_addr, is_task_64bit, &paddr, &copy, &space_needed, map, &mr);
+			kern_addr++;
+			complex = TRUE;
+			break;
+		case MACH_MSG_OOL_PORTS_DESCRIPTOR:
+                user_addr = ipc_kmsg_copyin_ool_ports_descriptor((mach_msg_ool_ports_descriptor_t *)kern_addr,
+                        user_addr, is_task_64bit, map, space, dest, kmsg, &mr);
+                kern_addr++;
+                complex = TRUE;
+                break;
+		default:
+			printf("bad descriptor type: %d idx: %d\n", user_addr->type.type, i);
+                /* Invalid descriptor */
+                mr = MACH_SEND_INVALID_TYPE;
+                break;
+        }
+
+        if (MACH_MSG_SUCCESS != mr) {
+            /* clean from start of message descriptors to i */
+            ipc_kmsg_clean_partial(kmsg, i,
+                    (mach_msg_descriptor_t *)((mach_msg_base_t *)kmsg->ikm_header + 1),
+                    paddr, space_needed);
+            goto out;
+        }
+    }
+    if (!complex)
+		kmsg->ikm_header->msgh_bits &= ~MACH_MSGH_BITS_COMPLEX;
+
+ out:
+    return (mr);
+}
+
+
+/*
+ *	Routine:	ipc_kmsg_copyin
+ *	Purpose:
+ *		"Copy-in" port rights and out-of-line memory
+ *		in the message.
+ *
+ *		In all failure cases, the message is left holding
+ *		no rights or memory.  However, the message buffer
+ *		is not deallocated.  If successful, the message
+ *		contains a valid destination port.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	Successful copyin.
+ *		MACH_SEND_INVALID_HEADER
+ *			Illegal value in the message header bits.
+ *		MACH_SEND_INVALID_NOTIFY	Bad notify port.
+ *		MACH_SEND_INVALID_DEST	Can't copyin destination port.
+ *		MACH_SEND_INVALID_REPLY	Can't copyin reply port.
+ *		MACH_SEND_INVALID_MEMORY	Can't grab out-of-line memory.
+ *		MACH_SEND_INVALID_RIGHT	Can't copyin port right in body.
+ *		MACH_SEND_INVALID_TYPE	Bad type specification.
+ *		MACH_SEND_MSG_TOO_SMALL	Body is too small for types/data.
+ */
+
+mach_msg_return_t
+ipc_kmsg_copyin(
+	ipc_kmsg_t	kmsg,
+	ipc_space_t	space,
+	vm_map_t	map,
+	mach_port_name_t	notify)
+{
+    mach_msg_return_t 		mr;
+    
+    mr = ipc_kmsg_copyin_header(kmsg, space, notify);
+    if (mr != MACH_MSG_SUCCESS) {
+		return mr;
+    }
+    if ((kmsg->ikm_header->msgh_bits & MACH_MSGH_BITS_COMPLEX) == 0)
+		return MACH_MSG_SUCCESS;
+    
+    return( ipc_kmsg_copyin_body( kmsg, space, map) );
+}
+
+/*
+ *	Routine:	ipc_kmsg_copyin_from_kernel
+ *	Purpose:
+ *		"Copy-in" port rights and out-of-line memory
+ *		in a message sent from the kernel.
+ *
+ *		Because the message comes from the kernel,
+ *		the implementation assumes there are no errors
+ *		or peculiarities in the message.
+ *
+ *		Returns TRUE if queueing the message
+ *		would result in a circularity.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_kmsg_copyin_from_kernel(
+	ipc_kmsg_t	kmsg)
+{
+	mach_msg_bits_t bits = kmsg->ikm_header->msgh_bits;
+	mach_msg_type_name_t rname = MACH_MSGH_BITS_REMOTE(bits);
+	mach_msg_type_name_t lname = MACH_MSGH_BITS_LOCAL(bits);
+	ipc_object_t remote = (ipc_object_t) kmsg->ikm_header->msgh_remote_port;
+	ipc_object_t local = (ipc_object_t) kmsg->ikm_header->msgh_local_port;
+
+	/* translate the destination and reply ports */
+
+	ipc_object_copyin_from_kernel(remote, rname);
+	if (IO_VALID(local))
+		ipc_object_copyin_from_kernel(local, lname);
+
+	/*
+	 *	The common case is a complex message with no reply port,
+	 *	because that is what the memory_object interface uses.
+	 */
+
+	if (bits == (MACH_MSGH_BITS_COMPLEX |
+		     MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, 0))) {
+		bits = (MACH_MSGH_BITS_COMPLEX |
+			MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND, 0));
+
+		kmsg->ikm_header->msgh_bits = bits;
+	} else {
+		bits = (MACH_MSGH_BITS_OTHER(bits) |
+			MACH_MSGH_BITS(ipc_object_copyin_type(rname),
+				       ipc_object_copyin_type(lname)));
+
+		kmsg->ikm_header->msgh_bits = bits;
+		if ((bits & MACH_MSGH_BITS_COMPLEX) == 0)
+			return;
+	}
+    {
+    	mach_msg_descriptor_t	*saddr, *eaddr;
+    	mach_msg_body_t		*body;
+
+		body = (mach_msg_body_t *) (kmsg->ikm_header + 1);
+    	saddr = (mach_msg_descriptor_t *) (body + 1);
+    	eaddr = (mach_msg_descriptor_t *) saddr + body->msgh_descriptor_count;
+
+    	for ( ; saddr <  eaddr; saddr++) {
+
+	    switch (saddr->type.type) {
+	    
+	        case MACH_MSG_PORT_DESCRIPTOR: {
+		    mach_msg_type_name_t 	name;
+		    ipc_object_t 		object;
+		    mach_msg_port_descriptor_t 	*dsc;
+		
+		    dsc = &saddr->port;
+		
+		    /* this is really the type SEND, SEND_ONCE, etc. */
+		    name = dsc->disposition;
+		    object = (ipc_object_t) dsc->name;
+		    dsc->disposition = ipc_object_copyin_type(name);
+		
+		    if (!IO_VALID(object)) {
+		        break;
+		    }
+
+		    ipc_object_copyin_from_kernel(object, name);
+		    
+		    if ((dsc->disposition == MACH_MSG_TYPE_PORT_RECEIVE) &&
+		        ipc_port_check_circularity((ipc_port_t) object, 
+						(ipc_port_t) remote)) {
+		        kmsg->ikm_header->msgh_bits |= MACH_MSGH_BITS_CIRCULAR;
+		    }
+		    break;
+	        }
+		case MACH_MSG_OOL_VOLATILE_DESCRIPTOR:
+	        case MACH_MSG_OOL_DESCRIPTOR: {
+		    /*
+		     * The sender should supply ready-made memory, i.e.
+		     * a vm_map_copy_t, so we don't need to do anything.
+		     */
+		    break;
+	        }
+	        case MACH_MSG_OOL_PORTS_DESCRIPTOR: {
+		    ipc_object_t            		*objects;
+		    int					j;
+		    mach_msg_type_name_t    		name;
+		    mach_msg_ool_ports_descriptor_t 	*dsc;
+		
+		    dsc = &saddr->ool_ports;
+
+		    /* this is really the type SEND, SEND_ONCE, etc. */
+		    name = dsc->disposition;
+		    dsc->disposition = ipc_object_copyin_type(name);
+	    	
+		    objects = (ipc_object_t *) dsc->address;
+	    	
+		    for ( j = 0; j < dsc->count; j++) {
+		        ipc_object_t object = objects[j];
+		        
+		        if (!IO_VALID(object))
+			    continue;
+		        
+		        ipc_object_copyin_from_kernel(object, name);
+    
+		        if ((dsc->disposition == MACH_MSG_TYPE_PORT_RECEIVE) &&
+			    ipc_port_check_circularity(
+						       (ipc_port_t) object,
+						       (ipc_port_t) remote))
+			    kmsg->ikm_header->msgh_bits |= MACH_MSGH_BITS_CIRCULAR;
+		    }
+		    break;
+	        }
+	        default: {
+		}
+	    }
+	}
+    }
+}
+
+/*
+ *	Routine:	ipc_kmsg_copyout_header
+ *	Purpose:
+ *		"Copy-out" port rights in the header of a message.
+ *		Operates atomically; if it doesn't succeed the
+ *		message header and the space are left untouched.
+ *		If it does succeed the remote/local port fields
+ *		contain port names instead of object pointers,
+ *		and the bits field is updated.
+ *
+ *		The notify argument implements the MACH_RCV_NOTIFY option.
+ *		If it is not MACH_PORT_NULL, it should name a receive right.
+ *		If the process of receiving the reply port creates a
+ *		new right in the receiving task, then the new right is
+ *		automatically registered for a dead-name notification,
+ *		with the notify port supplying the send-once right.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	Copied out port rights.
+ *		MACH_RCV_INVALID_NOTIFY	
+ *			Notify is non-null and doesn't name a receive right.
+ *			(Either KERN_INVALID_NAME or KERN_INVALID_RIGHT.)
+ *		MACH_RCV_HEADER_ERROR|MACH_MSG_IPC_SPACE
+ *			The space is dead.
+ *		MACH_RCV_HEADER_ERROR|MACH_MSG_IPC_SPACE
+ *			No room in space for another name.
+ *		MACH_RCV_HEADER_ERROR|MACH_MSG_IPC_KERNEL
+ *			Couldn't allocate memory for the reply port.
+ *		MACH_RCV_HEADER_ERROR|MACH_MSG_IPC_KERNEL
+ *			Couldn't allocate memory for the dead-name request.
+ */
+
+static mach_msg_return_t
+ipc_kmsg_copyout_header(
+	mach_msg_header_t	*msg,
+	ipc_space_t		space,
+	mach_msg_option_t option __unused)
+{
+	mach_msg_bits_t mbits = msg->msgh_bits;
+	ipc_port_t dest = (ipc_port_t) msg->msgh_remote_port;
+
+	assert(IP_VALID(dest));
+
+    {
+	mach_msg_type_name_t dest_type = MACH_MSGH_BITS_REMOTE(mbits);
+	mach_msg_type_name_t reply_type = MACH_MSGH_BITS_LOCAL(mbits);
+	ipc_port_t reply = (ipc_port_t) msg->msgh_local_port;
+	mach_port_name_t dest_name, reply_name;
+
+	if (IP_VALID(reply)) {
+		ipc_entry_t entry;
+		kern_return_t kr;
+		ipc_port_t notify_port = IP_NULL;
+
+		/*
+		 *	Handling notify (for MACH_RCV_NOTIFY) is tricky.
+		 *	The problem is atomically making a send-once right
+		 *	from the notify port and installing it for a
+		 *	dead-name request in the new entry, because this
+		 *	requires two port locks (on the notify port and
+		 *	the reply port).  However, we can safely make
+		 *	and consume send-once rights for the notify port
+		 *	as long as we hold the space locked.  This isn't
+		 *	an atomicity problem, because the only way
+		 *	to detect that a send-once right has been created
+		 *	and then consumed if it wasn't needed is by getting
+		 *	at the receive right to look at ip_sorights, and
+		 *	because the space is write-locked status calls can't
+		 *	lookup the notify port receive right.  When we make
+		 *	the send-once right, we lock the notify port,
+		 *	so any status calls in progress will be done.
+		 */
+
+		is_write_lock(space);
+
+		for (;;) {
+			ipc_port_request_index_t request;
+
+			if (!space->is_active) {
+				is_write_unlock(space);
+				return (MACH_RCV_HEADER_ERROR|
+					MACH_MSG_IPC_SPACE);
+			}
+
+			if ((reply_type != MACH_MSG_TYPE_PORT_SEND_ONCE) &&
+			    ipc_right_reverse(space, (ipc_object_t) reply,
+					      &reply_name, &entry)) {
+				/* reply port is locked and active */
+
+				/*
+				 *	We don't need the notify_port
+				 *	send-once right, but we can't release
+				 *	it here because reply port is locked.
+				 *	Wait until after the copyout to
+				 *	release the notify port right.
+				 */
+
+				assert(entry->ie_bits &
+					   MACH_PORT_TYPE_SEND_RECEIVE);
+				break;
+			}
+
+			ip_lock(reply);
+			if (!ip_active(reply)) {
+				ip_unlock(reply);
+				ip_release(reply);
+
+				ip_lock(dest);
+				is_write_unlock(space);
+
+				reply = IP_DEAD;
+				reply_name = MACH_PORT_NAME_DEAD;
+				goto copyout_dest;
+			}
+			ip_unlock(reply);
+			is_write_unlock(space);
+			reply_name = MACH_PORT_NAME_NULL;
+			kr = ipc_entry_get(space,
+				reply_type == MACH_MSG_TYPE_PORT_SEND_ONCE,
+							   &reply_name, &entry);
+
+			if (kr != KERN_SUCCESS) {
+
+				if (kr == KERN_RESOURCE_SHORTAGE)
+					return (MACH_RCV_HEADER_ERROR|
+							MACH_MSG_IPC_KERNEL);
+				else
+					return (MACH_RCV_HEADER_ERROR|
+							MACH_MSG_IPC_SPACE);
+			}
+
+			assert(IE_BITS_TYPE(entry->ie_bits)
+						== MACH_PORT_TYPE_NONE);
+			assert(entry->ie_object == IO_NULL);
+			is_write_lock(space);
+			ip_lock(reply);
+			if (notify_port == IP_NULL) {
+				ip_reference(reply);	/* hold onto the reply port */
+				/* not making dead name request */
+				entry->ie_object = (ipc_object_t) reply;
+				break;
+			}
+			kr = ipc_port_dnrequest(reply, reply_name,
+						notify_port, &request);
+			if (kr != KERN_SUCCESS) {
+				is_write_unlock(space);
+
+				ipc_entry_close(space, reply_name);
+
+				ip_lock(reply);
+				if (!ip_active(reply)) {
+					/* will fail next time around loop */
+
+					ip_unlock(reply);
+					is_write_lock(space);
+					continue;
+				}
+
+				kr = ipc_port_dngrow(reply, ITS_SIZE_NONE);
+				/* port is unlocked */
+				if (kr != KERN_SUCCESS)
+					return (MACH_RCV_HEADER_ERROR|
+						MACH_MSG_IPC_KERNEL);
+
+				is_write_lock(space);
+				continue;
+			}
+			is_write_lock(space);
+			ip_lock(reply);
+			ip_reference(reply);	/* hold onto the reply port */
+			entry->ie_object = (ipc_object_t) reply;
+			entry->ie_request = request;
+			break;
+		}
+
+		/* space and reply port are locked and active */
+
+		ip_reference(reply);	/* hold onto the reply port */
+
+		mtx_assert(&reply->port_comm.rcd_io_lock_data, MA_OWNED);
+		kr = ipc_right_copyout(space, reply_name, entry,
+				       reply_type, (ipc_object_t) reply);
+		/* reply port is unlocked */
+		assert(kr == KERN_SUCCESS);
+
+		ip_lock(dest);
+		is_write_unlock(space);
+	} else {
+		/*
+		 *	No reply port!  This is an easy case.
+		 *	We only need to have the space locked
+		 *	when checking notify and when locking
+		 *	the destination (to ensure atomicity).
+		 */
+
+		is_read_lock(space);
+		if (!space->is_active) {
+			is_read_unlock(space);
+			return MACH_RCV_HEADER_ERROR|MACH_MSG_IPC_SPACE;
+		}
+
+		ip_lock(dest);
+		is_read_unlock(space);
+
+		reply_name = CAST_MACH_PORT_TO_NAME(reply);
+	}
+
+	/*
+	 *	At this point, the space is unlocked and the destination
+	 *	port is locked.  (Lock taken while space was locked.)
+	 *	reply_name is taken care of; we still need dest_name.
+	 *	We still hold a ref for reply (if it is valid).
+	 *
+	 *	If the space holds receive rights for the destination,
+	 *	we return its name for the right.  Otherwise the task
+	 *	managed to destroy or give away the receive right between
+	 *	receiving the message and this copyout.  If the destination
+	 *	is dead, return MACH_PORT_DEAD, and if the receive right
+	 *	exists somewhere else (another space, in transit)
+	 *	return MACH_PORT_NULL.
+	 *
+	 *	Making this copyout operation atomic with the previous
+	 *	copyout of the reply port is a bit tricky.  If there was
+	 *	no real reply port (it wasn't IP_VALID) then this isn't
+	 *	an issue.  If the reply port was dead at copyout time,
+	 *	then we are OK, because if dest is dead we serialize
+	 *	after the death of both ports and if dest is alive
+	 *	we serialize after reply died but before dest's (later) death.
+	 *	So assume reply was alive when we copied it out.  If dest
+	 *	is alive, then we are OK because we serialize before
+	 *	the ports' deaths.  So assume dest is dead when we look at it.
+	 *	If reply dies/died after dest, then we are OK because
+	 *	we serialize after dest died but before reply dies.
+	 *	So the hard case is when reply is alive at copyout,
+	 *	dest is dead at copyout, and reply died before dest died.
+	 *	In this case pretend that dest is still alive, so
+	 *	we serialize while both ports are alive.
+	 *
+	 *	Because the space lock is held across the copyout of reply
+	 *	and locking dest, the receive right for dest can't move
+	 *	in or out of the space while the copyouts happen, so
+	 *	that isn't an atomicity problem.  In the last hard case
+	 *	above, this implies that when dest is dead that the
+	 *	space couldn't have had receive rights for dest at
+	 *	the time reply was copied-out, so when we pretend
+	 *	that dest is still alive, we can return MACH_PORT_NULL.
+	 *
+	 *	If dest == reply, then we have to make it look like
+	 *	either both copyouts happened before the port died,
+	 *	or both happened after the port died.  This special
+	 *	case works naturally if the timestamp comparison
+	 *	is done correctly.
+	 */
+
+    copyout_dest:
+
+	if (ip_active(dest)) {
+		ipc_object_copyout_dest(space, (ipc_object_t) dest,
+					dest_type, &dest_name);
+		/* dest is unlocked */
+	} else {
+		ipc_port_timestamp_t timestamp;
+
+		timestamp = dest->ip_timestamp;
+		ip_unlock(dest);
+		ip_release(dest);
+
+		if (IP_VALID(reply)) {
+			ip_lock(reply);
+			if (ip_active(reply) ||
+			    IP_TIMESTAMP_ORDER(timestamp,
+					       reply->ip_timestamp))
+				dest_name = MACH_PORT_NAME_DEAD;
+			else
+				dest_name = MACH_PORT_NAME_NULL;
+			ip_unlock(reply);
+		} else
+			dest_name = MACH_PORT_NAME_DEAD;
+	}
+
+	if (IP_VALID(reply))
+		ipc_port_release(reply);
+
+	msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
+			  MACH_MSGH_BITS(reply_type, dest_type));
+	msg->msgh_local_port = CAST_MACH_NAME_TO_PORT(dest_name);
+	msg->msgh_remote_port = CAST_MACH_NAME_TO_PORT(reply_name);
+    }
+
+	return MACH_MSG_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_kmsg_copyout_object
+ *	Purpose:
+ *		Copy-out a port right.  Always returns a name,
+ *		even for unsuccessful return codes.  Always
+ *		consumes the supplied object.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	The space acquired the right
+ *			(name is valid) or the object is dead (MACH_PORT_DEAD).
+ *		MACH_MSG_IPC_SPACE	No room in space for the right,
+ *			or the space is dead.  (Name is MACH_PORT_NULL.)
+ *		MACH_MSG_IPC_KERNEL	Kernel resource shortage.
+ *			(Name is MACH_PORT_NULL.)
+ */
+
+static mach_msg_return_t
+ipc_kmsg_copyout_object(
+	ipc_space_t		space,
+	ipc_object_t		object,
+	mach_msg_type_name_t	msgt_name,
+	mach_port_name_t		*namep)
+{
+	kern_return_t kr;
+
+	if (!IO_VALID(object)) {
+		*namep = CAST_MACH_PORT_TO_NAME(object);
+		return MACH_MSG_SUCCESS;
+	}
+
+	kr = ipc_object_copyout(space, object, msgt_name, namep);
+	if (kr != KERN_SUCCESS) {
+		if (msgt_name != 0) {
+			ipc_object_destroy(object, msgt_name);
+
+			if (kr == KERN_INVALID_CAPABILITY)
+				*namep = MACH_PORT_NAME_DEAD;
+			else {
+				*namep = MACH_PORT_NAME_NULL;
+
+				if (kr == KERN_RESOURCE_SHORTAGE)
+					return MACH_MSG_IPC_KERNEL;
+				else
+					return MACH_MSG_IPC_SPACE;
+			}
+		} else
+			return kr;
+	}
+
+	return MACH_MSG_SUCCESS;
+}
+
+static mach_msg_descriptor_t *
+ipc_kmsg_copyout_port_descriptor(mach_msg_descriptor_t *dsc,
+        mach_msg_descriptor_t *dest_dsc,
+        ipc_space_t space,
+	    kern_return_t *mr)
+{
+    mach_port_t			port;
+    mach_port_name_t		name;
+    mach_msg_type_name_t		disp;
+
+
+    /* Copyout port right carried in the message */
+    port = dsc->port.name;
+    disp = dsc->port.disposition;
+    *mr |= ipc_kmsg_copyout_object(space, 
+            (ipc_object_t)port, 
+            disp, 
+			&name);
+
+	MDPRINTF(("ipc_kmsg_copyout_port_descriptor name is %d\n",name));
+    if(current_task() == kernel_task)
+    {
+        mach_msg_port_descriptor_t *user_dsc = (mach_msg_port_descriptor_t *)dest_dsc;
+        user_dsc--; // point to the start of this port descriptor
+        user_dsc->name = CAST_MACH_NAME_TO_PORT(name);
+        user_dsc->disposition = disp;
+        user_dsc->type = MACH_MSG_PORT_DESCRIPTOR;
+        dest_dsc = (mach_msg_descriptor_t *)user_dsc;
+    } else {
+        mach_msg_legacy_port_descriptor_t *user_dsc = (mach_msg_legacy_port_descriptor_t *)dest_dsc;
+        user_dsc--; // point to the start of this port descriptor
+        user_dsc->name = name;
+        user_dsc->disposition = disp;
+        user_dsc->type = MACH_MSG_PORT_DESCRIPTOR;
+        dest_dsc = (mach_msg_descriptor_t *)user_dsc;
+    }
+
+    return (mach_msg_descriptor_t *)dest_dsc;
+}
+
+static mach_msg_descriptor_t *
+ipc_kmsg_copyout_ool_descriptor(mach_msg_ool_descriptor_t *dsc, mach_msg_descriptor_t *user_dsc, int is_lp64, vm_map_t map, mach_msg_return_t *mr)
+{
+	vm_offset_t			rcv_addr;
+	vm_map_copy_t map_copy;
+	mach_msg_copy_options_t		copy_options;
+	mach_msg_size_t size;
+	kern_return_t kr;
+	mach_msg_ool_descriptor_t *user_ool_dsc;
+
+	//SKIP_PORT_DESCRIPTORS(sstart, send);
+
+	assert(dsc->copy != MACH_MSG_KALLOC_COPY_T);
+	assert(dsc->copy != MACH_MSG_PAGE_LIST_COPY_T);
+
+	copy_options = dsc->copy;
+	size = dsc->size;
+	rcv_addr = 0;
+
+	if ((map_copy = (vm_map_copy_t) dsc->address) != VM_MAP_COPY_NULL) {
+		/*
+		 * Whether the data was virtually or physically
+		 * copied we have a vm_map_copy_t for it.
+		 * If there's an overwrite region specified
+		 * overwrite it, otherwise do a virtual copy out.
+		 */
+		kr = vm_map_copyout(map, &rcv_addr, map_copy);
+		if (kr != KERN_SUCCESS) {
+			if (kr == KERN_RESOURCE_SHORTAGE)
+				*mr |= MACH_MSG_VM_KERNEL;
+			else
+				*mr |= MACH_MSG_VM_SPACE;
+			vm_map_copy_discard(map_copy);
+			rcv_addr = 0;
+			size = 0;
+		}
+
+	} else {
+		size = 0;
+	}
+    /*
+     * Now update the descriptor as the user would see it.
+     * This may require expanding the descriptor to the user
+     * visible size.  There is already space allocated for
+     * this in what naddr points to.
+     */
+	user_ool_dsc = (mach_msg_ool_descriptor_t *)user_dsc;
+	user_ool_dsc--;
+	user_ool_dsc->address = (void *)rcv_addr;
+	user_ool_dsc->size = size;
+	user_ool_dsc->type = MACH_MSG_OOL_DESCRIPTOR;
+	user_ool_dsc->copy = copy_options;
+	user_ool_dsc->deallocate = (copy_options == MACH_MSG_VIRTUAL_COPY) ? TRUE : FALSE;
+	user_dsc = (mach_msg_descriptor_t *)user_ool_dsc;
+
+	return (user_dsc);
+}
+
+
+static mach_msg_descriptor_t *
+ipc_kmsg_copyout_ool_ports_descriptor(mach_msg_ool_ports_descriptor_t *dsc,
+        mach_msg_descriptor_t *user_dsc,
+        int is_64bit __unused,
+        vm_map_t map,
+        ipc_space_t space,
+        ipc_kmsg_t kmsg,
+		mach_msg_return_t *mr)
+{
+	vm_offset_t            		addr;
+	mach_port_t            		*objects;
+	mach_port_name_t            *names;
+	mach_msg_type_number_t 		j, count;
+	mach_msg_type_name_t 		disp;
+	vm_size_t           		plength, pnlength;
+	mach_msg_ool_ports_descriptor_t *user_ool_dsc;
+	kern_return_t kr;
+
+	disp = dsc->disposition;
+	count = dsc->count;
+	plength = count * sizeof(mach_port_t);
+	pnlength = count * sizeof(mach_port_name_t);
+
+	if (plength != 0 && dsc->address != 0) {
+		/*
+		 * Dynamically allocate the region
+		 */
+		dsc->copy = MACH_MSG_ALLOCATE;
+		if ((kr = mach_vm_allocate(map, &addr, pnlength, VM_FLAGS_ANYWHERE)) !=
+			KERN_SUCCESS) {
+			/* check that the memory has been freed */
+			ipc_kmsg_clean_body(kmsg, 1, (mach_msg_descriptor_t *)dsc);
+			dsc->address = 0;
+
+			if (kr == KERN_RESOURCE_SHORTAGE){
+				*mr |= MACH_MSG_VM_KERNEL;
+			} else {
+				*mr |= MACH_MSG_VM_SPACE;
+			}
+		}
+		if (addr != 0) {
+			objects = (mach_port_t *) dsc->address;
+            names = (mach_port_name_t *) dsc->address;
+
+            /* copyout port rights carried in the message */
+
+            for ( j = 0; j < count ; j++) {
+                ipc_object_t object = (ipc_object_t)objects[j];
+
+                *mr |= ipc_kmsg_copyout_object(space, object,
+											   disp, &names[j]);
+            }
+
+            /* copyout to memory allocated above */
+            void *data = dsc->address;
+            if (copyoutmap(map, data, addr, pnlength) != KERN_SUCCESS)
+                *mr |= MACH_MSG_VM_SPACE;
+            free(data, M_MACH_TMP);
+		}
+	} else
+		addr = 0;
+
+	user_ool_dsc = (mach_msg_ool_ports_descriptor_t *)user_dsc;
+	user_ool_dsc--;
+
+	user_ool_dsc->address = (void *)addr;
+	user_ool_dsc->deallocate = TRUE;
+	user_ool_dsc->copy = MACH_MSG_VIRTUAL_COPY;
+	user_ool_dsc->type = MACH_MSG_OOL_PORTS_DESCRIPTOR;
+	user_ool_dsc->disposition = disp;
+	user_ool_dsc->count = count;
+
+	user_dsc = (mach_msg_descriptor_t *)user_ool_dsc;
+
+	return user_dsc;
+}
+
+/*
+ *	Routine:	ipc_kmsg_copyout_body
+ *	Purpose:
+ *		"Copy-out" port rights and out-of-line memory
+ *		in the body of a message.
+ *
+ *		The error codes are a combination of special bits.
+ *		The copyout proceeds despite errors.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	Successful copyout.
+ *		MACH_MSG_IPC_SPACE	No room for port right in name space.
+ *		MACH_MSG_VM_SPACE	No room for memory in address space.
+ *		MACH_MSG_IPC_KERNEL	Resource shortage handling port right.
+ *		MACH_MSG_VM_KERNEL	Resource shortage handling memory.
+ *		MACH_MSG_INVALID_RT_DESCRIPTOR Descriptor incompatible with RT
+ */
+
+static mach_msg_return_t
+ipc_kmsg_copyout_body(
+	ipc_kmsg_t		kmsg,
+	ipc_space_t		space,
+	vm_map_t		map,
+	mach_msg_body_t		*slist)
+{
+    mach_msg_body_t 		*body;
+	mach_msg_descriptor_t	*kern_dsc, *user_dsc;
+    mach_msg_descriptor_t 	*saddr;
+    mach_msg_return_t 		mr = MACH_MSG_SUCCESS;
+	mach_msg_type_number_t	dsc_count, sdsc_count;
+	int i;
+
+	body = (mach_msg_body_t *) (kmsg->ikm_header + 1);
+	dsc_count = body->msgh_descriptor_count;
+    kern_dsc = (mach_msg_descriptor_t *) (body + 1);
+	user_dsc = &kern_dsc[dsc_count];
+
+    /*
+     * Do scatter list setup
+     */
+    if (slist != MACH_MSG_BODY_NULL) {
+		saddr = (mach_msg_descriptor_t *) (slist + 1);
+		sdsc_count = slist->msgh_descriptor_count;
+    }
+    else {
+		saddr = MACH_MSG_DESCRIPTOR_NULL;
+		sdsc_count = 0;
+    }
+
+    for (i = dsc_count-1; i >= 0; i--) {
+		switch (kern_dsc[i].type.type) {
+		case MACH_MSG_PORT_DESCRIPTOR:
+			user_dsc = ipc_kmsg_copyout_port_descriptor(kern_dsc + i, user_dsc, space, &mr);
+			break;
+		case MACH_MSG_OOL_VOLATILE_DESCRIPTOR:
+		case MACH_MSG_OOL_DESCRIPTOR:
+			/* ... */
+			user_dsc = ipc_kmsg_copyout_ool_descriptor(
+				(mach_msg_ool_descriptor_t *)&kern_dsc[i], user_dsc, TRUE, map, &mr);
+			break;
+		case MACH_MSG_OOL_PORTS_DESCRIPTOR:
+			/* ... */
+			user_dsc = ipc_kmsg_copyout_ool_ports_descriptor(
+				(mach_msg_ool_ports_descriptor_t *)&kern_dsc[i], user_dsc, TRUE, map, space, kmsg, &mr);
+			break;
+	    default : {
+		panic("untyped or unsupported IPC copyout body: invalid message descriptor");
+	    }
+	}
+    }
+	if(user_dsc != kern_dsc) {
+        vm_offset_t dsc_adjust = (vm_offset_t)user_dsc - (vm_offset_t)kern_dsc;
+		MDPRINTF(("dsc_adjust=%ld\n", dsc_adjust));
+        memmove((char *)((vm_offset_t)kmsg->ikm_header + dsc_adjust), kmsg->ikm_header, sizeof(mach_msg_base_t));
+        kmsg->ikm_header = (mach_msg_header_t *)((vm_offset_t)kmsg->ikm_header + dsc_adjust);
+        /* Update the message size for the smaller user representation */
+        kmsg->ikm_header->msgh_size -= (mach_msg_size_t)dsc_adjust;
+    }
+    return mr;
+}
+
+/*
+ *	Routine:	ipc_kmsg_copyout_size
+ *	Purpose:
+ *		Compute the size of the message as copied out to the given
+ *		map. If the destination map's pointers are a different size
+ *		than the kernel's, we have to allow for expansion/
+ *		contraction of the descriptors as appropriate.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		size of the message as it would be received.
+ */
+
+mach_msg_size_t
+ipc_kmsg_copyout_size(
+	ipc_kmsg_t		kmsg,
+	vm_map_t		map)
+{
+    mach_msg_size_t		send_size;
+
+    send_size = kmsg->ikm_header->msgh_size;
+#ifdef notyet
+    boolean_t is_task_64bit = (map->max_offset > VM_MAX_ADDRESS);
+#else
+    boolean_t is_task_64bit = TRUE;
+#endif
+
+#if defined(__LP64__)
+	send_size -= LEGACY_HEADER_SIZE_DELTA;
+#endif
+	MDPRINTF(("ipc_kmsg_copyout_size() is_task_64bit=%d -> send_size=%d msgh_bits=0x%x delta=%d\n",
+			  is_task_64bit, send_size, kmsg->ikm_header->msgh_bits, LEGACY_HEADER_SIZE_DELTA));
+    if (kmsg->ikm_header->msgh_bits & MACH_MSGH_BITS_COMPLEX) {
+        mach_msg_body_t *body;
+        mach_msg_descriptor_t *saddr, *eaddr;
+
+
+        body = (mach_msg_body_t *) (kmsg->ikm_header + 1);
+        saddr = (mach_msg_descriptor_t *) (body + 1);
+        eaddr = saddr + body->msgh_descriptor_count;
+
+        for ( ; saddr < eaddr; saddr++ ) {
+            switch (saddr->type.type) {
+                case MACH_MSG_OOL_DESCRIPTOR:
+                case MACH_MSG_OOL_VOLATILE_DESCRIPTOR:
+                case MACH_MSG_OOL_PORTS_DESCRIPTOR:
+                    if(!is_task_64bit)
+                        send_size -= DESC_SIZE_ADJUSTMENT;
+                    break;
+				case MACH_MSG_PORT_DESCRIPTOR:
+                    send_size -= DESC_SIZE_ADJUSTMENT;
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+    return send_size;
+}
+
+/*
+ *	Routine:	ipc_kmsg_copyout
+ *	Purpose:
+ *		"Copy-out" port rights and out-of-line memory
+ *		in the message.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	Copied out all rights and memory.
+ *		MACH_RCV_INVALID_NOTIFY	Bad notify port.
+ *			Rights and memory in the message are intact.
+ *		MACH_RCV_HEADER_ERROR + special bits
+ *			Rights and memory in the message are intact.
+ *		MACH_RCV_BODY_ERROR + special bits
+ *			The message header was successfully copied out.
+ *			As much of the body was handled as possible.
+ */
+
+mach_msg_return_t
+ipc_kmsg_copyout(
+	ipc_kmsg_t		kmsg,
+	ipc_space_t		space,
+	vm_map_t		map,
+	mach_msg_body_t		*slist,
+	mach_msg_option_t option __unused)
+{
+	mach_msg_return_t mr;
+
+	mr = ipc_kmsg_copyout_header(kmsg->ikm_header, space, 0);
+	if (mr != MACH_MSG_SUCCESS)
+		return mr;
+
+	if (kmsg->ikm_header->msgh_bits & MACH_MSGH_BITS_COMPLEX) {
+		mr = ipc_kmsg_copyout_body(kmsg, space, map, slist);
+
+		if (mr != MACH_MSG_SUCCESS)
+			mr |= MACH_RCV_BODY_ERROR;
+	}
+
+	return mr;
+}
+
+/*
+ *	Routine:	ipc_kmsg_copyout_pseudo
+ *	Purpose:
+ *		Does a pseudo-copyout of the message.
+ *		This is like a regular copyout, except
+ *		that the ports in the header are handled
+ *		as if they are in the body.  They aren't reversed.
+ *
+ *		The error codes are a combination of special bits.
+ *		The copyout proceeds despite errors.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	Successful copyout.
+ *		MACH_MSG_IPC_SPACE	No room for port right in name space.
+ *		MACH_MSG_VM_SPACE	No room for memory in address space.
+ *		MACH_MSG_IPC_KERNEL	Resource shortage handling port right.
+ *		MACH_MSG_VM_KERNEL	Resource shortage handling memory.
+ */
+
+mach_msg_return_t
+ipc_kmsg_copyout_pseudo(
+	ipc_kmsg_t		kmsg,
+	ipc_space_t		space,
+	vm_map_t		map,
+	mach_msg_body_t		*slist)
+{
+	mach_msg_bits_t mbits = kmsg->ikm_header->msgh_bits;
+	ipc_object_t dest = (ipc_object_t) kmsg->ikm_header->msgh_remote_port;
+	ipc_object_t reply = (ipc_object_t) kmsg->ikm_header->msgh_local_port;
+	mach_msg_type_name_t dest_type = MACH_MSGH_BITS_REMOTE(mbits);
+	mach_msg_type_name_t reply_type = MACH_MSGH_BITS_LOCAL(mbits);
+	mach_port_name_t dest_name, reply_name;
+	mach_msg_return_t mr;
+
+	assert(IO_VALID(dest));
+
+	mr = (ipc_kmsg_copyout_object(space, dest, dest_type, &dest_name) |
+	      ipc_kmsg_copyout_object(space, reply, reply_type, &reply_name));
+
+	kmsg->ikm_header->msgh_bits = mbits &~ MACH_MSGH_BITS_CIRCULAR;
+	kmsg->ikm_header->msgh_remote_port = CAST_MACH_NAME_TO_PORT(dest_name);
+	kmsg->ikm_header->msgh_local_port = CAST_MACH_NAME_TO_PORT(reply_name);
+
+	if (mbits & MACH_MSGH_BITS_COMPLEX) {
+		mr |= ipc_kmsg_copyout_body(kmsg, space, map, slist);
+	}
+
+	return mr;
+}
+
+/*
+ *	Routine:	ipc_kmsg_copyout_dest
+ *	Purpose:
+ *		Copies out the destination port in the message.
+ *		Destroys all other rights and memory in the message.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_kmsg_copyout_dest(
+	ipc_kmsg_t	kmsg,
+	ipc_space_t	space)
+{
+	mach_msg_bits_t mbits;
+	ipc_object_t dest;
+	ipc_object_t reply;
+	mach_msg_type_name_t dest_type;
+	mach_msg_type_name_t reply_type;
+	mach_port_name_t dest_name, reply_name;
+
+	mbits = kmsg->ikm_header->msgh_bits;
+	dest = (ipc_object_t) kmsg->ikm_header->msgh_remote_port;
+	reply = (ipc_object_t) kmsg->ikm_header->msgh_local_port;
+	dest_type = MACH_MSGH_BITS_REMOTE(mbits);
+	reply_type = MACH_MSGH_BITS_LOCAL(mbits);
+
+	assert(IO_VALID(dest));
+
+	io_lock(dest);
+	if (io_active(dest)) {
+		ipc_object_copyout_dest(space, dest, dest_type, &dest_name);
+		/* dest is unlocked */
+	} else {
+		io_unlock(dest);
+		io_release(dest);
+		dest_name = MACH_PORT_NAME_DEAD;
+	}
+
+	if (IO_VALID(reply)) {
+		ipc_object_destroy(reply, reply_type);
+		reply_name = MACH_PORT_NAME_NULL;
+	} else
+		reply_name = CAST_MACH_PORT_TO_NAME(reply);
+
+	kmsg->ikm_header->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
+				      MACH_MSGH_BITS(reply_type, dest_type));
+	kmsg->ikm_header->msgh_local_port = CAST_MACH_NAME_TO_PORT(dest_name);
+	kmsg->ikm_header->msgh_remote_port = CAST_MACH_NAME_TO_PORT(reply_name);
+
+	if (mbits & MACH_MSGH_BITS_COMPLEX) {
+		mach_msg_body_t *body;
+
+		body = (mach_msg_body_t *) (kmsg->ikm_header + 1);
+		ipc_kmsg_clean_body(kmsg, body->msgh_descriptor_count, (mach_msg_descriptor_t *)(body + 1));
+	}
+}
+
+/*
+ *	Routine:	ipc_kmsg_check_scatter
+ *	Purpose:
+ *		Checks scatter and gather lists for consistency.
+ *		
+ *	Algorithm:
+ *		The gather is assumed valid since it has been copied in.
+ *		The scatter list has only been range checked.
+ *		Gather list descriptors are sequentially paired with scatter 
+ *		list descriptors, with port descriptors in either list ignored.
+ *		Descriptors are consistent if the type fileds match and size
+ *		of the scatter descriptor is less than or equal to the
+ *		size of the gather descriptor.  A MACH_MSG_ALLOCATE copy 
+ *		strategy in a scatter descriptor matches any size in the 
+ *		corresponding gather descriptor assuming they are the same type.
+ *		Either list may be larger than the other.  During the
+ *		subsequent copy out, excess scatter descriptors are ignored
+ *		and excess gather descriptors default to dynamic allocation.
+ *		
+ *		In the case of a size error, a new scatter list is formed
+ *		from the gather list copying only the size and type fields.
+ *		
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_MSG_SUCCESS		Lists are consistent
+ *		MACH_RCV_INVALID_TYPE		Scatter type does not match
+ *						gather type
+ *		MACH_RCV_SCATTER_SMALL		Scatter size less than gather
+ *						size
+ */
+
+mach_msg_return_t
+ipc_kmsg_check_scatter(
+	ipc_kmsg_t		kmsg,
+	mach_msg_option_t	option,
+	mach_msg_body_t		**slistp,
+	mach_msg_size_t		*sizep)
+{
+	mach_msg_body_t		*body;
+	mach_msg_descriptor_t 	*gstart, *gend;
+	mach_msg_descriptor_t 	*sstart, *send;
+	mach_msg_return_t 	mr = MACH_MSG_SUCCESS;
+
+	assert(*slistp != MACH_MSG_BODY_NULL);
+	assert(*sizep != 0);
+
+	body = (mach_msg_body_t *) (kmsg->ikm_header + 1);
+	gstart = (mach_msg_descriptor_t *) (body + 1);
+	gend = gstart + body->msgh_descriptor_count;
+
+	sstart = (mach_msg_descriptor_t *) (*slistp + 1);
+	send = sstart + (*slistp)->msgh_descriptor_count;
+
+	while (gstart < gend) {
+	    mach_msg_descriptor_type_t	g_type;
+
+	    /*
+	     * Skip port descriptors in gather list. 
+	     */
+	    g_type = gstart->type.type;
+	    if (g_type != MACH_MSG_PORT_DESCRIPTOR) {
+
+		/*
+	 	 * A scatter list with a 0 descriptor count is treated as an
+	 	 * automatic size mismatch.
+	 	 */
+		 if ((*slistp)->msgh_descriptor_count == 0) {
+			return(MACH_RCV_SCATTER_SMALL);
+		 }
+
+		/*
+		 * Skip port descriptors in  scatter list.
+		 */
+		while (sstart < send) {
+		    if (sstart->type.type != MACH_MSG_PORT_DESCRIPTOR)
+			break;
+		    sstart++;
+		}
+
+		/*
+		 * No more scatter descriptors, we're done
+		 */
+		if (sstart >= send) {
+		    break;
+		}
+
+		/*
+		 * Check type, copy and size fields
+		 */
+		if (g_type == MACH_MSG_OOL_DESCRIPTOR ||
+		    g_type == MACH_MSG_OOL_VOLATILE_DESCRIPTOR) {
+		    if (sstart->type.type != MACH_MSG_OOL_DESCRIPTOR &&
+			sstart->type.type != MACH_MSG_OOL_VOLATILE_DESCRIPTOR) {
+			return(MACH_RCV_INVALID_TYPE);
+		    }
+		    if (sstart->out_of_line.copy == MACH_MSG_OVERWRITE && 
+			gstart->out_of_line.size > sstart->out_of_line.size) {
+			    return(MACH_RCV_SCATTER_SMALL);
+		    }
+		}
+		else {
+		    if (sstart->type.type != MACH_MSG_OOL_PORTS_DESCRIPTOR) {
+			return(MACH_RCV_INVALID_TYPE);
+		    }
+		    if (sstart->ool_ports.copy == MACH_MSG_OVERWRITE &&
+			gstart->ool_ports.count > sstart->ool_ports.count) {
+			    return(MACH_RCV_SCATTER_SMALL);
+		    }
+		}
+	        sstart++;
+	    }
+	    gstart++;
+	}
+
+	return(mr);
+}
+
+/*
+ *	Routine:	ipc_kmsg_copyout_to_kernel
+ *	Purpose:
+ *		Copies out the destination and reply ports in the message.
+ *		Leaves all other rights and memory in the message alone.
+ *	Conditions:
+ *		Nothing locked.
+ *
+ *	Derived from ipc_kmsg_copyout_dest.
+ *	Use by mach_msg_rpc_from_kernel (which used to use copyout_dest).
+ *	We really do want to save rights and memory.
+ */
+
+void
+ipc_kmsg_copyout_to_kernel(
+	ipc_kmsg_t	kmsg,
+	ipc_space_t	space)
+{
+	ipc_object_t dest;
+	ipc_object_t reply;
+	mach_msg_type_name_t dest_type;
+	mach_msg_type_name_t reply_type;
+	mach_port_name_t dest_name, reply_name;
+
+	dest = (ipc_object_t) kmsg->ikm_header->msgh_remote_port;
+	reply = (ipc_object_t) kmsg->ikm_header->msgh_local_port;
+	dest_type = MACH_MSGH_BITS_REMOTE(kmsg->ikm_header->msgh_bits);
+	reply_type = MACH_MSGH_BITS_LOCAL(kmsg->ikm_header->msgh_bits);
+
+	assert(IO_VALID(dest));
+
+	io_lock(dest);
+	if (io_active(dest)) {
+		ipc_object_copyout_dest(space, dest, dest_type, &dest_name);
+		/* dest is unlocked */
+	} else {
+		io_unlock(dest);
+		io_release(dest);
+		dest_name = MACH_PORT_NAME_DEAD;
+	}
+
+	reply_name = CAST_MACH_PORT_TO_NAME(reply);
+
+	kmsg->ikm_header->msgh_bits =
+		(MACH_MSGH_BITS_OTHER(kmsg->ikm_header->msgh_bits) |
+					MACH_MSGH_BITS(reply_type, dest_type));
+	kmsg->ikm_header->msgh_local_port = CAST_MACH_NAME_TO_PORT(dest_name);
+	kmsg->ikm_header->msgh_remote_port = CAST_MACH_NAME_TO_PORT(reply_name);
+}
+
+
+#if	MACH_KDB
+#include <ddb/db_output.h>
+#include <sys/mach/ipc/ipc_print.h>
+
+
+/*
+ * Forward declarations
+ */
+void ipc_msg_print_untyped(
+	mach_msg_body_t		*body);
+
+char * ipc_type_name(
+	int		type_name,
+	boolean_t	received);
+
+void ipc_print_type_name(
+	int	type_name);
+
+char *
+msgh_bit_decode(
+	mach_msg_bits_t	bit);
+
+char *
+mm_copy_options_string(
+	mach_msg_copy_options_t	option);
+
+char *
+ipc_type_name(
+	int		type_name,
+	boolean_t	received)
+{
+	switch (type_name) {
+		case MACH_MSG_TYPE_PORT_NAME:
+		return "port_name";
+		
+		case MACH_MSG_TYPE_MOVE_RECEIVE:
+		if (received) {
+			return "port_receive";
+		} else {
+			return "move_receive";
+		}
+		
+		case MACH_MSG_TYPE_MOVE_SEND:
+		if (received) {
+			return "port_send";
+		} else {
+			return "move_send";
+		}
+		
+		case MACH_MSG_TYPE_MOVE_SEND_ONCE:
+		if (received) {
+			return "port_send_once";
+		} else {
+			return "move_send_once";
+		}
+		
+		case MACH_MSG_TYPE_COPY_SEND:
+		return "copy_send";
+		
+		case MACH_MSG_TYPE_MAKE_SEND:
+		return "make_send";
+		
+		case MACH_MSG_TYPE_MAKE_SEND_ONCE:
+		return "make_send_once";
+		
+		default:
+		return (char *) 0;
+	}
+}
+		
+void
+ipc_print_type_name(
+	int	type_name)
+{
+	char *name = ipc_type_name(type_name, TRUE);
+	if (name) {
+		printf("%s", name);
+	} else {
+		printf("type%d", type_name);
+	}
+}
+
+/*
+ * ipc_kmsg_print	[ debug ]
+ */
+void
+ipc_kmsg_print(
+	ipc_kmsg_t	kmsg)
+{
+	iprintf("kmsg=0x%x\n", kmsg);
+	iprintf("ikm_next=0x%x, prev=0x%x, size=%d",
+		kmsg->ikm_next,
+		kmsg->ikm_prev,
+		kmsg->ikm_size);
+
+	printf("\n");
+	ipc_msg_print(kmsg->ikm_header);
+}
+
+char *
+msgh_bit_decode(
+	mach_msg_bits_t	bit)
+{
+	switch (bit) {
+	    case MACH_MSGH_BITS_COMPLEX:	return "complex";
+	    case MACH_MSGH_BITS_CIRCULAR:	return "circular";
+	    case MACH_MSGH_BITS_RTALLOC:	return "rtalloc";
+	    default:				return (char *) 0;
+	}
+}
+
+/*
+ * ipc_msg_print	[ debug ]
+ */
+void
+ipc_msg_print(
+	mach_msg_header_t	*msgh)
+{
+	mach_msg_bits_t	mbits;
+	unsigned int	bit, i;
+	char		*bit_name;
+	int		needs_comma;
+
+	mbits = msgh->msgh_bits;
+	iprintf("msgh_bits=0x%x:  l=0x%x,r=0x%x\n",
+		mbits,
+		MACH_MSGH_BITS_LOCAL(msgh->msgh_bits),
+		MACH_MSGH_BITS_REMOTE(msgh->msgh_bits));
+
+	mbits = MACH_MSGH_BITS_OTHER(mbits) & ~MACH_MSGH_BITS_UNUSED;
+	indent += 2;
+	if (mbits)
+		iprintf("decoded bits:  ");
+	needs_comma = 0;
+	for (i = 0, bit = 1; i < sizeof(mbits) * 8; ++i, bit <<= 1) {
+		if ((mbits & bit) == 0)
+			continue;
+		bit_name = msgh_bit_decode((mach_msg_bits_t)bit);
+		if (bit_name)
+			printf("%s%s", needs_comma ? "," : "", bit_name);
+		else
+			printf("%sunknown(0x%x),", needs_comma ? "," : "", bit);
+		++needs_comma;
+	}
+	if (msgh->msgh_bits & MACH_MSGH_BITS_UNUSED) {
+		printf("%sunused=0x%x,", needs_comma ? "," : "",
+		       msgh->msgh_bits & MACH_MSGH_BITS_UNUSED);
+	}
+	printf("\n");
+	indent -= 2;
+
+	needs_comma = 1;
+	if (msgh->msgh_remote_port) {
+		iprintf("remote=0x%x(", msgh->msgh_remote_port);
+		ipc_print_type_name(MACH_MSGH_BITS_REMOTE(msgh->msgh_bits));
+		printf(")");
+	} else {
+		iprintf("remote=null");
+	}
+	if (msgh->msgh_local_port) {
+		printf("%slocal=0x%x(", needs_comma ? "," : "",
+		       msgh->msgh_local_port);
+		ipc_print_type_name(MACH_MSGH_BITS_LOCAL(msgh->msgh_bits));
+		printf(")\n");
+	} else {
+		printf("local=null\n");
+	}
+
+	iprintf("msgh_id=%d, size=%d\n",
+		msgh->msgh_id,
+		msgh->msgh_size);
+
+	if (mbits & MACH_MSGH_BITS_COMPLEX) {	
+		ipc_msg_print_untyped((mach_msg_body_t *) (msgh + 1));
+	}
+}
+
+
+char *
+mm_copy_options_string(
+	mach_msg_copy_options_t	option)
+{
+	char	*name;
+
+	switch (option) {
+	    case MACH_MSG_PHYSICAL_COPY:
+		name = "PHYSICAL";
+		break;
+	    case MACH_MSG_VIRTUAL_COPY:
+		name = "VIRTUAL";
+		break;
+	    case MACH_MSG_OVERWRITE:
+		name = "OVERWRITE";
+		break;
+	    case MACH_MSG_ALLOCATE:
+		name = "ALLOCATE";
+		break;
+	    case MACH_MSG_KALLOC_COPY_T:
+		name = "KALLOC_COPY_T";
+		break;
+	    case MACH_MSG_PAGE_LIST_COPY_T:
+		name = "PAGE_LIST_COPY_T";
+		break;
+	    default:
+		name = "unknown";
+		break;
+	}
+	return name;
+}
+
+void
+ipc_msg_print_untyped(
+	mach_msg_body_t		*body)
+{
+    mach_msg_descriptor_t	*saddr, *send;
+    mach_msg_descriptor_type_t	type;
+
+    iprintf("%d descriptors %d: \n", body->msgh_descriptor_count);
+
+    saddr = (mach_msg_descriptor_t *) (body + 1);
+    send = saddr + body->msgh_descriptor_count;
+
+    for ( ; saddr < send; saddr++ ) {
+	
+	type = saddr->type.type;
+
+	switch (type) {
+	    
+	    case MACH_MSG_PORT_DESCRIPTOR: {
+		mach_msg_port_descriptor_t *dsc;
+
+		dsc = &saddr->port;
+		iprintf("-- PORT name = 0x%x disp = ", dsc->name);
+		ipc_print_type_name(dsc->disposition);
+		printf("\n");
+		break;
+	    }
+	    case MACH_MSG_OOL_VOLATILE_DESCRIPTOR:
+	    case MACH_MSG_OOL_DESCRIPTOR: {
+		mach_msg_ool_descriptor_t *dsc;
+		
+		dsc = &saddr->out_of_line;
+		iprintf("-- OOL%s addr = 0x%x size = 0x%x copy = %s %s\n",
+			type == MACH_MSG_OOL_DESCRIPTOR ? "" : " VOLATILE",
+			dsc->address, dsc->size,
+			mm_copy_options_string(dsc->copy),
+			dsc->deallocate ? "DEALLOC" : "");
+		break;
+	    } 
+	    case MACH_MSG_OOL_PORTS_DESCRIPTOR : {
+		mach_msg_ool_ports_descriptor_t *dsc;
+
+		dsc = &saddr->ool_ports;
+
+		iprintf("-- OOL_PORTS addr = 0x%x count = 0x%x ",
+		          dsc->address, dsc->count);
+		printf("disp = ");
+		ipc_print_type_name(dsc->disposition);
+		printf(" copy = %s %s\n",
+		       mm_copy_options_string(dsc->copy),
+		       dsc->deallocate ? "DEALLOC" : "");
+		break;
+	    }
+
+	    default: {
+		iprintf("-- UNKNOWN DESCRIPTOR 0x%x\n", type);
+		break;
+	    }
+	}
+    }
+}
+#endif	/* MACH_KDB */


Property changes on: trunk/sys/compat/mach/ipc/ipc_kmsg.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/ipc_kobject.c
===================================================================
--- trunk/sys/compat/mach/ipc/ipc_kobject.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/ipc_kobject.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,603 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.10.3.4  92/05/27  00:46:06  jeffreyh
+ * 	Added ifdef MCMSG for nx_get/put_task_info
+ * 	[regnier at ssd.intel.com]
+ * 
+ * Revision 2.10.3.3  92/03/03  16:20:02  jeffreyh
+ * 	Add IKOT_PAGER_TERMINATING case to ipc_kobject_destroy.
+ * 	[92/02/25            dlb]
+ * 
+ * Revision 2.11  92/01/03  20:14:32  dbg
+ * 	Call <subsystem>_routine_name to find IPC stub to execute.
+ * 	Build reply message header by hand. (XXX)
+ * 	Simplify cleanup of request message when reply is success.
+ * 	[91/12/18            dbg]
+ * 
+ * Revision 2.10.3.2  92/02/21  11:23:50  jsb
+ * 	Shuffled xmm kobject cases in ipc_kobject_notify.
+ * 	[92/02/10  17:26:24  jsb]
+ * 
+ * Revision 2.10.3.1  92/01/21  21:50:42  jsb
+ * 	Removed debugging printf.
+ * 	[92/01/21  19:33:50  jsb]
+ * 
+ * 	Added ipc_kobject_notify for kernel-requested notifications.
+ * 	Added code to correctly release send-once kobject destinations.
+ * 	[92/01/21  18:20:19  jsb]
+ * 
+ * Revision 2.10  91/12/13  13:42:24  jsb
+ * 	Added support for norma/norma_internal.defs.
+ * 
+ * Revision 2.9  91/08/01  14:36:18  dbg
+ * 	Call machine-dependent interface routine, under
+ * 	MACH_MACHINE_ROUTINES.
+ * 	[91/08/01            dbg]
+ * 
+ * Revision 2.8  91/06/17  15:47:02  jsb
+ * 	Renamed NORMA conditionals. Added NORMA_VM support.
+ * 	[91/06/17  13:46:55  jsb]
+ * 
+ * Revision 2.7  91/06/06  17:07:05  jsb
+ * 	Added NORMA_TASK support.
+ * 	[91/05/14  09:05:48  jsb]
+ * 
+ * Revision 2.6  91/05/18  14:31:42  rpd
+ * 	Added check_simple_locks.
+ * 	[91/04/01            rpd]
+ * 
+ * Revision 2.5  91/05/14  16:42:00  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/03/16  14:50:02  rpd
+ * 	Replaced ith_saved with ikm_cache.
+ * 	[91/02/16            rpd]
+ * 
+ * Revision 2.3  91/02/05  17:26:37  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  16:12:51  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:54:08  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  23:46:53  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	kern/ipc_kobject.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Functions for letting a port represent a kernel object.
+ */
+
+#include <sys/mach/port.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/etap_macros.h>
+#if 0
+#include <kern/ipc_kobject.h>
+#include <kern/misc_protos.h>
+#endif
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_thread.h>
+
+#define vm_object_destroy(a)
+
+
+#pragma clang diagnostic ignored "-Wcast-qual"
+
+/*
+ *	Routine:	ipc_kobject_notify
+ *	Purpose:
+ *		Deliver notifications to kobjects that care about them.
+ */
+
+/* Forward Declarations */
+
+boolean_t
+ipc_kobject_notify(
+        mach_msg_header_t *request_header,
+        mach_msg_header_t *reply_header);
+
+#include <sys/mach/ndr.h>
+
+typedef struct {
+        mach_msg_id_t num;
+        mig_routine_t routine;
+	int size;
+#if	MACH_COUNTERS
+	mach_counter_t callcount;
+#endif
+} mig_hash_t;
+
+#define MAX_MIG_ENTRIES 1024
+#define MIG_HASH(x) (x)
+
+#ifndef max
+#define max(a,b)        (((a) > (b)) ? (a) : (b))
+#endif /* max */
+
+mig_hash_t mig_buckets[MAX_MIG_ENTRIES];
+int mig_table_max_displ;
+mach_msg_size_t mig_reply_size;
+
+#ifdef notyet
+#include <sys/mach/mach_server.h>
+#endif
+#include <sys/mach/clock_server.h>
+#include <sys/mach/host_priv_server.h>
+#include <sys/mach/mach_host_server.h>
+#include <sys/mach/mach_port_server.h>
+#include <sys/mach/mach_vm_server.h>
+#include <sys/mach/task_server.h>
+#include <sys/mach/vm_map_server.h>
+
+#if 0
+#include <sys/mach/bootstrap_server.h>
+#include <sys/mach/ledger_server.h>
+#include <sys/mach/sync_server.h>
+#include <device/device_server.h>
+#include <device/device_pager_server.h>
+#endif
+#if     MACH_DEBUG
+#include <mach_debug/mach_debug_server.h>
+#endif	/* MACH_DEBUG */
+#if     MACH_MACHINE_ROUTINES
+#include <machine/machine_routines.h>
+#endif	/* MACH_MACHINE_ROUTINES */
+
+rpc_subsystem_t mig_e[] = {
+#if 0	
+	(rpc_subsystem_t)&mach_subsystem,
+#endif
+	(rpc_subsystem_t)&clock_subsystem,	
+	(rpc_subsystem_t)&host_priv_subsystem,
+	(rpc_subsystem_t)&mach_host_subsystem,
+	(rpc_subsystem_t)&mach_port_subsystem,
+	(rpc_subsystem_t)&mach_vm_subsystem,
+	(rpc_subsystem_t)&task_subsystem,
+	(rpc_subsystem_t)&vm_map_subsystem,
+#if 0	
+	(rpc_subsystem_t)&clock_subsystem,
+	(rpc_subsystem_t)&do_bootstrap_subsystem,
+	(rpc_subsystem_t)&ds_device_subsystem,
+	(rpc_subsystem_t)&memory_object_subsystem,
+	(rpc_subsystem_t)&sync_subsystem,
+	(rpc_subsystem_t)&ledger_subsystem,
+#endif	
+#if     MACH_DEBUG
+        (rpc_subsystem_t)&mach_debug_subsystem,
+#endif  /* MACH_DEBUG */
+#if     MACH_MACHINE_ROUTINES
+        (rpc_subsystem_t)&MACHINE_SUBSYSTEM,
+#endif  /* MACH_MACHINE_ROUTINES */
+};
+
+void
+mig_init(void)
+	{
+	register unsigned int i, n = sizeof(mig_e)/sizeof(rpc_subsystem_t);
+    register unsigned int howmany;
+    register mach_msg_id_t j, pos, nentry, range;
+	
+    for (i = 0; i < n; i++) {
+	range = mig_e[i]->end - mig_e[i]->start;
+	if (!mig_e[i]->start || range < 0)
+			panic("the msgh_ids in mig_e[] aren't valid!");
+	mig_reply_size = max(mig_reply_size, mig_e[i]->maxsize);
+
+	for  (j = 0; j < range; j++) {
+	if (mig_e[i]->routine[j].stub_routine) { 
+				/* Only put real entries in the table */
+	nentry = j + mig_e[i]->start;	
+	for (pos = MIG_HASH(nentry) % MAX_MIG_ENTRIES, howmany = 1;
+	mig_buckets[pos].num; pos = (pos + 1) % MAX_MIG_ENTRIES, howmany++) {
+	if (mig_buckets[pos].num == nentry)
+		panic("multiple entries with the same msgh_id");	
+	if (howmany == MAX_MIG_ENTRIES)
+		panic("the mig dispatch table is too small");
+	}
+	
+	mig_buckets[pos].num = nentry;
+	mig_buckets[pos].routine = mig_e[i]->routine[j].stub_routine;
+	if (mig_e[i]->routine[j].max_reply_msg)
+		mig_buckets[pos].size = mig_e[i]->routine[j].max_reply_msg;
+	else
+		mig_buckets[pos].size = mig_e[i]->maxsize;
+	
+	mig_table_max_displ = max(howmany, mig_table_max_displ);
+	}
+	}
+    }
+}
+
+/*
+ *	Routine:	ipc_kobject_server
+ *	Purpose:
+ *		Handle a message sent to the kernel.
+ *		Generates a reply message.
+ *		Version for Untyped IPC.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+ipc_kmsg_t
+ipc_kobject_server(ipc_kmsg_t	request)
+{
+	mach_msg_size_t alloc_size, reply_size;
+	ipc_kmsg_t reply;
+	kern_return_t kr;
+	ipc_port_t *destp;
+	mach_msg_format_0_trailer_t *trailer;
+	register mig_hash_t *ptr;
+
+	/*
+	 * Find out corresponding mig_hash entry if any
+	 */
+	{
+		register int key = request->ikm_header->msgh_id;
+		register int i = MIG_HASH(key);
+		register int max_iter = mig_table_max_displ;
+	
+		do
+			ptr = &mig_buckets[i++ % MAX_MIG_ENTRIES];
+		while (key != ptr->num && ptr->num && --max_iter);
+
+		if (!ptr->routine || key != ptr->num) {
+			ptr = (mig_hash_t *)0;
+			reply_size = mig_reply_size;
+		} else {
+			reply_size = ptr->size;
+		}
+	}
+	alloc_size = reply_size;
+	/* round up for ikm_cache; overhead is added by ikm_alloc */
+	if ((alloc_size += MAX_TRAILER_SIZE) < IKM_SAVED_MSG_SIZE)
+		alloc_size = IKM_SAVED_MSG_SIZE;
+
+	reply = ipc_kmsg_alloc(alloc_size);
+
+	if (reply == IKM_NULL) {
+		printf("ipc_kobject_server: dropping request\n");
+		ipc_kmsg_destroy(request);
+		return IKM_NULL;
+	}
+	ikm_init_special(reply, reply_size);
+	/*
+	 * Initialize reply message.
+	 */
+	{
+#define	InP	((mach_msg_header_t *) request->ikm_header)
+#define	OutP	((mig_reply_error_t *) reply->ikm_header)
+
+		OutP->NDR = NDR_record;
+		OutP->Head.msgh_size = sizeof(mig_reply_error_t);
+
+		OutP->Head.msgh_bits =
+			MACH_MSGH_BITS(MACH_MSGH_BITS_LOCAL(InP->msgh_bits), 0);
+		OutP->Head.msgh_remote_port = InP->msgh_local_port;
+		OutP->Head.msgh_local_port  = MACH_PORT_NULL;
+		OutP->Head.msgh_voucher_port  = MACH_PORT_NAME_NULL;
+		OutP->Head.msgh_id = InP->msgh_id + 100;
+#undef	InP
+#undef	OutP
+	}
+
+/*
+ * Find the routine to call, and call it
+ * to perform the kernel function
+ */
+	{
+	    if (ptr)	
+			(*ptr->routine)(request->ikm_header, reply->ikm_header);
+	    else {
+			if (!ipc_kobject_notify(request->ikm_header, reply->ikm_header)){
+#if	MACH_IPC_TEST
+				printf("ipc_kobject_server: bogus kernel message, id=%d\n",
+					   request->ikm_header->msgh_id);
+#endif	/* MACH_IPC_TEST */
+				((mig_reply_error_t *) reply->ikm_header)->RetCode
+					= MIG_BAD_ID;
+			}
+	    }
+	}
+
+/*
+ *	Destroy destination. The following code differs from
+ *	ipc_object_destroy in that we release the send-once
+ *	right instead of generating a send-once notification
+ * 	(which would bring us here again, creating a loop).
+ *	It also differs in that we only expect send or
+ *	send-once rights, never receive rights.
+ *
+ *	We set msgh_remote_port to IP_NULL so that the kmsg
+ *	destroy routines don't try to destroy the port twice.
+ */
+	destp = (ipc_port_t *) &request->ikm_header->msgh_remote_port;
+	switch (MACH_MSGH_BITS_REMOTE(request->ikm_header->msgh_bits)) {
+	case MACH_MSG_TYPE_PORT_SEND:
+		ipc_port_release_send(*destp);
+		break;
+		
+	case MACH_MSG_TYPE_PORT_SEND_ONCE:
+		ipc_port_release_sonce(*destp);
+		break;
+		
+	default:
+		panic("ipc_object_destroy: strange destination rights");
+	}
+	*destp = IP_NULL;
+
+	if (!(reply->ikm_header->msgh_bits & MACH_MSGH_BITS_COMPLEX) &&
+		((mig_reply_error_t *) reply->ikm_header)->RetCode != KERN_SUCCESS)
+		kr = ((mig_reply_error_t *) reply->ikm_header)->RetCode;
+	else
+		kr = KERN_SUCCESS;
+
+	if ((kr == KERN_SUCCESS) || (kr == MIG_NO_REPLY)) {
+		/*
+		 *	The server function is responsible for the contents
+		 *	of the message.  The reply port right is moved
+		 *	to the reply message, and we have deallocated
+		 *	the destination port right, so we just need
+		 *	to free the kmsg.
+		 */
+
+		/*
+		 * Like ipc_kmsg_put, but without the copyout.  Also,
+		 * messages to the kernel will never have been allocated
+		 * from the rt_zone.
+		 */
+
+		ikm_free(request);
+	} else {
+		/*
+		 *	The message contents of the request are intact.
+		 *	Destroy everthing except the reply port right,
+		 *	which is needed in the reply message.
+		 */
+
+		request->ikm_header->msgh_local_port = MACH_PORT_NULL;
+		ipc_kmsg_destroy(request);
+	}
+
+	if (kr == MIG_NO_REPLY) {
+		/*
+		 *	The server function will send a reply message
+		 *	using the reply port right, which it has saved.
+		 */
+
+		ikm_free(reply);
+		return IKM_NULL;
+	} else if (!IP_VALID((ipc_port_t)reply->ikm_header->msgh_remote_port)) {
+		/*
+		 *	Can't queue the reply message if the destination
+		 *	(the reply port) isn't valid.
+		 */
+
+		ipc_kmsg_destroy(reply);
+		return IKM_NULL;
+	}
+
+	trailer = (mach_msg_format_0_trailer_t *)
+		((vm_offset_t)reply->ikm_header + (int)reply->ikm_header->msgh_size);
+	trailer->msgh_sender = KERNEL_SECURITY_TOKEN;
+	trailer->msgh_trailer_type = MACH_MSG_TRAILER_FORMAT_0;
+	trailer->msgh_trailer_size = MACH_MSG_TRAILER_MINIMUM_SIZE;
+	return reply;
+}
+
+/*
+ *	Routine:	ipc_kobject_set
+ *	Purpose:
+ *		Make a port represent a kernel object of the given type.
+ *		The caller is responsible for handling refs for the
+ *		kernel object, if necessary.
+ *	Conditions:
+ *		Nothing locked.  The port must be active.
+ */
+
+void
+ipc_kobject_set(
+	ipc_port_t		port,
+	ipc_kobject_t		kobject,
+	ipc_kobject_type_t	type)
+{
+	ip_lock(port);
+	assert(ip_active(port) || (ip_kotype(port) == IKOT_PAGER_TERMINATING));
+#if	MACH_ASSERT
+	port->ip_spares[2] = (port->ip_bits & IO_BITS_KOTYPE);
+#endif	/* MACH_ASSERT */
+	port->ip_bits = (port->ip_bits &~ IO_BITS_KOTYPE) | type;
+	port->ip_kobject = kobject;
+	ip_unlock(port);
+}
+
+/*
+ *	Routine:	ipc_kobject_destroy
+ *	Purpose:
+ *		Release any kernel object resources associated
+ *		with the port, which is being destroyed.
+ *
+ *		This should only be needed when resources are
+ *		associated with a user's port.  In the normal case,
+ *		when the kernel is the receiver, the code calling
+ *		ipc_port_dealloc_kernel should clean up the resources.
+ *	Conditions:
+ *		The port is not locked, but it is dead.
+ */
+
+void
+ipc_kobject_destroy(
+	ipc_port_t	port)
+{
+	switch (ip_kotype(port)) {
+	    case IKOT_PAGER:
+		vm_object_destroy(port);
+		break;
+
+	    case IKOT_PAGER_TERMINATING:
+		vm_object_pager_wakeup(port);
+		break;
+
+	    case IKOT_DEVICE:
+	    case IKOT_SEMAPHORE:
+	    case IKOT_LOCK_SET:
+		break;
+
+	    default:
+#if	MACH_ASSERT
+		printf("ipc_kobject_destroy: port 0x%x, kobj 0x%x, type %d\n",
+		       port, port->ip_kobject, ip_kotype(port));
+#endif	/* MACH_ASSERT */
+		break;
+	}
+}
+
+boolean_t
+ipc_kobject_notify(
+	mach_msg_header_t *request_header,
+	mach_msg_header_t *reply_header)
+{
+	ipc_port_t port = (ipc_port_t) request_header->msgh_remote_port;
+
+	((mig_reply_error_t *) reply_header)->RetCode = MIG_NO_REPLY;
+	switch (request_header->msgh_id) {
+		case MACH_NOTIFY_PORT_DELETED:
+		case MACH_NOTIFY_PORT_DESTROYED:
+		case MACH_NOTIFY_NO_SENDERS:
+		case MACH_NOTIFY_SEND_ONCE:
+		case MACH_NOTIFY_DEAD_NAME:
+		break;
+
+		default:
+		return FALSE;
+	}
+	switch (ip_kotype(port)) {
+		case IKOT_DEVICE:
+		return ds_notify(request_header);
+
+		case IKOT_MASTER_DEVICE:
+		return ds_master_notify(request_header);
+
+		default:
+                return FALSE;
+        }
+}
+
+#if	MACH_COUNTERS && MACH_KDB
+#include <mach_kdb.h>
+
+#include <ddb/db_output.h>
+#include <ddb/db_sym.h>
+
+#define printf  kdbprintf
+
+extern void kobjserver_stats(void);
+extern void bucket_stats_print(mig_hash_t *bucket);
+
+extern void kobjserver_stats_clear(void);
+
+
+void
+kobjserver_stats_clear(void)
+{
+	int i;
+	for (i = 0; i < MAX_MIG_ENTRIES; i++) {
+		mig_buckets[i].callcount = 0;
+	}
+}
+
+void
+kobjserver_stats(void)
+{
+    register unsigned int i, n = sizeof(mig_e)/sizeof(rpc_subsystem_t);
+    register unsigned int howmany;
+    register mach_msg_id_t j, pos, nentry, range;
+	
+    db_printf("Kobject server call counts:\n");
+    for (i = 0; i < n; i++) {
+	db_printf("  ");
+	db_printsym((vm_offset_t)mig_e[i], DB_STGY_ANY);
+	db_printf(":\n");
+	range = mig_e[i]->end - mig_e[i]->start;
+	if (!mig_e[i]->start || range < 0) continue;
+
+	for  (j = 0; j < range; j++) {
+	    nentry = j + mig_e[i]->start;	
+	    for (pos = MIG_HASH(nentry) % MAX_MIG_ENTRIES, howmany = 1;
+		 mig_buckets[pos].num;
+		 pos = ++pos % MAX_MIG_ENTRIES, howmany++) {
+		    if (mig_buckets[pos].num == nentry)
+			bucket_stats_print(&mig_buckets[pos]);
+	    }
+	}
+    }
+}
+
+void
+bucket_stats_print(mig_hash_t *bucket)
+{
+	if (bucket->callcount) {
+		db_printf("    ");
+		db_printsym((vm_offset_t)bucket->routine, DB_STGY_ANY);
+		db_printf(" (%d):\t%d\n", bucket->num, bucket->callcount);
+	}
+}
+
+#endif	/* MACH_COUNTERS && MACH_KDB */


Property changes on: trunk/sys/compat/mach/ipc/ipc_kobject.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/ipc_mqueue.c
===================================================================
--- trunk/sys/compat/mach/ipc/ipc_mqueue.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/ipc_mqueue.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,917 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.17.3.7  92/09/15  17:20:54  jeffreyh
+ * 	Added code to detect if a race condition was lost in the NORMA
+ * 	system  and our port is now a proxy (migrated out from under the
+ * 	thread), in which case we return MACH_RCV_PORT_CHANGED.
+ * 	[92/07/24            sjs]
+ * 
+ * Revision 2.17.3.6  92/06/24  17:59:57  jeffreyh
+ * 	Allow norma_ipc_send to fail.
+ * 	[92/06/02            dlb]
+ * 
+ * Revision 2.17.3.5  92/05/27  00:44:23  jeffreyh
+ * 	In ipc_mqueue_receive, check whether a kmsg got queued while we called
+ * 	netipc_replenish.
+ * 	[92/05/12            dlb]
+ * 
+ * Revision 2.17.3.4.2.1  92/04/28  16:01:59  jeffreyh
+ * 	Fixed race condition in NORMA system for ipc_mqueue_send().
+ * 	[92/04/16            sjs]
+ * 
+ * Revision 2.17.3.4  92/03/28  10:09:17  jeffreyh
+ * 	In error cases call norma_ipc_error_receiving instead
+ * 	of norma_ipc_finish receiving.  This may eat the kmsg.
+ * 	[92/03/20		dlb]
+ * 
+ * Revision 2.17.3.3  92/03/03  16:18:53  jeffreyh
+ * 	Changes from TRUNK
+ * 	[92/02/26  11:51:40  jeffreyh]
+ * 
+ * Revision 2.18  92/01/03  20:13:05  dbg
+ * 	Removed THREAD_SHOULD_TERMINATE.
+ * 	[91/12/19            dbg]
+ * 
+ * Revision 2.17.3.2  92/01/21  21:50:26  jsb
+ * 	Picked up hack from dlb at osf.org to call norma_ipc_finish_receiving
+ * 	before ipc_kmsg_destroy. The real fix is to use uncopyout_to_network.
+ * 	[92/01/17  14:35:03  jsb]
+ * 
+ * Revision 2.17.3.1  92/01/03  16:35:24  jsb
+ * 	Removed spurious arguments to norma_ipc_send.
+ * 	Options and timeout will be handled here, not by norma_ipc_send.
+ * 	[91/12/26  19:51:59  jsb]
+ * 
+ * 	Corrected log.
+ * 	[91/12/24  14:15:11  jsb]
+ *
+ * Revision 2.17  91/12/15  10:40:33  jsb
+ * 	Added norma_ipc_finish_receiving call to support large in-line msgs.
+ * 
+ * Revision 2.16  91/12/14  14:27:10  jsb
+ * 	Removed ipc_fields.h hack.
+ * 
+ * Revision 2.15  91/11/14  16:56:07  rpd
+ * 	Picked up mysterious norma changes.
+ * 	[91/11/14            rpd]
+ * 
+ * Revision 2.14  91/08/28  11:13:34  jsb
+ * 	Added seqno argument to ipc_mqueue_receive.
+ * 	Also added seqno processing to ipc_mqueue_send, ipc_mqueue_move.
+ * 	[91/08/10            rpd]
+ * 	Fixed norma_ipc_handoff technology.
+ * 	Renamed clport things to norma_ipc things.
+ * 	[91/08/15  08:23:17  jsb]
+ * 
+ * Revision 2.13  91/08/03  18:18:27  jsb
+ * 	Renamed replenish routine.
+ * 	[91/08/01  23:00:06  jsb]
+ * 
+ * 	Removed obsolete include.
+ * 	Added option, timeout parameters to ipc_clport_send.
+ * 	[91/07/17  14:04:15  jsb]
+ * 
+ * Revision 2.12  91/06/25  10:27:34  rpd
+ * 	Added some wait_result assertions.
+ * 	[91/05/30            rpd]
+ * 
+ * Revision 2.11  91/06/17  15:46:18  jsb
+ * 	Renamed NORMA conditionals.
+ * 	[91/06/17  10:44:39  jsb]
+ * 
+ * Revision 2.10  91/06/06  17:06:06  jsb
+ * 	Added call to ip_unlock after calling ipc_clport_send.
+ * 	Added support for clport handoff.
+ * 	[91/06/06  16:05:12  jsb]
+ * 
+ * Revision 2.9  91/05/14  16:33:58  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.8  91/03/16  14:48:18  rpd
+ * 	Renamed ipc_thread_{go,will_wait,will_wait_with_timeout}
+ * 	to thread_{go,will_wait,will_wait_with_timeout}.
+ * 	Replaced ipc_thread_block with thread_block.
+ * 	[91/02/17            rpd]
+ * 
+ * Revision 2.7  91/02/05  17:22:24  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:46:33  mrt]
+ * 
+ * Revision 2.6  91/01/08  15:14:35  rpd
+ * 	Changed continuation argument to (void (*)()).
+ * 	[90/12/18            rpd]
+ * 	Reorganized ipc_mqueue_receive.
+ * 	[90/11/22            rpd]
+ * 
+ * 	Minor cleanup.
+ * 	[90/11/11            rpd]
+ * 
+ * Revision 2.5  90/12/14  11:02:32  jsb
+ * 	Changed parameters in ipc_clport_send call.
+ * 	[90/12/13  21:20:13  jsb]
+ * 
+ * Revision 2.4  90/11/05  14:29:04  rpd
+ * 	Use new io_reference and io_release.
+ * 	Use new ip_reference and ip_release.
+ * 	[90/10/29            rpd]
+ * 
+ * Revision 2.3  90/09/28  16:54:58  jsb
+ * 	Added NORMA_IPC support.
+ * 	[90/09/28  14:03:24  jsb]
+ * 
+ * Revision 2.2  90/06/02  14:50:39  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  20:57:06  rpd]
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_mqueue.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Functions to manipulate IPC message queues.
+ */
+
+
+#include <sys/mach/port.h>
+#include <sys/mach/message.h>
+#include <sys/mach/ipc_kobject.h>
+
+#include <sys/mach/ipc/ipc_mqueue.h>
+#include <sys/mach/ipc/ipc_thread.h>
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_pset.h>
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/thread.h>
+
+
+/*
+ *	Routine:	ipc_mqueue_init
+ *	Purpose:
+ *		Initialize a newly-allocated message queue.
+ */
+
+void
+ipc_mqueue_init(
+	ipc_mqueue_t	mqueue)
+{
+	ipc_kmsg_queue_init(&mqueue->imq_messages);
+}
+
+/*
+ *	Routine:	ipc_mqueue_send
+ *	Purpose:
+ *		Send a message to a port.  The message holds a reference
+ *		for the destination port in the msgh_remote_port field.
+ *
+ *		If unsuccessful, the caller still has possession of
+ *		the message and must do something with it.  If successful,
+ *		the message is queued, given to a receiver, destroyed,
+ *		or handled directly by the kernel via mach_msg.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	The message was accepted.
+ *		MACH_SEND_TIMED_OUT	Caller still has message.
+ *		MACH_SEND_INTERRUPTED	Caller still has message.
+ */
+
+mach_msg_return_t
+ipc_mqueue_send(
+	ipc_kmsg_t		kmsg,
+	mach_msg_option_t	option,
+	mach_msg_timeout_t	timeout)
+{
+	ipc_port_t port;
+	kern_return_t           save_wait_result;
+	ipc_thread_t self = current_thread();
+
+	port = (ipc_port_t) kmsg->ikm_header->msgh_remote_port;
+	assert(IP_VALID(port));
+	MACH_VERIFY(io_otype((ipc_object_t)port) == IOT_PORT, ("bad type %d\n", io_otype((ipc_object_t)port)));
+	assert(io_otype((ipc_object_t)port) == IOT_PORT);
+
+	ip_lock(port);
+
+	if (port->ip_receiver == ipc_space_kernel) {
+		ipc_kmsg_t reply;
+
+		/*
+		 *	We can check ip_receiver == ipc_space_kernel
+		 *	before checking that the port is active because
+		 *	ipc_port_dealloc_kernel clears ip_receiver
+		 *	before destroying a kernel port.
+		 */
+
+		assert(ip_active(port));
+		ip_unlock(port);
+
+		reply = ipc_kobject_server(kmsg);
+		if (reply != IKM_NULL) {
+			self->ith_kmsg =  reply;
+			self->ith_object = (ipc_object_t)port;
+			ip_lock(port);
+			self->ith_seqno = port->ip_seqno++;
+			ip_unlock(port);
+			/* ipc_mqueue_send_always(reply); */
+		}
+#ifdef INVARIANTS
+		else
+			printf("reply from kobject == NULL\n");
+#endif
+		return MACH_MSG_SUCCESS;
+	}
+
+	if (kmsg->ikm_header->msgh_bits & MACH_MSGH_BITS_CIRCULAR) {
+		ip_unlock(port);
+
+		/* don't allow the creation of a circular loop */
+
+		ipc_kmsg_destroy(kmsg);
+		return MACH_MSG_SUCCESS;
+	}
+
+	for (;;) {
+		ipc_thread_t self;
+
+		/*
+		 *	Can't deliver to a dead port.
+		 *	However, we can pretend it got sent
+		 *	and was then immediately destroyed.
+		 */
+
+		if (!ip_active(port)) {
+			/*
+			 *	We can't let ipc_kmsg_destroy deallocate
+			 *	the port right, because we might end up
+			 *	in an infinite loop trying to deliver
+			 *	a send-once notification.
+			 */
+
+			ip_unlock(port);
+			ip_release(port);
+			kmsg->ikm_header->msgh_remote_port = MACH_PORT_NULL;
+			ipc_kmsg_destroy(kmsg);
+			return MACH_MSG_SUCCESS;
+		}
+
+		/*
+		 *  Don't block if:
+		 *	1) We're under the queue limit.
+		 *	2) Caller used the MACH_SEND_ALWAYS internal option.
+		 *	3) Message is sent to a send-once right.
+		 */
+
+		if ((port->ip_msgcount < port->ip_qlimit) ||
+		    (option & MACH_SEND_ALWAYS) ||
+		    (MACH_MSGH_BITS_REMOTE(kmsg->ikm_header->msgh_bits) ==
+						MACH_MSG_TYPE_PORT_SEND_ONCE))
+			break;
+
+		/* must block waiting for queue to clear */
+
+		self = current_thread();
+
+		if (option & MACH_SEND_TIMEOUT) {
+			if (timeout == 0) {
+				ip_unlock(port);
+				return MACH_SEND_TIMED_OUT;
+			}
+			thread_will_wait_with_timeout(self, timeout);
+		} else {
+			thread_will_wait(self);
+		}
+
+		counter(c_ipc_mqueue_send_block++);
+		self->ith_state = MACH_SEND_IN_PROGRESS;
+		self->ith_block_lock_data = &port->port_comm.rcd_io_lock_data;
+		ipc_thread_enqueue(&port->ip_blocked, self);
+		thread_block();
+
+		/* Save proper wait_result in case we block */
+		save_wait_result = self->wait_result;
+
+		/* why did we wake up? - finish_receive will remove us from the queue */
+
+		if (self->ith_state == MACH_MSG_SUCCESS)
+			continue;
+		ipc_thread_rmqueue(&port->ip_blocked, self);
+		assert(self->ith_state == MACH_SEND_IN_PROGRESS);
+
+		/*
+		 *	Thread wakeup-reason field tells us why
+		 *	the wait was interrupted.
+		 */
+
+		switch (save_wait_result) {
+		    case THREAD_INTERRUPTED:
+			/* send was interrupted - give up */
+
+			ip_unlock(port);
+			return MACH_SEND_INTERRUPTED;
+
+		    case THREAD_TIMED_OUT:
+			/* timeout expired */
+
+			assert(option & MACH_SEND_TIMEOUT);
+			timeout = 0;
+			break;
+
+		    case THREAD_RESTART:
+		    default:
+				panic("ipc_mqueue_send %d", save_wait_result);
+		}
+	}
+	(void) ipc_mqueue_deliver(port, kmsg, TRUE);
+
+	return MACH_MSG_SUCCESS;
+}
+
+
+/*
+ * ipc_mqueue_deliver: give the kmsg to a waiting receiver or else enqueue
+ * it on the port or pset.
+ *
+ * ipc_mqueue_deliver used to be the last block of code in ipc_mqueue_send.
+ * It is split out here so that the same code can be used to deliver DIPC
+ * kmsgs or meta_kmsgs.
+ *
+ * The port must be locked on entry; it will be unlocked on exit.  This
+ * routine CAN NOT FAIL when called from thread context.  However, from
+ * interrupt context it may not be able to complete its duties due to
+ * lock contention.
+ *
+ * Returns TRUE on successful delivery.
+ */
+#if	TRACE_BUFFER
+int	tr_ipc_mqueue_deliver = 0;
+#define	TR_IPC_MQEN(fmt, port, kmsg, thread_context)			\
+	tr_start();							\
+	if (tr_ipc_mqueue_deliver)					\
+		tr4((fmt), (port), (kmsg), (thread_context));
+#define	TR_IPC_MQEX(fmt, kmsg)						\
+	if (tr_ipc_mqueue_deliver)					\
+		tr2((fmt), (kmsg));					\
+	tr_stop();
+#else	/* TRACE_BUFFER */
+#define	TR_IPC_MQEN(fmt, port, kmsg, thread_context)
+#define	TR_IPC_MQEX(fmt, kmsg)
+#endif	/* TRACE_BUFFER */
+
+
+static void
+ipc_mqueue_run(thread_act_t receiver, ipc_mqueue_t mqueue, ipc_kmsg_t kmsg, ipc_port_t port)
+{
+	MPASS(receiver->ith_state == MACH_RCV_IN_PROGRESS ||
+		  receiver->ith_state == MACH_RCV_IN_PROGRESS_TIMED);
+	receiver->ith_state = MACH_MSG_SUCCESS;
+	receiver->ith_kmsg = kmsg;
+	receiver->ith_object = (ipc_object_t)port;
+	receiver->ith_seqno = port->ip_seqno++;
+	ip_unlock(port);
+	thread_go(receiver);
+}
+
+mach_msg_return_t
+ipc_mqueue_deliver(
+	register ipc_port_t	port,
+	register ipc_kmsg_t	kmsg,
+	boolean_t		thread_context)
+{
+	ipc_mqueue_t mqueue;
+	ipc_pset_t pset;
+	ipc_thread_t receiver;
+	TR_DECL("ipc_mqueue_deliver");
+
+	TR_IPC_MQEN("enter: port 0x%x kmsg 0x%x thd_ctxt %d", port, kmsg,
+		    thread_context);
+
+	assert(IP_VALID(port));
+	assert(ip_active(port));
+
+	pset = port->ip_pset;
+	mqueue = &port->ip_messages;
+	receiver = NULL;
+
+    /* first we check the the port and portset for waiters */
+	if (pset != NULL) {
+		ips_lock(pset);
+		receiver = thread_pool_get_act((ipc_object_t)pset, 0);
+		ips_unlock(pset);
+	} else if (receiver == NULL) {
+		receiver = thread_pool_get_act((ipc_object_t)port, 0);
+	}
+	/* we have a receiver - we're done */
+	if (receiver != NULL) {
+		ipc_mqueue_run(receiver, mqueue, kmsg, port);
+		return (MACH_MSG_SUCCESS);
+	}
+
+	assert(port->ip_msgcount >= 0);
+	ipc_kmsg_enqueue_macro(&mqueue->imq_messages, kmsg);
+	port->ip_msgcount++;
+	ip_unlock(port);
+
+	if (pset)
+		ipc_pset_signal(pset);
+
+	TR_IPC_MQEX("exit: wakeup 0x%x", receiver);
+	return MACH_MSG_SUCCESS;
+}
+
+
+/*
+ *	Routine:	ipc_mqueue_copyin
+ *	Purpose:
+ *		Convert a name in a space to a message queue.
+ *	Conditions:
+ *		Nothing locked.  If successful, the message queue
+ *		is returned locked and caller gets a ref for the object.
+ *		This ref ensures the continued existence of the queue.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	Found a message queue.
+ *		MACH_RCV_INVALID_NAME	The space is dead.
+ *		MACH_RCV_INVALID_NAME	The name doesn't denote a right.
+ *		MACH_RCV_INVALID_NAME
+ *			The denoted right is not receive or port set.
+ *		MACH_RCV_IN_SET		Receive right is a member of a set.
+ */
+
+mach_msg_return_t
+ipc_mqueue_copyin(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_bits_t *bitsp,
+	ipc_object_t	*objectp)
+{
+	ipc_entry_t entry;
+	ipc_entry_bits_t bits;
+	ipc_object_t object;
+	mach_msg_return_t mr;
+
+	is_read_lock(space);
+	if (!space->is_active) {
+		mr = MACH_RCV_INVALID_NAME;
+		goto error;
+	}
+
+	entry = ipc_entry_lookup(space, name);
+	if (entry == IE_NULL) {
+		mr = MACH_RCV_INVALID_NAME;
+		goto error;
+	}
+
+	bits = entry->ie_bits;
+	object = entry->ie_object;
+	ipc_object_reference(object);
+
+	if (bits & MACH_PORT_TYPE_RECEIVE) {
+		ipc_port_t port = NULL;
+
+		port = (ipc_port_t) object;
+		assert(port != IP_NULL);
+
+		assert(ip_active(port));
+		assert(port->ip_receiver_name == name);
+		assert(port->ip_receiver == space);
+		is_read_unlock(space);
+	} else if (bits & MACH_PORT_TYPE_PORT_SET) {
+		ipc_pset_t pset;
+
+		pset = (ipc_pset_t) object;
+		assert(pset != IPS_NULL);
+
+		assert(ips_active(pset));
+		assert(pset->ips_local_name == name);
+		is_read_unlock(space);
+	} else {
+		ipc_object_release(object);
+		mr = MACH_RCV_INVALID_NAME;
+		goto error;
+	}
+
+	/*
+	 *	At this point, the object is locked and active,
+	 *	the space is unlocked, and mqueue is initialized.
+	 */
+
+	*objectp = object;
+	*bitsp = bits;
+	return MACH_MSG_SUCCESS;
+error:
+	is_read_unlock(space);
+	return (mr);
+}
+
+
+static int
+ipc_mqueue_receive_error(ipc_thread_t self, int save_wait_result, int option)
+{
+	switch (self->ith_state) {
+	case MACH_RCV_PORT_DIED:
+	case MACH_RCV_PORT_CHANGED:
+		/* something bad happened to the port/set */
+		return self->ith_state;
+	case MACH_RCV_IN_PROGRESS:
+	case MACH_RCV_IN_PROGRESS_TIMED:
+		/*
+		 *	Awakened for other than IPC completion.
+		 *	Remove ourself from the waiting queue,
+		 *	then check the wakeup cause.
+		 */
+		if (self->ith_active) {
+			thread_pool_remove(self);
+			self->ith_block_lock_data = NULL;
+			self->ith_active = 0;
+		}
+		switch (save_wait_result) {
+		case THREAD_INTERRUPTED:
+			/* receive was interrupted - give up */
+			return MACH_RCV_INTERRUPTED;
+		case THREAD_TIMED_OUT:
+			/* timeout expired */
+			assert(option & MACH_RCV_TIMEOUT);
+			assert(self->ith_state == MACH_RCV_IN_PROGRESS_TIMED);
+			return (MACH_RCV_TIMED_OUT);
+		case THREAD_RESTART:
+		default:
+			panic("ipc_mqueue_receive: bad wait_result");
+		}
+		break;
+
+	default:
+		panic("ipc_mqueue_receive: strange ith_state");
+	}
+}
+
+static void
+ipc_mqueue_post_on_thread(
+	ipc_port_t			port,
+	mach_msg_option_t	option,
+	mach_msg_size_t		max_size,
+	thread_t                thread)
+{
+	ipc_kmsg_t kmsg;
+	ipc_mqueue_t 	mqueue = &port->ip_messages;
+
+	mach_msg_return_t mr = MACH_MSG_SUCCESS;
+	mach_msg_size_t rcv_size;
+	vm_map_t map = current_map();
+
+	/*
+	 * Do some sanity checking of our ability to receive
+	 * before pulling the message off the queue.
+	 */
+	kmsg = ipc_kmsg_queue_first(&mqueue->imq_messages);
+	assert(kmsg != IKM_NULL);
+
+	/*
+	 * If we really can't receive it, but we had the
+	 * MACH_RCV_LARGE option set, then don't take it off
+	 * the queue, instead return the appropriate error
+	 * (and size needed).
+	 */
+	rcv_size = ipc_kmsg_copyout_size(kmsg, map);
+	if (rcv_size + REQUESTED_TRAILER_SIZE(option) > max_size) {
+		mr = MACH_RCV_TOO_LARGE;
+		if (option & MACH_RCV_LARGE) {
+			thread->ith_receiver_name = port->ip_receiver_name;
+			thread->ith_kmsg = IKM_NULL;
+			thread->ith_msize = rcv_size;
+			thread->ith_seqno = 0;
+			thread->ith_state = mr;
+			return;
+		}
+	}
+
+	ipc_kmsg_rmqueue_first_macro(&mqueue->imq_messages, kmsg);
+	assert(port->ip_msgcount > 0);
+	port->ip_msgcount--;
+
+	thread->ith_object = (ipc_object_t)port;
+	thread->ith_seqno = port->ip_seqno++;
+	thread->ith_kmsg = kmsg;
+	thread->ith_state = mr;
+
+	current_task()->messages_received++;
+}
+
+mach_msg_return_t
+ipc_mqueue_pset_receive(
+	natural_t	bits,
+	mach_msg_option_t	option,
+	mach_msg_size_t		max_size,
+	mach_msg_timeout_t	timeout,
+	thread_t thread)
+{
+	ipc_port_t port;
+	ipc_pset_t pset;
+
+	pset = (ipc_pset_t)thread->ith_object;
+	assert(io_otype(thread->ith_object) == IOT_PORT_SET);
+restart:
+	TAILQ_FOREACH(port, &pset->ips_ports, ip_next) {
+		mtx_assert(&port->port_comm.rcd_io_lock_data, MA_NOTOWNED);
+		assert (port->ip_msgcount >= 0);
+		if (port->ip_msgcount != 0) {
+			if (ip_lock_try(port) == 0) {
+				ips_unlock(pset);
+				ip_lock(port);
+				ips_lock(pset);
+			}
+			/* one way or another we have the lock */
+			break;
+		}
+	}
+	if (port != NULL && port->ip_msgcount == 0) {
+		mtx_assert(&port->port_comm.rcd_io_lock_data, MA_OWNED);
+		ip_unlock(port);
+		goto restart;
+	}
+	if (port != NULL) {
+		mtx_assert(&port->port_comm.rcd_io_lock_data, MA_OWNED);
+		ipc_mqueue_post_on_thread(port, option, max_size, thread);
+		ip_unlock(port);
+		thread->ith_object = (ipc_object_t)port;
+		return (THREAD_NOT_WAITING);
+	}
+	if ((option & MACH_RCV_TIMEOUT) && (timeout == 0)) {
+		thread->ith_state = MACH_RCV_TIMED_OUT;
+		return (THREAD_NOT_WAITING);
+	}
+
+	return (THREAD_WAITING);
+}
+
+/*
+ *	Routine:	ipc_mqueue_receive
+ *	Purpose:
+ *		Receive a message from a message queue.
+ *
+ *	Conditions:
+ *		The message queue is locked; it will be returned unlocked.
+ *
+ *		Our caller must hold a reference for the port or port set
+ *		to which this queue belongs, to keep the queue
+ *		from being deallocated.  Furthermore, the port or set
+ *		must have been active when the queue was locked.
+ *
+ *		The kmsg is returned with clean header fields
+ *		and with the circular bit turned off.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	Message returned in kmsgp.
+ *		MACH_RCV_TOO_LARGE	Message size returned in kmsgp.
+ *		MACH_RCV_TIMED_OUT	No message obtained.
+ *		MACH_RCV_INTERRUPTED	No message obtained.
+ *		MACH_RCV_PORT_DIED	Port/set died; no message.
+ *		MACH_RCV_PORT_CHANGED	Port moved into set; no msg.
+ *
+ */
+
+
+mach_msg_return_t
+ipc_mqueue_receive(
+	natural_t	bits,
+	mach_msg_option_t	option,
+	mach_msg_size_t		max_size,
+	mach_msg_timeout_t	timeout,
+	ipc_kmsg_t		*kmsgp,
+	mach_port_seqno_t	*seqnop,
+	thread_t thread)
+{
+	ipc_port_t port;
+	ipc_pset_t pset;
+	ipc_kmsg_t kmsg;
+	ipc_mqueue_t mqueue;
+	mach_port_seqno_t seqno;
+	mach_msg_return_t mr;
+	ipc_kmsg_queue_t kmsgs;
+	thread_t self;
+	kern_return_t	save_wait_result;
+	int rc;
+
+	/* logic currently too confused to support anything else */
+	MPASS(thread == current_thread());
+	MPASS(thread->ith_object != NULL);
+	assert(io_otype(thread->ith_object) == IOT_PORT || io_otype(thread->ith_object) == IOT_PORT_SET);
+	self = thread;
+	pset = NULL;
+
+	io_lock(thread->ith_object);
+	io_reference(thread->ith_object);
+	if (thread->ith_kmsg != NULL) {
+		thread->ith_state = MACH_MSG_SUCCESS;
+		goto rx_done;
+	}
+
+	if (bits & MACH_PORT_TYPE_PORT_SET) {
+		pset = (ipc_pset_t)thread->ith_object;
+
+		rc = ipc_mqueue_pset_receive(bits, option, max_size, timeout, thread);
+		if (rc == THREAD_NOT_WAITING) {
+			if (thread->ith_state == MACH_RCV_TIMED_OUT || thread->ith_state == MACH_RCV_TOO_LARGE) {
+				ips_unlock(pset);
+				ips_release(pset);
+				return (thread->ith_state);
+			} else {
+				kmsg = thread->ith_kmsg;
+				seqno = thread->ith_seqno;
+				MPASS(pset != (ipc_pset_t)thread->ith_object);
+				/* drop passed in pset lock and acquire the port lock */
+				ips_unlock(pset);
+				ips_release(pset);
+				pset = NULL;
+
+				io_lock(thread->ith_object);
+				io_reference(thread->ith_object);
+				goto rx_done;
+			}
+		}
+		assert(io_otype(thread->ith_object) == IOT_PORT_SET);
+	} else {
+		port = (ipc_port_t)thread->ith_object;
+		assert(port->ip_msgcount >= 0);
+		mqueue = &port->ip_messages;
+		kmsgs = &mqueue->imq_messages;
+		kmsg = ipc_kmsg_queue_first(kmsgs);
+		/* a message is already on the queue */
+		if (kmsg != IKM_NULL) {
+			ipc_mqueue_post_on_thread(port, option, max_size, thread);
+			if (thread->ith_state == MACH_MSG_SUCCESS) 
+				goto rx_done;
+			else {
+				io_unlock(thread->ith_object);
+				io_release(thread->ith_object);
+				return (thread->ith_state);
+			}
+		}
+	}
+
+	/* must block waiting for a message */
+	if (option & MACH_RCV_TIMEOUT) {
+		if (timeout == 0) {
+			return MACH_RCV_TIMED_OUT;
+		}
+
+		self->ith_state = MACH_RCV_IN_PROGRESS_TIMED;
+	} else {
+		self->ith_state = MACH_RCV_IN_PROGRESS;
+		timeout = 0;
+	}
+	thread_will_wait_with_timeout(self, timeout);
+
+	self->ith_active = 1;
+	self->ith_block_lock_data = &((rpc_common_t)(self->ith_object))->rcd_io_lock_data;
+	thread_pool_put_act(self);
+
+	self->ith_msize = max_size;
+	thread_block();
+	/* Save proper wait_result in case we block */
+	save_wait_result = self->wait_result;
+
+	/* why did we wake up? */
+	if (self->ith_state != MACH_MSG_SUCCESS)
+		goto error;
+
+	if (pset) {
+		ips_unlock(pset);
+		ips_release(pset);
+		io_reference(self->ith_object);
+		io_lock(self->ith_object);
+	}
+
+rx_done:
+	assert(io_otype(self->ith_object) == IOT_PORT);
+	assert(self->ith_kmsg != NULL);
+	*kmsgp = self->ith_kmsg;
+	*seqnop = self->ith_seqno;
+	port = (ipc_port_t)thread->ith_object;
+
+	assert(io_otype(self->ith_object) == IOT_PORT);
+
+	mr = ipc_mqueue_finish_receive(kmsgp, port, option, max_size);
+
+	io_unlock(self->ith_object);
+	io_release(self->ith_object);
+	self->ith_kmsg = NULL;
+	self->ith_object = NULL;
+	return (mr);
+error:
+	mr = ipc_mqueue_receive_error(self, save_wait_result, option);
+
+	io_unlock(self->ith_object);
+	io_release(self->ith_object);
+	self->ith_kmsg = NULL;
+	self->ith_object = NULL;
+	return (mr);
+}
+
+
+mach_msg_return_t
+ipc_mqueue_finish_receive(
+	ipc_kmsg_t		*kmsgp,
+	ipc_port_t		port,
+	mach_msg_option_t	option,
+	mach_msg_size_t		max_size)
+{
+	ipc_kmsg_t		kmsg;
+	mach_msg_return_t	mr;
+	ipc_thread_t 		self = current_thread();
+	mach_msg_size_t rcv_size;
+
+	mr = MACH_MSG_SUCCESS;
+	kmsg = *kmsgp;
+	/* check sizes */
+
+	rcv_size = ipc_kmsg_copyout_size(kmsg, thread_map(self));
+	if (rcv_size + REQUESTED_TRAILER_SIZE(option) > max_size) {
+		/* the receive buffer isn't large enough */
+		printf("%s max_size=%d REQUESTED_TRAILER_SIZE(option=%d)=%d\n",
+			   curthread->td_proc->p_comm, max_size, option, REQUESTED_TRAILER_SIZE(option));
+		/* ipc_kmsg_print(kmsg); */
+		printf("rcv_size=%d\n", rcv_size);
+		mr = MACH_RCV_TOO_LARGE;
+	} else if (self->ith_scatter_list != MACH_MSG_BODY_NULL) {
+		/* verify the scatter list */
+		mr = ipc_kmsg_check_scatter(kmsg,
+					self->ith_option,
+					&self->ith_scatter_list,
+					&self->ith_scatter_list_size);
+	}
+
+	if (mr == MACH_MSG_SUCCESS) {
+		assert((kmsg->ikm_header->msgh_bits & MACH_MSGH_BITS_CIRCULAR)
+									== 0);
+	}
+
+	if (ip_active(port)) {
+		ipc_thread_queue_t senders;
+		ipc_thread_t sender;
+
+		assert(port->ip_msgcount >= 0);
+		senders = &port->ip_blocked;
+		sender = ipc_thread_queue_first(senders);
+
+		MPASS(sender == NULL || sender->ith_state == MACH_SEND_IN_PROGRESS);
+
+		if ((sender != ITH_NULL) &&
+			(port->ip_msgcount < port->ip_qlimit)) {
+			ipc_thread_rmqueue(senders, sender);
+			sender->ith_state = MACH_MSG_SUCCESS;
+			thread_go(sender);
+		}
+	}
+	*kmsgp = kmsg;
+	return mr;
+}


Property changes on: trunk/sys/compat/mach/ipc/ipc_mqueue.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/ipc_notify.c
===================================================================
--- trunk/sys/compat/mach/ipc/ipc_notify.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/ipc_notify.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,449 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5.2.2  92/03/28  10:09:23  jeffreyh
+ * 	NORMA_IPC: Don't send send_once notification if port is dead.
+ * 	[92/03/25            dlb]
+ * 
+ * Revision 2.5.2.1  92/01/03  16:35:29  jsb
+ * 	Did I say ndproxy? I meant to say nsproxy.
+ * 	[91/12/31  21:40:41  jsb]
+ * 
+ * 	Changes for IP_NORMA_REQUEST macros being renamed to ip_ndproxy{,m,p}.
+ * 	[91/12/30  07:57:26  jsb]
+ * 
+ * 	Use IP_IS_NORMA_NSREQUEST macro.
+ * 	[91/12/28  17:05:21  jsb]
+ * 
+ * 	Added norma_ipc_notify_no_senders hook in ipc_notify_no_senders.
+ * 	[91/12/24  14:37:56  jsb]
+ * 
+ * Revision 2.5  91/08/28  11:13:41  jsb
+ * 	Changed msgh_kind to msgh_seqno.
+ * 	[91/08/09            rpd]
+ * 
+ * Revision 2.4  91/05/14  16:34:24  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:22:33  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:46:58  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:50:50  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  20:57:58  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_notify.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Notification-sending functions.
+ */
+
+
+#include <sys/mach/port.h>
+#include <sys/mach/message.h>
+#include <sys/mach/notify.h>
+#if 0
+#include <kern/assert.h>
+#include <kern/misc_protos.h>
+#endif
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/ipc/ipc_mqueue.h>
+#include <sys/mach/ipc/ipc_notify.h>
+#include <sys/mach/ipc/ipc_port.h>
+
+/*
+ * Forward declarations
+ */
+void ipc_notify_init_port_deleted(
+	mach_port_deleted_notification_t	*n);
+
+void ipc_notify_init_port_destroyed(
+	mach_port_destroyed_notification_t	*n);
+
+void ipc_notify_init_no_senders(
+	mach_no_senders_notification_t		*n);
+
+void ipc_notify_init_send_once(
+	mach_send_once_notification_t		*n);
+
+void ipc_notify_init_dead_name(
+	mach_dead_name_notification_t		*n);
+
+mach_port_deleted_notification_t	ipc_notify_port_deleted_template;
+mach_port_destroyed_notification_t	ipc_notify_port_destroyed_template;
+mach_no_senders_notification_t		ipc_notify_no_senders_template;
+mach_send_once_notification_t		ipc_notify_send_once_template;
+mach_dead_name_notification_t		ipc_notify_dead_name_template;
+
+/*
+ *	Routine:	ipc_notify_init_port_deleted
+ *	Purpose:
+ *		Initialize a template for port-deleted notifications.
+ */
+
+void
+ipc_notify_init_port_deleted(
+	mach_port_deleted_notification_t	*n)
+{
+	mach_msg_header_t *m = &n->not_header;
+
+	m->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0);
+	m->msgh_local_port = MACH_PORT_NULL;
+	m->msgh_remote_port = MACH_PORT_NULL;
+	m->msgh_id = MACH_NOTIFY_PORT_DELETED;
+	m->msgh_size = ((int)sizeof *n) - sizeof(mach_msg_format_0_trailer_t);
+
+	n->not_port = MACH_PORT_NAME_NULL;
+	n->NDR = NDR_record;
+	n->trailer.msgh_seqno = 0;
+	n->trailer.msgh_sender = KERNEL_SECURITY_TOKEN;
+	n->trailer.msgh_trailer_type = MACH_MSG_TRAILER_FORMAT_0;
+	n->trailer.msgh_trailer_size = MACH_MSG_TRAILER_MINIMUM_SIZE;
+}
+
+/*
+ *	Routine:	ipc_notify_init_port_destroyed
+ *	Purpose:
+ *		Initialize a template for port-destroyed notifications.
+ */
+
+void
+ipc_notify_init_port_destroyed(
+	mach_port_destroyed_notification_t	*n)
+{
+	mach_msg_header_t *m = &n->not_header;
+
+	m->msgh_bits = MACH_MSGH_BITS_COMPLEX |
+		MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0);
+	m->msgh_local_port = MACH_PORT_NULL;
+	m->msgh_remote_port = MACH_PORT_NULL;
+	m->msgh_id = MACH_NOTIFY_PORT_DESTROYED;
+	m->msgh_size = ((int)sizeof *n) - sizeof(mach_msg_format_0_trailer_t);
+
+	n->not_body.msgh_descriptor_count = 1;
+	n->not_port.disposition = MACH_MSG_TYPE_PORT_RECEIVE;
+	n->not_port.name = MACH_PORT_NULL;
+	n->not_port.type = MACH_MSG_PORT_DESCRIPTOR;
+	n->trailer.msgh_seqno = 0;
+	n->trailer.msgh_sender = KERNEL_SECURITY_TOKEN;
+	n->trailer.msgh_trailer_type = MACH_MSG_TRAILER_FORMAT_0;
+	n->trailer.msgh_trailer_size = MACH_MSG_TRAILER_MINIMUM_SIZE;
+}
+
+/*
+ *	Routine:	ipc_notify_init_no_senders
+ *	Purpose:
+ *		Initialize a template for no-senders notifications.
+ */
+
+void
+ipc_notify_init_no_senders(
+	mach_no_senders_notification_t	*n)
+{
+	mach_msg_header_t *m = &n->not_header;
+
+	m->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0);
+	m->msgh_local_port = MACH_PORT_NULL;
+	m->msgh_remote_port = MACH_PORT_NULL;
+	m->msgh_id = MACH_NOTIFY_NO_SENDERS;
+	m->msgh_size = ((int)sizeof *n) - sizeof(mach_msg_format_0_trailer_t);
+
+	n->NDR = NDR_record;
+	n->trailer.msgh_seqno = 0;
+	n->trailer.msgh_sender = KERNEL_SECURITY_TOKEN;
+	n->trailer.msgh_trailer_type = MACH_MSG_TRAILER_FORMAT_0;
+	n->trailer.msgh_trailer_size = MACH_MSG_TRAILER_MINIMUM_SIZE;
+	n->not_count = 0;
+}
+
+/*
+ *	Routine:	ipc_notify_init_send_once
+ *	Purpose:
+ *		Initialize a template for send-once notifications.
+ */
+
+void
+ipc_notify_init_send_once(
+	mach_send_once_notification_t	*n)
+{
+	mach_msg_header_t *m = &n->not_header;
+
+	m->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0);
+	m->msgh_local_port = MACH_PORT_NULL;
+	m->msgh_remote_port = MACH_PORT_NULL;
+	m->msgh_id = MACH_NOTIFY_SEND_ONCE;
+	m->msgh_size = ((int)sizeof *n) - sizeof(mach_msg_format_0_trailer_t);
+	n->trailer.msgh_seqno = 0;
+	n->trailer.msgh_sender = KERNEL_SECURITY_TOKEN;
+	n->trailer.msgh_trailer_type = MACH_MSG_TRAILER_FORMAT_0;
+	n->trailer.msgh_trailer_size = MACH_MSG_TRAILER_MINIMUM_SIZE;
+}
+
+/*
+ *	Routine:	ipc_notify_init_dead_name
+ *	Purpose:
+ *		Initialize a template for dead-name notifications.
+ */
+
+void
+ipc_notify_init_dead_name(
+	mach_dead_name_notification_t	*n)
+{
+	mach_msg_header_t *m = &n->not_header;
+
+	m->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0);
+	m->msgh_local_port = MACH_PORT_NULL;
+	m->msgh_remote_port = MACH_PORT_NULL;
+	m->msgh_id = MACH_NOTIFY_DEAD_NAME;
+	m->msgh_size = ((int)sizeof *n) - sizeof(mach_msg_format_0_trailer_t);
+
+	n->not_port = MACH_PORT_NAME_NULL;
+	n->NDR = NDR_record;
+	n->trailer.msgh_seqno = 0;
+	n->trailer.msgh_sender = KERNEL_SECURITY_TOKEN;
+	n->trailer.msgh_trailer_type = MACH_MSG_TRAILER_FORMAT_0;
+	n->trailer.msgh_trailer_size = MACH_MSG_TRAILER_MINIMUM_SIZE;
+}
+
+/*
+ *	Routine:	ipc_notify_init
+ *	Purpose:
+ *		Initialize the notification subsystem.
+ */
+
+void
+ipc_notify_init(void)
+{
+	ipc_notify_init_port_deleted(&ipc_notify_port_deleted_template);
+	ipc_notify_init_port_destroyed(&ipc_notify_port_destroyed_template);
+	ipc_notify_init_no_senders(&ipc_notify_no_senders_template);
+	ipc_notify_init_send_once(&ipc_notify_send_once_template);
+	ipc_notify_init_dead_name(&ipc_notify_dead_name_template);
+}
+
+/*
+ *	Routine:	ipc_notify_port_deleted
+ *	Purpose:
+ *		Send a port-deleted notification.
+ *	Conditions:
+ *		Nothing locked.
+ *		Consumes a ref/soright for port.
+ */
+
+void
+ipc_notify_port_deleted(
+	ipc_port_t	port,
+	mach_port_name_t	name)
+{
+	ipc_kmsg_t kmsg;
+	mach_port_deleted_notification_t *n;
+
+		kmsg = ikm_alloc(sizeof *n);
+	if (kmsg == IKM_NULL) {
+		printf("dropped port-deleted (%p, 0x%x)\n", port, name);
+		ipc_port_release_sonce(port);
+		return;
+	}
+
+	ikm_init(kmsg, sizeof *n);
+	n = (mach_port_deleted_notification_t *) kmsg->ikm_header;
+	*n = ipc_notify_port_deleted_template;
+
+	n->not_header.msgh_remote_port = (mach_port_t) port;
+	n->not_port = name;
+
+	ipc_mqueue_send_always(kmsg);
+}
+
+/*
+ *	Routine:	ipc_notify_port_destroyed
+ *	Purpose:
+ *		Send a port-destroyed notification.
+ *	Conditions:
+ *		Nothing locked.
+ *		Consumes a ref/soright for port.
+ *		Consumes a ref for right, which should be a receive right
+ *		prepped for placement into a message.  (In-transit,
+ *		or in-limbo if a circularity was detected.)
+ */
+
+void
+ipc_notify_port_destroyed(
+	ipc_port_t	port,
+	ipc_port_t	right)
+{
+	ipc_kmsg_t kmsg;
+	mach_port_destroyed_notification_t *n;
+
+		kmsg = ikm_alloc(sizeof *n);
+	if (kmsg == IKM_NULL) {
+		printf("dropped port-destroyed (%p, %p)\n",
+		       port, right);
+		ipc_port_release_sonce(port);
+		ipc_port_release_receive(right);
+		return;
+	}
+
+	ikm_init(kmsg, sizeof *n);
+	n = (mach_port_destroyed_notification_t *) kmsg->ikm_header;
+	*n = ipc_notify_port_destroyed_template;
+
+	n->not_header.msgh_remote_port = (mach_port_t) port;
+	n->not_port.name = (mach_port_t)right;
+
+	ipc_mqueue_send_always(kmsg);
+}
+
+/*
+ *	Routine:	ipc_notify_no_senders
+ *	Purpose:
+ *		Send a no-senders notification.
+ *	Conditions:
+ *		Nothing locked.
+ *		Consumes a ref/soright for port.
+ */
+
+void
+ipc_notify_no_senders(
+	ipc_port_t		port,
+	mach_port_mscount_t	mscount)
+{
+	ipc_kmsg_t kmsg;
+	mach_no_senders_notification_t *n;
+
+		kmsg = ikm_alloc(sizeof *n);
+	if (kmsg == IKM_NULL) {
+		printf("dropped no-senders (%p, %u)\n", port, mscount);
+		ipc_port_release_sonce(port);
+		return;
+	}
+
+	ikm_init(kmsg, sizeof *n);
+	n = (mach_no_senders_notification_t *) kmsg->ikm_header;
+	*n = ipc_notify_no_senders_template;
+
+	n->not_header.msgh_remote_port = (mach_port_t) port;
+	n->not_count = mscount;
+
+	ipc_mqueue_send_always(kmsg);
+}
+
+/*
+ *	Routine:	ipc_notify_send_once
+ *	Purpose:
+ *		Send a send-once notification.
+ *	Conditions:
+ *		Nothing locked.
+ *		Consumes a ref/soright for port.
+ */
+
+void
+ipc_notify_send_once(
+	ipc_port_t	port)
+{
+	ipc_kmsg_t kmsg;
+	mach_send_once_notification_t *n;
+
+	kmsg = ikm_alloc(sizeof *n);
+	if (kmsg == IKM_NULL) {
+		printf("dropped send-once (%p)\n", port);
+		ipc_port_release_sonce(port);
+		return;
+	}
+
+	ikm_init(kmsg, sizeof *n);
+	n = (mach_send_once_notification_t *) kmsg->ikm_header;
+	*n = ipc_notify_send_once_template;
+
+	n->not_header.msgh_remote_port = (mach_port_t) port;
+
+	ipc_mqueue_send_always(kmsg);
+}
+
+/*
+ *	Routine:	ipc_notify_dead_name
+ *	Purpose:
+ *		Send a dead-name notification.
+ *	Conditions:
+ *		Nothing locked.
+ *		Consumes a ref/soright for port.
+ */
+
+void
+ipc_notify_dead_name(
+	ipc_port_t	port,
+	mach_port_name_t	name)
+{
+	ipc_kmsg_t kmsg;
+	mach_dead_name_notification_t *n;
+
+		kmsg = ikm_alloc(sizeof *n);
+	if (kmsg == IKM_NULL) {
+		printf("dropped dead-name (%p, 0x%x)\n", port, name);
+		ipc_port_release_sonce(port);
+		return;
+	}
+
+	ikm_init(kmsg, sizeof *n);
+	n = (mach_dead_name_notification_t *) kmsg->ikm_header;
+	*n = ipc_notify_dead_name_template;
+
+	n->not_header.msgh_remote_port = (mach_port_t) port;
+	n->not_port = name;
+
+	ipc_mqueue_send_always(kmsg);
+}


Property changes on: trunk/sys/compat/mach/ipc/ipc_notify.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/ipc_object.c
===================================================================
--- trunk/sys/compat/mach/ipc/ipc_object.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/ipc_object.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,956 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5.2.1  92/01/03  16:35:36  jsb
+ * 	Made ipc_object_print look nicer.
+ * 	[91/12/27  21:29:04  jsb]
+ * 
+ * Revision 2.5  91/05/14  16:34:52  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:22:44  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:49:10  mrt]
+ * 
+ * Revision 2.3  90/11/05  14:29:11  rpd
+ * 	Removed ipc_object_reference_macro, ipc_object_release_macro.
+ * 	Use new io_reference and io_release.
+ * 	Use new ip_reference and ip_release.
+ * 	[90/10/29            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:50:59  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  20:58:32  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_object.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Functions to manipulate IPC objects.
+ */
+
+#include <sys/cdefs.h>
+
+#include <sys/types.h>
+#include <sys/file.h>
+
+#include <sys/mach/kern_return.h>
+#include <sys/mach/port.h>
+#include <sys/mach/message.h>
+#include <sys/mach/ipc/port.h>
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/ipc/ipc_entry.h>
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_hash.h>
+#include <sys/mach/ipc/ipc_right.h>
+#include <sys/mach/ipc/ipc_notify.h>
+#include <sys/mach/ipc/ipc_pset.h>
+
+uma_zone_t ipc_object_zones[IOT_NUMBER];
+
+/*
+ *	Routine:	ipc_object_translate
+ *	Purpose:
+ *		Look up an object in a space.
+ *	Conditions:
+ *		Nothing locked before.  If successful, the object
+ *		is returned locked.  The caller doesn't get a ref.
+ *	Returns:
+ *		KERN_SUCCESS		Objected returned locked.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	The name doesn't denote a right.
+ *		KERN_INVALID_RIGHT	Name doesn't denote the correct right.
+ */
+
+kern_return_t
+ipc_object_translate(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	mach_port_right_t	right,
+	ipc_object_t		*objectp)
+{
+	ipc_entry_t entry;
+	ipc_object_t object;
+
+	if ((entry = ipc_entry_lookup(space, name)) == NULL)
+		return KERN_INVALID_NAME;
+
+	if ((entry->ie_bits & MACH_PORT_TYPE(right)) == (mach_port_right_t) 0) {
+		return KERN_INVALID_RIGHT;
+	}
+
+	object = entry->ie_object;
+	if (object == IO_NULL)
+		return (KERN_TERMINATED);
+
+	/* caller already holds locked reference */
+	if (*objectp != object)
+		io_lock(object);
+
+	*objectp = object;
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_object_alloc_dead
+ *	Purpose:
+ *		Allocate a dead-name entry.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		The dead name is allocated.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_NO_SPACE		No room for an entry in the space.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+ipc_object_alloc_dead(
+	ipc_space_t	space,
+	mach_port_name_t	*namep)
+{
+	ipc_entry_t entry;
+	kern_return_t kr;
+
+
+	kr = ipc_entry_alloc(space, FALSE, namep, &entry);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* space is write-locked */
+
+	/* null object, MACH_PORT_TYPE_DEAD_NAME, 1 uref */
+
+	assert(entry->ie_object == IO_NULL);
+	entry->ie_bits |= MACH_PORT_TYPE_DEAD_NAME | 1;
+
+	is_write_unlock(space);
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_object_alloc_dead_name
+ *	Purpose:
+ *		Allocate a dead-name entry, with a specific name.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		The dead name is allocated.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_NAME_EXISTS	The name already denotes a right.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+ipc_object_alloc_dead_name(
+	ipc_space_t	space,
+	mach_port_name_t	name)
+{
+	ipc_entry_t entry;
+	kern_return_t kr;
+
+
+	kr = ipc_entry_alloc_name(space, name, &entry);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* space is write-locked */
+
+	if (ipc_right_inuse(space, name, entry))
+		return KERN_NAME_EXISTS;
+
+	/* null object, MACH_PORT_TYPE_DEAD_NAME, 1 uref */
+
+	assert(entry->ie_object == IO_NULL);
+	entry->ie_bits |= MACH_PORT_TYPE_DEAD_NAME | 1;
+
+	is_write_unlock(space);
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_object_alloc
+ *	Purpose:
+ *		Allocate an object.
+ *	Conditions:
+ *		Nothing locked.  If successful, the object is returned locked.
+ *		The caller doesn't get a reference for the object.
+ *	Returns:
+ *		KERN_SUCCESS		The object is allocated.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_NO_SPACE		No room for an entry in the space.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+ipc_object_alloc(
+	ipc_space_t		space,
+	ipc_object_type_t	otype,
+	mach_port_type_t	type,
+	mach_port_name_t		*namep,
+	ipc_object_t		*objectp)
+{
+	ipc_object_t object;
+	ipc_entry_t entry;
+	kern_return_t kr;
+	int size;
+
+	assert(otype < IOT_NUMBER);
+	assert((type & MACH_PORT_TYPE_ALL_RIGHTS) == type);
+	assert(type != MACH_PORT_TYPE_NONE);
+
+	object = io_alloc(otype);
+	if (object == IO_NULL)
+		return KERN_RESOURCE_SHORTAGE;
+
+	size = otype == IOT_PORT ? sizeof(struct ipc_port) : sizeof(struct ipc_pset);
+	bzero((char *)object, size);
+
+	io_lock_init(object);
+#if VERBOSE_DEBUGGING
+	printf("allocated new object %p type %d\n", object, otype);
+#endif
+
+	kr = ipc_entry_alloc(space,
+		type == MACH_PORT_TYPE_SEND_ONCE, namep, &entry);
+	if (kr != KERN_SUCCESS) {
+		io_free(otype, object);
+		return kr;
+	}
+	/* space is write-locked */
+
+	entry->ie_bits |= type;;
+	entry->ie_object = object;
+
+	io_lock(object);
+	is_write_unlock(space);
+
+	object->io_references = 1; /* for entry, not caller */
+	object->io_bits = io_makebits(TRUE, otype, 0);
+
+	*objectp = object;
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_object_alloc_name
+ *	Purpose:
+ *		Allocate an object, with a specific name.
+ *	Conditions:
+ *		Nothing locked.  If successful, the object is returned locked.
+ *		The caller doesn't get a reference for the object.
+ *	Returns:
+ *		KERN_SUCCESS		The object is allocated.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_NAME_EXISTS	The name already denotes a right.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+ipc_object_alloc_name(
+	ipc_space_t		space,
+	ipc_object_type_t	otype,
+	mach_port_type_t	type,
+	mach_port_name_t		name,
+	ipc_object_t		*objectp)
+{
+	ipc_object_t object;
+	ipc_entry_t entry;
+	kern_return_t kr;
+	int size;
+
+	assert(otype < IOT_NUMBER);
+	assert((type & MACH_PORT_TYPE_ALL_RIGHTS) == type);
+	assert(type != MACH_PORT_TYPE_NONE);
+
+	object = io_alloc(otype);
+	if (object == IO_NULL)
+		return KERN_RESOURCE_SHORTAGE;
+
+	size = otype == IOT_PORT ? sizeof(struct ipc_port) : sizeof(struct ipc_pset);
+	bzero((char *)object, size);
+
+	io_lock_init(object);
+	kr = ipc_entry_alloc_name(space, name, &entry);
+	if (kr != KERN_SUCCESS) {
+		io_free(otype, object);
+		return kr;
+	}
+	/* space is write-locked */
+
+	if (ipc_right_inuse(space, name, entry)) {
+		io_free(otype, object);
+		return KERN_NAME_EXISTS;
+	}
+
+	entry->ie_bits |= type;
+	entry->ie_object = object;
+
+	io_lock(object);
+	is_write_unlock(space);
+
+	object->io_references = 1; /* for entry, not caller */
+	object->io_bits = io_makebits(TRUE, otype, 0);
+
+	*objectp = object;
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_object_copyin_type
+ *	Purpose:
+ *		Convert a send type name to a received type name.
+ */
+
+mach_msg_type_name_t
+ipc_object_copyin_type(
+	mach_msg_type_name_t	msgt_name)
+{
+	switch (msgt_name) {
+	    case 0:
+		return 0;
+
+	    case MACH_MSG_TYPE_MOVE_RECEIVE:
+			return MACH_MSG_TYPE_PORT_RECEIVE;
+
+	    case MACH_MSG_TYPE_MOVE_SEND_ONCE:
+	    case MACH_MSG_TYPE_MAKE_SEND_ONCE:
+			return MACH_MSG_TYPE_PORT_SEND_ONCE;
+
+	    case MACH_MSG_TYPE_MOVE_SEND:
+	    case MACH_MSG_TYPE_MAKE_SEND:
+	    case MACH_MSG_TYPE_COPY_SEND:
+			return MACH_MSG_TYPE_PORT_SEND;
+
+	    case MACH_MSG_TYPE_DISPOSE_RECEIVE:
+	    case MACH_MSG_TYPE_DISPOSE_SEND:
+	    case MACH_MSG_TYPE_DISPOSE_SEND_ONCE:
+	default:
+			return MACH_MSG_TYPE_PORT_NONE;
+	}
+}
+
+/*
+ *	Routine:	ipc_object_copyin
+ *	Purpose:
+ *		Copyin a capability from a space.
+ *		If successful, the caller gets a ref
+ *		for the resulting object, unless it is IO_DEAD.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Acquired an object, possibly IO_DEAD.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	Name doesn't exist in space.
+ *		KERN_INVALID_RIGHT	Name doesn't denote correct right.
+ */
+
+kern_return_t
+ipc_object_copyin(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	mach_msg_type_name_t	msgt_name,
+	ipc_object_t		*objectp)
+{
+	ipc_entry_t entry;
+	ipc_port_t soright;
+	kern_return_t kr;
+	int xlock;
+
+	if (ipc_entry_file_to_port(space, name, objectp) == KERN_SUCCESS)
+		return (KERN_SUCCESS);
+	/*
+	 *	Could first try a read lock when doing
+	 *	MACH_MSG_TYPE_COPY_SEND, MACH_MSG_TYPE_MAKE_SEND,
+	 *	and MACH_MSG_TYPE_MAKE_SEND_ONCE.
+	 */
+	if (msgt_name == MACH_MSG_TYPE_MAKE_SEND ||
+		msgt_name == MACH_MSG_TYPE_COPY_SEND ||
+		msgt_name == MACH_MSG_TYPE_MAKE_SEND_ONCE)
+		xlock = 0;
+	else
+		xlock = 1;
+	kr = ipc_right_lookup(space, name, &entry, xlock);
+	if (kr != KERN_SUCCESS) {
+		printf("ipc_right_lookup failed: msgt=%d kr=%d\n", msgt_name, kr);
+		return kr;
+	}
+	/* space is write-locked and active */
+
+	kr = ipc_right_copyin(space, name, entry, msgt_name, TRUE, objectp,
+		     &soright);
+
+	if (IE_BITS_TYPE(entry->ie_bits) == MACH_PORT_TYPE_NONE)
+		/* drops the lock */
+		ipc_entry_dealloc(space, name, entry);
+	else {
+		if (xlock)
+			is_write_unlock(space);
+		else
+			is_read_unlock(space);
+	}
+	if ((kr == KERN_SUCCESS) && (soright != IP_NULL))
+		ipc_notify_port_deleted(soright, name);
+
+	return kr;
+}
+
+/*
+ *	Routine:	ipc_object_copyin_from_kernel
+ *	Purpose:
+ *		Copyin a naked capability from the kernel.
+ *
+ *		MACH_MSG_TYPE_MOVE_RECEIVE
+ *			The receiver must be ipc_space_kernel.
+ *			Consumes the naked receive right.
+ *		MACH_MSG_TYPE_COPY_SEND
+ *			A naked send right must be supplied.
+ *			The port gains a reference, and a send right
+ *			if the port is still active.
+ *		MACH_MSG_TYPE_MAKE_SEND
+ *			The receiver must be ipc_space_kernel.
+ *			The port gains a reference and a send right.
+ *		MACH_MSG_TYPE_MOVE_SEND
+ *			Consumes a naked send right.
+ *		MACH_MSG_TYPE_MAKE_SEND_ONCE
+ *			The port gains a reference and a send-once right.
+ *			Receiver also be the caller of device subsystem,
+ *			so no assertion.
+ *		MACH_MSG_TYPE_MOVE_SEND_ONCE
+ *			Consumes a naked send-once right.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_object_copyin_from_kernel(
+	ipc_object_t		object,
+	mach_msg_type_name_t	msgt_name)
+{
+	assert(IO_VALID(object));
+
+	switch (msgt_name) {
+	    case MACH_MSG_TYPE_MOVE_RECEIVE: {
+		ipc_port_t port = (ipc_port_t) object;
+
+		ip_lock(port);
+		assert(ip_active(port));
+		assert(port->ip_receiver_name != MACH_PORT_NAME_NULL);
+		assert(port->ip_receiver == ipc_space_kernel);
+
+		/* relevant part of ipc_port_clear_receiver */
+		ipc_port_set_mscount(port, 0);
+
+		port->ip_receiver_name = MACH_PORT_NAME_NULL;
+		port->ip_destination = IP_NULL;
+		ip_unlock(port);
+		break;
+	    }
+
+	    case MACH_MSG_TYPE_COPY_SEND: {
+		ipc_port_t port = (ipc_port_t) object;
+
+		ip_lock(port);
+		if (ip_active(port)) {
+			assert(port->ip_srights > 0);
+			port->ip_srights++;
+		}
+		ip_reference(port);
+		ip_unlock(port);
+		break;
+	    }
+
+	    case MACH_MSG_TYPE_MAKE_SEND: {
+		ipc_port_t port = (ipc_port_t) object;
+
+		ip_lock(port);
+		assert(ip_active(port));
+		assert(port->ip_receiver_name != MACH_PORT_NAME_NULL);
+		assert(port->ip_receiver == ipc_space_kernel);
+
+		ip_reference(port);
+		port->ip_mscount++;
+		port->ip_srights++;
+		ip_unlock(port);
+		break;
+	    }
+
+	    case MACH_MSG_TYPE_MOVE_SEND:
+		/* move naked send right into the message */
+		break;
+
+	    case MACH_MSG_TYPE_MAKE_SEND_ONCE: {
+		ipc_port_t port = (ipc_port_t) object;
+
+		ip_lock(port);
+		assert(ip_active(port));
+		assert(port->ip_receiver_name != MACH_PORT_NAME_NULL);
+
+		ip_reference(port);
+		port->ip_sorights++;
+		ip_unlock(port);
+		break;
+	    }
+
+	    case MACH_MSG_TYPE_MOVE_SEND_ONCE:
+		/* move naked send-once right into the message */
+		break;
+
+	    default:
+		panic("ipc_object_copyin_from_kernel: strange rights");
+	}
+}
+
+/*
+ *	Routine:	ipc_object_destroy
+ *	Purpose:
+ *		Destroys a naked capability.
+ *		Consumes a ref for the object.
+ *
+ *		A receive right should be in limbo or in transit.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_object_destroy(
+	ipc_object_t		object,
+	mach_msg_type_name_t	msgt_name)
+{
+	assert(IO_VALID(object));
+	assert(io_otype(object) == IOT_PORT);
+
+	switch (msgt_name) {
+	case MACH_MSG_TYPE_PORT_SEND:
+		ipc_port_release_send((ipc_port_t) object);
+		break;
+
+	case MACH_MSG_TYPE_PORT_SEND_ONCE:
+		ipc_notify_send_once((ipc_port_t) object);
+		break;
+
+	case MACH_MSG_TYPE_PORT_RECEIVE:
+		ipc_port_release_receive((ipc_port_t) object);
+		break;
+	default:
+		panic("ipc_object_destroy: strange rights");
+	}
+}
+
+/*
+ *	Routine:	ipc_object_copyout
+ *	Purpose:
+ *		Copyout a capability, placing it into a space.
+ *		If successful, consumes a ref for the object.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Copied out object, consumed ref.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_CAPABILITY	The object is dead.
+ *		KERN_NO_SPACE		No room in space for another right.
+ *		KERN_RESOURCE_SHORTAGE	No memory available.
+ */
+
+kern_return_t
+ipc_object_copyout(
+	ipc_space_t		space,
+	ipc_object_t		object,
+	mach_msg_type_name_t	msgt_name,
+	mach_port_name_t		*namep)
+{
+	mach_port_name_t name;
+	ipc_entry_t entry;
+	kern_return_t kr;
+	ipc_port_t port;
+
+	assert(IO_VALID(object));
+	MACH_VERIFY(io_otype(object) == IOT_PORT, ("bad type value on %p\n", object));
+	assert(io_otype(object) == IOT_PORT);
+
+	port = (ipc_port_t)object;
+	if (port->ip_flags & IP_CONTEXT_FILE)
+		return (ipc_entry_port_to_file(space, namep, (ipc_object_t) port));
+
+	is_write_lock(space);
+	if (!space->is_active) {
+		is_write_unlock(space);
+		return KERN_INVALID_TASK;
+	}
+	if ((msgt_name != MACH_MSG_TYPE_PORT_SEND_ONCE) &&
+		ipc_right_reverse(space, object, &name, &entry)) {
+		/* object is locked and active */
+
+		assert(entry->ie_bits & MACH_PORT_TYPE_SEND_RECEIVE);
+		goto done;
+	}
+	is_write_unlock(space);
+	/* we don't wish to specify a name to allocate */ 
+	name = MACH_PORT_NAME_NULL;
+	kr = ipc_entry_get(space,
+			msgt_name == MACH_MSG_TYPE_PORT_SEND_ONCE,
+						   &name, &entry);
+	if (kr != KERN_SUCCESS) {
+		return (kr);
+	}
+
+	assert(IE_BITS_TYPE(entry->ie_bits) == MACH_PORT_TYPE_NONE);
+	assert(entry->ie_object == IO_NULL);
+
+	io_lock(object);
+	if (!io_active(object)) {
+		io_unlock(object);
+		is_write_lock(space);
+		/* unlocks */
+		ipc_entry_dealloc(space, name, entry);
+		return KERN_INVALID_CAPABILITY;
+	}
+
+	entry->ie_object = object;
+	/* space is write-locked and active, object is locked and active */
+	is_write_lock(space);
+done:
+	kr = ipc_right_copyout(space, name, entry,
+			       msgt_name, object);
+	is_write_unlock(space);
+	if (kr == KERN_SUCCESS)
+		*namep = name;
+	return kr;
+}
+
+/*
+ *	Routine:	ipc_object_copyout_name
+ *	Purpose:
+ *		Copyout a capability, placing it into a space.
+ *		The specified name is used for the capability.
+ *		If successful, consumes a ref for the object.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Copied out object, consumed ref.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_CAPABILITY	The object is dead.
+ *		KERN_RESOURCE_SHORTAGE	No memory available.
+ *		KERN_RIGHT_EXISTS	Space has rights under another name.
+ *		KERN_NAME_EXISTS	Name is already used.
+ */
+
+kern_return_t
+ipc_object_copyout_name(
+	ipc_space_t		space,
+	ipc_object_t		object,
+	mach_msg_type_name_t	msgt_name,
+	mach_port_name_t		name)
+{
+	mach_port_name_t oname;
+	ipc_entry_t oentry;
+	ipc_entry_t entry;
+	kern_return_t kr;
+
+	assert(IO_VALID(object));
+	assert(io_otype(object) == IOT_PORT);
+
+	kr = ipc_entry_alloc_name(space, name, &entry);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* space is write-locked and active */
+
+	if ((msgt_name != MACH_MSG_TYPE_PORT_SEND_ONCE) &&
+	    ipc_right_reverse(space, object, &oname, &oentry)) {
+		/* object is locked and active */
+
+		if (name != oname) {
+			io_unlock(object);
+
+			if (IE_BITS_TYPE(entry->ie_bits)
+						== MACH_PORT_TYPE_NONE)
+				ipc_entry_dealloc(space, name, entry);
+			else
+				is_write_unlock(space);
+			return KERN_RIGHT_EXISTS;
+		}
+
+		assert(entry == oentry);
+		assert(entry->ie_bits & MACH_PORT_TYPE_SEND_RECEIVE);
+	} else {
+		if (ipc_right_inuse(space, name, entry))
+			return KERN_NAME_EXISTS;
+
+		assert(IE_BITS_TYPE(entry->ie_bits) == MACH_PORT_TYPE_NONE);
+		assert(entry->ie_object == IO_NULL);
+
+		io_lock(object);
+		if (!io_active(object)) {
+			io_unlock(object);
+			ipc_entry_dealloc(space, name, entry);
+			return KERN_INVALID_CAPABILITY;
+		}
+
+		entry->ie_object = object;
+	}
+
+	/* space is write-locked and active, object is locked and active */
+
+	kr = ipc_right_copyout(space, name, entry,
+			       msgt_name, object);
+	/* object is unlocked */
+	is_write_unlock(space);
+	return kr;
+}
+
+/*
+ *	Routine:	ipc_object_copyout_dest
+ *	Purpose:
+ *		Translates/consumes the destination right of a message.
+ *		This is unlike normal copyout because the right is consumed
+ *		in a funny way instead of being given to the receiving space.
+ *		The receiver gets his name for the port, if he has receive
+ *		rights, otherwise MACH_PORT_NULL.
+ *	Conditions:
+ *		The object is locked and active.  Nothing else locked.
+ *		The object is unlocked and loses a reference.
+ */
+
+void
+ipc_object_copyout_dest(
+	ipc_space_t		space,
+	ipc_object_t		object,
+	mach_msg_type_name_t	msgt_name,
+	mach_port_name_t		*namep)
+{
+	mach_port_name_t name;
+
+	assert(IO_VALID(object));
+	assert(io_active(object));
+
+	io_release(object);
+
+	/*
+	 *	If the space is the receiver/owner of the object,
+	 *	then we quietly consume the right and return
+	 *	the space's name for the object.  Otherwise
+	 *	we destroy the right and return MACH_PORT_NULL.
+	 */
+
+	switch (msgt_name) {
+	    case MACH_MSG_TYPE_PORT_SEND: {
+		ipc_port_t port = (ipc_port_t) object;
+		ipc_port_t nsrequest = IP_NULL;
+		mach_port_mscount_t mscount;
+
+		if (port->ip_receiver == space)
+			name = port->ip_receiver_name;
+		else
+			name = MACH_PORT_NAME_NULL;
+
+		assert(port->ip_srights > 0);
+		if (--port->ip_srights == 0 &&
+		    port->ip_nsrequest != IP_NULL) {
+			nsrequest = port->ip_nsrequest;
+			port->ip_nsrequest = IP_NULL;
+			mscount = port->ip_mscount;
+			ip_unlock(port);
+			ipc_notify_no_senders(nsrequest, mscount);
+		} else
+			ip_unlock(port);
+		break;
+	    }
+
+	    case MACH_MSG_TYPE_PORT_SEND_ONCE: {
+		ipc_port_t port = (ipc_port_t) object;
+
+		assert(port->ip_sorights > 0);
+
+		if (port->ip_receiver == space) {
+			/* quietly consume the send-once right */
+
+			port->ip_sorights--;
+			name = port->ip_receiver_name;
+			ip_unlock(port);
+		} else {
+			/*
+			 *	A very bizarre case.  The message
+			 *	was received, but before this copyout
+			 *	happened the space lost receive rights.
+			 *	We can't quietly consume the soright
+			 *	out from underneath some other task,
+			 *	so generate a send-once notification.
+			 */
+
+			ip_reference(port); /* restore ref */
+			ip_unlock(port);
+
+			ipc_notify_send_once(port);
+			name = MACH_PORT_NAME_NULL;
+		}
+
+		break;
+	    }
+
+	    default:
+		panic("ipc_object_copyout_dest: strange rights");
+	}
+
+	*namep = name;
+}
+
+/*
+ *	Routine:	ipc_object_rename
+ *	Purpose:
+ *		Rename an entry in a space.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Renamed the entry.
+ *		KERN_INVALID_TASK	The space was dead.
+ *		KERN_INVALID_NAME	oname didn't denote an entry.
+ *		KERN_NAME_EXISTS	nname already denoted an entry.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate new entry.
+ */
+
+kern_return_t
+ipc_object_rename(
+	ipc_space_t	space,
+	mach_port_name_t	oname,
+	mach_port_name_t	nname)
+{
+	ipc_entry_t oentry, nentry;
+	kern_return_t kr;
+
+	kr = ipc_entry_alloc_name(space, nname, &nentry);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* space is write-locked and active */
+
+	if (ipc_right_inuse(space, nname, nentry)) {
+		/* space is unlocked */
+		return KERN_NAME_EXISTS;
+	}
+
+	/* don't let ipc_entry_lookup see the uninitialized new entry */
+
+	if ((oname == nname) ||
+	    ((oentry = ipc_entry_lookup(space, oname)) == IE_NULL)) {
+		ipc_entry_dealloc(space, nname, nentry);
+		return KERN_INVALID_NAME;
+	}
+
+	kr = ipc_right_rename(space, oname, oentry, nname, nentry);
+	/* space is unlocked */
+	return kr;
+}
+
+#if	MACH_KDB
+#include <mach_kdb.h>
+
+#include <ddb/db_output.h>
+
+#define	printf	kdbprintf
+
+/*
+ *	Routine:	ipc_object_print
+ *	Purpose:
+ *		Pretty-print an object for kdb.
+ */
+
+char *ikot_print_array[IKOT_MAX_TYPE] = {
+	"(NONE)             ",
+	"(THREAD)           ",
+	"(TASK)             ",
+	"(HOST)             ",
+	"(HOST_PRIV)        ",
+	"(PROCESSOR)        ",
+	"(PSET)             ",
+	"(PSET_NAME)        ",
+	"(PAGER)            ",
+	"(PAGER_REQUEST)    ",
+	"(DEVICE)           ",	/* 10 */
+	"(XMM_OBJECT)       ",
+	"(XMM_PAGER)        ",
+	"(XMM_KERNEL)       ",
+	"(XMM_REPLY)        ",
+	"(PAGER_TERMINATING)",
+	"(PAGING_NAME)      ",
+	"(HOST_SECURITY)    ",
+	"(LEDGER)           ",
+	"(MASTER_DEVICE)    ",
+	"(ACTIVATION)       ",	/* 20 */
+	"(SUBSYSTEM)        ",
+	"(IO_DONE_QUEUE)    ",
+	"(SEMAPHORE)        ",
+	"(LOCK_SET)         ",
+	"(CLOCK)            ",
+	"(CLOCK_CTRL)       ",	/* 26 */
+				/* << new entries here	*/
+	"(UNKNOWN)     "	/* magic catchall	*/
+};	/* Please keep in sync with kern/ipc_kobject.h	*/
+
+void
+ipc_object_print(
+	ipc_object_t	object)
+{
+	int kotype;
+
+	iprintf("%s", io_active(object) ? "active" : "dead");
+	printf(", refs=%d", object->io_references);
+	printf(", otype=%d", io_otype(object));
+	kotype = io_kotype(object);
+	if (kotype >= 0 && kotype < IKOT_MAX_TYPE)
+		printf(", kotype=%d %s\n", io_kotype(object),
+		       ikot_print_array[kotype]);
+	else
+		printf(", kotype=0x%x %s\n", io_kotype(object),
+		       ikot_print_array[IKOT_UNKNOWN]);
+}
+
+#endif	/* MACH_KDB */


Property changes on: trunk/sys/compat/mach/ipc/ipc_object.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/ipc_port.c
===================================================================
--- trunk/sys/compat/mach/ipc/ipc_port.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/ipc_port.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,2218 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.13.2.7  92/06/24  18:00:04  jeffreyh
+ * 	Add norma send once right management hook to ipc_port_release_sonce.
+ * 	[92/06/08            dlb]
+ * 
+ * Revision 2.13.2.6  92/05/27  00:45:00  jeffreyh
+ * 	Call NORMA hooks (norma_ipc_dnrequest_init) when first allocating
+ * 	a dnrequest table for a port, and when encountering a NORMA fake
+ * 	notification in ipc_port_destroy.
+ * 	[92/05/25            dlb]
+ * 
+ * 	Initialize new fields of port structure, add them to debugger
+ * 	show display.
+ * 	[92/05/19            sjs]
+ * 
+ * 	Call norma_ipc_finish_receiving before destroying kmsgs in 
+ * 	ipc_port_destroy because the kmsgs might still be in network format.
+ * 	[92/05/12            dlb]
+ * 
+ * Revision 2.13.2.5.1.1  92/05/06  17:47:00  jeffreyh
+ * 	Initialize new ip_norma_atrium_waiter field.  Add a norma assert.
+ * 	[92/05/05            dlb]
+ * 
+ * Revision 2.13.2.5  92/04/08  15:44:39  jeffreyh
+ * 	Set sequence number to zero before destroying port
+ * 	in ipc_port_dealloc_special.
+ * 	[92/04/01            dlb]
+ * 
+ * Revision 2.13.2.4  92/03/28  10:09:27  jeffreyh
+ * 	Do norma_ipc_port_destroy call after port is deactivated.
+ * 	[92/03/25            dlb]
+ * 
+ * Revision 2.13.2.3  92/02/21  14:35:39  jsb
+ * 	In ipc_port_alloc_special, throw debugging info into spare fields.
+ * 	[92/02/20  10:26:50  jsb]
+ * 
+ * 	Removed ip_norma_queued. Changed initialization of ip_norma_queue_next.
+ * 	Added ip_norma_spare[1234].
+ * 	[92/02/18  08:13:02  jsb]
+ * 
+ * 	Initialize and print ip_norma_xmm_object_refs field.
+ * 	[92/02/16  16:00:11  jsb]
+ * 
+ * 	Removed ipc_port_move_special routine. Added ip_norma_xmm_object field.
+ * 	[92/02/09  12:45:37  jsb]
+ * 
+ * Revision 2.13.2.2  92/01/21  21:50:31  jsb
+ * 	Added ipc_port_move_special. (dlb at osf.org)
+ * 	[92/01/17  14:29:16  jsb]
+ * 
+ * 	Removed norma_list_all_{ports,seqnos} hacks in ipc_print_port.
+ * 	Initialize port->ip_norma_next = port (vs. IP_NULL) for new
+ * 	norma/ipc_list.c implementation.
+ * 	[92/01/16  21:30:02  jsb]
+ * 
+ * Revision 2.13.2.1  92/01/03  16:35:42  jsb
+ * 	Incorporated 'show port 1' hack for listing more norma port info.
+ * 	[91/12/31  17:10:21  jsb]
+ * 
+ * 	Added support for ip_norma_{queued,queue_next}.
+ * 	Made ipc_port_print more consistent.
+ * 	[91/12/27  17:16:38  jsb]
+ * 
+ * 	Removed ip_norma_{wanted,migrating}; added ip_norma_{sotransit,atrium}.
+ * 	Incorporated 'show port 0' hack for listing all norma ports.
+ * 	[91/12/26  20:00:09  jsb]
+ * 
+ * 	Removed references to obsolete NORMA_IPC fields in struct ipc_port.
+ * 	Corrected log.
+ * 	[91/12/24  14:39:54  jsb]
+ * 
+ * Revision 2.13  91/12/14  14:27:37  jsb
+ * 	Removed ipc_fields.h hack.
+ * 
+ * Revision 2.12  91/11/14  16:56:14  rpd
+ * 	Added ipc_fields.h support to ipc_port_{init,print}.
+ *	Call norma_ipc_port_destroy instead of norma_ipc_destroy.
+ * 	[91/11/00            jsb]
+ * 
+ * Revision 2.11  91/10/09  16:09:42  af
+ * 	Removed unused variable.
+ * 	[91/09/16  09:42:52  rpd]
+ * 
+ * Revision 2.10  91/08/28  11:13:44  jsb
+ * 	Added ip_seqno and ipc_port_set_seqno.
+ * 	Changed ipc_port_init to initialize ip_seqno.
+ * 	Changed ipc_port_clear_receiver to zero ip_seqno.
+ * 	[91/08/09            rpd]
+ * 	Renamed clport fields in struct ipc_port to ip_norma fields.
+ * 	[91/08/15  08:20:08  jsb]
+ * 
+ * Revision 2.9  91/08/03  18:18:30  jsb
+ * 	Call norma_ipc_destroy when destroying port.
+ * 	Added clport fields to ipc_port_print.
+ * 	[91/07/24  22:14:01  jsb]
+ * 
+ * 	Fixed include. Changed clport field initialization.
+ * 	[91/07/17  14:05:38  jsb]
+ * 
+ * Revision 2.8  91/06/17  15:46:21  jsb
+ * 	Renamed NORMA conditionals.
+ * 	[91/06/17  10:44:21  jsb]
+ * 
+ * Revision 2.7  91/05/14  16:35:22  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.6  91/03/16  14:48:27  rpd
+ * 	Renamed ipc_thread_go to thread_go.
+ * 	[91/02/17            rpd]
+ * 
+ * Revision 2.5  91/02/05  17:23:02  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:49:46  mrt]
+ * 
+ * Revision 2.4  90/11/05  14:29:30  rpd
+ * 	Changed ip_release to ipc_port_release.
+ * 	Use new ip_reference and ip_release.
+ * 	[90/10/29            rpd]
+ * 
+ * Revision 2.3  90/09/28  16:55:10  jsb
+ * 	Added NORMA_IPC support.
+ * 	[90/09/28  14:03:45  jsb]
+ * 
+ * Revision 2.2  90/06/02  14:51:08  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:01:02  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_port.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Functions to manipulate IPC ports.
+ */
+
+
+#include <sys/mach/port.h>
+#include <sys/mach/kern_return.h>
+
+#include <sys/mach/ipc_kobject.h>
+#include <sys/mach/ipc/ipc_entry.h>
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_pset.h>
+#include <sys/mach/ipc/ipc_thread.h>
+#include <sys/mach/ipc/ipc_mqueue.h>
+#include <sys/mach/ipc/ipc_notify.h>
+#include <sys/mach/ipc/ipc_print.h>
+#include <sys/mach/ipc/ipc_table.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/thread.h>
+#include <sys/mach/rpc.h>
+
+#if	MACH_KDB
+#include <machine/db_machdep.h>
+#include <ddb/db_command.h>
+#include <ddb/db_expr.h>
+#endif	/* MACH_KDB */
+
+decl_mutex_data(,	ipc_port_multiple_lock_data)
+decl_mutex_data(,	ipc_port_timestamp_lock_data)
+ipc_port_timestamp_t	ipc_port_timestamp_data;
+
+#if	MACH_ASSERT
+void	ipc_port_init_debug(
+		ipc_port_t	port);
+#endif	/* MACH_ASSERT */
+
+#if	MACH_KDB && ZONE_DEBUG
+/* Forwards */
+void	print_type_ports(unsigned, unsigned);
+void	print_ports(void);
+#endif	/* MACH_KDB && ZONE_DEBUG */
+
+/*
+ *	Routine:	ipc_port_timestamp
+ *	Purpose:
+ *		Retrieve a timestamp value.
+ */
+
+ipc_port_timestamp_t
+ipc_port_timestamp(void)
+{
+	ipc_port_timestamp_t timestamp;
+
+	ipc_port_timestamp_lock();
+	timestamp = ipc_port_timestamp_data++;
+	ipc_port_timestamp_unlock();
+
+	return timestamp;
+}
+
+/*
+ *	Routine:	ipc_port_dnrequest
+ *	Purpose:
+ *		Try to allocate a dead-name request slot.
+ *		If successful, returns the request index.
+ *		Otherwise returns zero.
+ *	Conditions:
+ *		The port is locked and active.
+ *	Returns:
+ *		KERN_SUCCESS		A request index was found.
+ *		KERN_NO_SPACE		No index allocated.
+ */
+
+kern_return_t
+ipc_port_dnrequest(
+	ipc_port_t			port,
+	mach_port_name_t			name,
+	ipc_port_t			soright,
+	ipc_port_request_index_t	*indexp)
+{
+	ipc_port_request_t ipr, table;
+	ipc_port_request_index_t index;
+
+	assert(ip_active(port));
+	assert(name != MACH_PORT_NAME_NULL);
+	assert(soright != IP_NULL);
+
+	table = port->ip_dnrequests;
+	if (table == IPR_NULL)
+		return KERN_NO_SPACE;
+
+	index = table->ipr_next;
+	if (index == 0)
+		return KERN_NO_SPACE;
+
+	ipr = &table[index];
+	assert(ipr->ipr_name == MACH_PORT_NAME_NULL);
+
+	table->ipr_next = ipr->ipr_next;
+	ipr->ipr_name = name;
+	ipr->ipr_soright = soright;
+
+	*indexp = index;
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_port_dngrow
+ *	Purpose:
+ *		Grow a port's table of dead-name requests.
+ *	Conditions:
+ *		The port must be locked and active.
+ *		Nothing else locked; will allocate memory.
+ *		Upon return the port is unlocked.
+ *	Returns:
+ *		KERN_SUCCESS		Grew the table.
+ *		KERN_SUCCESS		Somebody else grew the table.
+ *		KERN_SUCCESS		The port died.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate new table.
+ *		KERN_NO_SPACE		Couldn't grow to desired size
+ */
+
+kern_return_t
+ipc_port_dngrow(
+	ipc_port_t	port,
+	int		target_size)
+{
+	ipc_table_size_t its;
+	ipc_port_request_t otable, ntable;
+
+	assert(ip_active(port));
+
+	otable = port->ip_dnrequests;
+	if (otable == IPR_NULL)
+		its = &ipc_table_dnrequests[0];
+	else
+		its = otable->ipr_size + 1;
+
+	if (target_size != ITS_SIZE_NONE) {
+		if ((otable != IPR_NULL) &&
+		    (target_size <= otable->ipr_size->its_size)) {
+			ip_unlock(port);
+			return KERN_SUCCESS;
+	        }
+		while ((its->its_size) && (its->its_size < target_size)) {
+			its++;
+		}
+		if (its->its_size == 0) {
+			ip_unlock(port);
+			return KERN_NO_SPACE;
+		}
+	}
+
+	ip_reference(port);
+	ip_unlock(port);
+
+	if ((its->its_size == 0) ||
+	    ((ntable = it_dnrequests_alloc(its)) == IPR_NULL)) {
+		ipc_port_release(port);
+		return KERN_RESOURCE_SHORTAGE;
+	}
+
+	ip_lock(port);
+
+	/*
+	 *	Check that port is still active and that nobody else
+	 *	has slipped in and grown the table on us.  Note that
+	 *	just checking port->ip_dnrequests == otable isn't
+	 *	sufficient; must check ipr_size.
+	 */
+
+	if (ip_active(port) &&
+	    (port->ip_dnrequests == otable) &&
+	    ((otable == IPR_NULL) || (otable->ipr_size+1 == its))) {
+		ipc_table_size_t oits;
+		ipc_table_elems_t osize, nsize;
+		ipc_port_request_index_t free, i;
+
+		/* copy old table to new table */
+
+		if (otable != IPR_NULL) {
+			oits = otable->ipr_size;
+			osize = oits->its_size;
+			free = otable->ipr_next;
+
+			(void) memcpy((void *)(ntable + 1),
+			      (const void *)(otable + 1),
+			      (osize - 1) * sizeof(struct ipc_port_request));
+		} else {
+			osize = 1;
+			free = 0;
+		}
+
+		nsize = its->its_size;
+		assert(nsize > osize);
+
+		/* add new elements to the new table's free list */
+
+		for (i = osize; i < nsize; i++) {
+			ipc_port_request_t ipr = &ntable[i];
+
+			ipr->ipr_name = MACH_PORT_NAME_NULL;
+			ipr->ipr_next = free;
+			free = i;
+		}
+
+		ntable->ipr_next = free;
+		ntable->ipr_size = its;
+		port->ip_dnrequests = ntable;
+		ip_unlock(port);
+
+		if (otable != IPR_NULL) {
+			it_dnrequests_free(oits, otable);
+	        }
+	} else {
+		ip_unlock(port);
+		it_dnrequests_free(its, ntable);
+	}
+	ip_release(port);
+	return KERN_SUCCESS;
+}
+ 
+/*
+ *	Routine:	ipc_port_dncancel
+ *	Purpose:
+ *		Cancel a dead-name request and return the send-once right.
+ *	Conditions:
+ *		The port must locked and active.
+ */
+
+ipc_port_t
+ipc_port_dncancel(
+	ipc_port_t			port,
+	mach_port_name_t			name,
+	ipc_port_request_index_t	index)
+{
+	ipc_port_request_t ipr, table;
+	ipc_port_t dnrequest;
+
+	assert(ip_active(port));
+	assert(name != MACH_PORT_NAME_NULL);
+	assert(index != 0);
+
+	table = port->ip_dnrequests;
+	assert(table != IPR_NULL);
+
+	ipr = &table[index];
+	dnrequest = ipr->ipr_soright;
+	assert(ipr->ipr_name == name);
+
+	/* return ipr to the free list inside the table */
+
+	ipr->ipr_name = MACH_PORT_NAME_NULL;
+	ipr->ipr_next = table->ipr_next;
+	table->ipr_next = index;
+
+	return dnrequest;
+}
+
+/*
+ *	Routine:	ipc_port_pdrequest
+ *	Purpose:
+ *		Make a port-deleted request, returning the
+ *		previously registered send-once right.
+ *		Just cancels the previous request if notify is IP_NULL.
+ *	Conditions:
+ *		The port is locked and active.  It is unlocked.
+ *		Consumes a ref for notify (if non-null), and
+ *		returns previous with a ref (if non-null).
+ */
+
+void
+ipc_port_pdrequest(
+	ipc_port_t	port,
+	ipc_port_t	notify,
+	ipc_port_t	*previousp)
+{
+	ipc_port_t previous;
+
+	assert(ip_active(port));
+
+	previous = port->ip_pdrequest;
+	port->ip_pdrequest = notify;
+	ip_unlock(port);
+
+	*previousp = previous;
+}
+
+/*
+ *	Routine:	ipc_port_nsrequest
+ *	Purpose:
+ *		Make a no-senders request, returning the
+ *		previously registered send-once right.
+ *		Just cancels the previous request if notify is IP_NULL.
+ *	Conditions:
+ *		The port is locked and active.  It is unlocked.
+ *		Consumes a ref for notify (if non-null), and
+ *		returns previous with a ref (if non-null).
+ */
+
+void
+ipc_port_nsrequest(
+	ipc_port_t		port,
+	mach_port_mscount_t	sync,
+	ipc_port_t		notify,
+	ipc_port_t		*previousp)
+{
+	ipc_port_t previous;
+	mach_port_mscount_t mscount;
+
+	assert(ip_active(port));
+
+	previous = port->ip_nsrequest;
+	mscount = port->ip_mscount;
+
+	if ((port->ip_srights == 0) &&
+	    (sync <= mscount) &&
+	    (notify != IP_NULL)) {
+		port->ip_nsrequest = IP_NULL;
+		ip_unlock(port);
+		ipc_notify_no_senders(notify, mscount);
+	} else {
+		port->ip_nsrequest = notify;
+		ip_unlock(port);
+	}
+
+	*previousp = previous;
+}
+
+/*
+ *	Routine:	ipc_port_set_qlimit
+ *	Purpose:
+ *		Changes a port's queue limit; the maximum number
+ *		of messages which may be queued to the port.
+ *	Conditions:
+ *		The port is locked and active.
+ */
+
+void
+ipc_port_set_qlimit(
+	ipc_port_t		port,
+	mach_port_msgcount_t	qlimit)
+{
+	assert(ip_active(port));
+
+	/* wake up senders allowed by the new qlimit */
+
+	if (qlimit > port->ip_qlimit) {
+		mach_port_msgcount_t i, wakeup;
+
+		/* caution: wakeup, qlimit are unsigned */
+
+		wakeup = qlimit - port->ip_qlimit;
+
+		for (i = 0; i < wakeup; i++) {
+			ipc_thread_t th;
+
+			th = ipc_thread_dequeue(&port->ip_blocked);
+			if (th == ITH_NULL)
+				break;
+
+			th->ith_state = MACH_MSG_SUCCESS;
+			thread_go(th);
+		}
+	}
+
+	port->ip_qlimit = qlimit;
+}
+
+/*
+ *	Routine:	ipc_port_set_seqno
+ *	Purpose:
+ *		Changes a port's sequence number.
+ *	Conditions:
+ *		The port is locked and active.
+ */
+
+void
+ipc_port_set_seqno(
+	ipc_port_t		port,
+	mach_port_seqno_t	seqno)
+{
+	if (port->ip_pset != IPS_NULL) {
+		ipc_pset_t pset = port->ip_pset;
+
+		ips_lock(pset);
+		if (!ips_active(pset)) {
+			ipc_pset_remove(pset, port);
+			ips_unlock(pset);
+			ips_release(pset);
+			goto no_port_set;
+		} else {
+			port->ip_seqno = seqno;
+		}
+	} else {
+	    no_port_set:
+		port->ip_seqno = seqno;
+	}
+}
+
+/*
+ *	Routine:	ipc_port_changed
+ *	Purpose:
+ *		Wake up receivers waiting on port.
+ *	Conditions:
+ *		The port is locked.
+ */
+
+static void
+ipc_port_changed(
+	ipc_port_t		port,
+	mach_msg_return_t	mr)
+{
+	ipc_thread_t th;
+
+	while ((th = thread_pool_get_act((ipc_object_t)port, 0)) != ITH_NULL) {
+		th->ith_state = mr;
+		thread_go(th);
+	}
+}
+
+/*
+ *	Routine:	ipc_port_clear_receiver
+ *	Purpose:
+ *		Prepares a receive right for transmission/destruction.
+ *	Conditions:
+ *		The port is locked and active.
+ */
+
+void
+ipc_port_clear_receiver(
+	ipc_port_t	port)
+{
+	ipc_pset_t pset;
+
+	assert(ip_active(port));
+
+	pset = port->ip_pset;
+	if (pset != IPS_NULL) {
+		ips_lock(pset);
+		ipc_pset_remove(pset, port);
+		ips_unlock(pset);
+		ips_release(pset);
+	}
+
+	ipc_port_changed(port, MACH_RCV_PORT_DIED);
+
+	ipc_port_set_mscount(port, 0);
+	port->ip_seqno = 0;
+}
+
+/*
+ *	Routine:	ipc_port_init
+ *	Purpose:
+ *		Initializes a newly-allocated port.
+ *		Doesn't touch the ip_object fields.
+ */
+
+void
+ipc_port_init(
+	ipc_port_t	port,
+	ipc_space_t	space,
+	mach_port_name_t	name)
+{
+	/* port->ip_kobject doesn't have to be initialized */
+
+	port->ip_receiver = space;
+	port->ip_receiver_name = name;
+
+	port->ip_mscount = 0;
+	port->ip_srights = 0;
+	port->ip_sorights = 0;
+
+	port->ip_nsrequest = IP_NULL;
+	port->ip_pdrequest = IP_NULL;
+	port->ip_dnrequests = IPR_NULL;
+
+	port->ip_pset = IPS_NULL;
+	port->ip_seqno = 0;
+	port->ip_msgcount = 0;
+	port->ip_qlimit = MACH_PORT_QLIMIT_DEFAULT;
+	port->ip_subsystem = RPC_SUBSYSTEM_NULL;
+	
+	port->ip_flags = 0;
+	port->ip_context = 0;
+
+	/*
+	 *	Turn no more senders detection on
+	 *	for all ports.  Eventually, this
+	 *	default will go away, and nms
+	 *	detection will be enabled depending
+	 *	on how the port is allocated. XXX
+	 */
+	IP_SET_NMS(port);
+
+#if	MACH_ASSERT
+	ipc_port_init_debug(port);
+#endif	/* MACH_ASSERT */
+
+	ipc_mqueue_init(&port->ip_messages);
+	thread_pool_init(&port->ip_thread_pool);
+	ipc_thread_queue_init(&port->ip_blocked);
+}
+
+/*
+ *	Routine:	ipc_port_alloc
+ *	Purpose:
+ *		Allocate a port.
+ *	Conditions:
+ *		Nothing locked.  If successful, the port is returned
+ *		locked.  (The caller doesn't have a reference.)
+ *	Returns:
+ *		KERN_SUCCESS		The port is allocated.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_NO_SPACE		No room for an entry in the space.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+ipc_port_alloc(
+	ipc_space_t	space,
+	mach_port_name_t	*namep,
+	ipc_port_t	*portp)
+{
+	ipc_port_t port;
+	mach_port_name_t name;
+	kern_return_t kr;
+
+	kr = ipc_object_alloc(space, IOT_PORT,
+			      MACH_PORT_TYPE_RECEIVE,
+			      &name, (ipc_object_t *) &port);
+	if (kr != KERN_SUCCESS)
+		return kr;
+
+	/* port is locked */
+
+	ipc_port_init(port, space, name);
+
+	*namep = name;
+	*portp = port;
+
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_port_alloc_name
+ *	Purpose:
+ *		Allocate a port, with a specific name.
+ *	Conditions:
+ *		Nothing locked.  If successful, the port is returned
+ *		locked.  (The caller doesn't have a reference.)
+ *	Returns:
+ *		KERN_SUCCESS		The port is allocated.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_NAME_EXISTS	The name already denotes a right.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+ipc_port_alloc_name(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_port_t	*portp)
+{
+	ipc_port_t port;
+	kern_return_t kr;
+
+	/* XXX - is there a case where we need this?*/
+	return KERN_NOT_SUPPORTED;
+
+	kr = ipc_object_alloc_name(space, IOT_PORT,
+				   MACH_PORT_TYPE_RECEIVE,
+				   name, (ipc_object_t *) &port);
+	if (kr != KERN_SUCCESS)
+		return kr;
+
+	/* port is locked */
+
+	ipc_port_init(port, space, name);
+
+	*portp = port;
+
+	return KERN_SUCCESS;
+}
+
+/*
+ * Generate dead name notifications.  Called from ipc_port_destroy
+ * and (#if DIPC) from dproc_dn_notify.  Port is unlocked but still
+ * has reference(s); dnrequests was taken from port while the port
+ * was locked but the port now has port->ip_dnrequests set to IPR_NULL.
+ */
+void
+ipc_port_dnnotify(
+	ipc_port_t		port,
+	ipc_port_request_t	dnrequests)
+{
+	ipc_table_size_t	its = dnrequests->ipr_size;
+	ipc_table_elems_t	size = its->its_size;
+	ipc_port_request_index_t index;
+
+	for (index = 1; index < size; index++) {
+		ipc_port_request_t	ipr = &dnrequests[index];
+		mach_port_name_t		name = ipr->ipr_name;
+		ipc_port_t		soright;
+
+		if (name == MACH_PORT_NAME_NULL)
+			continue;
+
+		soright = ipr->ipr_soright;
+		assert(soright != IP_NULL);
+
+		ipc_notify_dead_name(soright, name);
+	}
+
+	it_dnrequests_free(its, dnrequests);
+}
+
+/*
+ *	Routine:	ipc_port_destroy
+ *	Purpose:
+ *		Destroys a port.  Cleans up queued messages.
+ *
+ *		If the port has a backup, it doesn't get destroyed,
+ *		but is sent in a port-destroyed notification to the backup.
+ *	Conditions:
+ *		The port is locked and alive; nothing else locked.
+ *		The caller has a reference, which is consumed.
+ *		Afterwards, the port is unlocked and dead.
+ */
+
+void
+ipc_port_destroy(
+	ipc_port_t	port)
+{
+	ipc_port_t pdrequest, nsrequest;
+	ipc_mqueue_t mqueue;
+	ipc_kmsg_queue_t kmqueue;
+	ipc_kmsg_t kmsg;
+	ipc_thread_t sender;
+	ipc_port_request_t dnrequests;
+	thread_pool_t thread_pool;
+
+	assert(ip_active(port));
+	/* port->ip_receiver_name is garbage */
+	/* port->ip_receiver/port->ip_destination is garbage */
+	assert(io_otype((ipc_object_t)port) == IOT_PORT);
+	assert(port->ip_pset == IPS_NULL);
+	assert(port->ip_mscount == 0);
+	assert(port->ip_seqno == 0);
+
+	/* first check for a backup port */
+
+	pdrequest = port->ip_pdrequest;
+	if (pdrequest != IP_NULL) {
+		/* we assume the ref for pdrequest */
+		port->ip_pdrequest = IP_NULL;
+
+		/* make port be in limbo */
+		port->ip_receiver_name = MACH_PORT_NAME_NULL;
+		port->ip_destination = IP_NULL;
+		ip_unlock(port);
+
+		if (!ipc_port_check_circularity(port, pdrequest)) {
+			/* consumes our refs for port and pdrequest */
+			ipc_notify_port_destroyed(pdrequest, port);
+			return;
+		} else {
+			/* consume pdrequest and destroy port */
+			ipc_port_release_sonce(pdrequest);
+		}
+
+		ip_lock(port);
+		assert(ip_active(port));
+		assert(port->ip_pset == IPS_NULL);
+		assert(port->ip_mscount == 0);
+		assert(port->ip_seqno == 0);
+		assert(port->ip_pdrequest == IP_NULL);
+		assert(port->ip_receiver_name == MACH_PORT_NAME_NULL);
+		assert(port->ip_destination == IP_NULL);
+
+		/* fall through and destroy the port */
+	}
+
+	/*
+	 *	rouse all blocked senders
+	 *
+	 *	This must be done with the port locked, because
+	 *	ipc_mqueue_send can play with the ip_blocked queue
+	 *	of a dead port.
+	 */
+
+	while ((sender = ipc_thread_dequeue(&port->ip_blocked)) != ITH_NULL) {
+		sender->ith_state = MACH_MSG_SUCCESS;
+		thread_go(sender);
+	}
+
+	/* once port is dead, we don't need to keep it locked */
+
+	port->ip_object.io_bits &= ~IO_BITS_ACTIVE;
+	port->ip_timestamp = ipc_port_timestamp();
+
+	/* save for later */
+	dnrequests = port->ip_dnrequests;
+	port->ip_dnrequests = IPR_NULL;
+	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;
+	if (nsrequest != IP_NULL)
+		ipc_notify_send_once(nsrequest); /* consumes ref */
+
+	/* destroy any queued messages */
+
+	mqueue = &port->ip_messages;
+	kmqueue = &mqueue->imq_messages;
+
+	while ((kmsg = ipc_kmsg_dequeue(kmqueue)) != IKM_NULL) {
+		assert(kmsg->ikm_header->msgh_remote_port ==
+						(mach_port_t) port);
+
+		port->ip_msgcount--;
+		ipc_port_release(port);
+		kmsg->ikm_header->msgh_remote_port = MACH_PORT_NULL;
+		ipc_kmsg_destroy(kmsg);
+
+	}
+
+	/* generate dead-name notifications */
+	if (dnrequests != IPR_NULL) {
+		ipc_port_dnnotify(port, dnrequests);
+	}
+
+	if (ip_kotype(port) != IKOT_NONE)
+		ipc_kobject_destroy(port);
+
+	/* XXXX Perhaps should verify that ip_thread_pool is empty! */
+
+	ipc_port_release(port); /* consume caller's ref */
+}
+
+/*
+ *	Routine:	ipc_port_check_circularity
+ *	Purpose:
+ *		Check if queueing "port" in a message for "dest"
+ *		would create a circular group of ports and messages.
+ *
+ *		If no circularity (FALSE returned), then "port"
+ *		is changed from "in limbo" to "in transit".
+ *
+ *		That is, we want to set port->ip_destination == dest,
+ *		but guaranteeing that this doesn't create a circle
+ *		port->ip_destination->ip_destination->... == port
+ *	Conditions:
+ *		No ports locked.  References held for "port" and "dest".
+ */
+
+boolean_t
+ipc_port_check_circularity(
+	ipc_port_t	port,
+	ipc_port_t	dest)
+{
+	ipc_port_t base;
+
+	assert(port != IP_NULL);
+	assert(dest != IP_NULL);
+
+	if (port == dest)
+		return TRUE;
+	base = dest;
+
+	/*
+	 *	First try a quick check that can run in parallel.
+	 *	No circularity if dest is not in transit.
+	 */
+
+	ip_lock(port);
+	if (ip_lock_try(dest)) {
+		if (!ip_active(dest) ||
+		    (dest->ip_receiver_name != MACH_PORT_NAME_NULL) ||
+		    (dest->ip_destination == IP_NULL))
+			goto not_circular;
+
+		/* dest is in transit; further checking necessary */
+
+		ip_unlock(dest);
+	}
+	ip_unlock(port);
+
+	ipc_port_multiple_lock(); /* massive serialization */
+
+	/*
+	 *	Search for the end of the chain (a port not in transit),
+	 *	acquiring locks along the way.
+	 */
+
+	for (;;) {
+		ip_lock(base);
+
+		if (!ip_active(base) ||
+		    (base->ip_receiver_name != MACH_PORT_NAME_NULL) ||
+		    (base->ip_destination == IP_NULL))
+			break;
+
+		base = base->ip_destination;
+	}
+
+	/* all ports in chain from dest to base, inclusive, are locked */
+
+	if (port == base) {
+		/* circularity detected! */
+
+		ipc_port_multiple_unlock();
+
+		/* port (== base) is in limbo */
+
+		assert(ip_active(port));
+		assert(port->ip_receiver_name == MACH_PORT_NAME_NULL);
+		assert(port->ip_destination == IP_NULL);
+
+		while (dest != IP_NULL) {
+			ipc_port_t next;
+
+			/* dest is in transit or in limbo */
+
+			assert(ip_active(dest));
+			assert(dest->ip_receiver_name == MACH_PORT_NAME_NULL);
+
+			next = dest->ip_destination;
+			ip_unlock(dest);
+			dest = next;
+		}
+		printf("port %p is circular\n", port);
+		return TRUE;
+	}
+
+	/*
+	 *	The guarantee:  lock port while the entire chain is locked.
+	 *	Once port is locked, we can take a reference to dest,
+	 *	add port to the chain, and unlock everything.
+	 */
+
+	ip_lock(port);
+	ipc_port_multiple_unlock();
+
+    not_circular:
+
+	/* port is in limbo */
+
+	assert(ip_active(port));
+	assert(port->ip_receiver_name == MACH_PORT_NAME_NULL);
+	assert(port->ip_destination == IP_NULL);
+
+	ip_reference(dest);
+	port->ip_destination = dest;
+
+	/* now unlock chain */
+
+	while (port != base) {
+		ipc_port_t next;
+
+		/* port is in transit */
+
+		assert(ip_active(port));
+		assert(port->ip_receiver_name == MACH_PORT_NAME_NULL);
+		assert(port->ip_destination != IP_NULL);
+
+		next = port->ip_destination;
+		ip_unlock(port);
+		port = next;
+	}
+
+	/* base is not in transit */
+
+	assert(!ip_active(base) ||
+	       (base->ip_receiver_name != MACH_PORT_NAME_NULL) ||
+	       (base->ip_destination == IP_NULL));
+	ip_unlock(base);
+
+	return FALSE;
+}
+
+/*
+ *	Routine:	ipc_port_lookup_notify
+ *	Purpose:
+ *		Make a send-once notify port from a receive right.
+ *		Returns IP_NULL if name doesn't denote a receive right.
+ *	Conditions:
+ *		The space must be locked (read or write) and active.
+ */
+
+ipc_port_t
+ipc_port_lookup_notify(
+	ipc_space_t	space,
+	mach_port_name_t	name)
+{
+	ipc_port_t port;
+	ipc_entry_t entry;
+
+	assert(space->is_active);
+
+	entry = ipc_entry_lookup(space, name);
+	if (entry == IE_NULL)
+		return IP_NULL;
+
+	if ((entry->ie_bits & MACH_PORT_TYPE_RECEIVE) == 0)
+		return IP_NULL;
+
+	port = (ipc_port_t) entry->ie_object;
+	assert(port != IP_NULL);
+
+	ip_lock(port);
+	assert(ip_active(port));
+	assert(port->ip_receiver_name == name);
+	assert(port->ip_receiver == space);
+
+	ip_reference(port);
+	port->ip_sorights++;
+	ip_unlock(port);
+
+	return port;
+}
+
+/*
+ *	Routine:	ipc_port_make_send
+ *	Purpose:
+ *		Make a naked send right from a receive right.
+ *	Conditions:
+ *		The port is not locked but it is active.
+ */
+
+ipc_port_t
+ipc_port_make_send(
+	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_copy_send
+ *	Purpose:
+ *		Make a naked send right from another naked send right.
+ *			IP_NULL		-> IP_NULL
+ *			IP_DEAD		-> IP_DEAD
+ *			dead port	-> IP_DEAD
+ *			live port	-> port + ref
+ *	Conditions:
+ *		Nothing locked except possibly a space.
+ */
+
+ipc_port_t
+ipc_port_copy_send(
+	ipc_port_t	port)
+{
+	ipc_port_t sright;
+
+	if (!IP_VALID(port))
+		return port;
+
+	ip_lock(port);
+	if (ip_active(port)) {
+		assert(port->ip_srights > 0);
+
+		ip_reference(port);
+		port->ip_srights++;
+		sright = port;
+	} else
+		sright = IP_DEAD;
+	ip_unlock(port);
+
+	return sright;
+}
+
+/*
+ *	Routine:	ipc_port_copyout_send
+ *	Purpose:
+ *		Copyout a naked send right (possibly null/dead),
+ *		or if that fails, destroy the right.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+mach_port_name_t
+ipc_port_copyout_send(
+	ipc_port_t	sright,
+	ipc_space_t	space)
+{
+	mach_port_name_t name;
+
+	if (IP_VALID(sright)) {
+		kern_return_t kr;
+
+		kr = ipc_object_copyout(space, (ipc_object_t) sright,
+					MACH_MSG_TYPE_PORT_SEND, &name);
+		if (kr != KERN_SUCCESS) {
+			ipc_port_release_send(sright);
+
+			if (kr == KERN_INVALID_CAPABILITY)
+				name = MACH_PORT_NAME_DEAD;
+			else
+				name = MACH_PORT_NAME_NULL;
+		}
+	} else
+		name = MACH_PORT_NAME_NULL;
+
+	return name;
+}
+
+/*
+ *	Routine:	ipc_port_release_send
+ *	Purpose:
+ *		Release a (valid) naked send right.
+ *		Consumes a ref for the port.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_port_release_send(
+	ipc_port_t	port)
+{
+	ipc_port_t nsrequest = IP_NULL;
+	mach_port_mscount_t mscount;
+
+	assert(IP_VALID(port));
+
+	ip_lock(port);
+
+	if (!ip_active(port)) {
+		ip_unlock(port);
+		ip_release(port);
+		return;
+	}
+
+	assert(port->ip_srights > 0);
+
+	if (--port->ip_srights == 0 &&
+	    port->ip_nsrequest != IP_NULL) {
+		nsrequest = port->ip_nsrequest;
+		port->ip_nsrequest = IP_NULL;
+		mscount = port->ip_mscount;
+		ip_unlock(port);
+		ipc_notify_no_senders(nsrequest, mscount);
+#if 0		
+		/*
+		 * Check that there are no other locks taken, because
+		 * [norma_]ipc_notify_no_senders routines may block.
+		 */
+		check_simple_locks();
+#endif		
+	} else
+		ip_unlock(port);
+	ip_release(port);
+}
+
+/*
+ *	Routine:	ipc_port_make_sonce
+ *	Purpose:
+ *		Make a naked send-once right from a receive right.
+ *	Conditions:
+ *		The port is not locked but it is active.
+ */
+
+ipc_port_t
+ipc_port_make_sonce(
+	ipc_port_t	port)
+{
+	assert(IP_VALID(port));
+
+	ip_lock(port);
+	assert(ip_active(port));
+	port->ip_sorights++;
+	ip_reference(port);
+	ip_unlock(port);
+
+	return port;
+}
+
+/*
+ *	Routine:	ipc_port_release_sonce
+ *	Purpose:
+ *		Release a naked send-once right.
+ *		Consumes a ref for the port.
+ *
+ *		In normal situations, this is never used.
+ *		Send-once rights are only consumed when
+ *		a message (possibly a send-once notification)
+ *		is sent to them.
+ *	Conditions:
+ *		Nothing locked except possibly a space.
+ */
+
+void
+ipc_port_release_sonce(
+	ipc_port_t	port)
+{
+	assert(IP_VALID(port));
+
+	ip_lock(port);
+
+	assert(port->ip_sorights > 0);
+
+	port->ip_sorights--;
+
+	ip_unlock(port);
+	ip_release(port);
+}
+
+/*
+ *	Routine:	ipc_port_release_receive
+ *	Purpose:
+ *		Release a naked (in limbo or in transit) receive right.
+ *		Consumes a ref for the port; destroys the port.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_port_release_receive(
+	ipc_port_t	port)
+{
+	ipc_port_t dest;
+
+	assert(IP_VALID(port));
+
+	ip_lock(port);
+	assert(ip_active(port));
+	assert(port->ip_receiver_name == MACH_PORT_NAME_NULL);
+	dest = port->ip_destination;
+
+	ipc_port_destroy(port); /* consumes ref, unlocks */
+
+	if (dest != IP_NULL)
+		ipc_port_release(dest);
+}
+
+/*
+ *	Routine:	ipc_port_alloc_special
+ *	Purpose:
+ *		Allocate a port in a special space.
+ *		The new port is returned with one ref.
+ *		If unsuccessful, IP_NULL is returned.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+ipc_port_t
+ipc_port_alloc_special(
+	ipc_space_t	space)
+{
+	ipc_port_t port;
+
+	port = (ipc_port_t) io_alloc(IOT_PORT);
+
+	assert(port != IP_NULL);
+	if (port == IP_NULL)
+		return IP_NULL;
+
+	bzero((char *)port, sizeof(*port));
+	io_lock_init(&port->ip_object);
+	port->ip_references = 1;
+	port->ip_object.io_bits = io_makebits(TRUE, IOT_PORT, 0);
+
+	ipc_port_init(port, space, 1);
+
+	return port;
+}
+
+/*
+ *	Routine:	ipc_port_dealloc_special
+ *	Purpose:
+ *		Deallocate a port in a special space.
+ *		Consumes one ref for the port.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_port_dealloc_special(
+	ipc_port_t	port,
+	ipc_space_t	space)
+{
+	ip_lock(port);
+	assert(ip_active(port));
+	assert(port->ip_receiver_name != MACH_PORT_NAME_NULL);
+	assert(port->ip_receiver == space);
+
+	/*
+	 *	We clear ip_receiver_name and ip_receiver to simplify
+	 *	the ipc_space_kernel check in ipc_mqueue_send.
+	 */
+
+	port->ip_receiver_name = MACH_PORT_NAME_NULL;
+	port->ip_receiver = IS_NULL;
+
+	/* relevant part of ipc_port_clear_receiver */
+	ipc_port_set_mscount(port, 0);
+	port->ip_seqno = 0;
+
+	ipc_port_destroy(port);
+}
+
+
+
+void
+ipc_voucher_release(ipc_voucher_t voucher)
+{
+	;
+}
+
+#if	MACH_ASSERT
+/*
+ *	Keep a list of all allocated ports.
+ *	Allocation is intercepted via ipc_port_init;
+ *	deallocation is intercepted via io_free.
+ */
+queue_head_t	port_alloc_queue;
+decl_mutex_data(,port_alloc_queue_lock)
+
+unsigned long	port_count = 0;
+unsigned long	port_count_warning = 20000;
+unsigned long	port_timestamp = 0;
+
+void		db_port_stack_trace(
+			ipc_port_t	port);
+void		db_ref(
+			int		refs);
+int		db_port_walk(
+			unsigned int	verbose,
+			unsigned int	display,
+			unsigned int	ref_search,
+			unsigned int	ref_target);
+void		db_find_rcvr(
+			ipc_thread_t	thread);
+
+
+/*
+ *	Initialize global state needed for run-time
+ *	port debugging.
+ */
+void
+ipc_port_debug_init(void)
+{
+	queue_init(&port_alloc_queue);
+	mach_mutex_init(&port_alloc_queue_lock, ETAP_IPC_PORT_ALLOCQ);
+}
+
+
+/*
+ *	Initialize all of the debugging state in a port.
+ *	Insert the port into a global list of all allocated ports.
+ */
+void
+ipc_port_init_debug(
+	ipc_port_t	port)
+{
+	unsigned int	i;
+
+	port->ip_thread = (unsigned long) current_thread();
+	port->ip_timetrack = port_timestamp++;
+	for (i = 0; i < IP_CALLSTACK_MAX; ++i)
+		port->ip_callstack[i] = 0;
+	for (i = 0; i < IP_NSPARES; ++i)
+		port->ip_spares[i] = 0;
+
+	/*
+	 *	Machine-dependent routine to fill in an
+	 *	array with up to IP_CALLSTACK_MAX levels
+	 *	of return pc information.
+	 */
+	machine_callstack(&port->ip_callstack[0], IP_CALLSTACK_MAX);
+
+#if 0
+	mutex_lock(&port_alloc_queue_lock);
+	++port_count;
+	if (port_count_warning > 0 && port_count >= port_count_warning)
+		assert(port_count < port_count_warning);
+	queue_enter(&port_alloc_queue, port, ipc_port_t, ip_port_links);
+	mutex_unlock(&port_alloc_queue_lock);
+#endif
+}
+
+
+/*
+ *	Remove a port from the queue of allocated ports.
+ *	This routine should be invoked JUST prior to
+ *	deallocating the actual memory occupied by the port.
+ */
+void
+ipc_port_track_dealloc(
+	ipc_port_t	port)
+{
+#if 0
+	mutex_lock(&port_alloc_queue_lock);
+	assert(port_count > 0);
+	--port_count;
+	queue_remove(&port_alloc_queue, port, ipc_port_t, ip_port_links);
+	mutex_unlock(&port_alloc_queue_lock);
+#endif
+}
+
+#endif	/* MACH_ASSERT */
+
+
+#if	MACH_KDB
+
+#include <ddb/db_output.h>
+#include <ddb/db_print.h>
+
+#define	printf	kdbprintf
+extern int indent;
+
+int
+db_port_queue_print(
+	ipc_port_t	port);
+
+/*
+ * ipc_entry_print - pretty-print an ipc_entry
+ */
+static void ipc_entry_print(struct ipc_entry *, char *); /* forward */
+
+static void ipc_entry_print(struct ipc_entry *iep, char *tag)
+{
+
+	iprintf("%s @", tag);
+	printf(" 0x%x, bits=%x object=%x\n",
+		iep, iep->ie_bits, iep->ie_object);
+	indent += 2;
+	iprintf("urefs=%x ", IE_BITS_UREFS(iep->ie_bits));
+	printf("type=%x gen=%x\n",
+		IE_BITS_TYPE(iep->ie_bits), IE_BITS_GEN(iep->ie_bits));
+	indent -= 2;
+}
+
+/*
+ *	Routine:	ipc_port_print
+ *	Purpose:
+ *		Pretty-print a port for kdb.
+ */
+int	ipc_port_print_long = 0;	/* set for more detail */
+
+void
+ipc_port_print(
+	ipc_port_t	port,
+	boolean_t	have_addr,
+	db_expr_t	count,
+	char		*modif)
+{
+	extern int	indent;
+	db_addr_t	task;
+	int		task_id;
+	int		nmsgs;
+	int		verbose = 0;
+#if	MACH_ASSERT
+	int		i, needs_indent, items_printed;
+#endif	/* MACH_ASSERT */
+	
+	if (db_option(modif, 'l') || db_option(modif, 'v'))
+		++verbose;
+
+	printf("port 0x%x\n", port);
+
+	indent += 2;
+
+	ipc_object_print(&port->ip_object);
+
+	if (ipc_port_print_long) {
+		iprintf("pool=0x%x", port->ip_thread_pool);
+		printf("\n");
+	}
+
+	if (!ip_active(port)) {
+		iprintf("timestamp=0x%x", port->ip_timestamp);
+	} else if (port->ip_receiver_name == MACH_PORT_NAME_NULL) {
+		iprintf("destination=0x%x (", port->ip_destination);
+		if (port->ip_destination != MACH_PORT_NULL &&
+		    (task = db_task_from_space(port->ip_destination->
+					       ip_receiver, &task_id)))
+			printf("task%d at 0x%x", task_id, task);
+		else
+			printf("unknown");
+		printf(")");
+	} else {
+		iprintf("receiver=0x%x (", port->ip_receiver);
+		if (port->ip_receiver == ipc_space_kernel)
+			printf("kernel");
+		else if (port->ip_receiver == ipc_space_reply)
+			printf("reply");
+		else if (port->ip_receiver == default_pager_space)
+			printf("default_pager");
+		else if (task = db_task_from_space(port->ip_receiver, &task_id))
+			printf("task%d at 0x%x", task_id, task);
+		else
+			printf("unknown");
+		printf(")");
+	}
+	printf(", receiver_name=0x%x", port->ip_receiver_name);
+	printf("%s\n", IP_NMS(port) ? ", NMS tracking" : "");
+
+	iprintf("mscount=%d", port->ip_mscount);
+	printf(", srights=%d", port->ip_srights);
+	printf(", sorights=%d\n", port->ip_sorights);
+
+	iprintf("nsrequest=0x%x", port->ip_nsrequest);
+	printf(", pdrequest=0x%x", port->ip_pdrequest);
+	printf(", dnrequests=0x%x\n", port->ip_dnrequests);
+
+	iprintf("pset=0x%x", port->ip_pset);
+	printf(", seqno=%d", port->ip_seqno);
+	printf(", msgcount=%d", port->ip_msgcount);
+	printf(", qlimit=%d\n", port->ip_qlimit);
+
+	iprintf("kmsgs=0x%x", port->ip_messages.imq_messages.ikmq_base);
+	printf(", rcvrs=0x%x", port->ip_messages.imq_threads.ithq_base);
+	printf(", sndrs=0x%x", port->ip_blocked.ithq_base);
+	printf(", kobj=0x%x\n", port->ip_kobject);
+
+	iprintf("flags=0x%x", port->ip_flags);
+	
+#if	NORMA_VM
+	iprintf("xmm_object_refs=0x%x xmm_object = 0x%x\n",
+		port->ip_norma_xmm_object_refs, port->ip_norma_xmm_object);
+#endif	/* NORMA_VM */
+
+#if	MACH_ASSERT
+	/* don't bother printing callstack or queue links */
+	iprintf("ip_thread=0x%x, ip_timetrack=0x%x\n",
+		port->ip_thread, port->ip_timetrack);
+	items_printed = 0;
+	needs_indent = 1;
+	for (i = 0; i < IP_NSPARES; ++i) {
+		if (port->ip_spares[i] != 0) {
+			if (needs_indent) {
+				iprintf("");
+				needs_indent = 0;
+			}
+			printf("%sip_spares[%d] = %d",
+			       items_printed ? ", " : "", i, 
+			       port->ip_spares[i]);
+			if (++items_printed >= 4) {
+				needs_indent = 1;
+				printf("\n");
+				items_printed = 0;
+			}
+		}
+	}
+#endif	/* MACH_ASSERT */
+
+	if (verbose) {
+		iprintf("kmsg queue contents:\n");
+		indent += 2;
+		nmsgs = db_port_queue_print(port);
+		indent -= 2;
+		iprintf("...total kmsgs:  %d\n", nmsgs);
+	}
+
+	indent -=2;
+}
+
+ipc_port_t
+ipc_name_to_data(
+	task_t		task,
+	mach_port_name_t	name)
+{
+	ipc_space_t	space;
+	ipc_entry_t	entry;
+
+	if (task == TASK_NULL) {
+		db_printf("port_name_to_data: task is null\n");
+		return (0);
+	}
+	if ((space = task->itk_space) == 0) {
+		db_printf("port_name_to_data: task->itk_space is null\n");
+		return (0);
+	}
+	if (!space->is_active) {
+		db_printf("port_name_to_data: task->itk_space not active\n");
+		return (0);
+	}
+	if ((entry = ipc_entry_lookup(space, name)) == 0) {
+		db_printf("port_name_to_data: lookup yields zero\n");
+		return (0);
+	}
+	return ((ipc_port_t)entry->ie_object);
+}
+
+#if	ZONE_DEBUG
+void
+print_type_ports(type, dead)
+	unsigned type;
+	unsigned dead;
+{
+	ipc_port_t port;
+	int n;
+
+	n = 0;
+	for (port = (ipc_port_t)first_element(ipc_object_zones[IOT_PORT]);
+	     port;
+	     port = (ipc_port_t)next_element(ipc_object_zones[IOT_PORT], 
+					     (vm_offset_t)port))
+		if (ip_kotype(port) == type &&
+		    (!dead || !ip_active(port))) {
+			if (++n % 5)
+				printf("0x%x\t", port);
+			else
+				printf("0x%x\n", port);
+		}
+	if (n % 5)
+		printf("\n");
+}
+
+void
+print_ports(void)
+{
+	ipc_port_t port;
+	int total_port_count;
+	int space_null_count;
+	int space_kernel_count;
+	int space_reply_count;
+	int space_pager_count;
+	int space_other_count;
+	struct {
+		int total_count;
+		int dead_count;
+	} port_types[IKOT_MAX_TYPE];
+
+	total_port_count = 0;
+
+	bzero((char *)&port_types[0], sizeof(port_types));
+	space_null_count = 0;
+	space_kernel_count = 0;
+	space_reply_count = 0;
+	space_pager_count = 0;
+	space_other_count = 0;
+
+	for (port = (ipc_port_t)first_element(ipc_object_zones[IOT_PORT]);
+	     port;
+	     port = (ipc_port_t)next_element(ipc_object_zones[IOT_PORT], 
+					     (vm_offset_t)port)) {
+		total_port_count++;
+		if (ip_kotype(port) >= IKOT_MAX_TYPE) {
+			port_types[IKOT_UNKNOWN].total_count++;
+			if (!io_active(&port->ip_object))
+				port_types[IKOT_UNKNOWN].dead_count++;
+		} else {
+			port_types[ip_kotype(port)].total_count++;
+			if (!io_active(&port->ip_object))
+				port_types[ip_kotype(port)].dead_count++;
+		}
+
+		if (!port->ip_receiver)
+			space_null_count++;
+		else if (port->ip_receiver == ipc_space_kernel)
+		  	space_kernel_count++;
+		else if (port->ip_receiver == ipc_space_reply)
+		  	space_reply_count++;
+		else if (port->ip_receiver == default_pager_space)
+		  	space_pager_count++;
+		else
+			space_other_count++;
+	}
+	printf("\n%7d	total ports\n\n", total_port_count);
+
+#define PRINT_ONE_PORT_TYPE(name) \
+	printf("%7d	%s", port_types[IKOT_##name].total_count, # name); \
+	if (port_types[IKOT_##name].dead_count) \
+	     printf(" (%d dead ports)", port_types[IKOT_##name].dead_count);\
+	printf("\n");
+
+	PRINT_ONE_PORT_TYPE(NONE);
+	PRINT_ONE_PORT_TYPE(THREAD);
+	PRINT_ONE_PORT_TYPE(TASK);
+	PRINT_ONE_PORT_TYPE(HOST);
+	PRINT_ONE_PORT_TYPE(HOST_PRIV);
+	PRINT_ONE_PORT_TYPE(PROCESSOR);
+	PRINT_ONE_PORT_TYPE(PSET);
+	PRINT_ONE_PORT_TYPE(PSET_NAME);
+	PRINT_ONE_PORT_TYPE(PAGER);
+	PRINT_ONE_PORT_TYPE(PAGING_REQUEST);
+	PRINT_ONE_PORT_TYPE(XMM_OBJECT);
+	PRINT_ONE_PORT_TYPE(DEVICE);
+	PRINT_ONE_PORT_TYPE(XMM_PAGER);
+	PRINT_ONE_PORT_TYPE(XMM_KERNEL);
+	PRINT_ONE_PORT_TYPE(XMM_REPLY);
+	PRINT_ONE_PORT_TYPE(PAGER_TERMINATING);
+	PRINT_ONE_PORT_TYPE(CLOCK);
+	PRINT_ONE_PORT_TYPE(CLOCK_CTRL);
+	PRINT_ONE_PORT_TYPE(MASTER_DEVICE);
+	PRINT_ONE_PORT_TYPE(UNKNOWN);
+	printf("\nipc_space:\n\n");
+	printf("NULL	KERNEL	REPLY	PAGER	OTHER\n");
+	printf("%d	%d	%d	%d	%d\n",
+	       space_null_count,
+	       space_kernel_count,
+	       space_reply_count,
+	       space_pager_count,
+	       space_other_count
+	);
+}
+
+#endif	/* ZONE_DEBUG */
+
+
+/*
+ *	Print out all the kmsgs in a queue.  Aggregate kmsgs with
+ *	identical message ids into a single entry.  Count up the
+ *	amount of inline and out-of-line data consumed by each
+ *	and every kmsg.
+ *
+
+ */
+
+#define	KMSG_MATCH_FIELD(kmsg)	((unsigned int) kmsg->ikm_header->msgh_id)
+#define	DKQP_LONG(kmsg)	FALSE
+char	*dkqp_long_format = "(%3d) <%10d> 0x%x   %10d %10d\n";
+char	*dkqp_format = "(%3d) <%10d> 0x%x   %10d %10d\n";
+
+int
+db_kmsg_queue_print(
+	ipc_kmsg_t	kmsg);
+int
+db_kmsg_queue_print(
+	ipc_kmsg_t	kmsg)
+{
+	ipc_kmsg_t	ikmsg, first_kmsg;
+	register int	icount;
+	mach_msg_id_t	cur_id;
+	unsigned int	inline_total, ool_total;
+	int		nmsgs;
+
+	iprintf("Count      msgh_id  kmsg addr inline bytes   ool bytes\n");
+	inline_total = ool_total = (vm_size_t) 0;
+	cur_id = KMSG_MATCH_FIELD(kmsg);
+	for (icount = 0, nmsgs = 0, first_kmsg = ikmsg = kmsg;
+	     kmsg != IKM_NULL && (kmsg != first_kmsg || nmsgs == 0);
+	     kmsg = kmsg->ikm_next) {
+		++nmsgs;
+		if (!(KMSG_MATCH_FIELD(kmsg) == cur_id)) {
+			iprintf(DKQP_LONG(kmsg) ? dkqp_long_format:dkqp_format,
+				icount,	cur_id, ikmsg, inline_total,ool_total);
+			cur_id = KMSG_MATCH_FIELD(kmsg);
+			icount = 1;
+			ikmsg = kmsg;
+			inline_total = ool_total = 0;
+		} else {
+			icount++;
+		}
+		if (DKQP_LONG(kmsg))
+			inline_total += kmsg->ikm_size;
+		else
+			inline_total += kmsg->ikm_header->msgh_size;
+	}
+	iprintf(DKQP_LONG(kmsg) ? dkqp_long_format : dkqp_format,
+		icount,	cur_id, ikmsg, inline_total, ool_total);
+	return nmsgs;
+}
+
+
+/*
+ *	Process all of the messages on a port - prints out the
+ *	number of occurences of each message type, and the first
+ *	kmsg with a particular msgh_id.
+ */
+int
+db_port_queue_print(
+	ipc_port_t	port)
+{
+	ipc_kmsg_t	kmsg;
+
+	if (ipc_kmsg_queue_empty(&port->ip_messages.imq_messages))
+		return 0;
+	kmsg = ipc_kmsg_queue_first(&port->ip_messages.imq_messages);
+	return db_kmsg_queue_print(kmsg);
+}
+
+
+#if	MACH_ASSERT
+#include <ddb/db_sym.h>
+#include <ddb/db_access.h>
+
+#define	FUNC_NULL	((void (*)) 0)
+#define	MAX_REFS	5		/* bins for tracking ref counts */
+
+/*
+ *	Translate port's cache of call stack pointers
+ *	into symbolic names.
+ */
+void
+db_port_stack_trace(
+	ipc_port_t	port)
+{
+	unsigned int	i;
+
+	for (i = 0; i < IP_CALLSTACK_MAX; ++i) {
+		iprintf("[%d] 0x%x\t", i, port->ip_callstack[i]);
+		if (port->ip_callstack[i] != 0 &&
+		    DB_VALID_KERN_ADDR(port->ip_callstack[i]))
+			db_printsym(port->ip_callstack[i], DB_STGY_PROC);
+		printf("\n");
+	}
+}
+
+
+typedef struct port_item {
+	unsigned long	item;
+	unsigned long	count;
+} port_item;
+
+
+#define	ITEM_MAX	400
+typedef struct port_track {
+	char		*name;
+	unsigned long	max;
+	unsigned long	warning;
+	port_item	items[ITEM_MAX];
+} port_track;
+
+port_track	port_callers;		/* match against calling addresses */
+port_track	port_threads;		/* match against allocating threads */
+port_track	port_spaces;		/* match against ipc spaces */
+
+void		port_track_init(
+			port_track	*trackp,
+			char		*name);
+void		port_item_add(
+			port_track	*trackp,
+			unsigned long	item);
+void		port_track_sort(
+			port_track	*trackp);
+void		port_track_print(
+			port_track	*trackp,
+			void		(*func)(port_item *));
+void		port_callers_print(
+			port_item	*p);
+
+void
+port_track_init(
+	port_track	*trackp,
+	char		*name)
+{
+	port_item	*i;
+
+	trackp->max = trackp->warning = 0;
+	trackp->name = name;
+	for (i = trackp->items; i < trackp->items + ITEM_MAX; ++i)
+		i->item = i->count = 0;
+}
+
+
+void
+port_item_add(
+	port_track	*trackp,
+	unsigned long	item)
+{
+	port_item	*limit, *i;
+
+	limit = trackp->items + trackp->max;
+	for (i = trackp->items; i < limit; ++i)
+		if (i->item == item) {
+			i->count++;
+			return;
+		}
+	if (trackp->max >= ITEM_MAX) {
+		if (trackp->warning++ == 0)
+			iprintf("%s:  no room\n", trackp->name);
+		return;
+	}
+	i->item = item;
+	i->count = 1;
+	trackp->max++;
+}
+
+
+/*
+ *	Simple (and slow) bubble sort.
+ */
+void
+port_track_sort(
+	port_track	*trackp)
+{
+	port_item	*limit, *p;
+	port_item	temp;
+	boolean_t	unsorted;
+
+	limit = trackp->items + trackp->max - 1;
+	do {
+		unsorted = FALSE;
+		for (p = trackp->items; p < limit - 1; ++p) {
+			if (p->count < (p+1)->count) {
+				temp = *p;
+				*p = *(p+1);
+				*(p+1) = temp;
+				unsorted = TRUE;
+			}
+		}
+	} while (unsorted == TRUE);
+}
+
+
+void
+port_track_print(
+	port_track	*trackp,
+	void		(*func)(port_item *))
+{
+	port_item	*limit, *p;
+
+	limit = trackp->items + trackp->max;
+	iprintf("%s:\n", trackp->name);
+	for (p = trackp->items; p < limit; ++p) {
+		if (func != FUNC_NULL)
+			(*func)(p);
+		else
+			iprintf("0x%x\t%8d\n", p->item, p->count);
+	}
+}
+
+
+void
+port_callers_print(
+	port_item	*p)
+{
+	iprintf("0x%x\t%8d\t", p->item, p->count);
+	db_printsym(p->item, DB_STGY_PROC);
+	printf("\n");
+}
+
+
+/*
+ *	Show all ports with a given reference count.
+ */
+void
+db_ref(
+	int		refs)
+{
+	db_port_walk(1, 1, 1, refs);
+}
+
+
+#ifndef	DIPC_IS_DIPC_PORT
+#define	DIPC_IS_DIPC_PORT(p)	0
+#endif	/* DIPC_IS_DIPC_PORT */
+
+/*
+ *	Examine all currently allocated ports.
+ *	Options:
+ *		verbose		display suspicious ports
+ *		display		print out each port encountered
+ *		ref_search	restrict examination to ports with
+ *				a specified reference count
+ *		ref_target	reference count for ref_search
+ */
+int
+db_port_walk(
+	unsigned int	verbose,
+	unsigned int	display,
+	unsigned int	ref_search,
+	unsigned int	ref_target)
+{
+	ipc_port_t	port;
+	unsigned int	ref_overflow, refs, i, ref_inactive_overflow;
+	unsigned int	no_receiver, no_match;
+	unsigned int	ref_counts[MAX_REFS];
+	unsigned int	inactive[MAX_REFS];
+	unsigned int	ipc_ports = 0;
+	unsigned int	proxies = 0, principals = 0;
+
+	iprintf("Allocated port count is %d\n", port_count);
+	no_receiver = no_match = ref_overflow = 0;
+	ref_inactive_overflow = 0;
+	for (i = 0; i < MAX_REFS; ++i) {
+		ref_counts[i] = 0;
+		inactive[i] = 0;
+	}
+	port_track_init(&port_callers, "port callers");
+	port_track_init(&port_threads, "port threads");
+	port_track_init(&port_spaces, "port spaces");
+	if (ref_search)
+		iprintf("Walking ports of ref_count=%d.\n", ref_target);
+	else
+		iprintf("Walking all ports.\n");
+
+	queue_iterate(&port_alloc_queue, port, ipc_port_t, ip_port_links) {
+		char	*port_type;
+
+		if (DIPC_IS_DIPC_PORT(port)) {
+			if (IP_IS_REMOTE(port)) {
+				port_type = "    PROXY";
+				if (ip_active(port))
+					++proxies;
+			} else {
+				port_type = "PRINCIPAL";
+				if (ip_active(port))
+					++principals;
+			}
+		} else {
+			port_type = " IPC port";
+			if (ip_active(port))
+				ipc_ports++;
+		}
+
+		refs = port->ip_references;
+		if (ref_search && refs != ref_target)
+			continue;
+
+		if (refs >= MAX_REFS) {
+			if (ip_active(port))
+				++ref_overflow;
+			else
+				++ref_inactive_overflow;
+		} else {
+			if (refs == 0 && verbose)
+				iprintf("%s 0x%x has ref count of zero!\n",
+					port_type, port);
+			if (ip_active(port))
+				ref_counts[refs]++;
+			else
+				inactive[refs]++;
+		}
+		port_item_add(&port_threads, (unsigned long) port->ip_thread);
+		for (i = 0; i < IP_CALLSTACK_MAX; ++i) {
+			if (port->ip_callstack[i] != 0 &&
+			    DB_VALID_KERN_ADDR(port->ip_callstack[i]))
+				port_item_add(&port_callers,
+					      port->ip_callstack[i]);
+		}
+		if (!ip_active(port)) {
+			if (verbose)
+				iprintf("%s 0x%x, inactive, refcnt %d\n",
+					port_type, port, refs);
+			continue;
+		}
+
+		if (port->ip_receiver_name == MACH_PORT_NAME_NULL) {
+			iprintf("%s  0x%x, no receiver, refcnt %d\n",
+				port, refs);
+			++no_receiver;
+			continue;
+		}
+		if (port->ip_receiver == ipc_space_kernel ||
+		    port->ip_receiver == ipc_space_reply ||
+		    ipc_entry_lookup(port->ip_receiver,
+				     port->ip_receiver_name) != IE_NULL) {
+			port_item_add(&port_spaces,
+				      (unsigned long)port->ip_receiver);
+			if (display) {
+				iprintf( "%s 0x%x time 0x%x ref_cnt %d\n",
+						port_type, port,
+						port->ip_timetrack, refs);
+			}
+			continue;
+		}
+		iprintf("%s 0x%x, rcvr 0x%x, name 0x%x, ref %d, no match\n",
+				port_type, port, port->ip_receiver,
+				port->ip_receiver_name, refs);
+		++no_match;
+	}
+	iprintf("Active port type summary:\n");
+	iprintf("\tlocal  IPC %6d\n", ipc_ports);
+	iprintf("summary:\tcallers %d threads %d spaces %d\n",
+		port_callers.max, port_threads.max, port_spaces.max);
+
+	iprintf("\tref_counts:\n");
+	for (i = 0; i < MAX_REFS; ++i)
+		iprintf("\t  ref_counts[%d] = %d\n", i, ref_counts[i]);
+
+	iprintf("\t%d ports w/o receivers, %d w/o matches\n",
+		no_receiver, no_match);
+
+	iprintf("\tinactives:");
+	if ( ref_inactive_overflow || inactive[0] || inactive[1] ||
+	     inactive[2] || inactive[3] || inactive[4] )
+		printf(" [0]=%d [1]=%d [2]=%d [3]=%d [4]=%d [5+]=%d\n",
+			inactive[0], inactive[1], inactive[2],
+			inactive[3], inactive[4], ref_inactive_overflow);
+	else
+		printf(" No inactive ports.\n");
+
+	port_track_sort(&port_spaces);
+	port_track_print(&port_spaces, FUNC_NULL);
+	port_track_sort(&port_threads);
+	port_track_print(&port_threads, FUNC_NULL);
+	port_track_sort(&port_callers);
+	port_track_print(&port_callers, port_callers_print);
+	return 0;
+}
+
+
+void
+db_find_rcvr(
+	ipc_thread_t	thread)
+{
+	ipc_port_t		port;
+	ipc_thread_queue_t	queue;
+	ipc_thread_t		th, first;
+
+	queue_iterate(&port_alloc_queue, port, ipc_port_t, ip_port_links) {
+		if (port->ip_pset)
+			queue = &port->ip_pset->ips_messages.imq_threads;
+		else
+			queue = &port->ip_messages.imq_threads;
+
+		first = ipc_thread_queue_first(queue);
+		if (first == ITH_NULL)
+			continue;
+		th = first;
+		do {
+			if (th == thread) {
+				iprintf("");
+				if (port->ip_pset)
+					printf("pset=%x ", port->ip_pset);
+				printf("port=%x\n", port);
+			}
+			th = th->ith_next;
+		} while (th != first);
+	}
+}
+
+#endif	/* MACH_ASSERT */
+
+#endif	/* MACH_KDB */


Property changes on: trunk/sys/compat/mach/ipc/ipc_port.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/ipc_pset.c
===================================================================
--- trunk/sys/compat/mach/ipc/ipc_pset.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/ipc_pset.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,699 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5  91/05/14  16:35:47  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:23:15  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:50:24  mrt]
+ * 
+ * Revision 2.3  90/11/05  14:29:47  rpd
+ * 	Use new ips_reference and ips_release.
+ * 	[90/10/29            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:51:19  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:01:53  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_pset.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Functions to manipulate IPC port sets.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/event.h>
+
+
+
+#define MACH_INTERNAL
+#include <sys/mach/port.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/message.h>
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/ipc/ipc_mqueue.h>
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_pset.h>
+#include <sys/mach/ipc/ipc_right.h>
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/ipc/ipc_print.h>
+
+#include <sys/mach/thread.h>
+
+static void
+kn_sx_lock(void *arg)
+{
+	struct sx *lock = arg;
+
+	sx_xlock(lock);
+}
+
+static void
+kn_sx_unlock(void *arg)
+{
+	struct sx *lock = arg;
+
+	sx_xunlock(lock);
+}
+
+static void
+sx_assert_locked(void *arg)
+{
+	sx_assert((struct sx *)arg, SX_LOCKED);
+}
+
+static void
+sx_assert_unlocked(void *arg)
+{
+	sx_assert((struct sx *)arg, SX_UNLOCKED);
+}
+
+void
+io_validate(ipc_object_t io)
+{
+	ipc_port_t port;
+	ipc_pset_t pset;
+
+	if (io_otype(io) == IOT_PORT) {
+		port = (ipc_port_t)io;
+		MPASS(port->ip_pset == NULL);
+		assert(!ip_active(port));
+	} else {
+		pset = (ipc_pset_t)io;
+		MPASS(TAILQ_EMPTY(&pset->ips_ports));
+	}
+
+}
+
+/*
+ * Forward declarations
+ */
+void ipc_pset_add(
+	ipc_pset_t	pset,
+	ipc_port_t	port);
+
+/*
+ *	Routine:	ipc_pset_alloc
+ *	Purpose:
+ *		Allocate a port set.
+ *	Conditions:
+ *		Nothing locked.  If successful, the port set is returned
+ *		locked.  (The caller doesn't have a reference.)
+ *	Returns:
+ *		KERN_SUCCESS		The port set is allocated.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_NO_SPACE		No room for an entry in the space.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+ipc_pset_alloc(
+	ipc_space_t	space,
+	mach_port_name_t	*namep,
+	ipc_pset_t	*psetp)
+{
+	ipc_pset_t pset;
+	mach_port_name_t name;
+	kern_return_t kr;
+
+	kr = ipc_object_alloc(space, IOT_PORT_SET,
+			      MACH_PORT_TYPE_PORT_SET,
+			      &name, (ipc_object_t *) &pset);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* pset is locked */
+
+	pset->ips_local_name = name;
+	TAILQ_INIT(&pset->ips_ports);
+	sx_init(&pset->ips_note_lock, "pset knote lock");
+	knlist_init(&pset->ips_note, &pset->ips_note_lock,
+				kn_sx_lock, kn_sx_unlock, sx_assert_locked, sx_assert_unlocked);
+	thread_pool_init(&pset->ips_thread_pool);
+	*namep = name;
+	*psetp = pset;
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_pset_alloc_name
+ *	Purpose:
+ *		Allocate a port set, with a specific name.
+ *	Conditions:
+ *		Nothing locked.  If successful, the port set is returned
+ *		locked.  (The caller doesn't have a reference.)
+ *	Returns:
+ *		KERN_SUCCESS		The port set is allocated.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_NAME_EXISTS	The name already denotes a right.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+ipc_pset_alloc_name(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_pset_t	*psetp)
+{
+	ipc_pset_t pset;
+	kern_return_t kr;
+
+
+	kr = ipc_object_alloc_name(space, IOT_PORT_SET,
+				   MACH_PORT_TYPE_PORT_SET,
+				   name, (ipc_object_t *) &pset);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* pset is locked */
+
+	pset->ips_local_name = name;
+	thread_pool_init(&pset->ips_thread_pool);
+	*psetp = pset;
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_pset_add
+ *	Purpose:
+ *		Puts a port into a port set.
+ *		The port set gains a reference.
+ *	Conditions:
+ *		Both port and port set are locked and active.
+ *		The port isn't already in a set.
+ *		The owner of the port set is also receiver for the port.
+ */
+
+void
+ipc_pset_add(
+	ipc_pset_t	pset,
+	ipc_port_t	port)
+{
+	assert(ips_active(pset));
+	assert(ip_active(port));
+	assert(port->ip_pset == IPS_NULL);
+
+	port->ip_pset = pset;
+	ips_reference(pset);
+	TAILQ_INSERT_TAIL(&pset->ips_ports, port, ip_next);
+}
+
+/*
+ *	Routine:	ipc_pset_remove
+ *	Purpose:
+ *		Removes a port from a port set.
+ *		The port set loses a reference.
+ *	Conditions:
+ *		Both port and port set are locked.
+ *		The port must be active.
+ */
+
+void
+ipc_pset_remove(
+	ipc_pset_t	pset,
+	ipc_port_t	port)
+{
+	assert(ip_active(port));
+	assert(port->ip_pset == pset);
+
+	port->ip_pset = IPS_NULL;
+	TAILQ_REMOVE(&pset->ips_ports, port, ip_next);
+}
+
+/*
+ *	Routine:	ipc_pset_move
+ *	Purpose:
+ *		If nset is IPS_NULL, removes port
+ *		from the port set it is in.  Otherwise, adds
+ *		port to nset, removing it from any set
+ *		it might already be in.
+ *	Conditions:
+ *		The space is read-locked.
+ *	Returns:
+ *		KERN_SUCCESS		Moved the port.
+ *		KERN_NOT_IN_SET		nset is null and port isn't in a set.
+ */
+
+kern_return_t
+ipc_pset_move(
+	ipc_space_t	space,
+	ipc_port_t	port,
+	ipc_pset_t	nset)
+{
+	ipc_pset_t oset;
+	int active;
+	int knotify;
+	/*
+	 *	While we've got the space locked, it holds refs for
+	 *	the port and nset (because of the entries).  Also,
+	 *	they must be alive.  While we've got port locked, it
+	 *	holds a ref for oset, which might not be alive.
+	 */
+
+	ip_lock(port);
+	assert(ip_active(port));
+
+	knotify = FALSE;
+	oset = port->ip_pset;
+
+	if (oset == nset) {
+		/* the port is already in the new set:  a noop */
+
+		is_read_unlock(space);
+	} else if (oset == IPS_NULL) {
+		/* just add port to the new set */
+
+		ips_lock(nset);
+		assert(ips_active(nset));
+		is_read_unlock(space);
+
+		ipc_pset_add(nset, port);
+		if (port->ip_msgcount != 0)
+			knotify = TRUE;
+		ips_unlock(nset);
+	} else if (nset == IPS_NULL) {
+		/* just remove port from the old set */
+
+		is_read_unlock(space);
+		ips_lock(oset);
+
+		ipc_pset_remove(oset, port);
+		active = ips_active(oset);
+		ips_unlock(oset);
+		ips_release(oset);
+		if (!active)
+			oset = IPS_NULL; /* trigger KERN_NOT_IN_SET */
+	} else {
+		/* atomically move port from oset to nset */
+
+		if (oset < nset) {
+			ips_lock(oset);
+			ips_lock(nset);
+		} else {
+			ips_lock(nset);
+			ips_lock(oset);
+		}
+
+		is_read_unlock(space);
+		assert(ips_active(nset));
+
+		ipc_pset_remove(oset, port);
+		ipc_pset_add(nset, port);
+
+		if (port->ip_msgcount != 0)
+			knotify = TRUE;
+
+		ips_unlock(nset);
+		ips_unlock(oset);	/* KERN_NOT_IN_SET not a possibility */
+		ips_release(oset);
+	}
+
+	ip_unlock(port);
+
+	if (knotify == TRUE)
+		ipc_pset_signal(nset);
+	return (((nset == IPS_NULL) && (oset == IPS_NULL)) ?
+		KERN_NOT_IN_SET : KERN_SUCCESS);
+}
+
+
+
+/*
+ *	Routine:	ipc_pset_changed
+ *	Purpose:
+ *		Wake up receivers waiting on pset.
+ *	Conditions:
+ *		The pset is locked.
+ */
+
+static void
+ipc_pset_changed(
+	ipc_pset_t		pset,
+	mach_msg_return_t	mr)
+{
+	ipc_thread_t th;
+
+	while ((th = thread_pool_get_act((ipc_object_t)pset, 0)) != ITH_NULL) {
+		th->ith_state = mr;
+		thread_go(th);
+	}
+}
+
+/*
+ *	Routine:	ipc_pset_destroy
+ *	Purpose:
+ *		Destroys a port_set.
+ *
+ *		Doesn't remove members from the port set;
+ *		that happens lazily.  As members are removed,
+ *		their messages are removed from the queue.
+ *	Conditions:
+ *		The port_set is locked and alive.
+ *		The caller has a reference, which is consumed.
+ *		Afterwards, the port_set is unlocked and dead.
+ */
+
+void
+ipc_pset_destroy(
+	ipc_pset_t	pset)
+{
+	ipc_port_t port;
+
+	pset->ips_object.io_bits &= ~IO_BITS_ACTIVE;
+	while (!TAILQ_EMPTY(&pset->ips_ports)) {
+		port = TAILQ_FIRST(&pset->ips_ports);
+		MPASS(port->ip_pset == pset);
+		if (ip_lock_try(port) == 0) {
+			ips_unlock(pset);
+			ip_lock(port);
+			ips_lock(pset);
+		}
+		TAILQ_REMOVE(&pset->ips_ports, port, ip_next);
+		port->ip_pset = NULL;
+		ip_unlock(port);
+		ips_release(pset);
+	}
+	ipc_pset_changed(pset, MACH_RCV_PORT_DIED);
+	ips_unlock(pset);
+	ips_release(pset);	/* consume the ref our caller gave us */
+}
+
+/**
+ *
+ * KQ handling
+ */
+  
+#include <sys/file.h>
+#include <sys/selinfo.h>
+#include <sys/eventvar.h>
+
+void 	knote_enqueue(struct knote *kn);
+
+#define KQ_LOCK(kq) do {						\
+	mtx_lock(&(kq)->kq_lock);					\
+} while (0)
+#define KQ_UNLOCK(kq) do {						\
+	mtx_unlock(&(kq)->kq_lock);					\
+} while (0)
+
+void
+ipc_pset_signal(ipc_pset_t pset)
+{
+	struct kqueue *kq, *kq_prev;
+	struct knote *kn;
+	struct knlist *list;
+
+	sx_slock(&pset->ips_note_lock);
+	if (KNLIST_EMPTY(&pset->ips_note)) {
+		sx_sunlock(&pset->ips_note_lock);
+		return;
+	}
+	list = &pset->ips_note;
+	kq = kq_prev = NULL;
+	SLIST_FOREACH(kn, &list->kl_list, kn_selnext) {
+		kq = kn->kn_kq;
+		if (kq != kq_prev) {
+			if (kq_prev)
+				KQ_UNLOCK(kq_prev);
+			KQ_LOCK(kq);
+		}
+		(kn)->kn_status |= KN_ACTIVE;
+		if (((kn)->kn_status & (KN_QUEUED | KN_DISABLED)) == 0)
+			knote_enqueue(kn);
+		kq_prev = kq;
+	}
+	MPASS(kq != NULL);
+	KQ_UNLOCK(kq);
+	sx_sunlock(&pset->ips_note_lock);
+}
+
+
+static int      filt_machportattach(struct knote *kn);
+static void     filt_machportdetach(struct knote *kn);
+static int      filt_machport(struct knote *kn, long hint);
+struct filterops machport_filtops = {
+	.f_isfd = 1,
+	.f_attach = filt_machportattach,
+	.f_detach = filt_machportdetach,
+	.f_event = filt_machport,
+};
+
+static int
+filt_machportattach(struct knote *kn)
+{
+	mach_port_name_t	name = (mach_port_name_t)kn->kn_kevent.ident;
+	ipc_pset_t			pset = IPS_NULL;
+	ipc_entry_t			entry;
+	kern_return_t		kr;
+	struct knlist		*note;
+
+	kr = ipc_object_translate(current_space(), name, MACH_PORT_RIGHT_PORT_SET,
+							  (ipc_object_t *)&pset);
+
+	if (kr != KERN_SUCCESS)
+		return (kr == KERN_INVALID_NAME ? ENOENT : ENOTSUP);
+	note = &pset->ips_note;
+	ips_unlock(pset);
+
+	/* need the actual entry for knote */
+	if ((entry = ipc_entry_lookup(current_space(), name)) == NULL)
+		return (ENOENT);
+	KASSERT(entry->ie_object == (ipc_object_t)pset, ("entry->ie_object == pset"));
+
+	kn->kn_fp = entry->ie_fp;
+	knlist_add(note, kn, 0);
+	return (0);
+}
+
+extern void kdb_backtrace(void);
+
+static void
+filt_machportdetach(struct knote *kn)
+{
+	mach_port_name_t	name = (mach_port_name_t)kn->kn_kevent.ident;
+	ipc_pset_t		pset = IPS_NULL;
+	ipc_entry_t entry = NULL;;
+
+
+
+	if (kn->kn_fp->f_type != DTYPE_MACH_IPC)
+		goto fail;
+
+	entry = kn->kn_fp->f_data;
+	if ((entry->ie_bits & MACH_PORT_TYPE_PORT_SET) == 0)
+		goto fail;
+	if ((pset = (ipc_pset_t)entry->ie_object) == NULL)
+		goto fail;
+
+
+	knlist_remove(&pset->ips_note, kn, 0);
+	return;
+fail:
+	kdb_backtrace();
+	printf("kqdetach fail for: %d pset: %p entry: %p\n", name, pset, entry);
+}
+
+
+static int
+filt_machport(struct knote *kn, long hint)
+{
+
+	mach_port_name_t        name = (mach_port_name_t)kn->kn_kevent.ident;
+	ipc_entry_t				entry = kn->kn_fp->f_data;
+	ipc_pset_t              pset = (ipc_pset_t) entry->ie_object;
+	thread_t				self = current_thread();
+	kern_return_t           kr;
+	mach_msg_option_t	option;
+	mach_msg_size_t		size;
+
+	if (hint == EV_EOF) {
+		kn->kn_data = 0;
+		kn->kn_flags |= (EV_EOF | EV_ONESHOT);
+		return (1);
+	} else if (hint == 0) {
+
+		kr = ipc_object_translate(current_space(), name, MACH_PORT_RIGHT_PORT_SET,
+								  (ipc_object_t *)&pset);
+		if (kr != KERN_SUCCESS || !ips_active(pset)) {
+			kdb_backtrace();
+			printf("%s: filt_machport kr=%d ips_active=%d name=%d\n", curproc->p_comm, kr, !!ips_active(pset), name);
+			kn->kn_data = 0;
+			kn->kn_flags |= (EV_EOF | EV_ONESHOT);
+			return (1);
+		}
+
+		ips_reference(pset);
+
+		if (pset != (ipc_pset_t)entry->ie_object)
+			ips_unlock(pset);
+
+	} else
+		panic("invalid hint %ld\n", hint);
+
+
+	option = kn->kn_sfflags & (MACH_RCV_MSG|MACH_RCV_LARGE|MACH_RCV_LARGE_IDENTITY|
+				   MACH_RCV_TRAILER_MASK|MACH_RCV_VOUCHER);
+
+	if (option & MACH_RCV_MSG) {
+		self->ith_msg_addr = (mach_vm_address_t) kn->kn_ext[0];
+		size = (mach_msg_size_t)kn->kn_ext[1];
+		printf("%s:%d: filt_machport option: %d \n", curproc->p_comm, curproc->p_pid, option);
+	} else {
+		option = MACH_RCV_LARGE;
+		self->ith_msg_addr = 0;
+		size = 0;
+	}
+
+	self->ith_object = (ipc_object_t)pset;
+	self->ith_msize = size;
+	self->ith_option = option;
+	self->ith_scatter_list_size = 0;
+	self->ith_receiver_name = MACH_PORT_NAME_NULL;
+	option |= MACH_RCV_TIMEOUT;
+	self->ith_state = MACH_RCV_IN_PROGRESS;
+
+
+	ips_lock(pset);
+	kr = ipc_mqueue_pset_receive(MACH_PORT_TYPE_PORT_SET, option, size,
+							0/* immediate timeout */, self);
+
+	ips_unlock(pset);
+	assert(kr == THREAD_NOT_WAITING);
+	assert(self->ith_state != MACH_RCV_IN_PROGRESS);
+	ips_release(pset);
+
+	if (self->ith_state == MACH_RCV_TIMED_OUT) {
+		return (0);
+	}
+	if ((option & MACH_RCV_MSG) != MACH_RCV_MSG) {
+		assert(self->ith_state == MACH_RCV_TOO_LARGE);
+		assert(self->ith_kmsg == IKM_NULL);
+		kn->kn_data = self->ith_receiver_name;
+#ifdef __LP64__
+		printf("%s:%d, receiver_name %ld\n", curproc->p_comm, curproc->p_pid, kn->kn_data);
+#endif
+		return (1);
+	}
+
+	assert(option & MACH_RCV_MSG);
+	kn->kn_ext[1] = self->ith_msize;
+	kn->kn_data = MACH_PORT_NAME_NULL;
+#ifdef __LP64__
+	printf("%s:%d receive result size: %d to: %lx \n", curproc->p_comm, curproc->p_pid, self->ith_msize, self->ith_msg_addr);
+#endif
+	kn->kn_fflags = mach_msg_receive_results(self);
+
+    if ((kn->kn_fflags == MACH_RCV_TOO_LARGE) &&
+	    (option & MACH_RCV_LARGE_IDENTITY))
+	    kn->kn_data = self->ith_receiver_name;
+
+	return (1);
+}
+
+#if	MACH_KDB
+#include <mach_kdb.h>
+
+#include <ddb/db_output.h>
+
+#define	printf	kdbprintf
+
+int
+ipc_list_count(
+	struct ipc_kmsg *base)
+{
+	register int count = 0;
+
+	if (base) {
+		struct ipc_kmsg *kmsg = base;
+
+		++count;
+		while (kmsg && kmsg->ikm_next != base
+			    && kmsg->ikm_next != IKM_BOGUS){
+			kmsg = kmsg->ikm_next;
+			++count;
+		}
+	}
+	return(count);
+}
+
+/*
+ *	Routine:	ipc_pset_print
+ *	Purpose:
+ *		Pretty-print a port set for kdb.
+ */
+
+void
+ipc_pset_print(
+	ipc_pset_t	pset)
+{
+	extern int indent;
+
+	printf("pset 0x%x\n", pset);
+
+	indent += 2;
+
+	ipc_object_print(&pset->ips_object);
+	iprintf("local_name = 0x%x\n", pset->ips_local_name);
+	iprintf("%d kmsgs => 0x%x",
+		ipc_list_count(pset->ips_messages.imq_messages.ikmq_base),
+		pset->ips_messages.imq_messages.ikmq_base);
+	printf(",rcvrs = 0x%x\n", pset->ips_messages.imq_threads.ithq_base);
+
+	indent -=2;
+}
+
+#endif	/* MACH_KDB */


Property changes on: trunk/sys/compat/mach/ipc/ipc_pset.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/ipc_right.c
===================================================================
--- trunk/sys/compat/mach/ipc/ipc_right.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/ipc_right.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,2086 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6  91/05/14  16:36:12  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.5  91/02/14  14:08:29  mrt
+ * 	Fixed bug in ipc_right_copyin_check, following rchen's report.
+ * 	[91/01/26            rpd]
+ * 
+ * Revision 2.4  91/02/05  17:23:26  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:50:46  mrt]
+ * 
+ * Revision 2.3  90/11/05  14:30:05  rpd
+ * 	Changed io_release to ipc_object_release.
+ * 	Changed ip_release to ipc_port_release.
+ * 	Use new ip_reference and ip_release.
+ * 	[90/10/29            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:51:28  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:02:31  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_right.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Functions to manipulate IPC capabilities.
+ */
+
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/param.h>
+
+#include <sys/mach/kern_return.h>
+#include <sys/mach/port.h>
+#include <sys/mach/message.h>
+#if 0
+#include <kern/assert.h>
+#include <kern/misc_protos.h>
+#include <kern/ipc_subsystem.h>
+#endif
+#include <sys/mach/ipc/port.h>
+#include <sys/mach/ipc/ipc_entry.h>
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_hash.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_pset.h>
+#include <sys/mach/ipc/ipc_right.h>
+#include <sys/mach/ipc/ipc_notify.h>
+#include <sys/mach/ipc/ipc_table.h>
+
+#include <sys/mach/task.h>
+
+#ifdef INVARIANTS
+#define OBJECT_CLEAR(entry, name) do {									\
+		/* printf("clearing object %p name: %d %s:%d\n", entry->ie_object, name, __FILE__, __LINE__); */ \
+		(entry)->ie_object = IO_NULL;									\
+} while (0)
+#else
+#define OBJECT_CLEAR(entry, name) (entry)->ie_object = IO_NULL
+#endif
+
+/*
+ *	Routine:	ipc_right_lookup_write
+ *	Purpose:
+ *		Finds an entry in a space, given the name.
+ *	Conditions:
+ *		Nothing locked.  If successful, the space is write-locked.
+ *	Returns:
+ *		KERN_SUCCESS		Found an entry.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	Name doesn't exist in space.
+ */
+
+kern_return_t
+ipc_right_lookup(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	*entryp,
+	int xlock)
+{
+	ipc_entry_t entry;
+
+
+	assert(space != IS_NULL);
+
+
+	if (!space->is_active)
+		return KERN_INVALID_TASK;
+	if ((entry = ipc_entry_lookup(space, name)) == IE_NULL)
+		return KERN_INVALID_NAME;
+
+	if (xlock)
+		is_write_lock(space);
+	else
+		is_read_lock(space);
+	*entryp = entry;
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_right_reverse
+ *	Purpose:
+ *		Translate (space, object) -> (name, entry).
+ *		Only finds send/receive rights.
+ *		Returns TRUE if an entry is found; if so,
+ *		the object is locked and active.
+ *	Conditions:
+ *		The space must be locked (read or write) and active.
+ *		Nothing else locked.
+ */
+
+boolean_t
+ipc_right_reverse(
+	ipc_space_t	space,
+	ipc_object_t	object,
+	mach_port_name_t	*namep,
+	ipc_entry_t	*entryp)
+{
+	ipc_port_t port;
+	mach_port_name_t name;
+	ipc_entry_t entry;
+
+	/* would switch on io_otype to handle multiple types of object */
+
+	assert(space->is_active);
+	assert(io_otype(object) == IOT_PORT);
+
+	port = (ipc_port_t) object;
+
+	ip_lock(port);
+	if (!ip_active(port)) {
+		ip_unlock(port);
+
+		return FALSE;
+	}
+
+	if (port->ip_receiver == space) {
+		name = port->ip_receiver_name;
+		assert(name != MACH_PORT_NAME_NULL);
+
+		entry = ipc_entry_lookup(space, name);
+
+		assert(entry != IE_NULL);
+		assert(entry->ie_bits & MACH_PORT_TYPE_RECEIVE);
+		assert(port == (ipc_port_t) entry->ie_object);
+
+		*namep = name;
+		*entryp = entry;
+		return TRUE;
+	}
+
+	if (ipc_hash_lookup(space, (ipc_object_t) port, namep, entryp)) {
+		assert((entry = *entryp) != IE_NULL);
+		assert(IE_BITS_TYPE(entry->ie_bits) == MACH_PORT_TYPE_SEND);
+		assert(port == (ipc_port_t) entry->ie_object);
+
+		return TRUE;
+	}
+
+	ip_unlock(port);
+	return FALSE;
+}
+
+/*
+ *	Routine:	ipc_right_dnrequest
+ *	Purpose:
+ *		Make a dead-name request, returning the previously
+ *		registered send-once right.  If notify is IP_NULL,
+ *		just cancels the previously registered request.
+ *
+ *		This interacts with the IE_BITS_COMPAT, because they
+ *		both use ie_request.  If this is a compat entry, then
+ *		previous always gets IP_NULL.  If notify is IP_NULL,
+ *		then the entry remains a compat entry.  Otherwise
+ *		the real dead-name request is registered and the entry
+ *		is no longer a compat entry.
+ *	Conditions:
+ *		Nothing locked.  May allocate memory.
+ *		Only consumes/returns refs if successful.
+ *	Returns:
+ *		KERN_SUCCESS		Made/canceled dead-name request.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	Name doesn't exist in space.
+ *		KERN_INVALID_RIGHT	Name doesn't denote port/dead rights.
+ *		KERN_INVALID_ARGUMENT	Name denotes dead name, but
+ *			immediate is FALSE or notify is IP_NULL.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+ipc_right_dnrequest(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	boolean_t	immediate,
+	ipc_port_t	notify,
+	ipc_port_t	*previousp)
+{
+	ipc_port_t previous;
+	ipc_port_t port = NULL;
+
+	for (;;) {
+		ipc_entry_t entry;
+		ipc_entry_bits_t bits;
+		kern_return_t kr;
+
+		kr = ipc_right_lookup_write(space, name, &entry);
+		ip_unlock_assert(port);
+		if (kr != KERN_SUCCESS)
+			return kr;
+		/* space is write-locked and active */
+
+		bits = entry->ie_bits;
+		if (bits & MACH_PORT_TYPE_PORT_RIGHTS) {
+
+			ipc_port_request_index_t request;
+
+			port = (ipc_port_t) entry->ie_object;
+			assert(port != IP_NULL);
+
+			if (!ipc_right_check(space, port, name, entry)) {
+				/* port is locked and active */
+
+				if (notify == IP_NULL) {
+					previous = ipc_right_dncancel_macro(
+						space, port, name, entry);
+
+					ip_unlock(port);
+					is_write_unlock(space);
+					break;
+				}
+
+				/*
+				 *	If a registered soright exists,
+				 *	want to atomically switch with it.
+				 *	If ipc_port_dncancel finds us a
+				 *	soright, then the following
+				 *	ipc_port_dnrequest will reuse
+				 *	that slot, so we are guaranteed
+				 *	not to unlock and retry.
+				 */
+
+				previous = ipc_right_dncancel_macro(space,
+							port, name, entry);
+
+				kr = ipc_port_dnrequest(port, name, notify,
+							&request);
+				if (kr != KERN_SUCCESS) {
+					assert(previous == IP_NULL);
+					is_write_unlock(space);
+
+					kr = ipc_port_dngrow(port,
+							     ITS_SIZE_NONE);
+					ip_unlock_assert(port);
+					/* port is unlocked */
+					if (kr != KERN_SUCCESS)
+						return kr;
+
+					continue;
+				}
+
+				assert(request != 0);
+				ip_unlock(port);
+
+				entry->ie_request = request;
+				is_write_unlock(space);
+				break;
+			}
+
+			bits = entry->ie_bits;
+			assert(bits & MACH_PORT_TYPE_DEAD_NAME);
+		}
+
+		if ((bits & MACH_PORT_TYPE_DEAD_NAME) &&
+		    immediate && (notify != IP_NULL)) {
+
+			assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_DEAD_NAME);
+			assert(ipc_entry_refs(entry) > 0);
+
+			ipc_entry_hold(entry); /* increment urefs */
+			is_write_unlock(space);
+
+			ipc_notify_dead_name(notify, name);
+			previous = IP_NULL;
+			break;
+		}
+
+		is_write_unlock(space);
+		if (port)
+			ip_unlock_assert(port);
+		if (bits & MACH_PORT_TYPE_PORT_OR_DEAD)
+			return KERN_INVALID_ARGUMENT;
+		else
+			return KERN_INVALID_RIGHT;
+	}
+	if (port)
+		ip_unlock_assert(port);
+	*previousp = previous;
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_right_dncancel
+ *	Purpose:
+ *		Cancel a dead-name request and return the send-once right.
+ *		Afterwards, entry->ie_request == 0.
+ *	Conditions:
+ *		The space must be write-locked; the port must be locked.
+ *		The port must be active; the space doesn't have to be.
+ */
+
+ipc_port_t
+ipc_right_dncancel(
+	ipc_space_t	space,
+	ipc_port_t	port,
+	mach_port_name_t	name,
+	ipc_entry_t	entry)
+{
+	ipc_port_t dnrequest;
+
+	assert(ip_active(port));
+	assert(port == (ipc_port_t) entry->ie_object);
+
+	dnrequest = ipc_port_dncancel(port, name, entry->ie_request);
+	entry->ie_request = 0;
+
+	return dnrequest;
+}
+
+/*
+ *	Routine:	ipc_right_inuse
+ *	Purpose:
+ *		Check if an entry is being used.
+ *		Returns TRUE if it is.
+ *	Conditions:
+ *		The space is write-locked and active.
+ *		It is unlocked if the entry is inuse.
+ */
+
+boolean_t
+ipc_right_inuse(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	entry)
+{
+	ipc_entry_bits_t bits = entry->ie_bits;
+
+	if (IE_BITS_TYPE(bits) != MACH_PORT_TYPE_NONE) {
+		is_write_unlock(space);
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+/*
+ *	Routine:	ipc_right_check
+ *	Purpose:
+ *		Check if the port has died.  If it has,
+ *		clean up the entry and return TRUE.
+ *	Conditions:
+ *		The space is write-locked; the port is not locked.
+ *		If returns FALSE, the port is also locked and active.
+ *		Otherwise, entry is converted to a dead name, freeing
+ *		a reference to port.
+ *
+ */
+
+boolean_t
+ipc_right_check(
+	ipc_space_t	space,
+	ipc_port_t	port,
+	mach_port_name_t	name,
+	ipc_entry_t	entry)
+{
+	ipc_entry_bits_t bits;
+
+	assert(space->is_active);
+	assert(port == (ipc_port_t) entry->ie_object);
+
+	ip_lock(port);
+	if (ip_active(port)) {
+		return FALSE;
+	}
+	ip_unlock(port);
+
+	/* this was either a pure send right or a send-once right */
+
+	bits = entry->ie_bits;
+	assert((bits & MACH_PORT_TYPE_RECEIVE) == 0);
+	assert(ipc_entry_refs(entry) > 0);
+
+	if (bits & MACH_PORT_TYPE_SEND) {
+		assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_SEND);
+		ipc_hash_delete(space, (ipc_object_t) port, name, entry);
+	} else {
+		assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_SEND_ONCE);
+		MACH_VERIFY(ipc_entry_refs(entry) == 1, ("urefs expected 1 got %d", ipc_entry_refs(entry)));
+	}
+
+	ipc_port_release(port);
+
+	/* convert entry to dead name */
+
+	bits = (bits &~ IE_BITS_TYPE_MASK) | MACH_PORT_TYPE_DEAD_NAME;
+
+	if (entry->ie_request != 0) {
+		entry->ie_request = 0;
+		ipc_entry_hold(entry); /* increment urefs */
+	}
+
+	entry->ie_bits = bits;
+	OBJECT_CLEAR(entry, name);
+	return TRUE;
+}
+
+/*
+ *	Routine:	ipc_right_clean
+ *	Purpose:
+ *		Cleans up an entry in a dead space.
+ *		The entry isn't deallocated or removed
+ *		from reverse hash tables.
+ *	Conditions:
+ *		The space is dead and unlocked.
+ */
+
+void
+ipc_right_clean(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	entry)
+{
+	ipc_entry_bits_t bits = entry->ie_bits;
+	mach_port_type_t type = IE_BITS_TYPE(bits);
+
+	assert(!space->is_active);
+
+	/*
+	 *	IE_BITS_COMPAT/ipc_right_dncancel doesn't have this
+	 *	problem, because we check that the port is active.  If
+	 *	we didn't cancel IE_BITS_COMPAT, ipc_port_destroy
+	 *	would still work, but dead space refs would accumulate
+	 *	in ip_dnrequests.  They would use up slots in
+	 *	ip_dnrequests and keep the spaces from being freed.
+	 */
+
+	switch (type) {
+	    case MACH_PORT_TYPE_DEAD_NAME:
+		assert(entry->ie_request == 0);
+		assert(entry->ie_object == IO_NULL);
+		break;
+
+	    case MACH_PORT_TYPE_PORT_SET: {
+		ipc_pset_t pset = (ipc_pset_t) entry->ie_object;
+
+		assert(entry->ie_request == 0);
+		assert(pset != IPS_NULL);
+		assert(ips_active(pset));
+
+		sx_slock(&pset->ips_note_lock);
+		KNOTE(&pset->ips_note, EV_EOF, KNF_LISTLOCKED);
+		sx_sunlock(&pset->ips_note_lock);
+		ipc_entry_close(space, name);
+		break;
+	    }
+
+	    case MACH_PORT_TYPE_SEND:
+	    case MACH_PORT_TYPE_RECEIVE:
+	    case MACH_PORT_TYPE_SEND_RECEIVE:
+	    case MACH_PORT_TYPE_SEND_ONCE: {
+		ipc_port_t port = (ipc_port_t) entry->ie_object;
+		ipc_port_t dnrequest;
+		ipc_port_t nsrequest = IP_NULL;
+		mach_port_mscount_t mscount;
+
+		assert(port != IP_NULL);
+		ip_lock(port);
+
+		if (!ip_active(port)) {
+			ip_unlock(port);
+			ip_release(port);
+			break;
+		}
+
+		dnrequest = ipc_right_dncancel_macro(space, port, name, entry);
+
+		if (type & MACH_PORT_TYPE_SEND) {
+			assert(port->ip_srights > 0);
+			if (--port->ip_srights == 0
+			    ) {
+				nsrequest = port->ip_nsrequest;
+				if (nsrequest != IP_NULL) {
+					port->ip_nsrequest = IP_NULL;
+					mscount = port->ip_mscount;
+				}
+			}
+		}
+
+		if (type & MACH_PORT_TYPE_RECEIVE) {
+			assert(port->ip_receiver_name == name);
+			assert(port->ip_receiver == space);
+
+			ipc_port_clear_receiver(port);
+			ipc_port_destroy(port); /* consumes our ref, unlocks */
+		} else if (type & MACH_PORT_TYPE_SEND_ONCE) {
+			assert(port->ip_sorights > 0);
+			ip_unlock(port);
+
+			ipc_notify_send_once(port); /* consumes our ref */
+		} else {
+			assert(port->ip_receiver != space);
+
+			ip_unlock(port); /* port is active */
+			ip_release(port);
+		}
+
+		if (nsrequest != IP_NULL)
+			ipc_notify_no_senders(nsrequest, mscount);
+
+		if (dnrequest != IP_NULL)
+			ipc_notify_port_deleted(dnrequest, name);
+		break;
+	    }
+
+	    default:
+		panic("ipc_right_clean: strange type");
+	}
+}
+
+/*
+ *	Routine:	ipc_right_destroy
+ *	Purpose:
+ *		Destroys an entry in a space.
+ *	Conditions:
+ *		The space is write-locked, and is unlocked upon return.
+ *		The space must be active.
+ *	Returns:
+ *		KERN_SUCCESS		The entry was destroyed.
+ */
+
+kern_return_t
+ipc_right_destroy(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	entry)
+{
+	ipc_entry_bits_t bits = entry->ie_bits;
+	mach_port_type_t type = IE_BITS_TYPE(bits);
+
+	assert(space->is_active);
+
+	switch (type) {
+	    case MACH_PORT_TYPE_DEAD_NAME:
+		assert(entry->ie_request == 0);
+		assert(entry->ie_object == IO_NULL);
+
+		ipc_entry_dealloc(space, name, entry);
+		is_write_unlock(space);
+		break;
+
+	    case MACH_PORT_TYPE_PORT_SET: {
+		ipc_pset_t pset = (ipc_pset_t) entry->ie_object;
+
+		assert(entry->ie_request == 0);
+		assert(pset != IPS_NULL);
+
+
+		is_write_unlock(space);
+
+		assert(ips_active(pset));
+		sx_slock(&pset->ips_note_lock);
+		KNOTE(&pset->ips_note, EV_EOF, KNF_LISTLOCKED);
+		sx_sunlock(&pset->ips_note_lock);
+		ipc_entry_close(space, name);
+
+		break;
+	    }
+
+	    case MACH_PORT_TYPE_SEND:
+	    case MACH_PORT_TYPE_RECEIVE:
+	    case MACH_PORT_TYPE_SEND_RECEIVE:
+	    case MACH_PORT_TYPE_SEND_ONCE: {
+		ipc_port_t port = (ipc_port_t) entry->ie_object;
+		ipc_port_t nsrequest = IP_NULL;
+		mach_port_mscount_t mscount;
+		ipc_port_t dnrequest;
+
+		assert(port != IP_NULL);
+
+		if (type == MACH_PORT_TYPE_SEND)
+			ipc_hash_delete(space, (ipc_object_t) port,
+					name, entry);
+
+		ip_lock(port);
+
+		if (!ip_active(port)) {
+			assert((type & MACH_PORT_TYPE_RECEIVE) == 0);
+			ip_unlock(port);
+			ip_release(port);
+
+			entry->ie_request = 0;
+			OBJECT_CLEAR(entry, name);
+			ipc_entry_dealloc(space, name, entry);
+			is_write_unlock(space);
+			break;
+		}
+
+		dnrequest = ipc_right_dncancel_macro(space, port, name, entry);
+
+		OBJECT_CLEAR(entry, name);
+		ipc_entry_dealloc(space, name, entry);
+		is_write_unlock(space);
+
+		if (type & MACH_PORT_TYPE_SEND) {
+			assert(port->ip_srights > 0);
+			if (--port->ip_srights == 0
+			    ) {
+				nsrequest = port->ip_nsrequest;
+				if (nsrequest != IP_NULL) {
+					port->ip_nsrequest = IP_NULL;
+					mscount = port->ip_mscount;
+				}
+			}
+		}
+
+		if (type & MACH_PORT_TYPE_RECEIVE) {
+			assert(ip_active(port));
+			assert(port->ip_receiver == space);
+
+			ipc_port_clear_receiver(port);
+			ipc_port_destroy(port); /* consumes our ref, unlocks */
+		} else if (type & MACH_PORT_TYPE_SEND_ONCE) {
+			assert(port->ip_sorights > 0);
+			ip_unlock(port);
+
+			ipc_notify_send_once(port); /* consumes our ref */
+		} else {
+			assert(port->ip_receiver != space);
+
+			ip_unlock(port);
+			ip_release(port);
+		}
+
+		if (nsrequest != IP_NULL)
+			ipc_notify_no_senders(nsrequest, mscount);
+
+		if (dnrequest != IP_NULL)
+			ipc_notify_port_deleted(dnrequest, name);
+		break;
+	    }
+
+	    default:
+		panic("ipc_right_destroy: strange type");
+	}
+
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_right_dealloc
+ *	Purpose:
+ *		Releases a send/send-once/dead-name user ref.
+ *		Like ipc_right_delta with a delta of -1,
+ *		but looks at the entry to determine the right.
+ *	Conditions:
+ *		The space is write-locked, and is unlocked upon return.
+ *		The space must be active.
+ *	Returns:
+ *		KERN_SUCCESS		A user ref was released.
+ *		KERN_INVALID_RIGHT	Entry has wrong type.
+ */
+
+kern_return_t
+ipc_right_dealloc(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	entry)
+{
+	ipc_entry_bits_t bits = entry->ie_bits;
+	mach_port_type_t type = IE_BITS_TYPE(bits);
+
+	assert(space->is_active);
+
+	switch (type) {
+	case MACH_PORT_TYPE_DEAD_NAME: {
+	    dead_name:
+
+		assert(ipc_entry_refs(entry) > 0);
+		assert(entry->ie_request == 0);
+		assert(entry->ie_object == IO_NULL);
+
+		if (ipc_entry_refs(entry) > 1) {
+			ipc_entry_release(entry);
+			is_write_unlock(space);
+		} else
+			ipc_entry_dealloc(space, name, entry);
+
+		break;
+	    }
+
+	    case MACH_PORT_TYPE_SEND_ONCE: {
+		ipc_port_t port, dnrequest;
+
+		MACH_VERIFY(ipc_entry_refs(entry) == 1, ("urefs expected 1 got %d", ipc_entry_refs(entry)));
+		port = (ipc_port_t) entry->ie_object;
+		assert(port != IP_NULL);
+
+		if (ipc_right_check(space, port, name, entry)) {
+
+			bits = entry->ie_bits;
+			assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_DEAD_NAME);
+			goto dead_name;
+		}
+		/* port is locked and active */
+
+		assert(port->ip_sorights > 0);
+
+		dnrequest = ipc_right_dncancel_macro(space, port, name, entry);
+		ip_unlock(port);
+
+		OBJECT_CLEAR(entry, name);
+		/* drops the lock */
+		ipc_entry_dealloc(space, name, entry);
+
+		ipc_notify_send_once(port);
+
+		if (dnrequest != IP_NULL)
+			ipc_notify_port_deleted(dnrequest, name);
+		break;
+	    }
+
+	    case MACH_PORT_TYPE_SEND: {
+		ipc_port_t port;
+		ipc_port_t dnrequest = IP_NULL;
+		ipc_port_t nsrequest = IP_NULL;
+		mach_port_mscount_t mscount;
+
+
+		assert(ipc_entry_refs(entry) > 0);
+
+		port = (ipc_port_t) entry->ie_object;
+		assert(port != IP_NULL);
+
+		if (ipc_right_check(space, port, name, entry)) {
+			bits = entry->ie_bits;
+			assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_DEAD_NAME);
+			goto dead_name;
+		}
+		/* port is locked and active */
+
+		assert(port->ip_srights > 0);
+
+		if (ipc_entry_refs(entry) > 1) {
+			ip_unlock(port);
+			ipc_entry_release(entry); /* decrement urefs */
+			is_write_unlock(space);
+		} else {
+			if (--port->ip_srights == 0
+			    ) {
+				nsrequest = port->ip_nsrequest;
+				if (nsrequest != IP_NULL) {
+					port->ip_nsrequest = IP_NULL;
+					mscount = port->ip_mscount;
+				}
+
+			}
+
+			dnrequest = ipc_right_dncancel_macro(space, port,
+							     name, entry);
+
+			ipc_hash_delete(space, (ipc_object_t) port,
+					name, entry);
+			ip_unlock(port);
+			ip_release(port);
+			OBJECT_CLEAR(entry, name);
+			/* drops the space lock */
+			ipc_entry_dealloc(space, name, entry);
+		}
+		/* even if dropped a ref, port is active */
+
+
+		if (nsrequest != IP_NULL)
+			ipc_notify_no_senders(nsrequest, mscount);
+
+		if (dnrequest != IP_NULL)
+			ipc_notify_port_deleted(dnrequest, name);
+		break;
+	    }
+
+	    case MACH_PORT_TYPE_SEND_RECEIVE: {
+		ipc_port_t port;
+		ipc_port_t nsrequest = IP_NULL;
+		mach_port_mscount_t mscount;
+
+		assert(ipc_entry_refs(entry) > 0);
+
+		port = (ipc_port_t) entry->ie_object;
+		assert(port != IP_NULL);
+
+		ip_lock(port);
+		assert(ip_active(port));
+		assert(port->ip_receiver_name == name);
+		assert(port->ip_receiver == space);
+		assert(port->ip_srights > 0);
+
+		if (ipc_entry_refs(entry) > 1) {
+			ipc_entry_release(entry);
+		} else {
+			if (--port->ip_srights == 0
+			    ) {
+				nsrequest = port->ip_nsrequest;
+				if (nsrequest != IP_NULL) {
+					port->ip_nsrequest = IP_NULL;
+					mscount = port->ip_mscount;
+				}
+			}
+
+			entry->ie_bits = bits &~ (IE_BITS_UREFS_MASK|
+						  MACH_PORT_TYPE_SEND);
+		}
+
+		ip_unlock(port);
+		is_write_unlock(space);
+
+		if (nsrequest != IP_NULL)
+			ipc_notify_no_senders(nsrequest, mscount);
+		break;
+	    }
+
+	    default:
+		is_write_unlock(space);
+		return KERN_INVALID_RIGHT;
+	}
+
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_right_delta
+ *	Purpose:
+ *		Modifies the user-reference count for a right.
+ *		May deallocate the right, if the count goes to zero.
+ *	Conditions:
+ *		The space is write-locked, and is unlocked upon return.
+ *		The space must be active.
+ *	Returns:
+ *		KERN_SUCCESS		Count was modified.
+ *		KERN_INVALID_RIGHT	Entry has wrong type.
+ *		KERN_INVALID_VALUE	Bad delta for the right.
+ */
+
+kern_return_t
+ipc_right_delta(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	ipc_entry_t		entry,
+	mach_port_right_t	right,
+	mach_port_delta_t	delta)
+{
+	ipc_entry_bits_t bits = entry->ie_bits;
+
+/*
+ *	The following is used (for case MACH_PORT_RIGHT_DEAD_NAME) in the
+ *	switch below. It is used to keep track of those cases (in DIPC)
+ *	where we have postponed the dropping of a port reference. Since
+ *	the dropping of the reference could cause the port to disappear
+ *	we postpone doing so when we are holding the space lock.
+ */
+
+
+	assert(space->is_active);
+	assert(right < MACH_PORT_RIGHT_NUMBER);
+
+	/* Rights-specific restrictions and operations. */
+
+	switch (right) {
+	    case MACH_PORT_RIGHT_PORT_SET: {
+		ipc_pset_t pset;
+
+		if ((bits & MACH_PORT_TYPE_PORT_SET) == 0)
+			goto invalid_right;
+
+		assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_PORT_SET);
+		assert(IE_BITS_UREFS(bits) == 0);
+		assert(entry->ie_request == 0);
+
+		if (delta == 0)
+			goto success;
+
+		if (delta != -1)
+			goto invalid_value;
+
+		pset = (ipc_pset_t) entry->ie_object;
+		assert(pset != IPS_NULL);
+		assert(ips_active(pset));
+
+		/* space must be unlocked when calling KNOTE & close */
+		is_write_unlock(space);
+
+		sx_slock(&pset->ips_note_lock);
+		KNOTE(&pset->ips_note, EV_EOF, KNF_LISTLOCKED);
+		sx_sunlock(&pset->ips_note_lock);
+
+		ipc_entry_close(space, name);
+
+		break;
+	    }
+
+	    case MACH_PORT_RIGHT_RECEIVE: {
+		ipc_port_t port;
+		ipc_port_t dnrequest = IP_NULL;
+
+		if ((bits & MACH_PORT_TYPE_RECEIVE) == 0)
+			goto invalid_right;
+
+		if (delta == 0)
+			goto success;
+
+		if (delta != -1)
+			goto invalid_value;
+
+		port = (ipc_port_t) entry->ie_object;
+		assert(port != IP_NULL);
+
+		/*
+		 *	The port lock is needed for ipc_right_dncancel;
+		 *	otherwise, we wouldn't have to take the lock
+		 *	until just before dropping the space lock.
+		 */
+
+		ip_lock(port);
+		assert(ip_active(port));
+		assert(port->ip_receiver_name == name);
+		assert(port->ip_receiver == space);
+
+		if (bits & MACH_PORT_TYPE_SEND) {
+			assert(IE_BITS_TYPE(bits) ==
+					MACH_PORT_TYPE_SEND_RECEIVE);
+			assert(ipc_entry_refs(entry) > 0);
+			assert(port->ip_srights > 0);
+
+			/*
+			 *	The remaining send right turns into a
+			 *	dead name.  Notice we don't decrement
+			 *	ip_srights, generate a no-senders notif,
+			 *	or use ipc_right_dncancel, because the
+			 *	port is destroyed "first".
+			 */
+
+			bits &= ~IE_BITS_TYPE_MASK;
+			bits |= MACH_PORT_TYPE_DEAD_NAME;
+
+			if (entry->ie_request != 0) {
+				entry->ie_request = 0;
+				ipc_entry_hold(entry); /* increment urefs */
+			}
+
+			entry->ie_bits = bits;
+			OBJECT_CLEAR(entry, name);
+			is_write_unlock(space);
+		} else {
+			assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_RECEIVE);
+
+			dnrequest = ipc_right_dncancel_macro(space, port,
+							     name, entry);
+			OBJECT_CLEAR(entry, name);
+			/* drops the space lock */
+			ipc_entry_dealloc(space, name, entry);
+		}
+
+
+		ipc_port_clear_receiver(port);
+		ipc_port_destroy(port);	/* consumes ref, unlocks */
+
+		if (dnrequest != IP_NULL)
+			ipc_notify_port_deleted(dnrequest, name);
+		break;
+	    }
+
+	    case MACH_PORT_RIGHT_SEND_ONCE: {
+		ipc_port_t port, dnrequest;
+
+		if ((bits & MACH_PORT_TYPE_SEND_ONCE) == 0)
+			goto invalid_right;
+
+		assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_SEND_ONCE);
+		MACH_VERIFY(ipc_entry_refs(entry) == 1, ("urefs expected 1 got %d", ipc_entry_refs(entry)));
+
+		port = (ipc_port_t) entry->ie_object;
+		assert(port != IP_NULL);
+
+		if (ipc_right_check(space, port, name, entry)) {
+			assert(!(entry->ie_bits & MACH_PORT_TYPE_SEND_ONCE));
+			goto invalid_right;
+		}
+		/* port is locked and active */
+
+		assert(port->ip_sorights > 0);
+
+		if ((delta > 0) || (delta < -1)) {
+			ip_unlock(port);
+			goto invalid_value;
+		}
+
+		if (delta == 0) {
+			ip_unlock(port);
+			goto success;
+		}
+
+		dnrequest = ipc_right_dncancel_macro(space, port, name, entry);
+		ip_unlock(port);
+
+		OBJECT_CLEAR(entry, name);
+		/* drops the space lock */
+		ipc_entry_dealloc(space, name, entry);
+
+		ipc_notify_send_once(port);
+
+		if (dnrequest != IP_NULL)
+			ipc_notify_port_deleted(dnrequest, name);
+		break;
+	    }
+
+	    case MACH_PORT_RIGHT_DEAD_NAME: {
+		mach_port_urefs_t urefs;
+
+		if (bits & MACH_PORT_TYPE_SEND_RIGHTS) {
+			ipc_port_t port;
+
+			port = (ipc_port_t) entry->ie_object;
+			assert(port != IP_NULL);
+			if (!ipc_right_check(space, port, name, entry)) {
+				/* port is locked and active */
+				ip_unlock(port);
+				goto invalid_right;
+			}
+			bits = entry->ie_bits;
+		} else if ((bits & MACH_PORT_TYPE_DEAD_NAME) == 0)
+			goto invalid_right;
+
+		assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_DEAD_NAME);
+		assert(ipc_entry_refs(entry) > 0);
+		assert(entry->ie_object == IO_NULL);
+		assert(entry->ie_request == 0);
+
+		urefs = ipc_entry_refs(entry);
+		if (MACH_PORT_UREFS_UNDERFLOW(urefs, delta))
+			goto invalid_value;
+
+		if ((urefs + delta) == 0) {
+			/* drops the space lock */
+			ipc_entry_dealloc(space, name, entry);
+		} else {
+			ipc_entry_add_refs(entry, delta);
+			is_write_unlock(space);
+		}
+		break;
+	    }
+
+	    case MACH_PORT_RIGHT_SEND: {
+		mach_port_urefs_t urefs;
+		ipc_port_t port;
+		ipc_port_t dnrequest = IP_NULL;
+		ipc_port_t nsrequest = IP_NULL;
+		mach_port_mscount_t mscount;
+
+		if ((bits & MACH_PORT_TYPE_SEND) == 0)
+			goto invalid_right;
+
+		/* maximum urefs for send is MACH_PORT_UREFS_MAX-1 */
+
+		port = (ipc_port_t) entry->ie_object;
+		assert(port != IP_NULL);
+
+		if (ipc_right_check(space, port, name, entry)) {
+			assert((entry->ie_bits & MACH_PORT_TYPE_SEND) == 0);
+			goto invalid_right;
+		}
+		/* port is locked and active */
+
+		assert(port->ip_srights > 0);
+
+		urefs = ipc_entry_refs(entry);
+		if (MACH_PORT_UREFS_UNDERFLOW(urefs, delta)) {
+			ip_unlock(port);
+			goto invalid_value;
+		}
+
+		if ((urefs + delta) == 0) {
+			if (--port->ip_srights == 0
+			    ) {
+				nsrequest = port->ip_nsrequest;
+				if (nsrequest != IP_NULL) {
+					port->ip_nsrequest = IP_NULL;
+					mscount = port->ip_mscount;
+				}
+			}
+
+			if (bits & MACH_PORT_TYPE_RECEIVE) {
+				assert(port->ip_receiver_name == name);
+				assert(port->ip_receiver == space);
+				assert(IE_BITS_TYPE(bits) ==
+						MACH_PORT_TYPE_SEND_RECEIVE);
+
+				entry->ie_bits = bits &~ (IE_BITS_UREFS_MASK|
+										  MACH_PORT_TYPE_SEND);
+				ip_unlock(port);
+				is_write_unlock(space);
+
+			} else {
+				assert(IE_BITS_TYPE(bits) ==
+						MACH_PORT_TYPE_SEND);
+
+				dnrequest = ipc_right_dncancel_macro(
+						space, port, name, entry);
+
+				ipc_hash_delete(space, (ipc_object_t) port,
+						name, entry);
+				ip_unlock(port);
+				ip_release(port);
+				OBJECT_CLEAR(entry, name);
+				/* drops the space lock */
+				ipc_entry_dealloc(space, name, entry);
+			}
+		} else {
+			is_write_unlock(space);
+			ip_unlock(port);
+			ipc_entry_add_refs(entry, delta);
+		}
+		/* even if dropped a ref, port is active */
+
+
+		if (nsrequest != IP_NULL)
+			ipc_notify_no_senders(nsrequest, mscount);
+
+		if (dnrequest != IP_NULL)
+			ipc_notify_port_deleted(dnrequest, name);
+		break;
+	    }
+
+	    default:
+		panic("ipc_right_delta: strange right");
+	}
+
+	return KERN_SUCCESS;
+
+    success:
+	is_write_unlock(space);
+	return KERN_SUCCESS;
+
+    invalid_right:
+	is_write_unlock(space);
+	return KERN_INVALID_RIGHT;
+
+    invalid_value:
+	is_write_unlock(space);
+	return KERN_INVALID_VALUE;
+}
+
+/*
+ *	Routine:	ipc_right_info
+ *	Purpose:
+ *		Retrieves information about the right.
+ *	Conditions:
+ *		The space is write-locked, and is unlocked upon return
+ *		if the call is unsuccessful.  The space must be active.
+ *	Returns:
+ *		KERN_SUCCESS		Retrieved info; space still locked.
+ */
+
+kern_return_t
+ipc_right_info(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	ipc_entry_t		entry,
+	mach_port_type_t	*typep,
+	mach_port_urefs_t	*urefsp)
+{
+	ipc_entry_bits_t bits = entry->ie_bits;
+	ipc_port_request_index_t request;
+	mach_port_type_t type;
+
+	if (bits & MACH_PORT_TYPE_SEND_RIGHTS) {
+		ipc_port_t port = (ipc_port_t) entry->ie_object;
+
+		if (ipc_right_check(space, port, name, entry)) {
+			bits = entry->ie_bits;
+			assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_DEAD_NAME);
+		} else
+			ip_unlock(port);
+	}
+
+	type = IE_BITS_TYPE(bits);
+	request = entry->ie_request;
+
+	if (request != 0)
+		type |= MACH_PORT_TYPE_DNREQUEST;
+
+	*typep = type;
+	*urefsp = ipc_entry_refs(entry);
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_right_copyin_check
+ *	Purpose:
+ *		Check if a subsequent ipc_right_copyin (for receiver) would succeed.
+ *	Conditions:
+ *		The space is locked (read or write) and active.
+ */
+
+boolean_t
+ipc_right_copyin_check(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	ipc_entry_t		entry,
+	mach_msg_type_name_t	msgt_name)
+{
+	ipc_port_t port = (ipc_port_t) entry->ie_object;
+	ipc_entry_bits_t bits = entry->ie_bits;
+
+	assert(space->is_active);
+
+	switch (msgt_name) {
+	    case MACH_MSG_TYPE_MAKE_SEND:
+	    case MACH_MSG_TYPE_MAKE_SEND_ONCE:
+	    case MACH_MSG_TYPE_MOVE_RECEIVE:
+		if ((bits & MACH_PORT_TYPE_RECEIVE) == 0)
+			return FALSE;
+		if (port == NULL)
+			return (FALSE);
+		if (port->ip_receiver != space)
+			return (FALSE);
+		break;
+
+	    case MACH_MSG_TYPE_COPY_SEND:
+	    case MACH_MSG_TYPE_MOVE_SEND:
+	    case MACH_MSG_TYPE_MOVE_SEND_ONCE: {
+		boolean_t active;
+
+		if (bits & MACH_PORT_TYPE_DEAD_NAME)
+			break;
+
+		if (port == NULL)
+			return (FALSE);
+		if (port->ip_receiver != space)
+			return (FALSE);
+
+		if ((bits & MACH_PORT_TYPE_SEND_RIGHTS) == 0)
+			return FALSE;
+
+		ip_lock(port);
+		active = ip_active(port);
+		ip_unlock(port);
+
+		if (!active) {
+			break;
+		}
+
+		if (msgt_name == MACH_MSG_TYPE_MOVE_SEND_ONCE) {
+			if ((bits & MACH_PORT_TYPE_SEND_ONCE) == 0)
+				return FALSE;
+		} else {
+			if ((bits & MACH_PORT_TYPE_SEND) == 0)
+				return FALSE;
+		}
+
+		break;
+	    }
+
+	    default:
+		panic("ipc_right_copyin_check: strange rights");
+	}
+
+	return TRUE;
+}
+
+/*
+ *	Routine:	ipc_right_copyin
+ *	Purpose:
+ *		Copyin a capability from a space.
+ *		If successful, the caller gets a ref
+ *		for the resulting object, unless it is IO_DEAD,
+ *		and possibly a send-once right which should
+ *		be used in a port-deleted notification.
+ *
+ *		If deadok is not TRUE, the copyin operation
+ *		will fail instead of producing IO_DEAD.
+ *
+ *		The entry is never deallocated (except
+ *		when KERN_INVALID_NAME), so the caller
+ *		should deallocate the entry if its type
+ *		is MACH_PORT_TYPE_NONE.
+ *	Conditions:
+ *		The space is write-locked and active.
+ *	Returns:
+ *		KERN_SUCCESS		Acquired an object, possibly IO_DEAD.
+ *		KERN_INVALID_RIGHT	Name doesn't denote correct right.
+ */
+
+#define ELOG printf("%s:%d bits: %08x\n", __FILE__, __LINE__, bits)
+
+kern_return_t
+ipc_right_copyin(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	ipc_entry_t		entry,
+	mach_msg_type_name_t	msgt_name,
+	boolean_t		deadok,
+	ipc_object_t		*objectp,
+	ipc_port_t		*sorightp)
+{
+	ipc_entry_bits_t bits = entry->ie_bits;
+
+	assert(space->is_active);
+
+	switch (msgt_name) {
+	    case MACH_MSG_TYPE_MAKE_SEND: {
+		ipc_port_t port;
+
+		if ((bits & MACH_PORT_TYPE_RECEIVE) == 0) {
+			ELOG;
+			goto invalid_right;
+		}
+		port = (ipc_port_t) entry->ie_object;
+		assert(port != IP_NULL);
+
+		ip_lock(port);
+		assert(ip_active(port));
+		assert(port->ip_receiver_name == name);
+		assert(port->ip_receiver == space);
+
+		port->ip_mscount++;
+		port->ip_srights++;
+		ip_reference(port);
+		ip_unlock(port);
+
+		*objectp = (ipc_object_t) port;
+		*sorightp = IP_NULL;
+		break;
+	    }
+
+	    case MACH_MSG_TYPE_MAKE_SEND_ONCE: {
+		ipc_port_t port;
+
+		if ((bits & MACH_PORT_TYPE_RECEIVE) == 0) {
+			ELOG;
+			goto invalid_right;
+		}
+		port = (ipc_port_t) entry->ie_object;
+		assert(port != IP_NULL);
+
+		ip_lock(port);
+		assert(ip_active(port));
+		assert(port->ip_receiver_name == name);
+		assert(port->ip_receiver == space);
+
+		port->ip_sorights++;
+		ip_reference(port);
+		ip_unlock(port);
+
+		*objectp = (ipc_object_t) port;
+		*sorightp = IP_NULL;
+		break;
+	    }
+
+	    case MACH_MSG_TYPE_MOVE_RECEIVE: {
+		ipc_port_t port;
+		ipc_port_t dnrequest = IP_NULL;
+
+		if ((bits & MACH_PORT_TYPE_RECEIVE) == 0) {
+			ELOG;
+			goto invalid_right;
+		}
+		port = (ipc_port_t) entry->ie_object;
+		assert(port != IP_NULL);
+
+		ip_lock(port);
+		assert(ip_active(port));
+		assert(port->ip_receiver_name == name);
+		assert(port->ip_receiver == space);
+
+		if (bits & MACH_PORT_TYPE_SEND) {
+			assert(IE_BITS_TYPE(bits) ==
+					MACH_PORT_TYPE_SEND_RECEIVE);
+			assert(ipc_entry_refs(entry) > 0);
+			assert(port->ip_srights > 0);
+
+			ipc_hash_insert(space, (ipc_object_t) port,
+					name, entry);
+
+			ip_reference(port);
+		} else {
+			assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_RECEIVE);
+			assert(IE_BITS_UREFS(bits) == 0);
+
+			dnrequest = ipc_right_dncancel_macro(space, port,
+							     name, entry);
+
+			OBJECT_CLEAR(entry, name);
+		}
+		entry->ie_bits = bits &~ MACH_PORT_TYPE_RECEIVE;
+
+		ipc_port_clear_receiver(port);
+
+		port->ip_receiver_name = MACH_PORT_NAME_NULL;
+		port->ip_destination = IP_NULL;
+		ip_unlock(port);
+
+		*objectp = (ipc_object_t) port;
+		*sorightp = dnrequest;
+		break;
+	    }
+
+	    case MACH_MSG_TYPE_COPY_SEND: {
+		ipc_port_t port;
+
+		if (bits & MACH_PORT_TYPE_DEAD_NAME)
+			goto copy_dead;
+
+		/* allow for dead send-once rights */
+
+		if ((bits & MACH_PORT_TYPE_SEND_RIGHTS) == 0) {
+			goto invalid_right;
+		}
+		assert(ipc_entry_refs(entry) > 0);
+
+		port = (ipc_port_t) entry->ie_object;
+		assert(port != IP_NULL);
+
+		if (ipc_right_check(space, port, name, entry)) {
+			bits = entry->ie_bits;
+			goto copy_dead;
+		}
+		/* port is locked and active */
+
+		if ((bits & MACH_PORT_TYPE_SEND) == 0) {
+			assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_SEND_ONCE);
+			assert(port->ip_sorights > 0);
+
+			ip_unlock(port);
+			ELOG;
+			goto invalid_right;
+		}
+
+		assert(port->ip_srights > 0);
+
+		port->ip_srights++;
+		ip_reference(port);
+		ip_unlock(port);
+
+		*objectp = (ipc_object_t) port;
+		*sorightp = IP_NULL;
+		break;
+	    }
+
+	    case MACH_MSG_TYPE_MOVE_SEND: {
+		ipc_port_t port;
+		ipc_port_t dnrequest = IP_NULL;
+
+		if (bits & MACH_PORT_TYPE_DEAD_NAME)
+			goto move_dead;
+
+		/* allow for dead send-once rights */
+
+		if ((bits & MACH_PORT_TYPE_SEND_RIGHTS) == 0) {
+			ELOG;
+			goto invalid_right;
+		}
+		assert(ipc_entry_refs(entry) > 0);
+
+		port = (ipc_port_t) entry->ie_object;
+		assert(port != IP_NULL);
+
+		if (ipc_right_check(space, port, name, entry)) {
+			bits = entry->ie_bits;
+			goto move_dead;
+		}
+		/* port is locked and active */
+
+		if ((bits & MACH_PORT_TYPE_SEND) == 0) {
+			assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_SEND_ONCE);
+			assert(port->ip_sorights > 0);
+
+			ip_unlock(port);
+			ELOG;
+			goto invalid_right;
+		}
+
+		assert(port->ip_srights > 0);
+
+		if (ipc_entry_refs(entry) == 1) {
+			if (bits & MACH_PORT_TYPE_RECEIVE) {
+				assert(port->ip_receiver_name == name);
+				assert(port->ip_receiver == space);
+				assert(IE_BITS_TYPE(bits) ==
+						MACH_PORT_TYPE_SEND_RECEIVE);
+
+				ip_reference(port);
+			} else {
+				assert(IE_BITS_TYPE(bits) ==
+						MACH_PORT_TYPE_SEND);
+
+				dnrequest = ipc_right_dncancel_macro(
+						space, port, name, entry);
+
+				ipc_hash_delete(space, (ipc_object_t) port,
+								name, entry);
+				OBJECT_CLEAR(entry, name);
+			}
+			entry->ie_bits = bits &~
+				(IE_BITS_UREFS_MASK|MACH_PORT_TYPE_SEND);
+		} else {
+			MPASS(ipc_entry_refs(entry) > 1);
+			port->ip_srights++;
+			ip_reference(port);
+			ipc_entry_release(entry); /* decrement urefs */
+		}
+
+		ip_unlock(port);
+
+		*objectp = (ipc_object_t) port;
+		*sorightp = dnrequest;
+		break;
+	    }
+
+	    case MACH_MSG_TYPE_MOVE_SEND_ONCE: {
+		ipc_port_t port;
+		ipc_port_t dnrequest;
+
+		if (bits & MACH_PORT_TYPE_DEAD_NAME)
+			goto move_dead;
+
+		/* allow for dead send rights */
+
+		if ((bits & MACH_PORT_TYPE_SEND_RIGHTS) == 0) {
+			ELOG;
+			goto invalid_right;
+		}
+		assert(ipc_entry_refs(entry) > 0);
+
+		port = (ipc_port_t) entry->ie_object;
+		assert(port != IP_NULL);
+
+		if (ipc_right_check(space, port, name, entry)) {
+			bits = entry->ie_bits;
+			ELOG;
+			goto move_dead;
+		}
+		/* port is locked and active */
+
+		if ((bits & MACH_PORT_TYPE_SEND_ONCE) == 0) {
+			assert(bits & MACH_PORT_TYPE_SEND);
+			assert(port->ip_srights > 0);
+
+			ip_unlock(port);
+			ELOG;
+			goto invalid_right;
+		}
+
+		assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_SEND_ONCE);
+		MACH_VERIFY(ipc_entry_refs(entry) == 1, ("urefs expected 1 got %d", ipc_entry_refs(entry)));
+		assert(port->ip_sorights > 0);
+
+		dnrequest = ipc_right_dncancel_macro(space, port, name, entry);
+		ip_unlock(port);
+
+		OBJECT_CLEAR(entry, name);
+		entry->ie_bits = bits &~ MACH_PORT_TYPE_SEND_ONCE;
+
+		*objectp = (ipc_object_t) port;
+		*sorightp = dnrequest;
+		break;
+	    }
+
+	    default:
+		panic("ipc_right_copyin: strange rights");
+	}
+
+	return KERN_SUCCESS;
+
+    copy_dead:
+	assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_DEAD_NAME);
+	assert(ipc_entry_refs(entry) > 0);
+	assert(entry->ie_request == 0);
+	assert(entry->ie_object == 0);
+
+	if (!deadok) {
+		ELOG;
+		goto invalid_right;
+	}
+	*objectp = IO_DEAD;
+	*sorightp = IP_NULL;
+	return KERN_SUCCESS;
+
+    move_dead:
+	assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_DEAD_NAME);
+	assert(ipc_entry_refs(entry) > 0);
+	assert(entry->ie_request == 0);
+	assert(entry->ie_object == 0);
+
+	if (!deadok) {
+		ELOG;
+		goto invalid_right;
+	}
+	if (ipc_entry_refs(entry) > 1)
+		ipc_entry_release(entry); /* decrement urefs */
+	else
+		entry->ie_bits = bits &~ MACH_PORT_TYPE_DEAD_NAME;
+
+	*objectp = IO_DEAD;
+	*sorightp = IP_NULL;
+	return KERN_SUCCESS;
+
+    invalid_right:
+	return KERN_INVALID_RIGHT;
+}
+
+/*
+ *	Routine:	ipc_right_copyin_undo
+ *	Purpose:
+ *		Undoes the effects of an ipc_right_copyin
+ *		of a send/send-once right that is dead.
+ *		(Object is either IO_DEAD or a dead port.)
+ *	Conditions:
+ *		The space is write-locked and active.
+ */
+
+void
+ipc_right_copyin_undo(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	ipc_entry_t		entry,
+	mach_msg_type_name_t	msgt_name,
+	ipc_object_t		object,
+	ipc_port_t		soright)
+{
+	ipc_entry_bits_t bits = entry->ie_bits;
+
+	assert(space->is_active);
+
+	assert((msgt_name == MACH_MSG_TYPE_MOVE_SEND) ||
+	       (msgt_name == MACH_MSG_TYPE_COPY_SEND) ||
+	       (msgt_name == MACH_MSG_TYPE_MOVE_SEND_ONCE));
+
+	if (soright != IP_NULL) {
+		assert((msgt_name == MACH_MSG_TYPE_MOVE_SEND) ||
+		       (msgt_name == MACH_MSG_TYPE_MOVE_SEND_ONCE));
+		assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_NONE);
+		assert(entry->ie_object == IO_NULL);
+		assert(object != IO_DEAD);
+
+		entry->ie_bits = ((bits &~ IE_BITS_RIGHT_MASK) |
+				  MACH_PORT_TYPE_DEAD_NAME | 2);
+	} else if (IE_BITS_TYPE(bits) == MACH_PORT_TYPE_NONE) {
+		assert((msgt_name == MACH_MSG_TYPE_MOVE_SEND) ||
+		       (msgt_name == MACH_MSG_TYPE_MOVE_SEND_ONCE));
+		assert(entry->ie_object == IO_NULL);
+
+		entry->ie_bits = ((bits &~ IE_BITS_RIGHT_MASK) |
+				  MACH_PORT_TYPE_DEAD_NAME | 1);
+	} else if (IE_BITS_TYPE(bits) == MACH_PORT_TYPE_DEAD_NAME) {
+		assert(entry->ie_object == IO_NULL);
+		assert(object == IO_DEAD);
+		assert(ipc_entry_refs(entry) > 0);
+
+		if (msgt_name != MACH_MSG_TYPE_COPY_SEND) {
+			ipc_entry_hold(entry);/* increment urefs */
+		}
+	} else {
+		assert((msgt_name == MACH_MSG_TYPE_MOVE_SEND) ||
+		       (msgt_name == MACH_MSG_TYPE_COPY_SEND));
+		assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_SEND);
+		assert(object != IO_DEAD);
+		assert(entry->ie_object == object);
+		assert(ipc_entry_refs(entry) > 0);
+
+		if (msgt_name != MACH_MSG_TYPE_COPY_SEND) {
+			ipc_entry_hold(entry); /* increment urefs */
+		}
+
+		/*
+		 *	May as well convert the entry to a dead name.
+		 *	(Or if it is a compat entry, destroy it.)
+		 */
+
+		if (!ipc_right_check(space, (ipc_port_t) object,
+							 name, entry))
+			ip_unlock((ipc_port_t) object);
+		/* object is dead so it is not locked */
+	}
+
+	/* release the reference acquired by copyin */
+
+	if (object != IO_DEAD)
+		ipc_object_release(object);
+}
+
+/*
+ *	Routine:	ipc_right_copyin_two
+ *	Purpose:
+ *		Like ipc_right_copyin with MACH_MSG_TYPE_MOVE_SEND
+ *		and deadok == FALSE, except that this moves two
+ *		send rights at once.
+ *	Conditions:
+ *		The space is write-locked and active.
+ *		The object is returned with two refs/send rights.
+ *	Returns:
+ *		KERN_SUCCESS		Acquired an object.
+ *		KERN_INVALID_RIGHT	Name doesn't denote correct right.
+ */
+
+kern_return_t
+ipc_right_copyin_two(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	entry,
+	ipc_object_t	*objectp,
+	ipc_port_t	*sorightp)
+{
+	ipc_entry_bits_t bits = entry->ie_bits;
+	mach_port_urefs_t urefs;
+	ipc_port_t port;
+	ipc_port_t dnrequest = IP_NULL;
+
+	assert(space->is_active);
+
+	if ((bits & MACH_PORT_TYPE_SEND) == 0)
+		goto invalid_right;
+
+	urefs = ipc_entry_refs(entry);
+	if (urefs < 2)
+		goto invalid_right;
+
+	port = (ipc_port_t) entry->ie_object;
+	assert(port != IP_NULL);
+
+	if (ipc_right_check(space, port, name, entry)) {
+		goto invalid_right;
+	}
+	/* port is locked and active */
+
+	assert(port->ip_srights > 0);
+
+	if (urefs == 2) {
+		if (bits & MACH_PORT_TYPE_RECEIVE) {
+			assert(port->ip_receiver_name == name);
+			assert(port->ip_receiver == space);
+			assert(IE_BITS_TYPE(bits) ==
+					MACH_PORT_TYPE_SEND_RECEIVE);
+
+			port->ip_srights++;
+			ip_reference(port);
+			ip_reference(port);
+		} else {
+			assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_SEND);
+
+			dnrequest = ipc_right_dncancel_macro(space, port,
+							     name, entry);
+			ipc_hash_delete(space, (ipc_object_t) port,
+							name, entry);
+			port->ip_srights++;
+			ip_reference(port);
+			OBJECT_CLEAR(entry, name);
+		}
+		entry->ie_bits = bits &~
+			(IE_BITS_UREFS_MASK|MACH_PORT_TYPE_SEND);
+	} else {
+		port->ip_srights += 2;
+		ip_reference(port);
+		ip_reference(port);
+		entry->ie_bits = bits-2; /* decrement urefs */
+	}
+	ip_unlock(port);
+
+	*objectp = (ipc_object_t) port;
+	*sorightp = dnrequest;
+	return KERN_SUCCESS;
+
+    invalid_right:
+	return KERN_INVALID_RIGHT;
+}
+
+/*
+ *	Routine:	ipc_right_copyout
+ *	Purpose:
+ *		Copyout a capability to a space.
+ *		If successful, consumes a ref for the object.
+ *
+ *		Always succeeds when given a newly-allocated entry,
+ *		because user-reference overflow isn't a possibility.
+ *
+ *	Conditions:
+ *		The space is write-locked and active.
+ *		The object is locked and active.
+ *		The object is unlocked; the space isn't.
+ *	Returns:
+ *		KERN_SUCCESS		Copied out capability.
+  */
+
+kern_return_t
+ipc_right_copyout(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	ipc_entry_t		entry,
+	mach_msg_type_name_t	msgt_name,
+	ipc_object_t		object)
+{
+	ipc_entry_bits_t bits = entry->ie_bits;
+	ipc_port_t port;
+
+	assert(IO_VALID(object));
+	assert(io_otype(object) == IOT_PORT);
+	assert(io_active(object));
+	assert(entry->ie_object == object);
+
+	port = (ipc_port_t) object;
+
+	switch (msgt_name) {
+	    case MACH_MSG_TYPE_PORT_SEND_ONCE:
+		assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_NONE);
+		assert(port->ip_sorights > 0);
+
+		/* transfer send-once right and ref to entry */
+		ip_unlock(port);
+
+		entry->ie_bits = bits | (MACH_PORT_TYPE_SEND_ONCE);
+		break;
+
+	    case MACH_MSG_TYPE_PORT_SEND:
+		assert(port->ip_srights > 0);
+
+		if (bits & MACH_PORT_TYPE_SEND) {
+
+			assert(port->ip_srights > 1);
+			assert(ipc_entry_refs(entry) > 0);
+
+			port->ip_srights--;
+			ip_unlock(port);
+			ip_release(port);
+		} else if (bits & MACH_PORT_TYPE_RECEIVE) {
+			assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_RECEIVE);
+
+			/* transfer send right to entry */
+			ip_unlock(port);
+			ip_release(port);
+		} else {
+			assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_NONE);
+
+			/* transfer send right and ref to entry */
+			ip_unlock(port);
+
+			/* entry is locked holding ref, so can use port */
+
+			ipc_hash_insert(space, (ipc_object_t) port,
+					name, entry);
+		}
+		ipc_entry_hold(entry);
+		entry->ie_bits = (bits | MACH_PORT_TYPE_SEND);
+		break;
+
+	    case MACH_MSG_TYPE_PORT_RECEIVE: {
+		ipc_port_t dest;
+
+		assert(port->ip_mscount == 0);
+		assert(port->ip_receiver_name == MACH_PORT_NAME_NULL);
+		dest = port->ip_destination;
+
+		port->ip_receiver_name = name;
+		port->ip_receiver = space;
+
+		assert((bits & MACH_PORT_TYPE_RECEIVE) == 0);
+
+		if (bits & MACH_PORT_TYPE_SEND) {
+			assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_SEND);
+			assert(ipc_entry_refs(entry) > 0);
+			assert(port->ip_srights > 0);
+
+			ip_unlock(port);
+			ip_release(port);
+
+			/* entry is locked holding ref, so can use port */
+
+			ipc_hash_delete(space, (ipc_object_t) port,
+					name, entry);
+		} else {
+			assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_NONE);
+
+			/* transfer ref to entry */
+			ip_unlock(port);
+		}
+
+		entry->ie_bits = bits | MACH_PORT_TYPE_RECEIVE;
+
+		if (dest != IP_NULL)
+			ipc_port_release(dest);
+		break;
+	    }
+
+	    default:
+		panic("ipc_right_copyout: strange rights");
+	}
+
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_right_rename
+ *	Purpose:
+ *		Transfer an entry from one name to another.
+ *		The old entry is deallocated.
+ *	Conditions:
+ *		The space is write-locked and active.
+ *		The new entry is unused.  Upon return,
+ *		the space is unlocked.
+ *	Returns:
+ *		KERN_SUCCESS		Moved entry to new name.
+ */
+
+kern_return_t
+ipc_right_rename(
+	ipc_space_t	space,
+	mach_port_name_t	oname,
+	ipc_entry_t	oentry,
+	mach_port_name_t	nname,
+	ipc_entry_t	nentry)
+{
+	ipc_entry_bits_t bits = oentry->ie_bits;
+	ipc_port_request_index_t request = oentry->ie_request;
+	ipc_object_t object = oentry->ie_object;
+
+	assert(space->is_active);
+	assert(oname != nname);
+
+	/*
+	 *	If IE_BITS_COMPAT, we can't allow the entry to be renamed
+	 *	if the port is dead.  (This would foil ipc_port_destroy.)
+	 *	Instead we should fail because oentry shouldn't exist.
+	 *	Note IE_BITS_COMPAT implies ie_request != 0.
+	 */
+
+	if (request != 0) {
+		ipc_port_t port;
+
+		assert(bits & MACH_PORT_TYPE_PORT_RIGHTS);
+		port = (ipc_port_t) object;
+		assert(port != IP_NULL);
+
+		if (ipc_right_check(space, port, oname, oentry)) {
+			bits = oentry->ie_bits;
+			assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_DEAD_NAME);
+			assert(oentry->ie_request == 0);
+			request = 0;
+			assert(oentry->ie_object == IO_NULL);
+			object = IO_NULL;
+		} else {
+			/* port is locked and active */
+
+			ipc_port_dnrename(port, request, oname, nname);
+			ip_unlock(port);
+			oentry->ie_request = 0;
+		}
+	}
+
+	/* initialize nentry before letting ipc_hash_insert see it */
+
+	assert((nentry->ie_bits & IE_BITS_RIGHT_MASK) == 0);
+	nentry->ie_bits |= bits & IE_BITS_RIGHT_MASK;
+	nentry->ie_request = request;
+	nentry->ie_object = object;
+
+	switch (IE_BITS_TYPE(bits)) {
+	    case MACH_PORT_TYPE_SEND: {
+		ipc_port_t port;
+
+		port = (ipc_port_t) object;
+		assert(port != IP_NULL);
+
+		ipc_hash_delete(space, (ipc_object_t) port, oname, oentry);
+		ipc_hash_insert(space, (ipc_object_t) port, nname, nentry);
+		break;
+	    }
+
+	    case MACH_PORT_TYPE_RECEIVE:
+	    case MACH_PORT_TYPE_SEND_RECEIVE: {
+		ipc_port_t port;
+
+		port = (ipc_port_t) object;
+		assert(port != IP_NULL);
+
+		ip_lock(port);
+		assert(ip_active(port));
+		assert(port->ip_receiver_name == oname);
+		assert(port->ip_receiver == space);
+
+		port->ip_receiver_name = nname;
+		ip_unlock(port);
+		break;
+	    }
+
+	    case MACH_PORT_TYPE_PORT_SET: {
+		ipc_pset_t pset;
+
+		pset = (ipc_pset_t) object;
+		assert(pset != IPS_NULL);
+
+		ips_lock(pset);
+		assert(ips_active(pset));
+		assert(pset->ips_local_name == oname);
+
+		pset->ips_local_name = nname;
+		ips_unlock(pset);
+		break;
+	    }
+
+	    case MACH_PORT_TYPE_SEND_ONCE:
+	    case MACH_PORT_TYPE_DEAD_NAME:
+		break;
+
+	    default:
+		panic("ipc_right_rename: strange rights");
+	}
+
+	assert(oentry->ie_request == 0);
+	OBJECT_CLEAR(oentry, oname);
+	/* drops the space lock */
+	ipc_entry_dealloc(space, oname, oentry);
+
+	return KERN_SUCCESS;
+}


Property changes on: trunk/sys/compat/mach/ipc/ipc_right.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/ipc_space.c
===================================================================
--- trunk/sys/compat/mach/ipc/ipc_space.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/ipc_space.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,321 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.8.2.1  92/01/03  16:35:55  jsb
+ * 	NORMA_IPC: declare ipc_space_remote.
+ * 	[91/12/24  14:00:40  jsb]
+ * 
+ * Revision 2.8  91/10/09  16:10:26  af
+ * 	 Revision 2.7.2.1  91/09/16  10:15:57  rpd
+ * 	 	Added <ipc/ipc_hash.h>.
+ * 	 	[91/09/02            rpd]
+ * 
+ * Revision 2.7.2.1  91/09/16  10:15:57  rpd
+ * 	Added <ipc/ipc_hash.h>.
+ * 	[91/09/02            rpd]
+ * 
+ * Revision 2.7  91/05/14  16:36:44  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.6  91/03/16  14:48:37  rpd
+ * 	Added is_growing.
+ * 	[91/03/07  16:38:42  rpd]
+ * 
+ * Revision 2.5  91/02/05  17:23:43  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:51:18  mrt]
+ * 
+ * Revision 2.4  91/01/08  15:14:48  rpd
+ * 	Removed MACH_IPC_GENNOS.
+ * 	[90/11/08            rpd]
+ * 
+ * Revision 2.3  90/11/05  14:30:20  rpd
+ * 	Use new ip_reference and ip_release.
+ * 	[90/10/29            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:51:39  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:03:12  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_space.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Functions to manipulate IPC capability spaces.
+ */
+#if 0
+#include <dipc.h>
+#include <mach_kdb.h>
+
+#include <mach/boolean.h>
+#endif
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+
+#include <sys/mach/kern_return.h>
+#include <sys/mach/port.h>
+#if 0
+#include <kern/assert.h>
+#endif
+
+#include <vm/uma.h>
+#include <sys/mach/ipc/port.h>
+#include <sys/mach/ipc/ipc_entry.h>
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_hash.h>
+#include <sys/mach/ipc/ipc_table.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/ipc/ipc_right.h>
+#include <sys/mach/thread.h>
+
+
+uma_zone_t ipc_space_zone;
+ipc_space_t ipc_space_kernel;
+ipc_space_t ipc_space_reply;
+
+/*
+ *	Routine:	ipc_space_reference
+ *	Routine:	ipc_space_release
+ *	Purpose:
+ *		Function versions of the IPC space macros.
+ *		The "is_" cover macros can be defined to use the
+ *		macros or the functions, as desired.
+ */
+
+void
+ipc_space_reference(
+	ipc_space_t	space)
+{
+	ipc_space_reference_macro(space);
+}
+
+void
+ipc_space_release(
+	ipc_space_t	space)
+{
+	ipc_space_release_macro(space);
+}
+
+/*
+ *	Routine:	ipc_space_create
+ *	Purpose:
+ *		Creates a new IPC space.
+ *
+ *		The new space has two references, one for the caller
+ *		and one because it is active.
+ *	Conditions:
+ *		Nothing locked.  Allocates memory.
+ *	Returns:
+ *		KERN_SUCCESS		Created a space.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+ipc_space_create(
+	ipc_table_size_t	initial,
+	ipc_space_t		*spacep)
+{
+	ipc_space_t space;
+	ipc_entry_t *table;
+	ipc_entry_num_t new_size;
+
+	space = is_alloc();
+	if (space == IS_NULL)
+		return KERN_RESOURCE_SHORTAGE;
+
+	table = it_entries_alloc(initial);
+	if (table == NULL) {
+		is_free(space);
+		return KERN_RESOURCE_SHORTAGE;
+	}
+
+	new_size = initial->its_size;
+	memset((void *) table, 0, new_size * sizeof(struct ipc_entry *));
+
+
+	is_ref_lock_init(space);
+	space->is_references = 2;
+
+	is_lock_init(space);
+	space->is_active = TRUE;
+	space->is_growing = FALSE;
+	space->is_table = table;
+	space->is_table_size = new_size;
+	space->is_table_next = initial+1;
+	LIST_INIT(&space->is_entry_list);
+
+	space->is_tree_total = 0;
+	space->is_tree_small = 0;
+	space->is_tree_hash = 0;
+
+	*spacep = space;
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_space_create_special
+ *	Purpose:
+ *		Create a special space.  A special space
+ *		doesn't hold rights in the normal way.
+ *		Instead it is place-holder for holding
+ *		disembodied (naked) receive rights.
+ *		See ipc_port_alloc_special/ipc_port_dealloc_special.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Created a space.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+ipc_space_create_special(
+	ipc_space_t	*spacep)
+{
+	ipc_space_t space;
+
+	space = is_alloc();
+	if (space == IS_NULL)
+		return KERN_RESOURCE_SHORTAGE;
+
+	is_ref_lock_init(space);
+	space->is_references = 1;
+
+	is_lock_init(space);
+	space->is_active = FALSE;
+	space->is_task = current_task();
+	LIST_INIT(&space->is_entry_list);
+
+	*spacep = space;
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	ipc_space_destroy
+ *	Purpose:
+ *		Marks the space as dead and cleans up the entries.
+ *		Does nothing if the space is already dead.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_space_destroy(
+	ipc_space_t	space)
+{
+	ipc_entry_t *table;
+	ipc_entry_num_t size;
+	mach_port_index_t index;
+	boolean_t active;
+
+	assert(space != IS_NULL);
+
+	is_write_lock(space);
+	active = space->is_active;
+	space->is_active = FALSE;
+	is_write_unlock(space);
+
+	if (!active)
+		return;
+
+	/*
+	 *	If somebody is trying to grow the table,
+	 *	we must wait until they finish and figure
+	 *	out the space died.
+	 */
+
+	is_read_lock(space);
+	while (space->is_growing) {
+		assert_wait((event_t) space, FALSE);
+		is_read_unlock(space);
+		thread_block();
+		is_read_lock(space);
+	}
+	is_read_unlock(space);
+
+	/*
+	 *	Now we can futz with it	without having it locked.
+	 */
+
+	table = space->is_table;
+	size = space->is_table_size;
+
+	for (index = 0; index < size; index++) {
+		ipc_entry_t entry = table[index];
+
+		if (entry == NULL)
+			continue;
+		while (entry != NULL) {
+			mach_port_type_t type = IE_BITS_TYPE(entry->ie_bits);
+
+			if (type != MACH_PORT_TYPE_NONE)
+				ipc_right_clean(space, entry->ie_name, entry);
+			entry = entry->ie_link;
+		}
+	}
+
+	it_entries_free(space->is_table_next-1, table);
+
+	/*
+	 *	Because the space is now dead,
+	 *	we must release the "active" reference for it.
+	 *	Our caller still has his reference.
+	 */
+
+	is_release(space);
+}


Property changes on: trunk/sys/compat/mach/ipc/ipc_space.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/ipc_table.c
===================================================================
--- trunk/sys/compat/mach/ipc/ipc_table.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/ipc_table.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,249 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6  91/10/09  16:11:08  af
+ * 	 Revision 2.5.2.1  91/09/16  10:16:06  rpd
+ * 	 	Removed unused variables.
+ * 	 	[91/09/02            rpd]
+ * 
+ * Revision 2.5.2.1  91/09/16  10:16:06  rpd
+ * 	Removed unused variables.
+ * 	[91/09/02            rpd]
+ * 
+ * Revision 2.5  91/05/14  16:37:35  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/03/16  14:48:52  rpd
+ * 	Added ipc_table_realloc and ipc_table_reallocable.
+ * 	[91/03/04            rpd]
+ * 
+ * Revision 2.3  91/02/05  17:24:15  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:52:05  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:51:58  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:04:20  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_table.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Functions to manipulate tables of IPC capabilities.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/kern_return.h>
+#if 0
+#include <mach/vm_param.h>
+#endif
+#include <sys/mach/ipc/ipc_table.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_entry.h>
+#if 0
+#include <kern/kalloc.h>
+#include <vm/vm_kern.h>
+#endif
+/*
+ * Forward declarations
+ */
+void ipc_table_fill(
+	ipc_table_size_t	its,
+	unsigned int		num,
+	unsigned int		min,
+	vm_size_t		elemsize);
+
+/*
+ *	We borrow the kalloc map, rather than creating
+ *	yet another submap of the kernel map.
+ */
+
+extern vm_map_t kalloc_map;
+
+ipc_table_size_t ipc_table_entries;
+unsigned int ipc_table_entries_size = 512;
+
+ipc_table_size_t ipc_table_dnrequests;
+unsigned int ipc_table_dnrequests_size = 64;
+
+void
+ipc_table_fill(
+	ipc_table_size_t	its,	     /* array to fill */
+	unsigned int		num,	     /* size of array */
+	unsigned int		min,	     /* at least this many elements */
+	vm_size_t		elemsize)    /* size of elements */
+{
+	unsigned int index;
+	vm_size_t minsize = min * elemsize;
+	vm_size_t size;
+	vm_size_t incrsize;
+
+	/* first use powers of two, up to the page size */
+
+	for (index = 0, size = 1;
+	     (index < num) && (size < PAGE_SIZE);
+	     size <<= 1) {
+		if (size >= minsize) {
+			its[index].its_size = size / elemsize;
+			index++;
+		}
+	}
+
+	/* then increments of a page, then two pages, etc. */
+
+	for (incrsize = PAGE_SIZE; index < num;) {
+		unsigned int period;
+
+		for (period = 0;
+		     (period < 15) && (index < num);
+		     period++, size += incrsize) {
+			if (size >= minsize) {
+				its[index].its_size = size / elemsize;
+				index++;
+			}
+		}
+		if (incrsize < (PAGE_SIZE << 3))
+			incrsize <<= 1;
+	}
+}
+
+void
+ipc_table_init(void)
+{
+	ipc_table_entries = (ipc_table_size_t)
+		kalloc(sizeof(struct ipc_table_size) *
+		       ipc_table_entries_size);
+	assert(ipc_table_entries != ITS_NULL);
+
+	ipc_table_fill(ipc_table_entries, ipc_table_entries_size - 1,
+		       4, sizeof(struct ipc_entry));
+
+	/* the last two elements should have the same size */
+
+	ipc_table_entries[ipc_table_entries_size - 1].its_size =
+		ipc_table_entries[ipc_table_entries_size - 2].its_size;
+
+
+	ipc_table_dnrequests = (ipc_table_size_t)
+		kalloc(sizeof(struct ipc_table_size) *
+		       ipc_table_dnrequests_size);
+	assert(ipc_table_dnrequests != ITS_NULL);
+
+	ipc_table_fill(ipc_table_dnrequests, ipc_table_dnrequests_size - 1,
+		       2, sizeof(struct ipc_port_request));
+
+	/* the last element should have zero size */
+
+	ipc_table_dnrequests[ipc_table_dnrequests_size - 1].its_size = 0;
+}
+
+/*
+ *	Routine:	ipc_table_alloc
+ *	Purpose:
+ *		Allocate a table.
+ *	Conditions:
+ *		May block.
+ */
+
+vm_offset_t
+ipc_table_alloc(
+	vm_size_t	size)
+{
+
+	return ((vm_offset_t)malloc(size, M_MACH_IPC_TABLE, M_ZERO|M_WAITOK));
+}
+
+/*
+ *	Routine:	ipc_table_realloc
+ *	Purpose:
+ *		Reallocate a big table.
+ *
+ *		The new table remaps the old table,
+ *		so copying is not necessary.
+ *	Conditions:
+ *		Only works for page-size or bigger tables.
+ *		May block.
+ */
+
+vm_offset_t
+ipc_table_realloc(
+	vm_size_t	old_size __unused,
+	vm_offset_t	old_table,
+	vm_size_t	new_size)
+{
+
+	return ((vm_offset_t)realloc((void*)old_table, new_size, M_MACH_IPC_TABLE, M_WAITOK));
+}
+
+/*
+ *	Routine:	ipc_table_free
+ *	Purpose:
+ *		Free a table allocated with ipc_table_alloc or
+ *		ipc_table_realloc.
+ *	Conditions:
+ *		May block.
+ */
+
+void
+ipc_table_free(
+	vm_size_t	size __unused,
+	vm_offset_t	table)
+{
+
+	free((void *)table, M_MACH_IPC_TABLE);
+}


Property changes on: trunk/sys/compat/mach/ipc/ipc_table.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/ipc_thread.c
===================================================================
--- trunk/sys/compat/mach/ipc/ipc_thread.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/ipc_thread.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,178 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/14  16:38:05  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:24:23  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:52:29  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:52:06  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:04:48  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_thread.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	IPC operations on threads.
+ */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/ipc/ipc_thread.h>
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/thread.h>
+/*
+ *	Routine:	ipc_thread_enqueue
+ *	Purpose:
+ *		Enqueue a thread.
+ */
+
+void
+ipc_thread_enqueue(
+	ipc_thread_queue_t	queue,
+	ipc_thread_t		thread)
+{
+	ipc_thread_enqueue_macro(queue, thread);
+}
+
+/*
+ *	Routine:	ipc_thread_dequeue
+ *	Purpose:
+ *		Dequeue and return a thread.
+ */
+
+ipc_thread_t
+ipc_thread_dequeue(
+	ipc_thread_queue_t	queue)
+{
+	ipc_thread_t first;
+
+	first = ipc_thread_queue_first(queue);
+
+	if (first != ITH_NULL)
+		ipc_thread_rmqueue_first_macro(queue, first);
+
+	return first;
+}
+
+/*
+ *	Routine:	ipc_thread_rmqueue
+ *	Purpose:
+ *		Pull a thread out of a queue.
+ */
+
+void
+ipc_thread_rmqueue(
+	ipc_thread_queue_t	queue,
+	ipc_thread_t		thread)
+{
+	ipc_thread_t next, prev;
+
+	assert(queue->ithq_base != ITH_NULL);
+
+	next = thread->ith_next;
+	prev = thread->ith_prev;
+
+	if (next == thread) {
+		assert(prev == thread);
+		assert(queue->ithq_base == thread);
+
+		queue->ithq_base = ITH_NULL;
+	} else {
+		if (queue->ithq_base == thread)
+			queue->ithq_base = next;
+
+		next->ith_prev = prev;
+		prev->ith_next = next;
+		ipc_thread_links_init(thread);
+	}
+}
+
+/*
+ *	Routine:	ipc_thread_inqueue
+ *	Purpose:
+ *		Check if a thread is in the queue.
+ */
+
+boolean_t
+ipc_thread_inqueue(
+	ipc_thread_queue_t	queue,
+	ipc_thread_t		thread)
+{
+	ipc_thread_t next, base;
+
+	base = queue->ithq_base;
+
+	if (base == ITH_NULL)
+		return FALSE;
+	
+	if (base == thread)
+		return TRUE;
+	
+	next = base->ith_next;
+
+	while (next != base) {
+		if (next == thread)
+			return TRUE;
+		next = next->ith_next;
+	}
+
+	return FALSE;
+}
+


Property changes on: trunk/sys/compat/mach/ipc/ipc_thread.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/mach_debug.c
===================================================================
--- trunk/sys/compat/mach/ipc/mach_debug.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/mach_debug.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,593 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5.5.1  92/03/03  16:18:59  jeffreyh
+ * 	Eliminate keep_wired argument from vm_map_copyin().
+ * 	[92/02/21  10:13:00  dlb]
+ * 	Changes from TRUNK
+ * 	[92/02/26  11:52:22  jeffreyh]
+ * 
+ * Revision 2.6  92/01/14  16:44:48  rpd
+ * 	Changed host_ipc_hash_info, host_ipc_marequest_info,
+ * 	and mach_port_space_info for CountInOut.
+ * 	[92/01/14            rpd]
+ * 	Added mach_port_kernel_object.
+ * 	[91/12/14            rpd]
+ * 
+ * Revision 2.5  91/05/14  16:38:28  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:24:30  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:52:50  mrt]
+ * 
+ * Revision 2.3  91/01/08  15:14:55  rpd
+ * 	Changed ipc_info_bucket_t to hash_info_bucket_t.
+ * 	[91/01/02            rpd]
+ * 	Removed MACH_IPC_GENNOS.
+ * 	[90/11/08            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:52:15  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:05:22  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/mach_debug.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Exported kernel calls.  See mach_debug/mach_debug.defs.
+ */
+
+#include <sys/mach/kern_return.h>
+#include <sys/mach/port.h>
+#include <sys/mach/vm_types.h>
+#include <sys/mach_debug/ipc_info.h>
+#include <sys/mach_debug/hash_info.h>
+#if 0
+#include <sys/mach/host.h>
+#include <kern/misc_protos.h>
+#include <vm/vm_map.h>
+#include <vm/vm_kern.h>
+#endif
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_hash.h>
+#include <sys/mach/ipc/ipc_table.h>
+#include <sys/mach/ipc/ipc_right.h>
+#include <sys/mach/mach_port_server.h>
+
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+#include <vm/vm_extern.h>
+
+/*
+ *	Routine:	mach_port_get_srights [kernel call]
+ *	Purpose:
+ *		Retrieve the number of extant send rights
+ *		that a receive right has.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Retrieved number of send rights.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	The name doesn't denote a right.
+ *		KERN_INVALID_RIGHT	Name doesn't denote receive rights.
+ */
+
+kern_return_t
+mach_port_get_srights(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	mach_port_rights_t	*srightsp)
+{
+	ipc_port_t port;
+	kern_return_t kr;
+	mach_port_rights_t srights;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	kr = ipc_port_translate_receive(space, name, &port);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* port is locked and active */
+
+	srights = port->ip_srights;
+	ip_unlock(port);
+
+	*srightsp = srights;
+	return KERN_SUCCESS;
+}
+#if 0
+/*
+ *	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.
+ */
+
+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;
+	hash_info_bucket_t *info;
+	unsigned int potential, actual;
+	kern_return_t kr;
+
+	if (host == HOST_NULL)
+		return KERN_INVALID_HOST;
+
+	/* start with in-line data */
+
+	info = *infop;
+	potential = *countp;
+
+	for (;;) {
+		actual = ipc_hash_info(info, potential);
+		if (actual <= potential)
+			break;
+
+		/* allocate more memory */
+
+		if (info != *infop)
+			kmem_free(ipc_kernel_map, addr, size);
+
+		size = round_page(actual * sizeof *info);
+		kr = kmem_alloc_pageable(ipc_kernel_map, &addr, size);
+		if (kr != KERN_SUCCESS)
+			return KERN_RESOURCE_SHORTAGE;
+
+		info = (hash_info_bucket_t *) addr;
+		potential = size/sizeof *info;
+	}
+
+	if (info == *infop) {
+		/* data fit in-line; nothing to deallocate */
+
+		*countp = actual;
+	} else if (actual == 0) {
+		kmem_free(ipc_kernel_map, addr, size);
+
+		*countp = 0;
+	} else {
+		vm_map_copy_t copy;
+		vm_size_t used;
+
+		used = round_page(actual * sizeof *info);
+
+		if (used != size)
+			kmem_free(ipc_kernel_map, addr + used, size - used);
+
+		kr = vm_map_copyin(kernel_map, addr, used,
+				   TRUE, &copy);
+		assert(kr == KERN_SUCCESS);
+
+		*infop = (hash_info_bucket_t *) copy;
+		*countp = actual;
+	}
+
+	return KERN_SUCCESS;
+}
+#endif
+
+/*
+ *	Routine:	mach_port_space_info
+ *	Purpose:
+ *		Returns information about an IPC space.
+ *	Conditions:
+ *		Nothing locked.  Obeys CountInOut protocol.
+ *	Returns:
+ *		KERN_SUCCESS		Returned information.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+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,
+	mach_msg_type_number_t 		*treeCntp)
+{
+#if 0
+	ipc_info_name_t *table_info;
+	unsigned int table_potential, table_actual;
+	vm_offset_t table_addr;
+	vm_size_t table_size;
+	ipc_info_tree_name_t *tree_info;
+	unsigned int tree_potential, tree_actual;
+	vm_offset_t tree_addr;
+	vm_size_t tree_size;
+	ipc_entry_t *table;
+	ipc_entry_num_t tsize;
+	mach_port_index_t index;
+	kern_return_t kr;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	/* start with in-line memory */
+
+	table_info = *tablep;
+	table_potential = *tableCntp;
+	tree_info = *treep;
+	tree_potential = *treeCntp;
+
+	for (;;) {
+		is_read_lock(space);
+		if (!space->is_active) {
+			is_read_unlock(space);
+			if (table_info != *tablep)
+				free(table_addr, M_MACH_TMP);
+			if (tree_info != *treep)
+				free(tree_addr, tree_);
+			return KERN_INVALID_TASK;
+		}
+
+		table_actual = space->is_table_size;
+		tree_actual = space->is_tree_total;
+
+		if ((table_actual <= table_potential) &&
+		    (tree_actual <= tree_potential))
+			break;
+
+		is_read_unlock(space);
+
+		if (table_actual > table_potential) {
+			if (table_info != *tablep)
+				kmem_free(ipc_kernel_map,
+					  table_addr, table_size);
+
+			table_size = round_page(table_actual *
+						sizeof *table_info);
+			kr = kmem_alloc(ipc_kernel_map,
+					&table_addr, table_size);
+			if (kr != KERN_SUCCESS) {
+				if (tree_info != *treep)
+					kmem_free(ipc_kernel_map,
+						  tree_addr, tree_size);
+
+				return KERN_RESOURCE_SHORTAGE;
+			}
+
+			table_info = (ipc_info_name_t *) table_addr;
+			table_potential = table_size/sizeof *table_info;
+		}
+
+		if (tree_actual > tree_potential) {
+			if (tree_info != *treep)
+				kmem_free(ipc_kernel_map,
+					  tree_addr, tree_size);
+
+			tree_size = round_page(tree_actual *
+					       sizeof *tree_info);
+			kr = kmem_alloc(ipc_kernel_map,
+					&tree_addr, tree_size);
+			if (kr != KERN_SUCCESS) {
+				if (table_info != *tablep)
+					kmem_free(ipc_kernel_map,
+						  table_addr, table_size);
+
+				return KERN_RESOURCE_SHORTAGE;
+			}
+
+			tree_info = (ipc_info_tree_name_t *) tree_addr;
+			tree_potential = tree_size/sizeof *tree_info;
+		}
+	}
+	/* space is read-locked and active; we have enough wired memory */
+
+	infop->iis_genno_mask = MACH_PORT_NGEN(MACH_PORT_NAME_DEAD);
+	infop->iis_table_size = space->is_table_size;
+	infop->iis_table_next = space->is_table_next->its_size;
+	infop->iis_tree_size = space->is_tree_total;
+	infop->iis_tree_small = space->is_tree_small;
+	infop->iis_tree_hash = space->is_tree_hash;
+
+	table = space->is_table;
+	tsize = space->is_table_size;
+
+	for (index = 0; index < tsize; index++) {
+		ipc_info_name_t *iin = &table_info[index];
+		ipc_entry_t entry = table[index];
+		ipc_entry_bits_t bits = entry->ie_bits;
+
+		iin->iin_name = MACH_PORT_MAKEB(index, bits);
+		iin->iin_collision = (bits & IE_BITS_COLLISION) ? TRUE : FALSE;
+		iin->iin_type = IE_BITS_TYPE(bits);
+		iin->iin_urefs = IE_BITS_UREFS(bits);
+		iin->iin_object = (vm_offset_t) entry->ie_object;
+		iin->iin_next = entry->ie_next;
+		iin->iin_hash = entry->ie_index;
+	}
+	is_read_unlock(space);
+
+	if (table_info == *tablep) {
+		/* data fit in-line; nothing to deallocate */
+
+		*tableCntp = table_actual;
+	} else if (table_actual == 0) {
+		kmem_free(ipc_kernel_map, table_addr, table_size);
+
+		*tableCntp = 0;
+	} else {
+		vm_size_t size_used, rsize_used;
+		vm_map_copy_t copy = NULL;
+
+		/* kmem_alloc doesn't zero memory */
+
+		size_used = table_actual * sizeof *table_info;
+		rsize_used = round_page(size_used);
+
+		if (rsize_used != table_size)
+			kmem_free(ipc_kernel_map,
+				  table_addr + rsize_used,
+				  table_size - rsize_used);
+
+		if (size_used != rsize_used)
+			bzero((char *) (table_addr + size_used),
+			      rsize_used - size_used);
+
+		kr = vm_map_unwire(ipc_kernel_map, table_addr,
+				   table_addr + rsize_used, FALSE);
+		assert(kr == KERN_SUCCESS);
+
+		kr = vm_map_copyin(ipc_kernel_map, table_addr, rsize_used,
+				   TRUE, &copy);
+		assert(kr == KERN_SUCCESS);
+
+		*tablep = (ipc_info_name_t *) copy;
+		*tableCntp = table_actual;
+	}
+
+	if (tree_info == *treep) {
+		/* data fit in-line; nothing to deallocate */
+
+		*treeCntp = tree_actual;
+	} else if (tree_actual == 0) {
+		kmem_free(ipc_kernel_map, tree_addr, tree_size);
+
+		*treeCntp = 0;
+	} else {
+		vm_size_t size_used, rsize_used;
+		vm_map_copy_t copy = NULL;
+
+		/* kmem_alloc doesn't zero memory */
+
+		size_used = tree_actual * sizeof *tree_info;
+		rsize_used = round_page(size_used);
+
+		if (rsize_used != tree_size)
+			kmem_free(ipc_kernel_map,
+				  tree_addr + rsize_used,
+				  tree_size - rsize_used);
+
+		if (size_used != rsize_used)
+			bzero((char *) (tree_addr + size_used),
+			      rsize_used - size_used);
+
+		kr = vm_map_unwire(ipc_kernel_map, tree_addr,
+				   tree_addr + rsize_used, FALSE);
+		assert(kr == KERN_SUCCESS);
+
+		kr = vm_map_copyin(ipc_kernel_map, tree_addr, rsize_used,
+				   TRUE, &copy);
+		assert(kr == KERN_SUCCESS);
+
+		*treep = (ipc_info_tree_name_t *) copy;
+		*treeCntp = tree_actual;
+	}
+#endif
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	mach_port_dnrequest_info
+ *	Purpose:
+ *		Returns information about the dead-name requests
+ *		registered with the named receive right.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Retrieved information.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	The name doesn't denote a right.
+ *		KERN_INVALID_RIGHT	Name doesn't denote receive rights.
+ */
+
+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;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	kr = ipc_port_translate_receive(space, name, &port);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* port is locked and active */
+
+	if (port->ip_dnrequests == IPR_NULL) {
+		total = 0;
+		used = 0;
+	} else {
+		ipc_port_request_t dnrequests = port->ip_dnrequests;
+		ipc_port_request_index_t index;
+
+		total = dnrequests->ipr_size->its_size;
+
+		for (index = 1, used = 0;
+		     index < total; index++) {
+			ipc_port_request_t ipr = &dnrequests[index];
+
+			if (ipr->ipr_name != MACH_PORT_NAME_NULL)
+				used++;
+		}
+	}
+	ip_unlock(port);
+
+	*totalp = total;
+	*usedp = used;
+	return KERN_SUCCESS;
+}
+
+#if 0
+/*
+ *	Routine:	mach_port_kernel_object [kernel call]
+ *	Purpose:
+ *		Retrieve the type and address of the kernel object
+ *		represented by a send or receive right.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Retrieved kernel object info.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	The name doesn't denote a right.
+ *		KERN_INVALID_RIGHT	Name doesn't denote
+ *					send or receive rights.
+ */
+
+kern_return_t
+mach_port_kernel_object(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	unsigned int	*typep,
+	/* vm_offset_t */	unsigned int *addrp)
+{
+	ipc_entry_t entry;
+	ipc_port_t port;
+	kern_return_t kr;
+
+	kr = ipc_right_lookup_read(space, name, &entry);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* space is read-locked and active */
+
+	if ((entry->ie_bits & MACH_PORT_TYPE_SEND_RECEIVE) == 0) {
+		is_read_unlock(space);
+		return KERN_INVALID_RIGHT;
+	}
+
+	port = (ipc_port_t) entry->ie_object;
+	assert(port != IP_NULL);
+
+	ip_lock(port);
+	is_read_unlock(space);
+
+	if (!ip_active(port)) {
+		ip_unlock(port);
+		return KERN_INVALID_RIGHT;
+	}
+
+	*typep = (unsigned int) ip_kotype(port);
+	*addrp = (vm_offset_t) port->ip_kobject;
+	ip_unlock(port);
+	return KERN_SUCCESS;
+}
+#endif
+
+
+/*
+ *	Routine:	mach_port_kobject [kernel call]
+ *	Purpose:
+ *		Retrieve the type and address of the kernel object
+ *		represented by a send or receive right. Returns
+ *		the kernel address in a mach_vm_address_t to
+ *		mask potential differences in kernel address space
+ *		size.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Retrieved kernel object info.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	The name doesn't denote a right.
+ *		KERN_INVALID_RIGHT	Name doesn't denote
+ *					send or receive rights.
+ */
+
+#if !MACH_IPC_DEBUG
+kern_return_t
+mach_port_kobject(
+	__unused ipc_space_t		space,
+	__unused mach_port_name_t	name,
+	__unused natural_t		*typep,
+	__unused mach_vm_address_t	*addrp)
+{
+        return KERN_FAILURE;
+}
+#endif


Property changes on: trunk/sys/compat/mach/ipc/mach_debug.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/mach_msg.c
===================================================================
--- trunk/sys/compat/mach/ipc/mach_msg.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/mach_msg.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,624 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.16.3.2  92/03/03  16:19:04  jeffreyh
+ * 	Changes from TRUNK
+ * 	[92/02/26  11:52:59  jeffreyh]
+ * 
+ * Revision 2.17  92/01/03  20:13:19  dbg
+ * 	Add quick dispatch to Mach Kernel messages.
+ * 	[91/12/18            dbg]
+ * 
+ * Revision 2.16  91/12/14  14:28:41  jsb
+ * 	Removed ipc_fields.h hack.
+ * 
+ * Revision 2.15  91/11/14  16:58:17  rpd
+ * 	Added ipc_fields.h hack.
+ *	Use IP_NORMA_IS_PROXY macro instead of ipc_space_remote.
+ * 	[91/11/00            jsb] 
+ * 
+ * Revision 2.14  91/10/09  16:11:23  af
+ * 	Added <ipc/ipc_notify.h>.  Fixed type-mismatch in msg_rpc_trap.
+ * 	[91/09/02            rpd]
+ * 
+ * Revision 2.13  91/08/28  11:13:53  jsb
+ * 	Changed MACH_RCV_TOO_LARGE and MACH_RCV_INVALID_NOTIFY to work
+ * 	like MACH_RCV_HEADER_ERROR, using ipc_kmsg_copyout_dest.
+ * 	[91/08/12            rpd]
+ * 
+ * 	Added seqno argument to ipc_mqueue_receive.
+ * 	Updated mach_msg_trap fast path for seqno processing.
+ * 	[91/08/10            rpd]
+ * 	Fixed mach_msg_interrupt to check for MACH_RCV_IN_PROGRESS.
+ * 	[91/08/03            rpd]
+ * 	Renamed clport things to norma_ipc things.
+ * 	[91/08/15  08:24:12  jsb]
+ * 
+ * Revision 2.12  91/07/31  17:43:41  dbg
+ * 	Add mach_msg_interrupt to force a thread waiting in mach_msg_continue
+ * 	or mach_msg_receive_continue into a stable state.
+ * 	[91/07/30  17:02:11  dbg]
+ * 
+ * Revision 2.11  91/06/25  10:27:47  rpd
+ * 	Fixed ikm_cache critical sections to avoid blocking operations.
+ * 	[91/05/23            rpd]
+ * 
+ * Revision 2.10  91/06/17  15:46:33  jsb
+ * 	Renamed NORMA conditionals.
+ * 	[91/06/17  10:46:35  jsb]
+ * 
+ * Revision 2.9  91/06/06  17:06:12  jsb
+ * 	A little more NORMA_IPC support.
+ * 	[91/05/13  17:22:08  jsb]
+ * 
+ * Revision 2.8  91/05/14  16:38:44  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.7  91/03/16  14:49:09  rpd
+ * 	Replaced ipc_thread_switch with thread_handoff.
+ * 	Replaced ith_saved with ikm_cache.
+ * 	[91/02/16            rpd]
+ * 	Made null mach_msg_trap measurement easier.
+ * 	[91/01/29            rpd]
+ * 
+ * Revision 2.6  91/02/05  17:24:37  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:53:02  mrt]
+ * 
+ * Revision 2.5  91/01/08  15:15:03  rpd
+ * 	Added KEEP_STACKS support.
+ * 	[91/01/07            rpd]
+ * 	Changed to use thread_syscall_return.
+ * 	Added msg_receive_continue.
+ * 	[90/12/18            rpd]
+ * 	Added mach_msg_continue, mach_msg_receive_continue.
+ * 	Changes to support kernel stack discarding/hand-off.
+ * 	[90/12/09  17:29:04  rpd]
+ * 
+ * 	Removed MACH_IPC_GENNOS.
+ * 	[90/11/08            rpd]
+ * 
+ * Revision 2.4  90/12/14  11:01:36  jsb
+ * 	Added NORMA_IPC support: always ipc_mqueue_send() to a remote port.
+ * 	[90/12/13  21:25:47  jsb]
+ * 
+ * Revision 2.3  90/11/05  14:30:29  rpd
+ * 	Removed ipc_object_release_macro.
+ * 	Changed ip_reference to ipc_port_reference.
+ * 	Changed ip_release to ipc_port_release.
+ * 	Changed io_release to ipc_object_release.
+ * 	Use new io_reference and io_release.
+ * 	Use new ip_reference and ip_release.
+ * 	[90/10/29            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:52:22  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:05:49  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/mach_msg.c
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Exported message traps.  See mach/message.h.
+ */
+
+#define MACH_INTERNAL
+#include <sys/mach/kern_return.h>
+#include <sys/mach/port.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/ipc/ipc_mqueue.h>
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_notify.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_pset.h>
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/ipc/ipc_thread.h>
+#include <sys/mach/ipc/ipc_entry.h>
+#include <sys/mach/ipc/mach_msg.h>
+#include <sys/mach/thread.h>
+#include <sys/mach/sched_prim.h>
+#include <sys/mach/ipc_kobject.h>
+
+
+/*
+ * Forward declarations
+ */
+
+mach_msg_return_t mach_msg_send(
+	mach_msg_header_t	*msg,
+	mach_msg_option_t	option,
+	mach_msg_size_t		send_size,
+	mach_msg_timeout_t	timeout,
+	mach_port_name_t		notify);
+
+mach_msg_return_t mach_msg_receive(
+	mach_msg_header_t	*msg,
+	mach_msg_option_t	option,
+	mach_msg_size_t		rcv_size,
+	mach_port_name_t		rcv_name,
+	mach_msg_timeout_t	timeout,
+	mach_msg_size_t		slist_size);
+
+mach_msg_return_t msg_receive_error(
+	ipc_kmsg_t		kmsg,
+	mach_msg_header_t	*msg,
+	mach_msg_option_t	option,
+	mach_port_seqno_t	seqno,
+	ipc_space_t		space);
+
+#if 0
+/* the size of each trailer has to be listed here for copyout purposes */
+mach_msg_trailer_size_t trailer_size[] = {
+          sizeof(mach_msg_trailer_t), 
+		  sizeof(mach_msg_seqno_trailer_t),
+		  sizeof(mach_msg_security_trailer_t)
+};
+#endif
+
+security_token_t KERNEL_SECURITY_TOKEN = KERNEL_SECURITY_TOKEN_VALUE;
+audit_token_t KERNEL_AUDIT_TOKEN = KERNEL_AUDIT_TOKEN_VALUE;
+
+mach_msg_format_0_trailer_t trailer_template = {
+	/* mach_msg_trailer_type_t */ MACH_MSG_TRAILER_FORMAT_0,
+	/* mach_msg_trailer_size_t */ MACH_MSG_TRAILER_MINIMUM_SIZE,
+        /* mach_port_seqno_t */       0,
+	/* security_token_t */        KERNEL_SECURITY_TOKEN_VALUE
+};
+
+/*
+ *	Routine:	mach_msg_send
+ *	Purpose:
+ *		Send a message.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	Sent the message.
+ *		MACH_SEND_MSG_TOO_SMALL	Message smaller than a header.
+ *		MACH_SEND_NO_BUFFER	Couldn't allocate buffer.
+ *		MACH_SEND_INVALID_DATA	Couldn't copy message data.
+ *		MACH_SEND_INVALID_HEADER
+ *			Illegal value in the message header bits.
+ *		MACH_SEND_INVALID_DEST	The space is dead.
+ *		MACH_SEND_INVALID_NOTIFY	Bad notify port.
+ *		MACH_SEND_INVALID_DEST	Can't copyin destination port.
+ *		MACH_SEND_INVALID_REPLY	Can't copyin reply port.
+ *		MACH_SEND_TIMED_OUT	Timeout expired without delivery.
+ *		MACH_SEND_INTERRUPTED	Delivery interrupted.
+ *		MACH_SEND_NO_NOTIFY	Can't allocate a msg-accepted request.
+ *		MACH_SEND_WILL_NOTIFY	Msg-accepted notif. requested.
+ *		MACH_SEND_NOTIFY_IN_PROGRESS
+ *			This space has already forced a message to this port.
+ */
+
+mach_msg_return_t
+mach_msg_send(
+	mach_msg_header_t	*msg,
+	mach_msg_option_t	option,
+	mach_msg_size_t		send_size,
+	mach_msg_timeout_t	timeout,
+	mach_port_name_t	notify)
+{
+	ipc_space_t space = current_space();
+	vm_map_t map = current_map();
+	ipc_kmsg_t kmsg;
+	mach_msg_return_t mr;
+
+	mr = ipc_kmsg_get(msg, send_size, &kmsg, space);
+
+	if (mr != MACH_MSG_SUCCESS)
+		return mr;
+
+	MDPRINTF(("send to remote port %d notify %d id %d name %s\n", (int)kmsg->ikm_header->msgh_remote_port,
+			  notify, kmsg->ikm_header->msgh_id, curproc->p_comm));
+
+	mr = ipc_kmsg_copyin(kmsg, space, map, MACH_PORT_NAME_NULL);
+	if (mr != MACH_MSG_SUCCESS) {
+		ikm_free(kmsg);
+		return mr;
+	}
+
+	mr = ipc_mqueue_send(kmsg, option & MACH_SEND_TIMEOUT, timeout);
+
+	if (mr != MACH_MSG_SUCCESS) {
+	    mr |= ipc_kmsg_copyout_pseudo(kmsg, space, map, MACH_MSG_BODY_NULL);
+	    (void) ipc_kmsg_put(msg, kmsg, kmsg->ikm_header->msgh_size);
+	}
+
+	return mr;
+}
+
+#define FREE_SCATTER_LIST(s, l, rt) 			\
+MACRO_BEGIN						\
+	if((s) != MACH_MSG_BODY_NULL) { 		\
+		KFREE(((vm_offset_t)(s)), (l), rt);	\
+	}						\
+MACRO_END
+
+/*
+ *	Routine:	mach_msg_receive
+ *	Purpose:
+ *		Receive a message.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	Received a message.
+ *		MACH_RCV_INVALID_NAME	The name doesn't denote a right,
+ *			or the denoted right is not receive or port set.
+ *		MACH_RCV_IN_SET		Receive right is a member of a set.
+ *		MACH_RCV_TOO_LARGE	Message wouldn't fit into buffer.
+ *		MACH_RCV_TIMED_OUT	Timeout expired without a message.
+ *		MACH_RCV_INTERRUPTED	Reception interrupted.
+ *		MACH_RCV_PORT_DIED	Port/set died while receiving.
+ *		MACH_RCV_PORT_CHANGED	Port moved into set while receiving.
+ *		MACH_RCV_INVALID_DATA	Couldn't copy to user buffer.
+ *		MACH_RCV_INVALID_NOTIFY	Bad notify port.
+ *		MACH_RCV_HEADER_ERROR
+ */
+
+mach_msg_return_t
+mach_msg_receive(
+	mach_msg_header_t	*msg,
+	mach_msg_option_t	option,
+	mach_msg_size_t		rcv_size,
+	mach_port_name_t		rcv_name,
+	mach_msg_timeout_t	timeout,
+	mach_msg_size_t		slist_size)
+{
+	ipc_thread_t self = current_thread();
+	ipc_space_t space = current_space();
+	vm_map_t map = current_map();
+	ipc_object_t object;
+	ipc_kmsg_t kmsg;
+	mach_port_seqno_t seqno;
+	mach_msg_return_t mr;
+	mach_msg_body_t *slist;
+	mach_msg_max_trailer_t *trailer;
+	ipc_entry_bits_t bits;
+
+	mr = ipc_mqueue_copyin(space, rcv_name, &bits, &object);
+	if (mr != MACH_MSG_SUCCESS) {
+		return mr;
+	}
+	/* hold ref for object; mqueue is locked */
+	/*
+ 	 * If MACH_RCV_OVERWRITE was specified, both receive_msg (msg)
+	 * and receive_msg_size (slist_size) need to be non NULL.
+	 */
+	if (option & MACH_RCV_OVERWRITE) {
+		if (slist_size < sizeof(mach_msg_base_t)) {
+			ipc_object_release(object);
+			return MACH_RCV_SCATTER_SMALL;
+		} else {
+			slist_size -= sizeof(mach_msg_header_t);
+			slist = (mach_msg_body_t *)KALLOC(slist_size, slist_rt);
+			if (slist == MACH_MSG_BODY_NULL ||
+			    copyin((char *) (msg + 1), (char *)slist,
+					slist_size)) {
+				ipc_object_release(object);
+				return MACH_RCV_INVALID_DATA;
+			}
+			if ((slist->msgh_descriptor_count*
+			     sizeof(mach_msg_descriptor_t)
+			     + sizeof(mach_msg_size_t)) > slist_size) {
+				FREE_SCATTER_LIST(slist, slist_size, slist_rt);
+				ipc_object_release(object);
+				return MACH_RCV_INVALID_TYPE;
+			}
+		}
+	} else {
+		slist = MACH_MSG_BODY_NULL;
+	}
+	assert(io_otype(object) == IOT_PORT || io_otype(object) == IOT_PORT_SET);
+	self->ith_option = option;
+	self->ith_scatter_list = slist;
+	self->ith_scatter_list_size = slist_size;
+	self->ith_object = object;
+	assert(object->io_references > 0);
+	mr = ipc_mqueue_receive(bits, option & MACH_RCV_TIMEOUT, rcv_size,
+							timeout, &kmsg, &seqno, self);
+	/* mqueue is unlocked */
+	ipc_object_release(object);
+
+	if (mr != MACH_MSG_SUCCESS) {
+		if (mr == MACH_RCV_TOO_LARGE || mr == MACH_RCV_SCATTER_SMALL
+		    ) {
+			if (msg_receive_error(kmsg, msg, option, seqno, space)
+			    == MACH_RCV_INVALID_DATA)
+				mr = MACH_RCV_INVALID_DATA;
+		}
+		FREE_SCATTER_LIST(slist, slist_size, slist_rt);
+		return mr;
+	}
+	trailer = (mach_msg_max_trailer_t *)
+			((vm_offset_t)kmsg->ikm_header +
+			round_msg(kmsg->ikm_header->msgh_size));
+	if (option & MACH_RCV_TRAILER_MASK) {
+		trailer->msgh_seqno = seqno;
+		trailer->msgh_context = kmsg->ikm_header->msgh_remote_port->ip_context;
+		trailer->msgh_trailer_size = REQUESTED_TRAILER_SIZE(option);
+	}
+
+	mr = ipc_kmsg_copyout(kmsg, space, map, slist, 0);
+	if (mr != MACH_MSG_SUCCESS) {
+		/* XXX do we know that the message always gets freed */
+		if ((mr &~ MACH_MSG_MASK) == MACH_RCV_BODY_ERROR
+		    ) {
+			if (ipc_kmsg_put(msg, kmsg, kmsg->ikm_header->msgh_size +
+			   trailer->msgh_trailer_size) == MACH_RCV_INVALID_DATA)
+				mr = MACH_RCV_INVALID_DATA;
+		}
+		else {
+			if (msg_receive_error(kmsg, msg, option, seqno, space) 
+						== MACH_RCV_INVALID_DATA)
+				mr = MACH_RCV_INVALID_DATA;
+		}
+
+		FREE_SCATTER_LIST(slist, slist_size, slist_rt);
+		return mr;
+	}
+	mr = ipc_kmsg_put(msg, kmsg, 
+					  kmsg->ikm_header->msgh_size + trailer->msgh_trailer_size);
+	FREE_SCATTER_LIST(slist, slist_size, slist_rt);
+
+	return mr;
+}
+
+
+/*
+ *	Routine:	mach_msg_overwrite_trap [mach trap]
+ *	Purpose:
+ *		Possibly send a message; possibly receive a message.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		All of mach_msg_send and mach_msg_receive error codes.
+ */
+
+mach_msg_return_t
+mach_msg_overwrite_trap(
+	mach_msg_header_t	*msg,
+	mach_msg_option_t	option,
+	mach_msg_size_t		send_size,
+	mach_msg_size_t		rcv_size,
+	mach_port_name_t	rcv_name,
+	mach_msg_timeout_t	timeout,
+	mach_port_name_t	notify,
+	mach_msg_header_t	*rcv_msg,
+    mach_msg_size_t		scatter_list_size)
+{
+	mach_msg_return_t  mr = MACH_MSG_SUCCESS;
+
+	if (option & MACH_SEND_MSG) {
+		mr = mach_msg_send(msg, option, send_size,
+				   timeout, notify);
+		if (mr != MACH_MSG_SUCCESS) {
+			return mr;
+		}
+	}
+
+	if (option & MACH_RCV_MSG) {
+		mach_msg_header_t *rcv;
+
+		/*
+		 * 1. MACH_RCV_OVERWRITE is on, and rcv_msg is our scatter list
+		 *    and receive buffer
+		 * 2. MACH_RCV_OVERWRITE is off, and rcv_msg might be the
+		 *    alternate receive buffer (separate send and receive buffers).
+		 */
+		if (option & MACH_RCV_OVERWRITE) 
+		    rcv = rcv_msg;
+		else if (rcv_msg != MACH_MSG_NULL)
+		    rcv = rcv_msg;
+		else
+		    rcv = msg;
+
+		MDPRINTF(("%s:%d receiving on %d ... ", curproc->p_comm, curthread->td_tid, rcv_name));
+		mr = mach_msg_receive(rcv, option, rcv_size, rcv_name, 
+							  timeout, scatter_list_size);
+		MDPRINTF(("%s:%d done on %d\n",curproc->p_comm, curthread->td_tid, rcv_name));
+
+	}
+
+	return (mr);
+}
+
+/*
+ *	Routine:	msg_receive_error	[internal]
+ *	Purpose:
+ *		Builds a minimal header/trailer and copies it to
+ *		the user message buffer.  Invoked when in the case of a
+ *		MACH_RCV_TOO_LARGE or MACH_RCV_BODY_ERROR error.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_MSG_SUCCESS	minimal header/trailer copied
+ *		MACH_RCV_INVALID_DATA	copyout to user buffer failed
+ */
+	
+mach_msg_return_t
+msg_receive_error(
+	ipc_kmsg_t		kmsg,
+	mach_msg_header_t	*msg,
+	mach_msg_option_t	option,
+	mach_port_seqno_t	seqno,
+	ipc_space_t		space)
+{
+	mach_vm_address_t context;
+	mach_msg_max_trailer_t *trailer;
+
+	context = kmsg->ikm_header->msgh_remote_port->ip_context;
+	/*
+	 * Copy out the destination port in the message.
+ 	 * Destroy all other rights and memory in the message.
+	 */
+	ipc_kmsg_copyout_dest(kmsg, space);
+
+	/*
+	 * Build a minimal message with the requested trailer.
+	 */
+	trailer = (mach_msg_max_trailer_t *) 
+			((vm_offset_t)kmsg->ikm_header +
+			round_msg(sizeof(mach_msg_header_t)));
+	kmsg->ikm_header->msgh_size = sizeof(mach_msg_header_t);
+	bcopy(  (char *)&trailer_template, 
+		(char *)trailer, 
+		sizeof(trailer_template));
+	if (option & MACH_RCV_TRAILER_MASK) {
+		trailer->msgh_seqno = seqno;
+		trailer->msgh_context = context;
+		trailer->msgh_trailer_size = REQUESTED_TRAILER_SIZE(option);
+	}
+
+	/*
+	 * Copy the message to user space
+	 */
+	if (ipc_kmsg_put(msg, kmsg, kmsg->ikm_header->msgh_size +
+			trailer->msgh_trailer_size) == MACH_RCV_INVALID_DATA)
+		return(MACH_RCV_INVALID_DATA);
+	else 
+		return(MACH_MSG_SUCCESS);
+}
+
+
+static mach_msg_return_t
+mach_msg_receive_results_error(thread_t thread)
+{
+	ipc_space_t space = current_space();
+
+	mach_msg_return_t mr = thread->ith_state;
+	mach_vm_address_t msg_addr = thread->ith_msg_addr;
+	mach_msg_option_t option = thread->ith_option;
+	ipc_kmsg_t        kmsg = thread->ith_kmsg;
+	mach_port_seqno_t seqno = thread->ith_seqno;
+	mach_msg_header_t *msg = (void *)msg_addr;
+
+	if (mr != MACH_RCV_TOO_LARGE)
+		return (mr);
+
+	if (option & MACH_RCV_LARGE) {
+		/*
+		 * We need to inform the user-level code that it needs more
+		 * space.  The value for how much space was returned in the
+		 * msize save area instead of the message (which was left on
+		 * the queue).
+		 */
+		if (option & MACH_RCV_LARGE_IDENTITY) {
+			if (copyout((char *) &thread->ith_receiver_name,
+						(void *) (msg_addr + offsetof(mach_msg_header_t, msgh_local_port)),
+						sizeof(mach_port_name_t)))
+				mr = MACH_RCV_INVALID_DATA;
+		}
+		if (copyout((char *) &thread->ith_msize,
+					(void *) (msg_addr + offsetof(mach_msg_header_t, msgh_size)),
+					sizeof(mach_msg_size_t)))
+			mr = MACH_RCV_INVALID_DATA;
+	} else {
+
+		if (msg_receive_error(kmsg, msg, option, seqno, space)
+			== MACH_RCV_INVALID_DATA)
+			mr = MACH_RCV_INVALID_DATA;
+	}
+	return (mr);
+}
+
+mach_msg_return_t
+mach_msg_receive_results(thread_t thread)
+{
+	ipc_space_t space = current_space();
+	vm_map_t	map = current_map();
+
+	mach_msg_return_t mr = thread->ith_state;
+	mach_vm_address_t msg_addr = thread->ith_msg_addr;
+	mach_msg_option_t option = thread->ith_option;
+	ipc_kmsg_t        kmsg = thread->ith_kmsg;
+	mach_port_seqno_t seqno = thread->ith_seqno;
+	mach_msg_trailer_size_t trailer_size;
+	mach_msg_header_t *msg = (void *)msg_addr;
+
+
+	thread->ith_kmsg = NULL;
+	if (mr != MACH_MSG_SUCCESS)
+		return mach_msg_receive_results_error(thread);
+
+
+#ifdef notyet
+	trailer_size = ipc_kmsg_add_trailer(kmsg, space, option, thread, seqno, FALSE,
+										kmsg->ikm_header->msgh_remote_port->ip_context);
+#endif
+	trailer_size = REQUESTED_TRAILER_SIZE(option);
+	mr = ipc_kmsg_copyout(kmsg, space, map, MACH_MSG_BODY_NULL, option);
+
+	if (mr != MACH_MSG_SUCCESS) {
+		if ((mr &~ MACH_MSG_MASK) == MACH_RCV_BODY_ERROR) {
+			if (ipc_kmsg_put(msg, kmsg, kmsg->ikm_header->msgh_size +
+							 trailer_size) == MACH_RCV_INVALID_DATA)
+				mr = MACH_RCV_INVALID_DATA;
+		} else {
+			if (msg_receive_error(kmsg, msg, option, seqno, space)
+				== MACH_RCV_INVALID_DATA)
+				mr = MACH_RCV_INVALID_DATA;
+		}
+	} else {
+		mr = ipc_kmsg_put(msg,
+						  kmsg,
+						  kmsg->ikm_header->msgh_size +
+						  trailer_size);
+	}
+
+	return (mr);
+}


Property changes on: trunk/sys/compat/mach/ipc/mach_msg.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/ipc/mach_port.c
===================================================================
--- trunk/sys/compat/mach/ipc/mach_port.c	                        (rev 0)
+++ trunk/sys/compat/mach/ipc/mach_port.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,1782 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6.3.2  92/09/15  17:21:01  jeffreyh
+ * 	Don't round region size to page boundary when calling
+ * 	vm_map_copyin.  From jph at tamarack.cray.com
+ * 	[92/09/15            dlb]
+ * 
+ * Revision 2.6.3.1  92/03/03  16:19:12  jeffreyh
+ * 	Eliminate keep_wired argument from vm_map_copyin().
+ * 	[92/02/21  10:13:34  dlb]
+ * 
+ * Revision 2.6  91/10/09  16:11:42  af
+ * 	 Revision 2.5.2.1  91/09/16  10:16:19  rpd
+ * 	 	Added <ipc/ipc_notify.h>.
+ * 	 	[91/09/02            rpd]
+ * 
+ * Revision 2.5.2.1  91/09/16  10:16:19  rpd
+ * 	Added <ipc/ipc_notify.h>.
+ * 	[91/09/02            rpd]
+ * 
+ * Revision 2.5  91/08/28  11:14:04  jsb
+ * 	Added mach_port_set_seqno and updated mach_port_get_receive_status
+ * 	for mps_seqno.  Added old_mach_port_get_receive_status.
+ * 	[91/08/09            rpd]
+ * 	Changed port_names for new vm_map_copyout failure behavior.
+ * 	[91/08/03            rpd]
+ * 
+ * Revision 2.4  91/05/14  16:39:20  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:25:06  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:53:35  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:52:28  rpd
+ * 	Modified mach_port_get_receive_status to return a mach_port_status_t.
+ * 	[90/05/13            rpd]
+ * 	Created for new IPC.
+ * 	[90/03/26  21:06:13  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/mach_port.c
+ *	Author:	Rich Draves
+ *	Date: 	1989
+ *
+ *	Exported kernel calls.  See mach/mach_port.defs.
+ */
+
+#include "opt_compat_mach.h"
+
+#include <sys/mach/port.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+
+#include <sys/mach/mach_param.h>
+#include <sys/mach/mach_port_server.h>
+
+#include <sys/mach/ipc/ipc_entry.h>
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_notify.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_pset.h>
+#include <sys/mach/ipc/ipc_right.h>
+#include <sys/mach/thread.h>
+#include <sys/mach/task.h>
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+#include <vm/vm_extern.h>
+
+
+#define assert_static CTASSERT 
+#pragma clang diagnostic ignored "-Wuninitialized"
+
+#ifdef COMPAT_MACH_PORT_DEBUG
+#define DPRINTF printf
+#else
+#define DPRINTF(...)
+#endif
+
+/*
+ * Forward declarations
+ */
+void mach_port_names_helper(
+	ipc_port_timestamp_t	timestamp,
+	ipc_entry_t		entry,
+	mach_port_name_t		name,
+	mach_port_name_t		*names,
+	mach_port_type_t	*types,
+	ipc_entry_num_t		*actualp);
+
+/* Zeroed template of qos flags */
+
+static mach_port_qos_t	qos_template;
+
+
+
+/*
+ *	Routine:	mach_port_names_helper
+ *	Purpose:
+ *		A helper function for mach_port_names.
+ */
+
+void
+mach_port_names_helper(
+	ipc_port_timestamp_t	timestamp,
+	ipc_entry_t		entry,
+	mach_port_name_t		name,
+	mach_port_name_t		*names,
+	mach_port_type_t	*types,
+	ipc_entry_num_t		*actualp)
+{
+	ipc_entry_bits_t bits = entry->ie_bits;
+	ipc_port_request_index_t request = entry->ie_request;
+	mach_port_name_t type;
+	ipc_entry_num_t actual;
+
+	if (bits & MACH_PORT_TYPE_SEND_RIGHTS) {
+		ipc_port_t port;
+		boolean_t died;
+
+		port = (ipc_port_t) entry->ie_object;
+		assert(port != IP_NULL);
+
+		/*
+		 *	The timestamp serializes mach_port_names
+		 *	with ipc_port_destroy.  If the port died,
+		 *	but after mach_port_names started, pretend
+		 *	that it isn't dead.
+		 */
+
+		ip_lock(port);
+		died = (!ip_active(port) &&
+			IP_TIMESTAMP_ORDER(port->ip_timestamp, timestamp));
+		ip_unlock(port);
+
+		if (died) {
+			/* pretend this is a dead-name entry */
+
+			bits &= ~(IE_BITS_TYPE_MASK);
+			bits |= MACH_PORT_TYPE_DEAD_NAME;
+			if (request != 0)
+				bits++;
+			request = 0;
+		}
+	}
+
+	type = IE_BITS_TYPE(bits);
+	if (request != 0)
+		type |= MACH_PORT_TYPE_DNREQUEST;
+
+	actual = *actualp;
+	names[actual] = name;
+	types[actual] = type;
+	*actualp = actual+1;
+}
+
+/*
+ *	Routine:	mach_port_names [kernel call]
+ *	Purpose:
+ *		Retrieves a list of the rights present in the space,
+ *		along with type information.  (Same as returned
+ *		by mach_port_type.)  The names are returned in
+ *		no particular order, but they (and the type info)
+ *		are an accurate snapshot of the space.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Arrays of names and types returned.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+mach_port_names(
+	ipc_space_t		space,
+	mach_port_name_t		**namesp,
+	mach_msg_type_number_t	*namesCnt,
+	mach_port_type_t	**typesp,
+	mach_msg_type_number_t	*typesCnt)
+{
+	return KERN_NOT_SUPPORTED;
+#ifdef notyet
+	ipc_entry_t *table;
+	ipc_entry_num_t tsize;
+	mach_port_index_t index;
+	ipc_entry_num_t actual;	/* this many names */
+	ipc_port_timestamp_t timestamp;	/* logical time of this operation */
+	mach_port_name_t *names;
+	mach_port_type_t *types;
+#ifdef notyet	
+	kern_return_t kr;
+#endif
+	vm_size_t size;		/* size of allocated memory */
+	vm_offset_t addr1 = 0;	/* allocated memory, for names */
+	vm_offset_t addr2 = 0;	/* allocated memory, for types */
+	vm_map_copy_t memory1 = NULL;	/* copied-in memory, for names */
+	vm_map_copy_t memory2 = NULL;	/* copied-in memory, for types */
+
+	/* safe simplifying assumption */
+	assert_static(sizeof(mach_port_name_t) == sizeof(mach_port_type_t));
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	size = 0;
+	for (;;) {
+		ipc_entry_num_t bound;
+		vm_size_t size_needed;
+
+		is_read_lock(space);
+		if (!space->is_active) {
+			is_read_unlock(space);
+			if (size != 0) {
+				kmem_free(ipc_kernel_map, addr1, size);
+				kmem_free(ipc_kernel_map, addr2, size);
+			}
+			return KERN_INVALID_TASK;
+		}
+
+		/* upper bound on number of names in the space */
+
+		bound = space->is_table_size + space->is_tree_total;
+		size_needed = round_page(bound * sizeof(mach_port_t));
+
+		if (size_needed <= size)
+			break;
+
+		is_read_unlock(space);
+
+		if (size != 0) {
+			kmem_free(ipc_kernel_map, addr1, size);
+			kmem_free(ipc_kernel_map, addr2, size);
+		}
+		size = size_needed;
+
+		kr = vm_allocate(ipc_kernel_map, &addr1, size, TRUE);
+		if (kr != KERN_SUCCESS)
+			return KERN_RESOURCE_SHORTAGE;
+
+		kr = vm_allocate(ipc_kernel_map, &addr2, size, TRUE);
+		if (kr != KERN_SUCCESS) {
+			kmem_free(ipc_kernel_map, addr1, size);
+			return KERN_RESOURCE_SHORTAGE;
+		}
+
+		/* can't fault while we hold locks */
+
+		kr = vm_map_wire(ipc_kernel_map, addr1, addr1 + size,
+				     VM_PROT_READ|VM_PROT_WRITE, FALSE);
+		assert(kr == KERN_SUCCESS);
+
+		kr = vm_map_wire(ipc_kernel_map, addr2, addr2 + size,
+				     VM_PROT_READ|VM_PROT_WRITE, FALSE);
+		assert(kr == KERN_SUCCESS);
+	}
+
+	/* space is read-locked and active */
+
+	names = (mach_port_name_t *) addr1;
+	types = (mach_port_type_t *) addr2;
+	actual = 0;
+
+	timestamp = ipc_port_timestamp();
+
+	table = space->is_table;
+	tsize = space->is_table_size;
+
+	for (index = 0; index < tsize; index++) {
+		ipc_entry_t entry = table[index];
+		ipc_entry_bits_t bits = entry->ie_bits;
+
+		if (IE_BITS_TYPE(bits) != MACH_PORT_TYPE_NONE) {
+
+			mach_port_names_helper(timestamp, entry, entry->ie_name,
+					       names, types, &actual);
+		}
+	}
+
+	is_read_unlock(space);
+
+
+	if (actual == 0) {
+		memory1 = VM_MAP_COPY_NULL;
+		memory2 = VM_MAP_COPY_NULL;
+
+		if (size != 0) {
+			kmem_free(ipc_kernel_map, addr1, size);
+			kmem_free(ipc_kernel_map, addr2, size);
+		}
+	} else {
+
+		vm_size_t size_used;
+		vm_size_t vm_size_used;
+
+		size_used = actual * sizeof(mach_port_t);
+		vm_size_used = round_page(size_used);
+
+		/*
+		 *	Make used memory pageable and get it into
+		 *	copied-in form.  Free any unused memory.
+		 */
+
+		kr = vm_map_unwire(ipc_kernel_map,
+				     addr1, addr1 + vm_size_used, FALSE);
+		assert(kr == KERN_SUCCESS);
+
+		kr = vm_map_unwire(ipc_kernel_map,
+				     addr2, addr2 + vm_size_used, FALSE);
+		assert(kr == KERN_SUCCESS);
+
+		kr = vm_map_copyin(ipc_kernel_map, addr1, size_used,
+				   TRUE, &memory1);
+		assert(kr == KERN_SUCCESS);
+
+		kr = vm_map_copyin(ipc_kernel_map, addr2, size_used,
+				   TRUE, &memory2);
+		assert(kr == KERN_SUCCESS);
+
+		if (vm_size_used != size) {
+			kmem_free(ipc_kernel_map,
+				  addr1 + vm_size_used, size - vm_size_used);
+			kmem_free(ipc_kernel_map,
+				  addr2 + vm_size_used, size - vm_size_used);
+		}
+
+	}
+	*namesp = (mach_port_name_t *) memory1;
+	*namesCnt = actual;
+	*typesp = (mach_port_type_t *) memory2;
+	*typesCnt = actual;
+	return KERN_SUCCESS;
+#endif
+}
+
+/*
+ *	Routine:	mach_port_type [kernel call]
+ *	Purpose:
+ *		Retrieves the type of a right in the space.
+ *		The type is a bitwise combination of one or more
+ *		of the following type bits:
+ *			MACH_PORT_TYPE_SEND
+ *			MACH_PORT_TYPE_RECEIVE
+ *			MACH_PORT_TYPE_SEND_ONCE
+ *			MACH_PORT_TYPE_PORT_SET
+ *			MACH_PORT_TYPE_DEAD_NAME
+ *		In addition, the following pseudo-type bits may be present:
+ *			MACH_PORT_TYPE_DNREQUEST
+ *				A dead-name notification is requested.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Type is returned.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	The name doesn't denote a right.
+ */
+
+kern_return_t
+mach_port_type(
+	ipc_space_t			space,
+	mach_port_name_t	name,
+	mach_port_type_t	*typep)
+{
+	mach_port_urefs_t urefs;
+	ipc_entry_t entry;
+	kern_return_t kr;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	kr = ipc_right_lookup_read(space, name, &entry);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* space is write-locked and active */
+
+	kr = ipc_right_info(space, name, entry, typep, &urefs);
+	if (kr == KERN_SUCCESS)
+		is_read_unlock(space);
+	/* space is unlocked */
+	return kr;
+}
+
+/*
+ *	Routine:	mach_port_rename [kernel call]
+ *	Purpose:
+ *		Changes the name denoting a right,
+ *		from oname to nname.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		The right is renamed.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	The oname doesn't denote a right.
+ *		KERN_INVALID_VALUE	The nname isn't a legal name.
+ *		KERN_NAME_EXISTS	The nname already denotes a right.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+mach_port_rename(
+	ipc_space_t	space,
+	mach_port_name_t	oname,
+	mach_port_name_t	nname)
+{
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	if (!MACH_PORT_NAME_VALID(nname))
+		return KERN_INVALID_VALUE;
+
+	return ipc_object_rename(space, oname, nname);
+}
+
+/*
+ *	Routine:	mach_port_allocate_name [kernel call]
+ *	Purpose:
+ *		Allocates a right in a space, using a specific name
+ *		for the new right.  Possible rights:
+ *			MACH_PORT_RIGHT_RECEIVE
+ *			MACH_PORT_RIGHT_PORT_SET
+ *			MACH_PORT_RIGHT_DEAD_NAME
+ *
+ *		A new port (allocated with MACH_PORT_RIGHT_RECEIVE)
+ *		has no extant send or send-once rights and no queued
+ *		messages.  Its queue limit is MACH_PORT_QLIMIT_DEFAULT
+ *		and its make-send count is 0.  It is not a member of
+ *		a port set.  It has no registered no-senders or
+ *		port-destroyed notification requests.
+ *
+ *		A new port set has no members.
+ *
+ *		A new dead name has one user reference.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		The right is allocated.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_VALUE	The name isn't a legal name.
+ *		KERN_INVALID_VALUE	"right" isn't a legal kind of right.
+ *		KERN_NAME_EXISTS	The name already denotes a right.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ *
+ *	Restrictions on name allocation:  NT bits are reserved by kernel,
+ *	must be set on any chosen name.  Can't do this at all in kernel
+ *	loaded server.
+ */
+
+kern_return_t
+mach_port_allocate_name(
+	ipc_space_t		space,
+	mach_port_right_t	right,
+	mach_port_name_t		name)
+{
+	kern_return_t		kr;
+	mach_port_qos_t		qos = qos_template;
+
+	qos.name = TRUE;
+
+	kr = mach_port_allocate_full (space, right, MACH_PORT_NULL,
+					&qos, &name);
+	return (kr);
+}
+
+/*
+ *	Routine:	mach_port_allocate [kernel call]
+ *	Purpose:
+ *		Allocates a right in a space.  Like mach_port_allocate_name,
+ *		except that the implementation picks a name for the right.
+ *		The name may be any legal name in the space that doesn't
+ *		currently denote a right.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		The right is allocated.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_VALUE	"right" isn't a legal kind of right.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ *		KERN_NO_SPACE		No room in space for another right.
+ */
+
+kern_return_t
+mach_port_allocate(
+	ipc_space_t		space,
+	mach_port_right_t	right,
+	mach_port_name_t		*namep)
+{
+	kern_return_t		kr;
+	mach_port_qos_t		qos = qos_template;
+
+	kr = mach_port_allocate_full (space, right, MACH_PORT_NULL,
+					&qos, namep);
+	return (kr);
+}
+
+/*
+ *	Routine:	mach_port_allocate_qos [kernel call]
+ *	Purpose:
+ *		Allocates a right, with qos options, in a space.  Like 
+ *		mach_port_allocate_name, except that the implementation 
+ *		picks a name for the right. The name may be any legal name 
+ *		in the space that doesn't currently denote a right.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		The right is allocated.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_VALUE	"right" isn't a legal kind of right.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ *		KERN_NO_SPACE		No room in space for another right.
+ */
+
+kern_return_t
+mach_port_allocate_qos(
+	ipc_space_t		space,
+	mach_port_right_t	right,
+	mach_port_qos_t		*qosp,
+	mach_port_name_t		*namep)
+{
+	kern_return_t		kr;
+
+	kr = mach_port_allocate_full (space, right, MACH_PORT_NULL,
+					qosp, namep);
+	return (kr);
+}
+
+/*
+ *	Routine:	mach_port_allocate_full [kernel call]
+ *	Purpose:
+ *		Allocates a right in a space.  Supports all of the
+ *		special cases, such as specifying a subsystem,
+ *		a specific name, a real-time port, etc.
+ *		The name may be any legal name in the space that doesn't
+ *		currently denote a right.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		The right is allocated.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_VALUE	"right" isn't a legal kind of right.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ *		KERN_NO_SPACE		No room in space for another right.
+ */
+
+kern_return_t
+mach_port_allocate_full(
+	ipc_space_t		space,
+	mach_port_right_t	right,
+	mach_port_t			proto,
+	mach_port_qos_t		*qosp,
+	mach_port_name_t		*namep)
+{
+	kern_return_t		kr;
+
+	if (space == IS_NULL)
+		return (KERN_INVALID_TASK);
+
+	if (proto != MACH_PORT_NULL)
+		return (KERN_INVALID_VALUE);
+
+	if (qosp->name) {
+		if (!MACH_PORT_NAME_VALID (*namep))
+			return (KERN_INVALID_VALUE);
+		if (is_fast_space (space))
+			return (KERN_FAILURE);
+	}
+
+	switch (right) {
+	    case MACH_PORT_RIGHT_RECEIVE:
+	    {
+		ipc_port_t	port;
+
+		if (qosp->name)
+			kr = ipc_port_alloc_name(space, *namep, &port);
+		else
+			kr = ipc_port_alloc(space, namep, &port);
+		if (kr == KERN_SUCCESS) {
+			ip_unlock(port);
+		}
+		break;
+	    }
+
+	    case MACH_PORT_RIGHT_PORT_SET:
+	    {
+		ipc_pset_t	pset;
+
+		if (qosp->name)
+			kr = ipc_pset_alloc_name(space, *namep, &pset);
+		else
+			kr = ipc_pset_alloc(space, namep, &pset);
+		if (kr == KERN_SUCCESS)
+			ips_unlock(pset);
+		break;
+	    }
+
+	    case MACH_PORT_RIGHT_DEAD_NAME:
+		kr = ipc_object_alloc_dead(space, namep);
+		break;
+
+	    default:
+		kr = KERN_INVALID_VALUE;
+		break;
+	}
+
+	return (kr);
+}
+
+/*
+ *	Routine:	mach_port_destroy [kernel call]
+ *	Purpose:
+ *		Cleans up and destroys all rights denoted by a name
+ *		in a space.  The destruction of a receive right
+ *		destroys the port, unless a port-destroyed request
+ *		has been made for it; the destruction of a port-set right
+ *		destroys the port set.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		The name is destroyed.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	The name doesn't denote a right.
+ */
+
+kern_return_t
+mach_port_destroy(
+	ipc_space_t	space,
+	mach_port_name_t	name)
+{
+	ipc_entry_t entry;
+	kern_return_t kr;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	kr = ipc_right_lookup_write(space, name, &entry);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* space is write-locked and active */
+
+	kr = ipc_right_destroy(space, name, entry); /* unlocks space */
+	return kr;
+}
+
+/*
+ *	Routine:	mach_port_deallocate [kernel call]
+ *	Purpose:
+ *		Deallocates a user reference from a send right,
+ *		send-once right, or a dead-name right.  May
+ *		deallocate the right, if this is the last uref,
+ *		and destroy the name, if it doesn't denote
+ *		other rights.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		The uref is deallocated.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	The name doesn't denote a right.
+ *		KERN_INVALID_RIGHT	The right isn't correct.
+ */
+
+kern_return_t
+mach_port_deallocate(
+	ipc_space_t	space,
+	mach_port_name_t	name)
+{
+	ipc_entry_t entry;
+	kern_return_t kr;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	kr = ipc_right_lookup_write(space, name, &entry);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* space is write-locked */
+
+	kr = ipc_right_dealloc(space, name, entry); /* unlocks space */
+	return kr;
+}
+
+/*
+ *	Routine:	mach_port_get_refs [kernel call]
+ *	Purpose:
+ *		Retrieves the number of user references held by a right.
+ *		Receive rights, port-set rights, and send-once rights
+ *		always have one user reference.  Returns zero if the
+ *		name denotes a right, but not the queried right.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Number of urefs returned.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_VALUE	"right" isn't a legal value.
+ *		KERN_INVALID_NAME	The name doesn't denote a right.
+ */
+
+kern_return_t
+mach_port_get_refs(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	mach_port_right_t	right,
+	mach_port_urefs_t	*urefsp)
+{
+	mach_port_type_t type;
+	mach_port_urefs_t urefs;
+	ipc_entry_t entry;
+	kern_return_t kr;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	if (right >= MACH_PORT_RIGHT_NUMBER)
+		return KERN_INVALID_VALUE;
+
+	kr = ipc_right_lookup_read(space, name, &entry);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* space is read-locked and active */
+
+	kr = ipc_right_info(space, name, entry, &type, &urefs);	/* unlocks */
+	if (kr != KERN_SUCCESS)
+		return kr;	/* space is unlocked */
+	is_read_unlock(space);
+
+	if (type & MACH_PORT_TYPE(right))
+		switch (right) {
+		    case MACH_PORT_RIGHT_SEND_ONCE:
+			assert(urefs == 1);
+			/* fall-through */
+
+		    case MACH_PORT_RIGHT_PORT_SET:
+		    case MACH_PORT_RIGHT_RECEIVE:
+			*urefsp = 1;
+			break;
+
+		    case MACH_PORT_RIGHT_DEAD_NAME:
+		    case MACH_PORT_RIGHT_SEND:
+			assert(urefs > 0);
+			*urefsp = urefs;
+			break;
+
+		    default:
+			panic("mach_port_get_refs: strange rights");
+		}
+	else
+		*urefsp = 0;
+
+	return kr;
+}
+
+/*
+ *	Routine:	mach_port_mod_refs
+ *	Purpose:
+ *		Modifies the number of user references held by a right.
+ *		The resulting number of user references must be non-negative.
+ *		If it is zero, the right is deallocated.  If the name
+ *		doesn't denote other rights, it is destroyed.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Modified number of urefs.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_VALUE	"right" isn't a legal value.
+ *		KERN_INVALID_NAME	The name doesn't denote a right.
+ *		KERN_INVALID_RIGHT	Name doesn't denote specified right.
+ *		KERN_INVALID_VALUE	Impossible modification to urefs.
+ *		KERN_UREFS_OVERFLOW	Urefs would overflow.
+ */
+
+kern_return_t
+mach_port_mod_refs(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	mach_port_right_t	right,
+	mach_port_delta_t	delta)
+{
+	ipc_entry_t entry;
+	kern_return_t kr;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	if (right >= MACH_PORT_RIGHT_NUMBER)
+		return KERN_INVALID_VALUE;
+
+	if (!MACH_PORT_NAME_VALID(name)) {
+		if (right == MACH_PORT_RIGHT_SEND ||
+		    right == MACH_PORT_RIGHT_SEND_ONCE)
+			return KERN_SUCCESS;
+		return KERN_INVALID_NAME;
+	}
+	kr = ipc_right_lookup_write(space, name, &entry);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* space is write-locked and active */
+
+	kr = ipc_right_delta(space, name, entry, right, delta);	/* unlocks */
+	return kr;
+}
+
+
+/*
+ *	Routine:	mach_port_set_mscount [kernel call]
+ *	Purpose:
+ *		Changes a receive right's make-send count.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Set make-send count.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	The name doesn't denote a right.
+ *		KERN_INVALID_RIGHT	Name doesn't denote receive rights.
+ */
+
+kern_return_t
+mach_port_set_mscount(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	mach_port_mscount_t	mscount)
+{
+	ipc_port_t port;
+	kern_return_t kr;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	kr = ipc_port_translate_receive(space, name, &port);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* port is locked and active */
+
+	ipc_port_set_mscount(port, mscount);
+
+	ip_unlock(port);
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	mach_port_set_seqno [kernel call]
+ *	Purpose:
+ *		Changes a receive right's sequence number.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Set sequence number.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	The name doesn't denote a right.
+ *		KERN_INVALID_RIGHT	Name doesn't denote receive rights.
+ */
+
+kern_return_t
+mach_port_set_seqno(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	mach_port_seqno_t	seqno)
+{
+	ipc_port_t port;
+	kern_return_t kr;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	kr = ipc_port_translate_receive(space, name, &port);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* port is locked and active */
+
+	ipc_port_set_seqno(port, seqno);
+
+	ip_unlock(port);
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	mach_port_gst_helper
+ *	Purpose:
+ *		A helper function for mach_port_get_set_status.
+ */
+
+static void
+mach_port_gst_helper(
+	ipc_pset_t		pset,
+	ipc_entry_num_t		maxnames,
+	mach_port_name_t		*names,
+	ipc_entry_num_t		*actualp)
+{
+	mach_port_name_t name;
+	ipc_port_t		port;
+	ipc_entry_num_t actual = *actualp;
+
+	assert(port != IP_NULL);
+
+	TAILQ_FOREACH(port, &pset->ips_ports, ip_next) {
+		assert(ip_active(port));
+		name = port->ip_receiver_name;
+		assert(name != MACH_PORT_NAME_NULL);
+		assert(port->ip_pset == pset);
+		if (actual < maxnames)
+			names[actual] = name;
+		*actualp = actual+1;
+	}
+}
+
+/*
+ *	Routine:	mach_port_get_set_status [kernel call]
+ *	Purpose:
+ *		Retrieves a list of members in a port set.
+ *		Returns the space's name for each receive right member.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Retrieved list of members.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	The name doesn't denote a right.
+ *		KERN_INVALID_RIGHT	Name doesn't denote a port set.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+mach_port_get_set_status(
+	ipc_space_t			space,
+	mach_port_name_t			name,
+	mach_port_name_t			**members,
+	mach_msg_type_number_t		*membersCnt)
+{
+	ipc_entry_num_t actual;		/* this many members */
+	ipc_entry_num_t maxnames;	/* space for this many members */
+	kern_return_t kr;
+
+	vm_size_t size;		/* size of allocated memory */
+	caddr_t addr;	/* allocated memory */
+	vm_map_copy_t memory;	/* copied-in memory */
+
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+	if (!MACH_PORT_NAME_VALID(name))
+		return KERN_INVALID_RIGHT;
+
+	size = PAGE_SIZE;	/* initial guess */
+
+	for (;;) {
+		mach_port_name_t *names;
+		ipc_pset_t pset;
+		ipc_object_t obj;
+
+		addr = malloc(size, M_MACH_VM, M_NOWAIT);
+		if (addr == NULL)
+			return KERN_RESOURCE_SHORTAGE;
+
+		kr = ipc_object_translate(space, name, MACH_PORT_RIGHT_PORT_SET, &obj);
+		if (kr != KERN_SUCCESS) {
+			free(addr, M_MACH_VM);
+			return kr;
+		}
+		pset = (ipc_pset_t) obj;
+		ips_reference(pset);
+
+
+		/* the port set must be active */
+		names = (mach_port_name_t *) addr;
+		maxnames = size / sizeof(mach_port_t);
+		actual = 0;
+
+		mach_port_gst_helper(pset, maxnames, names, &actual);
+		ips_unlock(pset);
+		ips_release(pset);
+
+		if (actual <= maxnames)
+			break;
+
+		/* didn't have enough memory; allocate more */
+
+		free(addr, M_MACH_VM);
+		size = round_page(actual * sizeof(mach_port_t)) + PAGE_SIZE;
+	}
+
+	if (actual == 0) {
+		memory = VM_MAP_COPY_NULL;
+
+		free(addr, M_MACH_TMP);
+	} else {
+		vm_size_t size_used;
+
+		size_used = actual * sizeof(mach_port_t);
+
+		/*
+		 *	Make used memory pageable and get it into
+		 *	copied-in form.  Free any unused memory.
+		 */
+		kr = vm_map_copyin(kernel_map, (vm_offset_t)addr, size_used,
+				   FALSE, &memory);
+		assert(kr == KERN_SUCCESS);
+	}
+
+	*members = (mach_port_name_t *) memory;
+	*membersCnt = actual;
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	mach_port_move_member [kernel call]
+ *	Purpose:
+ *		If after is MACH_PORT_NULL, removes member
+ *		from the port set it is in.  Otherwise, adds
+ *		member to after, removing it from any set
+ *		it might already be in.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Moved the port.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_NAME	Member didn't denote a right.
+ *		KERN_INVALID_RIGHT	Member didn't denote a receive right.
+ *		KERN_INVALID_NAME	After didn't denote a right.
+ *		KERN_INVALID_RIGHT	After didn't denote a port set right.
+ *		KERN_NOT_IN_SET
+ *			After is MACH_PORT_NULL and Member isn't in a port set.
+ */
+
+kern_return_t
+mach_port_move_member(
+	ipc_space_t	space,
+	mach_port_name_t	member,
+	mach_port_name_t	after)
+{
+	ipc_entry_t entry;
+	ipc_port_t port;
+	ipc_pset_t nset;
+	kern_return_t kr;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	kr = ipc_right_lookup_read(space, member, &entry);
+	if (kr != KERN_SUCCESS)
+		return kr;
+	/* space is read-locked and active */
+
+	if ((entry->ie_bits & MACH_PORT_TYPE_RECEIVE) == 0) {
+		is_read_unlock(space);
+		return KERN_INVALID_RIGHT;
+	}
+
+	port = (ipc_port_t) entry->ie_object;
+	assert(port != IP_NULL);
+
+	if (after == MACH_PORT_NAME_NULL)
+		nset = IPS_NULL;
+	else {
+		entry = ipc_entry_lookup(space, after);
+		if (entry == IE_NULL) {
+			is_read_unlock(space);
+			return KERN_INVALID_NAME;
+		}
+
+		if ((entry->ie_bits & MACH_PORT_TYPE_PORT_SET) == 0) {
+			is_read_unlock(space);
+			return KERN_INVALID_RIGHT;
+		}
+
+		nset = (ipc_pset_t) entry->ie_object;
+		assert(nset != IPS_NULL);
+	}
+
+	kr = ipc_pset_move(space, port, nset);
+	/* space is unlocked */
+	return kr;
+}
+
+/*
+ *	task_set_port_space:
+ *
+ *	Set port name space of task to specified size.
+ */
+kern_return_t
+task_set_port_space(
+ 	ipc_space_t	space,
+ 	int		table_entries)
+{
+
+	/* file descriptor code handles all of this */
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	mach_port_request_notification [kernel call]
+ *	Purpose:
+ *		Requests a notification.  The caller supplies
+ *		a send-once right for the notification to use,
+ *		and the call returns the previously registered
+ *		send-once right, if any.  Possible types:
+ *
+ *		MACH_NOTIFY_PORT_DESTROYED
+ *			Requests a port-destroyed notification
+ *			for a receive right.  Sync should be zero.
+ *		MACH_NOTIFY_NO_SENDERS
+ *			Requests a no-senders notification for a
+ *			receive right.  If there are currently no
+ *			senders, sync is less than or equal to the
+ *			current make-send count, and a send-once right
+ *			is supplied, then an immediate no-senders
+ *			notification is generated.
+ *		MACH_NOTIFY_DEAD_NAME
+ *			Requests a dead-name notification for a send
+ *			or receive right.  If the name is already a
+ *			dead name, sync is non-zero, and a send-once
+ *			right is supplied, then an immediate dead-name
+ *			notification is generated.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Requested a notification.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_VALUE	Bad id value.
+ *		KERN_INVALID_NAME	Name doesn't denote a right.
+ *		KERN_INVALID_RIGHT	Name doesn't denote appropriate right.
+ *		KERN_INVALID_CAPABILITY	The notify port is dead.
+ *	MACH_NOTIFY_PORT_DESTROYED:
+ *		KERN_INVALID_VALUE	Sync isn't zero.
+ *	MACH_NOTIFY_DEAD_NAME:
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ *		KERN_INVALID_ARGUMENT	Name denotes dead name, but
+ *			sync is zero or notify is IP_NULL.
+ *		KERN_UREFS_OVERFLOW	Name denotes dead name, but
+ *			generating immediate notif. would overflow urefs.
+ */
+
+kern_return_t
+mach_port_request_notification(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	mach_msg_id_t		id,
+	mach_port_mscount_t	sync,
+	ipc_port_t		notify,
+	ipc_port_t		*previousp)
+{
+	kern_return_t kr;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	if (notify == IP_DEAD)
+		return KERN_INVALID_CAPABILITY;
+
+	switch (id) {
+	case MACH_NOTIFY_PORT_DESTROYED: {
+		ipc_port_t port, previous;
+
+		if (sync != 0)
+			return KERN_INVALID_VALUE;
+
+		if (!MACH_PORT_NAME_VALID(name))
+			return KERN_INVALID_RIGHT;
+
+		kr = ipc_port_translate_receive(space, name, &port);
+		if (kr != KERN_SUCCESS)
+			return kr;
+		/* port is locked and active */
+
+		ipc_port_pdrequest(port, notify, &previous);
+		/* port is unlocked */
+
+		*previousp = previous;
+		break;
+	}
+
+	case MACH_NOTIFY_NO_SENDERS: {
+		ipc_port_t port;
+
+		if (!MACH_PORT_NAME_VALID(name))
+			return KERN_INVALID_RIGHT;
+
+		kr = ipc_port_translate_receive(space, name, &port);
+		if (kr != KERN_SUCCESS)
+			return kr;
+		/* port is locked and active */
+
+		ipc_port_nsrequest(port, sync, notify, previousp);
+		/* port is unlocked */
+		break;
+	}
+
+	case MACH_NOTIFY_DEAD_NAME: {
+		ipc_port_t port;
+		ipc_port_request_index_t indexp;
+
+		if (!MACH_PORT_NAME_VALID(name))
+			return KERN_INVALID_RIGHT;
+
+		kr = ipc_port_translate_receive(space, name, &port);
+		if (kr != KERN_SUCCESS)
+			return kr;
+		/* port is locked and active */
+
+		ipc_port_dnrequest(port, name, notify, &indexp);
+		ip_unlock(port);
+
+		/* XXX: what to do here? return index? */
+		*previousp = MACH_PORT_NULL;
+		break;
+	}
+
+	default:
+		return KERN_INVALID_VALUE;
+	}
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	mach_port_insert_right [kernel call]
+ *	Purpose:
+ *		Inserts a right into a space, as if the space
+ *		voluntarily received the right in a message,
+ *		except that the right gets the specified name.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Inserted the right.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_VALUE	The name isn't a legal name.
+ *		KERN_NAME_EXISTS	The name already denotes a right.
+ *		KERN_INVALID_VALUE	Message doesn't carry a port right.
+ *		KERN_INVALID_CAPABILITY	Port is null or dead.
+ *		KERN_UREFS_OVERFLOW	Urefs limit would be exceeded.
+ *		KERN_RIGHT_EXISTS	Space has rights under another name.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+mach_port_insert_right(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	ipc_port_t		poly,
+	mach_msg_type_name_t	polyPoly)
+{
+	if (space == IS_NULL) {
+		DPRINTF("insert_right: space is NULL\n");
+		return KERN_INVALID_TASK;
+	}
+	if (!MACH_PORT_NAME_VALID(name) ||
+	    !MACH_MSG_TYPE_PORT_ANY_RIGHT(polyPoly)) {
+		DPRINTF("invalid name or right name=%x polyPoly=%x\n", name, polyPoly);
+		return KERN_INVALID_VALUE;
+	}
+	if (!IO_VALID((ipc_object_t) poly)) {
+		DPRINTF("invalid capability\n");
+		return KERN_INVALID_CAPABILITY;
+	}
+	return ipc_object_copyout_name(space, (ipc_object_t) poly, 
+				       polyPoly, name);
+}
+
+/*
+ *	Routine:	mach_port_extract_right [kernel call]
+ *	Purpose:
+ *		Extracts a right from a space, as if the space
+ *		voluntarily sent the right to the caller.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Extracted the right.
+ *		KERN_INVALID_TASK	The space is null.
+ *		KERN_INVALID_TASK	The space is dead.
+ *		KERN_INVALID_VALUE	Requested type isn't a port right.
+ *		KERN_INVALID_NAME	Name doesn't denote a right.
+ *		KERN_INVALID_RIGHT	Name doesn't denote appropriate right.
+ */
+
+kern_return_t
+mach_port_extract_right(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	mach_msg_type_name_t	msgt_name,
+	ipc_port_t		*poly,
+	mach_msg_type_name_t	*polyPoly)
+{
+	kern_return_t kr;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	if (!MACH_MSG_TYPE_PORT_ANY(msgt_name))
+		return KERN_INVALID_VALUE;
+
+	kr = ipc_object_copyin(space, name, msgt_name, (ipc_object_t *) poly);
+
+	if (kr == KERN_SUCCESS)
+		*polyPoly = ipc_object_copyin_type(msgt_name);
+	return kr;
+}
+
+
+kern_return_t
+mach_port_get_attributes(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	int			flavor,
+        mach_port_info_t	info,
+        mach_msg_type_number_t	*count)
+{
+	ipc_port_t port;
+	kern_return_t kr;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+        switch (flavor) {
+        case MACH_PORT_LIMITS_INFO: {
+                mach_port_limits_t *lp = (mach_port_limits_t *)info;
+
+                if (*count < MACH_PORT_LIMITS_INFO_COUNT)
+                        return KERN_FAILURE;
+                
+                kr = ipc_port_translate_receive(space, name, &port);
+                if (kr != KERN_SUCCESS)
+                        return kr;
+                /* port is locked and active */
+
+                lp->mpl_qlimit = port->ip_qlimit;
+                *count = MACH_PORT_LIMITS_INFO_COUNT;
+                ip_unlock(port);
+                break;
+        }
+
+        case MACH_PORT_RECEIVE_STATUS: {
+			mach_port_status_t *statusp = (mach_port_status_t *)info;
+                
+                if (*count < MACH_PORT_RECEIVE_STATUS_COUNT)
+                        return KERN_FAILURE;
+                
+                kr = ipc_port_translate_receive(space, name, &port);
+                if (kr != KERN_SUCCESS)
+                        return kr;
+                /* port is locked and active */
+
+                if (port->ip_pset != IPS_NULL) {
+                        ipc_pset_t pset = port->ip_pset;
+
+                        ips_lock(pset);
+                        if (!ips_active(pset)) {
+                                ipc_pset_remove(pset, port);
+                                ips_unlock(pset);
+								ips_release(pset);
+                                goto no_port_set;
+                        } else {
+                                statusp->mps_pset = pset->ips_local_name;
+                                statusp->mps_seqno = port->ip_seqno;
+                                ips_unlock(pset);
+                                assert(MACH_PORT_NAME_VALID(statusp->mps_pset));
+                        }
+                } else {
+                no_port_set:
+                        statusp->mps_pset = MACH_PORT_NAME_NULL;
+                        statusp->mps_seqno = port->ip_seqno;
+                }
+                statusp->mps_mscount = port->ip_mscount;
+                statusp->mps_qlimit = port->ip_qlimit;
+                statusp->mps_msgcount = port->ip_msgcount;
+                statusp->mps_sorights = port->ip_sorights;
+                statusp->mps_srights = port->ip_srights > 0;
+                statusp->mps_pdrequest = port->ip_pdrequest != IP_NULL;
+                statusp->mps_nsrequest = port->ip_nsrequest != IP_NULL;
+		statusp->mps_flags = port->ip_flags;
+
+                *count = MACH_PORT_RECEIVE_STATUS_COUNT;
+                ip_unlock(port);
+                break;
+        }
+	
+	case MACH_PORT_DNREQUESTS_SIZE: {
+		ipc_port_request_t	table;
+		
+                if (*count < MACH_PORT_DNREQUESTS_SIZE_COUNT)
+                        return KERN_FAILURE;
+		
+                kr = ipc_port_translate_receive(space, name, &port);
+                if (kr != KERN_SUCCESS)
+                        return kr;
+                /* port is locked and active */
+		
+		table = port->ip_dnrequests;
+		if (table == IPR_NULL)
+			*(int *)info = 0;
+		else
+			*(int *)info = table->ipr_size->its_size;
+                *count = MACH_PORT_DNREQUESTS_SIZE_COUNT;
+                ip_unlock(port);
+		break;
+	}
+
+        default:
+		return KERN_INVALID_ARGUMENT;
+                /*NOTREACHED*/
+        }                
+
+	return KERN_SUCCESS;
+}
+
+kern_return_t
+mach_port_set_attributes(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	int			flavor,
+        mach_port_info_t	info,
+        mach_msg_type_number_t	count)
+{
+	ipc_port_t port;
+	kern_return_t kr;
+        
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+        switch (flavor) {
+                
+        case MACH_PORT_LIMITS_INFO: {
+                mach_port_limits_t *mplp = (mach_port_limits_t *)info;
+                
+                if (count < MACH_PORT_LIMITS_INFO_COUNT)
+                        return KERN_FAILURE;
+                
+                if (mplp->mpl_qlimit > MACH_PORT_QLIMIT_MAX)
+                        return KERN_INVALID_VALUE;
+
+                kr = ipc_port_translate_receive(space, name, &port);
+                if (kr != KERN_SUCCESS)
+                        return kr;
+                /* port is locked and active */
+
+                ipc_port_set_qlimit(port, mplp->mpl_qlimit);
+                ip_unlock(port);
+                break;
+        }
+		case MACH_PORT_DNREQUESTS_SIZE: {
+                if (count < MACH_PORT_DNREQUESTS_SIZE_COUNT)
+                        return KERN_FAILURE;
+                
+                kr = ipc_port_translate_receive(space, name, &port);
+                if (kr != KERN_SUCCESS)
+                        return kr;
+                /* port is locked and active */
+		
+				kr = ipc_port_dngrow(port, *(int *)info);
+				if (kr != KERN_SUCCESS)
+					return kr;
+				break;
+		}
+		case MACH_PORT_TEMPOWNER: {
+			if (!MACH_PORT_NAME_VALID(name))
+				return KERN_INVALID_RIGHT;
+			kr = ipc_port_translate_receive(space, name, &port);
+			if (kr != KERN_SUCCESS)
+				return kr;
+
+			if (is_ipc_kobject(ip_kotype(port))) {
+				ip_unlock(port);
+				return KERN_INVALID_ARGUMENT;
+			}
+			/*  without IMPORTANCE_INHERITANCE - this is essentially
+			 *  trivial
+			 */
+			port->ip_impdonation = 1;
+			port->ip_tempowner = 1;
+			ip_unlock(port);
+			break;
+		}
+        default:
+		return KERN_INVALID_ARGUMENT;
+                /*NOTREACHED*/
+        }
+	return KERN_SUCCESS;
+}
+
+#ifdef notyet
+/*
+ * Create an empty thread_activation (sans thread_shuttle) attached to
+ * a port or port set in a given task to receive incoming threads.
+ */
+/*
+ * NOTE: the following calls targeted at a thread_act port may be
+ * called on an empty thread_act:
+ *
+ * thread_get_exception_ports  thread_set_exception_ports
+ * thread_get_special_port     thread_set_special_port
+ * thread_get_state            thread_suspend
+ * thread_resume               thread_swap_exception_ports
+ * thread_sample               thread_terminate
+ *
+ * The following calls targeted at a thread_act port may _not_ be
+ * called on an empty thread_act (and will return KERN_INVALID_ARGUMENT
+ * if they are called with one):
+ *
+ * thread_abort                thread_info
+ * thread_abort_safely         thread_wire
+ * thread_depress_abort
+ *
+ * Also, if thread_switch() is called with an empty thread_act as
+ * its first argument, the argument will be ignored (i.e., the
+ * function will behave as if a zero-valued argument had been
+ * given).
+ */
+kern_return_t
+thread_activation_create(task_t task, mach_port_name_t name,
+                         vm_offset_t user_stack, vm_size_t stack_size, 
+			 thread_act_t *new_act)
+{
+	ipc_space_t space;
+	ipc_object_t object;
+	kern_return_t kr;
+	thread_act_t thr_act;
+	int is_port = 1;
+
+	if (task == TASK_NULL)
+		return KERN_INVALID_TASK;
+
+	/* First create the new activation.  */
+	/*
+	 * We'll need this stack later -- make sure it's present.
+	 */
+	assert(user_stack != 0);
+	kr = act_create(task, user_stack, stack_size, &thr_act);
+	if (kr != KERN_SUCCESS)
+		return kr;
+
+	space = task->itk_space;
+
+	kr = ipc_object_translate(space, name,
+				  MACH_PORT_RIGHT_PORT_SET, &object);
+	if (kr != KERN_SUCCESS) {
+		kr = ipc_object_translate(space, name,
+					  MACH_PORT_RIGHT_RECEIVE, &object);
+		if (kr != KERN_SUCCESS) {
+			thread_terminate(thr_act);
+			act_deallocate(thr_act);
+			return kr;
+		}
+		is_port = 0;
+	}
+	/* port/pset is locked and active */
+
+#if	MACH_ASSERT
+	if (watchacts & WA_PORT)
+		printf("thr_act on %s=%x stack=%x thr_act=%x\n",
+		       (is_port ? "port" : "pset"),
+		       object, user_stack, thr_act);
+#endif	/* MACH_ASSERT */
+
+	/* Assign the activation to the thread_pool.  */
+	kr = act_set_thread_pool(thr_act, (ipc_port_t)object);
+	if (kr != KERN_SUCCESS) {
+		io_unlock(object);
+		thread_terminate(thr_act);
+		act_deallocate(thr_act);
+		return kr;
+	}
+	io_unlock(object);
+
+
+	/* Pass our reference to the activation back to the user.  */
+	*new_act = thr_act;
+
+	return KERN_SUCCESS;
+}
+
+#endif
+
+int
+mach_port_construct(
+	ipc_space_t task,
+	mach_port_options_ptr_t options,
+	uint64_t context,
+	mach_port_name_t *name
+	)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_port_destruct(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_delta_t srdelta,
+	uint64_t guard
+)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_port_extract_member(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_name_t pset
+)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_port_get_context(
+	ipc_space_t space,
+	mach_port_name_t name,
+	mach_vm_address_t *context
+	)
+{
+	ipc_port_t port;
+	kern_return_t kr;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	if (!MACH_PORT_NAME_VALID(name))
+		return KERN_INVALID_RIGHT;
+
+	kr = ipc_port_translate_receive(space, name, &port);
+	if (kr != KERN_SUCCESS)
+		return kr;
+
+	/* Port locked and active */
+
+	/* For strictly guarded ports, return empty context (which acts as guard) */
+	if (port->ip_strict_guard)
+		*context = 0;
+	else
+		*context = port->ip_context;
+
+	ip_unlock(port);
+	return KERN_SUCCESS;
+}
+
+int	
+mach_port_guard(
+	ipc_space_t task,
+	mach_port_name_t name,
+	uint64_t guard,
+	boolean_t strict
+	)
+	UNSUPPORTED;
+
+
+
+int
+mach_port_insert_member(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_name_t pset
+)
+	UNSUPPORTED;
+
+int
+mach_port_peek(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_msg_trailer_type_t trailer_type,
+	mach_port_seqno_t *request_seqnop,
+	mach_msg_size_t *msg_sizep,
+	mach_msg_id_t *msg_idp,
+	mach_msg_trailer_info_t trailer_infop,
+	mach_msg_type_number_t *trailer_infopCnt
+	)
+	UNSUPPORTED;
+
+int
+mach_port_set_context(
+	ipc_space_t space,
+	mach_port_name_t name,
+	mach_vm_address_t context
+	)
+{
+	ipc_port_t port;
+	kern_return_t kr;
+
+	if (space == IS_NULL)
+		return KERN_INVALID_TASK;
+
+	if (!MACH_PORT_NAME_VALID(name))
+		return KERN_INVALID_RIGHT;
+
+	kr = ipc_port_translate_receive(space, name, &port);
+	if (kr != KERN_SUCCESS)
+		return kr;
+
+#ifdef notyet
+	/* port is locked and active */
+	if(port->ip_strict_guard) {
+		uint64_t portguard = port->ip_context;
+		ip_unlock(port);
+		/* For strictly guarded ports, disallow overwriting context; Raise Exception */
+		mach_port_guard_exception(name, context, portguard, kGUARD_EXC_SET_CONTEXT);
+		return KERN_INVALID_ARGUMENT;
+	}
+#endif
+	port->ip_context = context;
+
+	ip_unlock(port);
+	return KERN_SUCCESS;
+}
+
+int
+mach_port_space_basic_info(
+	ipc_space_t task,
+	ipc_info_space_basic_t *basic_info
+	)
+	UNSUPPORTED;
+
+int
+mach_port_unguard(
+	ipc_space_t task,
+	mach_port_name_t name,
+	uint64_t guard
+	)
+	UNSUPPORTED;
+	
+	


Property changes on: trunk/sys/compat/mach/ipc/mach_port.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/kern/ipc_host.c
===================================================================
--- trunk/sys/compat/mach/kern/ipc_host.c	                        (rev 0)
+++ trunk/sys/compat/mach/kern/ipc_host.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,608 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.10.3.1  92/06/24  18:05:09  jeffreyh
+ * 	Initalize host_paging_self for NORMA_IPC
+ * 	Add convert_port_to_host_paging
+ * 	[92/06/17            jeffreyh]
+ * 
+ * Revision 2.10  91/08/03  18:18:50  jsb
+ * 	Removed NORMA hooks.
+ * 	[91/07/17  23:05:10  jsb]
+ * 
+ * Revision 2.9  91/06/25  10:28:20  rpd
+ * 	Changed the convert_foo_to_bar functions
+ * 	to use ipc_port_t instead of mach_port_t.
+ * 	[91/05/27            rpd]
+ * 
+ * Revision 2.8  91/06/17  15:46:59  jsb
+ * 	Renamed NORMA conditionals.
+ * 	[91/06/17  10:49:34  jsb]
+ * 
+ * Revision 2.7  91/06/06  17:06:59  jsb
+ * 	Redid host port initialization under NORMA_IPC.
+ * 	[91/05/13  17:37:21  jsb]
+ * 
+ * Revision 2.6  91/05/14  16:41:36  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.5  91/02/05  17:26:24  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  16:12:32  mrt]
+ * 
+ * Revision 2.4  90/09/09  14:32:08  rpd
+ * 	Don't take out extra references in ipc_pset_init.
+ * 	[90/08/30            rpd]
+ * 
+ * Revision 2.3  90/06/19  22:58:46  rpd
+ * 	Changed convert_port_to_pset_name to allow
+ * 	both IKOT_PSET and IKOT_PSET_NAME ports.
+ * 	Changed convert_port_to_host to allow
+ * 	both IKOT_HOST and IKOT_HOST_PRIV ports.
+ * 	[90/06/18            rpd]
+ * 
+ * 	Fixed bug in convert_processor_to_port.
+ * 	[90/06/16            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:53:59  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  23:46:28  rpd]
+ * 
+ * 	Move includes.
+ * 	[89/08/02            dlb]
+ * 	Remove interrupt protection from pset locks.
+ * 	[89/06/14            dlb]
+ * 	Use port_alloc instead of xxx_port_allocate.
+ * 	[89/02/21            dlb]
+ * 	Reformat includes.
+ * 	[89/01/26            dlb]
+ * 
+ * 	Break processor_set_default into two pieces.
+ * 	[88/12/21            dlb]
+ * 
+ * 	Move host_self, host_priv_self to ipc_ptraps.c
+ * 	Rewrite processor_set_default to return both ports
+ * 	[88/11/30            dlb]
+ * 
+ * 	Created.
+ * 	[88/10/29            dlb]
+ * 
+ * Revision 2.4  89/12/22  15:52:20  rpd
+ * 	Take out extra reference on new processor set ports in
+ * 	ipc_pset_init for reply message; these ports are now
+ * 	returned untranslated.  Assume caller of ipc_pset_disable
+ * 	has pset locked as well as referenced.
+ * 	[89/12/15            dlb]
+ * 
+ * Revision 2.3  89/10/15  02:04:29  rpd
+ * 	Minor cleanups.
+ * 
+ * Revision 2.2  89/10/11  14:07:11  dlb
+ * 	Fix includes.
+ * 	Remove interrupt protection from pset locks.
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ *	kern/ipc_host.c
+ *
+ *	Routines to implement host ports.
+ */
+#include <sys/mach/message.h>
+#include <sys/mach/mach_host_server.h>
+#include <sys/mach/host.h>
+#include <sys/mach/processor.h>
+#include <sys/mach/task.h>
+#include <sys/mach/mach_traps.h>
+#include <sys/mach/thread.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_kobject.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_space.h>
+
+#include <sys/kernel.h>
+
+/*
+ * Forward declarations
+ */
+
+void
+ipc_processor_terminate(
+	processor_t	processor);
+
+void
+ipc_processor_disable(
+	processor_t	processor);
+
+boolean_t
+ref_pset_port_locked(
+	ipc_port_t port, boolean_t matchn, processor_set_t *ppset);
+
+/*
+ *	ipc_host_init: set up various things.
+ */
+
+void ipc_host_init(void)
+{
+	ipc_port_t	port;
+	/*
+	 *	Allocate and set up the two host ports.
+	 */
+	port = ipc_port_alloc_kernel();
+	if (port == IP_NULL)
+		panic("ipc_host_init");
+
+	ipc_kobject_set(port, (ipc_kobject_t) &realhost, IKOT_HOST);
+	realhost.host_self = port;
+
+	port = ipc_port_alloc_kernel();
+	if (port == IP_NULL)
+		panic("ipc_host_init");
+
+	ipc_kobject_set(port, (ipc_kobject_t) &realhost, IKOT_HOST_PRIV);
+	realhost.host_priv_self = port;
+
+	port = ipc_port_alloc_kernel();
+	if (port == IP_NULL)
+		panic("ipc_host_init");
+
+	ipc_kobject_set(port, (ipc_kobject_t) &realhost, IKOT_HOST_SECURITY);
+	realhost.host_security_self = port;
+	/*
+	 *	Set up ipc for default processor set.
+	 */
+	ipc_pset_init(&default_pset);
+	ipc_pset_enable(&default_pset);
+
+#ifdef notyet	
+	/*
+	 *	And for master processor
+	 */
+	ipc_processor_init(master_processor);
+	ipc_processor_enable(master_processor);
+#endif	
+}
+
+/*
+ *	Routine:	mach_host_self [mach trap]
+ *	Purpose:
+ *		Give the caller send rights for his own host port.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_PORT_NULL if there are any resource failures
+ *		or other errors.
+ */
+
+mach_port_name_t
+mach_host_self(void)
+{
+	ipc_port_t sright;
+
+	sright = ipc_port_make_send(realhost.host_self);
+	return ipc_port_copyout_send(sright, current_space());
+}
+
+/*
+ *	ipc_processor_init:
+ *
+ *	Initialize ipc access to processor by allocating port.
+ */
+
+void
+ipc_processor_init(
+	processor_t	processor)
+{
+	ipc_port_t	port;
+
+	port = ipc_port_alloc_kernel();
+	if (port == IP_NULL)
+		panic("ipc_processor_init");
+	processor->processor_self = port;
+}
+
+/*
+ *	ipc_processor_enable:
+ *
+ *	Enable ipc control of processor by setting port object.
+ */
+void
+ipc_processor_enable(
+	processor_t	processor)
+{
+	ipc_port_t	myport;
+
+	myport = processor->processor_self;
+	ipc_kobject_set(myport, (ipc_kobject_t) processor, IKOT_PROCESSOR);
+}
+
+/*
+ *	ipc_pset_init:
+ *
+ *	Initialize ipc control of a processor set by allocating its ports.
+ */
+
+void
+ipc_pset_init(
+	processor_set_t		pset)
+{
+	ipc_port_t	port;
+
+	port = ipc_port_alloc_kernel();
+	if (port == IP_NULL)
+		panic("ipc_pset_init");
+	pset->pset_self = port;
+
+	port = ipc_port_alloc_kernel();
+	if (port == IP_NULL)
+		panic("ipc_pset_init");
+	pset->pset_name_self = port;
+}
+
+/*
+ *	ipc_pset_enable:
+ *
+ *	Enable ipc access to a processor set.
+ */
+void
+ipc_pset_enable(
+	processor_set_t		pset)
+{
+		ipc_kobject_set(pset->pset_self,
+				(ipc_kobject_t) pset, IKOT_PSET);
+		ipc_kobject_set(pset->pset_name_self,
+				(ipc_kobject_t) pset, IKOT_PSET_NAME);
+}
+
+
+/*
+ *	processor_set_default, processor_set_default_priv:
+ *
+ *	Return ports for manipulating default_processor set.  MiG code
+ *	differentiates between these two routines.
+ */
+kern_return_t
+processor_set_default(
+	host_t			host,
+	processor_set_t		*pset)
+{
+	if (host == HOST_NULL)
+		return(KERN_INVALID_ARGUMENT);
+
+	*pset = &default_pset;
+	pset_reference(*pset);
+	return(KERN_SUCCESS);
+}
+
+/*
+ *	Routine:	convert_port_to_host
+ *	Purpose:
+ *		Convert from a port to a host.
+ *		Doesn't consume the port ref; the host produced may be null.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+host_t
+convert_port_to_host(
+	ipc_port_t	port)
+{
+	host_t host = HOST_NULL;
+
+	if (IP_VALID(port)) {
+		ip_lock(port);
+		if (ip_active(port) &&
+		    ((ip_kotype(port) == IKOT_HOST) ||
+		     (ip_kotype(port) == IKOT_HOST_PRIV) 
+		     ))
+			host = (host_t) port->ip_kobject;
+		ip_unlock(port);
+	}
+
+	return host;
+}
+
+/*
+ *	Routine:	convert_port_to_host_priv
+ *	Purpose:
+ *		Convert from a port to a host.
+ *		Doesn't consume the port ref; the host produced may be null.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+host_t
+convert_port_to_host_priv(
+	ipc_port_t	port)
+{
+	host_t host = HOST_NULL;
+
+	if (IP_VALID(port)) {
+		ip_lock(port);
+		if (ip_active(port) &&
+		    (ip_kotype(port) == IKOT_HOST_PRIV))
+			host = (host_t) port->ip_kobject;
+		ip_unlock(port);
+	}
+
+	return host;
+}
+
+/*
+ *	Routine:	convert_port_to_processor
+ *	Purpose:
+ *		Convert from a port to a processor.
+ *		Doesn't consume the port ref;
+ *		the processor produced may be null.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+processor_t
+convert_port_to_processor(
+	ipc_port_t	port)
+{
+	processor_t processor = PROCESSOR_NULL;
+
+	if (IP_VALID(port)) {
+		ip_lock(port);
+		if (ip_active(port) &&
+		    (ip_kotype(port) == IKOT_PROCESSOR))
+			processor = (processor_t) port->ip_kobject;
+		ip_unlock(port);
+	}
+
+	return processor;
+}
+
+/*
+ *	Routine:	convert_port_to_pset
+ *	Purpose:
+ *		Convert from a port to a pset.
+ *		Doesn't consume the port ref; produces a pset ref,
+ *		which may be null.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+processor_set_t
+convert_port_to_pset(
+	ipc_port_t	port)
+{
+	boolean_t r;
+	processor_set_t pset = PROCESSOR_SET_NULL;
+
+	r = FALSE;
+	while (!r && IP_VALID(port)) {
+		ip_lock(port);
+		r = ref_pset_port_locked(port, FALSE, &pset);
+		/* port unlocked */
+	}
+	return pset;
+}
+
+/*
+ *	Routine:	convert_port_to_pset_name
+ *	Purpose:
+ *		Convert from a port to a pset.
+ *		Doesn't consume the port ref; produces a pset ref,
+ *		which may be null.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+processor_set_t
+convert_port_to_pset_name(
+	ipc_port_t	port)
+{
+	boolean_t r;
+	processor_set_t pset = PROCESSOR_SET_NULL;
+
+	r = FALSE;
+	while (!r && IP_VALID(port)) {
+		ip_lock(port);
+		r = ref_pset_port_locked(port, TRUE, &pset);
+		/* port unlocked */
+	}
+	return pset;
+}
+
+boolean_t
+ref_pset_port_locked(ipc_port_t port, boolean_t matchn, processor_set_t *ppset)
+{
+	processor_set_t pset;
+
+	pset = PROCESSOR_SET_NULL;
+	if (ip_active(port) &&
+		((ip_kotype(port) == IKOT_PSET) ||
+		 (matchn && (ip_kotype(port) == IKOT_PSET_NAME)))) {
+		pset = (processor_set_t) port->ip_kobject;
+	}
+	*ppset = pset;
+	ip_unlock(port);
+	return (TRUE);
+}
+
+/*
+ *	Routine:	convert_host_to_port
+ *	Purpose:
+ *		Convert from a host to a port.
+ *		Produces a naked send right which may be invalid.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+ipc_port_t
+convert_host_to_port(
+	host_t		host)
+{
+	ipc_port_t port;
+
+	port = ipc_port_make_send(host->host_self);
+
+	return port;
+}
+
+/*
+ *	Routine:	convert_processor_to_port
+ *	Purpose:
+ *		Convert from a processor to a port.
+ *		Produces a naked send right which may be invalid.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+ipc_port_t
+convert_processor_to_port(
+	processor_t		processor)
+{
+	ipc_port_t port;
+
+	if (processor->processor_self != IP_NULL)
+		port = ipc_port_make_send(processor->processor_self);
+	else
+		port = IP_NULL;
+
+	return port;
+}
+
+/*
+ *	Routine:	convert_pset_to_port
+ *	Purpose:
+ *		Convert from a pset to a port.
+ *		Consumes a pset ref; produces a naked send right
+ *		which may be invalid.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+ipc_port_t
+convert_pset_to_port(
+	processor_set_t		pset)
+{
+	ipc_port_t port;
+
+	pset_lock(pset);
+	if (pset->active)
+		port = ipc_port_make_send(pset->pset_self);
+	else
+		port = IP_NULL;
+	pset_unlock(pset);
+
+	pset_deallocate(pset);
+	return port;
+}
+
+/*
+ *	Routine:	convert_pset_name_to_port
+ *	Purpose:
+ *		Convert from a pset to a port.
+ *		Consumes a pset ref; produces a naked send right
+ *		which may be invalid.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+ipc_port_t
+convert_pset_name_to_port(
+	processor_set_t		pset)
+{
+	ipc_port_t port;
+
+	pset_lock(pset);
+	if (pset->active)
+		port = ipc_port_make_send(pset->pset_name_self);
+	else
+		port = IP_NULL;
+	pset_unlock(pset);
+
+	pset_deallocate(pset);
+	return port;
+}
+
+/*
+ *	Routine:	convert_port_to_host_security
+ *	Purpose:
+ *		Convert from a port to a host security.
+ *		Doesn't consume the port ref; the port produced may be null.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+host_t
+convert_port_to_host_security(
+	ipc_port_t port)
+{
+	host_t host = HOST_NULL;
+
+	if (IP_VALID(port)) {
+		ip_lock(port);
+		if (ip_active(port) &&
+		    (ip_kotype(port) == IKOT_HOST_SECURITY))
+			host = (host_t) port->ip_kobject;
+		ip_unlock(port);
+	}
+
+	return host;
+}
+
+static void
+ipc_host_sysinit(void *arg __unused)
+{
+
+	ipc_host_init();
+}
+
+/* before SI_SUB_INTRINSIC and after SI_SUB_KLD where zones are initialized */
+SYSINIT(ipc_host, SI_SUB_CPU, SI_ORDER_ANY, ipc_host_sysinit, NULL);
+


Property changes on: trunk/sys/compat/mach/kern/ipc_host.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/kern/ipc_tt.c
===================================================================
--- trunk/sys/compat/mach/kern/ipc_tt.c	                        (rev 0)
+++ trunk/sys/compat/mach/kern/ipc_tt.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,1605 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.12  91/06/25  10:28:49  rpd
+ * 	Changed the convert_foo_to_bar functions
+ * 	to use ipc_port_t instead of mach_port_t.
+ * 	[91/05/27            rpd]
+ * 
+ * Revision 2.11  91/06/17  15:47:09  jsb
+ * 	Renamed NORMA conditionals. Moved norma code to norma/kern_task.c.
+ * 	[91/06/17  10:50:57  jsb]
+ * 
+ * Revision 2.10  91/06/06  17:07:15  jsb
+ * 	NORMA_TASK support.
+ * 	[91/05/14  09:17:09  jsb]
+ * 
+ * Revision 2.9  91/05/14  16:42:54  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.8  91/03/16  14:50:24  rpd
+ * 	Removed ith_saved.
+ * 	[91/02/16            rpd]
+ * 
+ * Revision 2.7  91/02/05  17:27:08  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  16:13:42  mrt]
+ * 
+ * Revision 2.6  91/01/08  15:16:05  rpd
+ * 	Added retrieve_task_self_fast, retrieve_thread_self_fast.
+ * 	[90/12/27            rpd]
+ * 
+ * Revision 2.5  90/11/05  14:31:08  rpd
+ * 	Changed ip_reference to ipc_port_reference.
+ * 	Use new ip_reference and ip_release.
+ * 	[90/10/29            rpd]
+ * 
+ * Revision 2.4  90/06/02  14:54:33  rpd
+ * 	Converted to new IPC.
+ * 	[90/03/26  22:05:07  rpd]
+ * 
+ *
+ * Condensed history:
+ *	Modified for pure kernel (dbg).
+ *	Support thread_exception_abort (dlb).
+ *	Added kernel monitor support (tfl).
+ *	Added task/thread kernel port interposing (rpd).
+ *	Improvements/fixes for task_secure (rpd).
+ * 	New translation cache (rpd).
+ *	Move old stuff under MACH_IPC_XXXHACK (rpd).
+ *	Created from mach_ipc.c (rpd).
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ * File:	ipc_tt.c
+ * Purpose:
+ *	Task and thread related IPC functions.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/syslog.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/mach_param.h>
+#include <sys/mach/task_special_ports.h>
+#include <sys/mach/thread_special_ports.h>
+#include <sys/mach/thread_status.h>
+#include <sys/mach/exception.h>
+#if 0
+#include <sys/mach/mach_traps.h>
+#include <sys/mach/mach_server.h>
+#endif
+#include <sys/mach/mach_host_server.h>
+#include <sys/mach/ipc_tt.h>
+#if 0
+#include <kern/thread_act.h>
+#include <kern/misc_protos.h>
+#endif
+#include <sys/mach/host_special_ports.h>
+#include <sys/mach/host.h>
+#include <sys/mach/thread.h>
+#include <sys/mach/mach_init.h>
+#include <sys/mach/task_server.h>
+#include <sys/mach/host_priv_server.h>
+
+#define THR_ACT_NULL NULL
+
+
+
+/*
+ *	Routine:	ipc_task_init
+ *	Purpose:
+ *		Initialize a task's IPC state.
+ *
+ *		If non-null, some state will be inherited from the parent.
+ *		The parent must be appropriately initialized.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_task_init(
+	task_t		task,
+	task_t		parent)
+{
+	ipc_space_t space;
+	ipc_port_t kport;
+	kern_return_t kr;
+	int i;
+
+
+	kr = ipc_space_create(&ipc_table_entries[0], &space);
+	if (kr != KERN_SUCCESS)
+		panic("ipc_task_init");
+
+
+	kport = ipc_port_alloc_kernel();
+	if (kport == IP_NULL)
+		panic("ipc_task_init");
+
+	task->itk_self = kport;
+	task->itk_sself = ipc_port_make_send(kport);
+	task->itk_space = space;
+	space->is_task = task;
+
+	if (parent == TASK_NULL) {
+		for (i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++) {
+			task->exc_actions[i].port = IP_NULL;
+		}/* for */
+		task->exc_actions[EXC_MACH_SYSCALL].port = 
+			ipc_port_make_send(realhost.host_self);
+		task->itk_bootstrap = IP_NULL;
+		for (i = 0; i < TASK_PORT_REGISTER_MAX; i++)
+			task->itk_registered[i] = IP_NULL;
+	} else {
+		itk_lock(parent);
+		assert(parent->itk_self != IP_NULL);
+
+		/* inherit registered ports */
+
+		for (i = 0; i < TASK_PORT_REGISTER_MAX; i++)
+			task->itk_registered[i] =
+				ipc_port_copy_send(parent->itk_registered[i]);
+
+		/* inherit exception and bootstrap ports */
+
+		for (i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++) {
+		    task->exc_actions[i].port =
+		  		ipc_port_copy_send(parent->exc_actions[i].port);
+		    task->exc_actions[i].flavor =
+				parent->exc_actions[i].flavor;
+		    task->exc_actions[i].behavior = 
+				parent->exc_actions[i].behavior;
+		}/* for */
+		task->itk_bootstrap =
+			ipc_port_copy_send(parent->itk_bootstrap);
+
+		itk_unlock(parent);
+	}
+}
+
+/*
+ *	Routine:	ipc_task_enable
+ *	Purpose:
+ *		Enable a task for IPC access.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_task_enable(
+	task_t		task)
+{
+	ipc_port_t kport;
+
+	itk_lock(task);
+	kport = task->itk_self;
+	if (kport != IP_NULL)
+		ipc_kobject_set(kport, (ipc_kobject_t) task, IKOT_TASK);
+	itk_unlock(task);
+}
+
+/*
+ *	Routine:	ipc_task_disable
+ *	Purpose:
+ *		Disable IPC access to a task.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_task_disable(
+	task_t		task)
+{
+	ipc_port_t kport;
+
+	itk_lock(task);
+	kport = task->itk_self;
+	if (kport != IP_NULL)
+		ipc_kobject_set(kport, IKO_NULL, IKOT_NONE);
+	itk_unlock(task);
+}
+
+/*
+ *	Routine:	ipc_task_terminate
+ *	Purpose:
+ *		Clean up and destroy a task's IPC state.
+ *	Conditions:
+ *		Nothing locked.  The task must be suspended.
+ *		(Or the current thread must be in the task.)
+ */
+
+void
+ipc_task_terminate(
+	task_t		task)
+{
+	ipc_port_t kport;
+	int i;
+
+	itk_lock(task);
+	kport = task->itk_self;
+
+	if (kport == IP_NULL) {
+		/* the task is already terminated (can this happen?) */
+		itk_unlock(task);
+		return;
+	}
+
+	task->itk_self = IP_NULL;
+	itk_unlock(task);
+
+	/* release the naked send rights */
+
+	if (IP_VALID(task->itk_sself))
+		ipc_port_release_send(task->itk_sself);
+
+	for (i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++) {
+		if (IP_VALID(task->exc_actions[i].port)) {
+			ipc_port_release_send(task->exc_actions[i].port);
+		}
+	}/* for */
+	if (IP_VALID(task->itk_bootstrap))
+		ipc_port_release_send(task->itk_bootstrap);
+
+	for (i = 0; i < TASK_PORT_REGISTER_MAX; i++)
+		if (IP_VALID(task->itk_registered[i]))
+			ipc_port_release_send(task->itk_registered[i]);
+
+	/* destroy the space, leaving just a reference for it */
+
+	if (!task->kernel_loaded)
+		ipc_space_destroy(task->itk_space);
+
+	/* destroy the kernel port */
+
+	ipc_port_dealloc_kernel(kport);
+}
+
+/*
+ *	Routine:	ipc_thread_init
+ *	Purpose:
+ *		Initialize a thread's IPC state.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_thread_init(
+	thread_t	thread)
+{
+	ipc_thread_links_init(thread);
+	ipc_kmsg_queue_init(&thread->ith_messages);
+	thread->ith_mig_reply = MACH_PORT_NULL;
+	thread->ith_rpc_reply = IP_NULL;
+}
+
+/*
+ *	Routine:	ipc_thread_terminate
+ *	Purpose:
+ *		Clean up and destroy a thread's IPC state.
+ *	Conditions:
+ *		Nothing locked.  The thread must be suspended.
+ *		(Or be the current thread.)
+ */
+
+void
+ipc_thread_terminate(
+	thread_t	thread)
+{
+	assert(ipc_kmsg_queue_empty(&thread->ith_messages));
+
+        if (thread->ith_rpc_reply != IP_NULL)
+            ipc_port_dealloc_reply(thread->ith_rpc_reply);
+	thread->ith_rpc_reply = IP_NULL;
+}
+
+/*
+ *	Routine:	ipc_thr_act_init
+ *	Purpose:
+ *		Initialize an thr_act's IPC state.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+ipc_thr_act_init(thread_act_t thr_act)
+{
+	ipc_port_t kport; int i;
+
+	kport = ipc_port_alloc_kernel();
+	if (kport == IP_NULL)
+		panic("ipc_thr_act_init");
+
+	thr_act->ith_self = kport;
+	thr_act->ith_sself = ipc_port_make_send(kport);
+
+	for (i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++)
+		thr_act->exc_actions[i].port = IP_NULL;
+
+	thr_act->exc_actions[EXC_MACH_SYSCALL].port =
+					ipc_port_make_send(realhost.host_self);
+
+	ipc_kobject_set(kport, (ipc_kobject_t) thr_act, IKOT_ACT);
+}
+
+#if 0
+
+void
+ipc_thr_act_disable(thread_act_t thr_act)
+{
+	int i;
+	ipc_port_t kport;
+
+	act_lock(thr_act);
+	kport = thr_act->ith_self;
+
+	if (kport != IP_NULL)
+		ipc_kobject_set(kport, IKO_NULL, IKOT_NONE);
+	act_unlock(thr_act);
+}
+
+
+void
+ipc_thr_act_disable_act_locked(thread_act_t thr_act)
+{
+	int i;
+	ipc_port_t kport;
+
+	kport = thr_act->ith_self;
+
+	if (kport != IP_NULL)
+		ipc_kobject_set(kport, IKO_NULL, IKOT_NONE);
+}
+#endif
+
+void
+ipc_thr_act_terminate(thread_act_t thr_act)
+{
+	ipc_port_t kport; int i;
+
+	act_lock(thr_act);
+	kport = thr_act->ith_self;
+
+	if (kport == IP_NULL) {
+		/* the thread is already terminated (can this happen?) */
+		act_unlock(thr_act);
+		return;
+	}
+
+	thr_act->ith_self = IP_NULL;
+	act_unlock(thr_act);
+
+	/* release the naked send rights */
+
+	if (IP_VALID(thr_act->ith_sself))
+		ipc_port_release_send(thr_act->ith_sself);
+	for (i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++) {
+	    if (IP_VALID(thr_act->exc_actions[i].port))
+		ipc_port_release_send(thr_act->exc_actions[i].port);
+	}
+
+	/* destroy the kernel port */
+	ipc_port_dealloc_kernel(kport);
+}
+
+
+/*
+ *	Routine:	retrieve_task_self_fast
+ *	Purpose:
+ *		Optimized version of retrieve_task_self,
+ *		that only works for the current task.
+ *
+ *		Return a send right (possibly null/dead)
+ *		for the task's user-visible self port.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+ipc_port_t
+retrieve_task_self_fast(
+	register task_t		task)
+{
+	register ipc_port_t port;
+
+	assert(task == current_task());
+
+	itk_lock(task);
+	assert(task->itk_self != IP_NULL);
+
+	if ((port = task->itk_sself) == task->itk_self) {
+		/* no interposing */
+		itk_unlock(task);
+		ip_lock(port);
+		assert(ip_active(port));
+		ip_reference(port);
+		port->ip_srights++;
+		ip_unlock(port);
+	} else {
+		itk_unlock(task);
+		port = ipc_port_copy_send(port);
+	}
+
+	return (port);
+}
+
+/*
+ *	Routine:	retrieve_act_self_fast
+ *	Purpose:
+ *		Optimized version of retrieve_thread_self,
+ *		that only works for the current thread.
+ *
+ *		Return a send right (possibly null/dead)
+ *		for the thread's user-visible self port.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+ipc_port_t
+retrieve_thread_self_fast(thread_t thr_act)
+{
+	register ipc_port_t port;
+
+	assert(thr_act == current_act());
+	act_lock(thr_act);
+	assert(thr_act->ith_self != IP_NULL);
+
+	if ((port = thr_act->ith_sself) == thr_act->ith_self) {
+		/* no interposing */
+
+		ip_lock(port);
+		assert(ip_active(port));
+		ip_reference(port);
+		port->ip_srights++;
+		ip_unlock(port);
+	} else
+		port = ipc_port_copy_send(port);
+	act_unlock(thr_act);
+
+	return port;
+}
+
+/*
+ *	Routine:	mach_task_self [mach trap]
+ *	Purpose:
+ *		Give the caller send rights for his own task port.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_PORT_NULL if there are any resource failures
+ *		or other errors.
+ */
+
+mach_port_name_t
+mach_task_self(void)
+{
+	task_t task = current_task();
+	ipc_space_t space = current_space();
+	ipc_port_t sright;
+
+	sright = retrieve_task_self_fast(task);
+	return ipc_port_copyout_send(sright, space);
+}
+
+/*
+ *	Routine:	mach_thread_self [mach trap]
+ *	Purpose:
+ *		Give the caller send rights for his own thread port.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_PORT_NULL if there are any resource failures
+ *		or other errors.
+ */
+
+mach_port_name_t
+mach_thread_self(void)
+{
+	thread_t thr_act = current_thread();
+	ipc_space_t space = current_space();
+	ipc_port_t sright;
+
+	sright = retrieve_thread_self_fast(thr_act);
+	return ipc_port_copyout_send(sright, space);
+}
+
+/*
+ *	Routine:	mach_reply_port [mach trap]
+ *	Purpose:
+ *		Allocate a port for the caller.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		MACH_PORT_NULL if there are any resource failures
+ *		or other errors.
+ */
+
+mach_port_name_t
+mach_reply_port(void)
+{
+	ipc_port_t port;
+	mach_port_name_t name;
+	kern_return_t kr;
+
+	kr = ipc_port_alloc(current_task()->itk_space, &name, &port);
+	if (kr == KERN_SUCCESS)
+		ip_unlock(port);
+	else
+		name = MACH_PORT_NAME_NULL;
+
+	return name;
+}
+
+/*
+ *	Routine:	task_get_special_port [kernel call]
+ *	Purpose:
+ *		Clones a send right for one of the task's
+ *		special ports.
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Extracted a send right.
+ *		KERN_INVALID_ARGUMENT	The task is null.
+ *		KERN_FAILURE		The task/space is dead.
+ *		KERN_INVALID_ARGUMENT	Invalid special port.
+ */
+
+kern_return_t
+task_get_special_port(
+	task_t		task,
+	int		which,
+	ipc_port_t	*portp)
+{
+	ipc_port_t port;
+
+	if (task == TASK_NULL)
+		return KERN_INVALID_ARGUMENT;
+
+	switch (which) {
+	case TASK_KERNEL_PORT:
+		port = ipc_port_copy_send(task->itk_sself);
+		break;
+
+	    case TASK_NAME_PORT:
+		port = ipc_port_make_send(task->itk_nself);
+		break;
+
+	    case TASK_HOST_PORT:
+		port = ipc_port_copy_send(task->itk_host);
+		break;
+
+	    case TASK_BOOTSTRAP_PORT:
+			port = ipc_port_copy_send(task->itk_bootstrap);
+		break;
+
+	    case TASK_SEATBELT_PORT:
+		port = ipc_port_copy_send(task->itk_seatbelt);
+		break;
+
+	    case TASK_ACCESS_PORT:
+		port = ipc_port_copy_send(task->itk_task_access);
+		break;
+
+		case TASK_DEBUG_CONTROL_PORT:
+		port = ipc_port_copy_send(task->itk_debug_control);
+		break;
+	    default:
+		return KERN_INVALID_ARGUMENT;
+	}
+
+	*portp = port;
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	task_set_special_port [kernel call]
+ *	Purpose:
+ *		Changes one of the task's special ports,
+ *		setting it to the supplied send right.
+ *	Conditions:
+ *		Nothing locked.  If successful, consumes
+ *		the supplied send right.
+ *	Returns:
+ *		KERN_SUCCESS		Changed the special port.
+ *		KERN_INVALID_ARGUMENT	The task is null.
+ *		KERN_FAILURE		The task/space is dead.
+ *		KERN_INVALID_ARGUMENT	Invalid special port.
+ */
+
+kern_return_t
+task_set_special_port(
+	task_t		task,
+	int		which,
+	ipc_port_t	port)
+{
+	ipc_port_t *whichp;
+	ipc_port_t old;
+
+#if VERBOSE_DEBUGGING
+	printf("task_set_special_port(task=%p, which=%d, port=%p)\n",task, which, port);
+#endif
+	/* we only support the current task */
+	if (task == TASK_NULL)
+		return KERN_INVALID_ARGUMENT;
+
+	switch (which) {
+	case TASK_KERNEL_PORT:
+		whichp = &task->itk_sself;
+		break;
+	case TASK_HOST_PORT:
+		whichp = &task->itk_host;
+		break;
+	case TASK_BOOTSTRAP_PORT:
+		whichp = &task->itk_bootstrap;
+		break;
+	case TASK_SEATBELT_PORT:
+		whichp = &task->itk_seatbelt;
+		break;
+	case TASK_ACCESS_PORT:
+		whichp = &task->itk_task_access;
+		break;
+	case TASK_DEBUG_CONTROL_PORT: 
+		whichp = &task->itk_debug_control;
+		break;
+	default:
+		return KERN_INVALID_ARGUMENT;
+	}/* switch */
+
+	if ((TASK_SEATBELT_PORT == which  || TASK_ACCESS_PORT == which) 
+		&& IP_VALID(*whichp)) {
+			itk_unlock(task);
+			return KERN_NO_ACCESS;
+	}
+	itk_lock(task);
+	if (task->itk_self == IP_NULL) {
+		itk_unlock(task);
+		return KERN_FAILURE;
+	}
+
+	old = *whichp;
+	*whichp = port;
+	itk_unlock(task);
+
+	if (IP_VALID(old))
+		ipc_port_release_send(old);
+	return KERN_SUCCESS;
+}
+
+
+/*
+ *	Routine:	mach_ports_register [kernel call]
+ *	Purpose:
+ *		Stash a handful of port send rights in the task.
+ *		Child tasks will inherit these rights, but they
+ *		must use mach_ports_lookup to acquire them.
+ *
+ *		The rights are supplied in a (wired) kalloc'd segment.
+ *		Rights which aren't supplied are assumed to be null.
+ *	Conditions:
+ *		Nothing locked.  If successful, consumes
+ *		the supplied rights and memory.
+ *	Returns:
+ *		KERN_SUCCESS		Stashed the port rights.
+ *		KERN_INVALID_ARGUMENT	The task is null.
+ *		KERN_INVALID_ARGUMENT	The task is dead.
+ *		KERN_INVALID_ARGUMENT	Too many port rights supplied.
+ */
+
+kern_return_t
+mach_ports_register(
+	task_t			task,
+	mach_port_array_t	memory,
+	mach_msg_type_number_t	portsCnt)
+{
+	ipc_port_t ports[TASK_PORT_REGISTER_MAX];
+	int i;
+
+	if ((task == TASK_NULL) ||
+	    (portsCnt > TASK_PORT_REGISTER_MAX))
+		return KERN_INVALID_ARGUMENT;
+
+	/*
+	 *	Pad the port rights with nulls.
+	 */
+
+	for (i = 0; i < portsCnt; i++)
+		ports[i] = (ipc_port_t) memory[i];
+	for (; i < TASK_PORT_REGISTER_MAX; i++)
+		ports[i] = IP_NULL;
+
+	itk_lock(task);
+	if (task->itk_self == IP_NULL) {
+		itk_unlock(task);
+		return KERN_INVALID_ARGUMENT;
+	}
+
+	/*
+	 *	Replace the old send rights with the new.
+	 *	Release the old rights after unlocking.
+	 */
+
+	for (i = 0; i < TASK_PORT_REGISTER_MAX; i++) {
+		ipc_port_t old;
+
+		old = task->itk_registered[i];
+		task->itk_registered[i] = ports[i];
+		ports[i] = old;
+	}
+
+	itk_unlock(task);
+
+	for (i = 0; i < TASK_PORT_REGISTER_MAX; i++)
+		if (IP_VALID(ports[i]))
+			ipc_port_release_send(ports[i]);
+
+	/*
+	 *	Now that the operation is known to be successful,
+	 *	we can free the memory.
+	 */
+
+	if (portsCnt != 0)
+		kfree((vm_offset_t) memory,
+		      (vm_size_t) (portsCnt * sizeof(mach_port_t)));
+
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	mach_ports_lookup [kernel call]
+ *	Purpose:
+ *		Retrieves (clones) the stashed port send rights.
+ *	Conditions:
+ *		Nothing locked.  If successful, the caller gets
+ *		rights and memory.
+ *	Returns:
+ *		KERN_SUCCESS		Retrieved the send rights.
+ *		KERN_INVALID_ARGUMENT	The task is null.
+ *		KERN_INVALID_ARGUMENT	The task is dead.
+ *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
+ */
+
+kern_return_t
+mach_ports_lookup(
+	task_t			task,
+	mach_port_array_t	*portsp,
+	mach_msg_type_number_t	*portsCnt)
+{
+	vm_offset_t memory;
+	vm_size_t size;
+	ipc_port_t *ports;
+	int i;
+
+	if (task == TASK_NULL)
+		return KERN_INVALID_ARGUMENT;
+
+	size = (vm_size_t) (TASK_PORT_REGISTER_MAX * sizeof(ipc_port_t));
+
+	memory = KALLOC(size, rt);
+	if (memory == 0)
+		return KERN_RESOURCE_SHORTAGE;
+
+	itk_lock(task);
+	if (task->itk_self == IP_NULL) {
+		itk_unlock(task);
+
+		KFREE(memory, size, rt);
+		return KERN_INVALID_ARGUMENT;
+	}
+
+	ports = (ipc_port_t *) memory;
+
+	/*
+	 *	Clone port rights.  Because kalloc'd memory
+	 *	is wired, we won't fault while holding the task lock.
+	 */
+
+	for (i = 0; i < TASK_PORT_REGISTER_MAX; i++)
+		ports[i] = ipc_port_copy_send(task->itk_registered[i]);
+
+	itk_unlock(task);
+
+	*portsp = (mach_port_array_t) ports;
+	*portsCnt = TASK_PORT_REGISTER_MAX;
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	convert_port_to_task
+ *	Purpose:
+ *		Convert from a port to a task.
+ *		Doesn't consume the port ref; produces a task ref,
+ *		which may be null.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+task_t
+convert_port_to_task(
+	ipc_port_t	port)
+{
+	boolean_t r;
+	task_t task = TASK_NULL;
+
+	/* currently only handle current task */
+	return (current_task());
+
+	r = FALSE;
+	while (!r && IP_VALID(port)) {
+		ip_lock(port);
+		r = ref_task_port_locked(port, &task);
+		/* port unlocked */
+	}
+
+	return task;
+}
+
+boolean_t
+ref_task_port_locked( ipc_port_t port, task_t *ptask )
+{
+	task_t task;
+
+	task = TASK_NULL;
+	if (ip_active(port) &&
+		(ip_kotype(port) == IKOT_TASK)) {
+		task = (task_t) port->ip_kobject;
+		assert(task != TASK_NULL);
+
+		/*
+		 * Normal lock ordering puts task_lock() before ip_lock().
+		 * Allow out-of-order locking here, inlining
+		 * task_reference() to accomodate it.
+		 */
+		if (!task_lock_try(task)) {
+			ip_unlock(port);
+			return (FALSE);
+		}
+		task->ref_count++;
+		task_unlock(task);
+	}
+	*ptask = task;
+	ip_unlock(port);
+	return (TRUE);
+}
+
+/*
+ *	Routine:	convert_port_to_space
+ *	Purpose:
+ *		Convert from a port to a space.
+ *		Doesn't consume the port ref; produces a space ref,
+ *		which may be null.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+ipc_space_t
+convert_port_to_space(
+	ipc_port_t	port)
+{
+	boolean_t r;
+	ipc_space_t space = IS_NULL;
+
+	r = FALSE;
+	while (!r && IP_VALID(port)) {
+		ip_lock(port);
+		r = ref_space_port_locked(port, &space);
+		/* port unlocked */
+	}
+	return space;
+}
+
+boolean_t
+ref_space_port_locked( ipc_port_t port, ipc_space_t *pspace )
+{
+	ipc_space_t space;
+
+	space = IS_NULL;
+	if (ip_active(port) &&
+		(ip_kotype(port) == IKOT_TASK)) {
+		space = ((task_t) port->ip_kobject)->itk_space;
+
+		/*
+		 * Normal lock ordering puts ipc_space lock before
+		 * ip_lock(). Allow out-of-order locking here, inlining
+		 * is_reference() to accomodate it.
+		 */
+		if (!mtx_trylock(&space->is_ref_lock_data)) {
+			ip_unlock(port);
+			return (FALSE);
+		}
+		space->is_references++;
+		mtx_unlock(&space->is_ref_lock_data);
+	}
+	*pspace = space;
+	ip_unlock(port);
+	return (TRUE);
+}
+
+/*
+ *	Routine:	convert_port_to_map
+ *	Purpose:
+ *		Convert from a port to a map.
+ *		Doesn't consume the port ref; produces a map ref,
+ *		which may be null.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+vm_map_t
+convert_port_to_map(
+	ipc_port_t	port)
+{
+	task_t task;
+	vm_map_t map;
+
+	task = convert_port_to_task(port);
+
+	if (task == TASK_NULL)
+		return VM_MAP_NULL;
+
+	map = &task->itk_p->p_vmspace->vm_map;
+	task_deallocate(task);
+	return (map);
+}
+
+static boolean_t
+ref_act_port_locked( ipc_port_t port, thread_act_t *pthr_act )
+{
+	thread_act_t thr_act;
+
+	thr_act = 0;
+	if (ip_active(port) &&
+		(ip_kotype(port) == IKOT_ACT)) {
+		thr_act = (thread_act_t) port->ip_kobject;
+		assert(thr_act != THR_ACT_NULL);
+
+		/*
+		 * Normal lock ordering is act_lock(), then ip_lock().
+		 * Allow out-of-order locking here, using
+		 * act_reference_act_locked() to accomodate it.
+		 */
+		if (!act_lock_try(thr_act)) {
+			ip_unlock(port);
+			return (FALSE);
+		}
+		act_locked_act_reference(thr_act);
+		act_unlock(thr_act);
+	}
+	*pthr_act = thr_act;
+	ip_unlock(port);
+	return (TRUE);
+}
+
+/*
+ *	Routine:	convert_port_to_act
+ *	Purpose:
+ *		Convert from a port to a thr_act.
+ *		Doesn't consume the port ref; produces an thr_act ref,
+ *		which may be null.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+thread_act_t
+convert_port_to_thread( ipc_port_t port )
+{
+	boolean_t r;
+	thread_act_t thr_act = 0;
+
+	r = FALSE;
+	while (!r && IP_VALID(port)) {
+		ip_lock(port);
+		r = ref_act_port_locked(port, &thr_act);
+		/* port unlocked */
+	}
+	return (thr_act);
+}
+
+/*
+ *	Routine:	convert_task_to_port
+ *	Purpose:
+ *		Convert from a task to a port.
+ *		Consumes a task ref; produces a naked send right
+ *		which may be invalid.  
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+ipc_port_t
+convert_task_to_port(
+	task_t		task)
+{
+	ipc_port_t port;
+
+	itk_lock(task);
+	if (task->itk_self != IP_NULL)
+		port = ipc_port_make_send(task->itk_self);
+	else
+		port = IP_NULL;
+	itk_unlock(task);
+
+	task_deallocate(task);
+	return port;
+}
+
+/*
+ *	Routine:	convert_act_to_port
+ *	Purpose:
+ *		Convert from a thr_act to a port.
+ *		Consumes an thr_act ref; produces a naked send right
+ *		which may be invalid.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+ipc_port_t
+convert_thread_to_port(thread_t thr_act)
+{
+	ipc_port_t port;
+
+	act_lock(thr_act);
+	if (thr_act->ith_self != IP_NULL)
+		port = ipc_port_make_send(thr_act->ith_self);
+	else
+		port = IP_NULL;
+	act_unlock(thr_act);
+
+	act_deallocate(thr_act);
+	return port;
+}
+
+/*
+ *	Routine:	space_deallocate
+ *	Purpose:
+ *		Deallocate a space ref produced by convert_port_to_space.
+ *	Conditions:
+ *		Nothing locked.
+ */
+
+void
+space_deallocate(
+	ipc_space_t	space)
+{
+	if (space != IS_NULL)
+		is_release(space);
+}
+
+/*
+ *	Routine:	host/task_set_exception_ports [kernel call]
+ *	Purpose:
+ *			Sets the host/task exception port, flavor and
+ *			behavior for the exception types specified by the mask.
+ *			There will be one send right per exception per valid
+ *			port.
+ *	Conditions:
+ *		Nothing locked.  If successful, consumes
+ *		the supplied send right.
+ *	Returns:
+ *		KERN_SUCCESS		Changed the special port.
+ *		KERN_INVALID_ARGUMENT	The thread is null,
+ *					Illegal mask bit set.
+ *					Illegal exception behavior
+ *		KERN_FAILURE		The thread is dead.
+ */
+
+kern_return_t
+host_set_exception_ports(
+	host_t		 	host,
+	exception_mask_t		exception_mask,
+	ipc_port_t			new_port,
+	exception_behavior_t		new_behavior,
+	thread_state_flavor_t		new_flavor)
+{
+	register int	i;
+	ipc_port_t	old_port[EXC_TYPES_COUNT];
+
+	if (!host)
+		return KERN_INVALID_ARGUMENT;
+
+	if (exception_mask & ~EXC_MASK_ALL)
+		return KERN_INVALID_ARGUMENT;
+
+	if (IP_VALID(new_port)) {
+		switch (new_behavior) {
+		case EXCEPTION_DEFAULT:
+		case EXCEPTION_STATE:
+		case EXCEPTION_STATE_IDENTITY:
+			break;
+		default:
+			return KERN_INVALID_ARGUMENT;
+		}
+	}
+	/* Cannot easily check "flavor", but that just means that the flavor
+	 * in the generated exception message might be garbage. GIGO */
+
+	host_lock(host);
+
+	for (i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++) {
+		if (exception_mask & (1 << i)) {
+			old_port[i] = host->exc_actions[i].port;
+			host->exc_actions[i].port =
+				ipc_port_copy_send(new_port);
+			host->exc_actions[i].behavior = new_behavior;
+			host->exc_actions[i].flavor = new_flavor;
+		} else
+			old_port[i] = IP_NULL;
+	}/* for */
+	/*
+	 * Consume send rights without any lock held.
+	 */
+	host_unlock(host);
+	for (i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++)
+		if (IP_VALID(old_port[i]))
+			ipc_port_release_send(old_port[i]);
+	if (IP_VALID(new_port))		 /* consume send right */
+		ipc_port_release_send(new_port);
+
+        return KERN_SUCCESS;
+}/* thread_set_exception_port */
+
+kern_return_t
+task_set_exception_ports(
+	task_t				task,
+	exception_mask_t		exception_mask,
+	ipc_port_t			new_port,
+	exception_behavior_t		new_behavior,
+	thread_state_flavor_t		new_flavor)
+{
+	register int	i;
+	ipc_port_t	old_port[EXC_TYPES_COUNT];
+
+	if (task == TASK_NULL) {
+		return KERN_INVALID_ARGUMENT;
+	}
+
+	if (exception_mask & ~EXC_MASK_ALL) {
+		return KERN_INVALID_ARGUMENT;
+	}
+
+	if (IP_VALID(new_port)) {
+		switch (new_behavior) {
+		case EXCEPTION_DEFAULT:
+		case EXCEPTION_STATE:
+		case EXCEPTION_STATE_IDENTITY:
+			break;
+		default:
+			return KERN_INVALID_ARGUMENT;
+		}
+	}
+	/* Cannot easily check "new_flavor", but that just means that
+	 * the flavor in the generated exception message might be garbage:
+	 * GIGO */
+
+        itk_lock(task);
+        if (task->itk_self == IP_NULL) {
+                itk_unlock(task);
+                return KERN_FAILURE;
+        }
+
+	for (i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++) {
+		if (exception_mask & (1 << i)) {
+			old_port[i] = task->exc_actions[i].port;
+			task->exc_actions[i].port =
+				ipc_port_copy_send(new_port);
+			task->exc_actions[i].behavior = new_behavior;
+			task->exc_actions[i].flavor = new_flavor;
+		} else
+			old_port[i] = IP_NULL;
+	}/* for */
+
+	/*
+	 * Consume send rights without any lock held.
+	 */
+        itk_unlock(task);
+	for (i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++)
+		if (IP_VALID(old_port[i]))
+			ipc_port_release_send(old_port[i]);
+	if (IP_VALID(new_port))		 /* consume send right */
+		ipc_port_release_send(new_port);
+
+        return KERN_SUCCESS;
+}/* task_set_exception_port */
+
+/*
+ *	Routine:	host/task_swap_exception_ports [kernel call]
+ *	Purpose:
+ *			Sets the thread/task exception port, flavor and
+ *			behavior for the exception types specified by the
+ *			mask.
+ *
+ *			The old ports, behavior and flavors are returned
+ *			Count specifies the array sizes on input and
+ *			the number of returned ports etc. on output.  The
+ *			arrays must be large enough to hold all the returned
+ *			data, MIG returnes an error otherwise.  The masks
+ *			array specifies the corresponding exception type(s).
+ *
+ *	Conditions:
+ *		Nothing locked.  If successful, consumes
+ *		the supplied send right.
+ *
+ *		Returns upto [in} CountCnt elements.
+ *	Returns:
+ *		KERN_SUCCESS		Changed the special port.
+ *		KERN_INVALID_ARGUMENT	The thread is null,
+ *					Illegal mask bit set.
+ *					Illegal exception behavior
+ *		KERN_FAILURE		The thread is dead.
+ */
+
+kern_return_t
+host_swap_exception_ports(
+	host_t			host,
+	exception_mask_t		exception_mask,
+	ipc_port_t			new_port,
+	exception_behavior_t		new_behavior,
+	thread_state_flavor_t		new_flavor,
+	exception_mask_array_t		masks,
+	mach_msg_type_number_t		* CountCnt,
+	exception_port_array_t		ports,
+	exception_behavior_array_t      behaviors,
+	thread_state_flavor_array_t     flavors	)
+{
+	register int	i,
+			j,
+			count;
+	ipc_port_t	old_port[EXC_TYPES_COUNT];
+
+	if (!host)
+		return KERN_INVALID_ARGUMENT;
+
+	if (exception_mask & ~EXC_MASK_ALL) {
+		return KERN_INVALID_ARGUMENT;
+	}
+
+	if (IP_VALID(new_port)) {
+		switch (new_behavior) {
+		case EXCEPTION_DEFAULT:
+		case EXCEPTION_STATE:
+		case EXCEPTION_STATE_IDENTITY:
+			break;
+		default:
+			return KERN_INVALID_ARGUMENT;
+		}
+	}
+	/* Cannot easily check "new_flavor", but that just means that
+	 * the flavor in the generated exception message might be garbage:
+	 * GIGO */
+
+	host_lock(host);
+	for (count = 0, i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++) {
+		if (exception_mask & (1 << i)) {
+			for (j = 0; j < count; j++) {
+/*
+ *				search for an identical entry, if found
+ *				set corresponding mask for this exception.
+ */
+				if (host->exc_actions[i].port == ports[j] &&
+				  host->exc_actions[i].behavior ==behaviors[j]
+				  && host->exc_actions[i].flavor ==flavors[j])
+				{
+					masks[j] |= (1 << i);
+					break;
+				}
+			}/* for */
+			if (j == count) {
+				masks[j] = (1 << i);
+				ports[j] =
+				ipc_port_copy_send(host->exc_actions[i].port);
+
+				behaviors[j] = host->exc_actions[i].behavior;
+				flavors[j] = host->exc_actions[i].flavor;
+				count++;
+			}
+
+			old_port[i] = host->exc_actions[i].port;
+			host->exc_actions[i].port =
+				ipc_port_copy_send(new_port);
+			host->exc_actions[i].behavior = new_behavior;
+			host->exc_actions[i].flavor = new_flavor;
+			if (count > *CountCnt) {
+				break;
+			}
+		} else
+			old_port[i] = IP_NULL;
+	}/* for */
+
+	/*
+	 * Consume send rights without any lock held.
+	 */
+	host_unlock(host);
+	for (i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++)
+		if (IP_VALID(old_port[i]))
+			ipc_port_release_send(old_port[i]);
+	if (IP_VALID(new_port))		 /* consume send right */
+		ipc_port_release_send(new_port);
+	*CountCnt = count;
+	return KERN_SUCCESS;
+}/* thread_swap_exception_ports */
+
+kern_return_t
+task_swap_exception_ports(
+	task_t				task,
+	exception_mask_t		exception_mask,
+	ipc_port_t			new_port,
+	exception_behavior_t		new_behavior,
+	thread_state_flavor_t		new_flavor,
+	exception_mask_array_t		masks,
+	mach_msg_type_number_t		* CountCnt,
+	exception_port_array_t		ports,
+	exception_behavior_array_t      behaviors,
+	thread_state_flavor_array_t     flavors		)
+{
+	register int	i,
+			j,
+			count;
+	ipc_port_t	old_port[EXC_TYPES_COUNT];
+
+	if (task == TASK_NULL)
+		return KERN_INVALID_ARGUMENT;
+
+	if (exception_mask & ~EXC_MASK_ALL) {
+		return KERN_INVALID_ARGUMENT;
+	}
+
+	if (IP_VALID(new_port)) {
+		switch (new_behavior) {
+		case EXCEPTION_DEFAULT:
+		case EXCEPTION_STATE:
+		case EXCEPTION_STATE_IDENTITY:
+			break;
+		default:
+			return KERN_INVALID_ARGUMENT;
+		}
+	}
+	/* Cannot easily check "new_flavor", but that just means that
+	 * the flavor in the generated exception message might be garbage:
+	 * GIGO */
+
+	itk_lock(task);
+	if (task->itk_self == IP_NULL) {
+		itk_unlock(task);
+		return KERN_FAILURE;
+	}
+
+	count = 0;
+
+	for (i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++) {
+		if (exception_mask & (1 << i)) {
+			for (j = 0; j < count; j++) {
+/*
+ *				search for an identical entry, if found
+ *				set corresponding mask for this exception.
+ */
+				if (task->exc_actions[i].port == ports[j] &&
+				  task->exc_actions[i].behavior == behaviors[j]
+				  && task->exc_actions[i].flavor == flavors[j])
+				{
+					masks[j] |= (1 << i);
+					break;
+				}
+			}/* for */
+			if (j == count) {
+				masks[j] = (1 << i);
+				ports[j] =
+				ipc_port_copy_send(task->exc_actions[i].port);
+				behaviors[j] = task->exc_actions[i].behavior;
+				flavors[j] = task->exc_actions[i].flavor;
+				count++;
+			}
+			old_port[i] = task->exc_actions[i].port;
+			task->exc_actions[i].port =
+				ipc_port_copy_send(new_port);
+			task->exc_actions[i].behavior = new_behavior;
+			task->exc_actions[i].flavor = new_flavor;
+			if (count > *CountCnt) {
+				break;
+			}
+		} else
+			old_port[i] = IP_NULL;
+	}/* for */
+
+
+	/*
+	 * Consume send rights without any lock held.
+	 */
+	itk_unlock(task);
+	for (i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++)
+		if (IP_VALID(old_port[i]))
+			ipc_port_release_send(old_port[i]);
+	if (IP_VALID(new_port))		 /* consume send right */
+		ipc_port_release_send(new_port);
+	*CountCnt = count;
+
+	return KERN_SUCCESS;
+}/* task_swap_exception_ports */
+
+
+/*
+ *	Routine:	host/task_get_exception_ports [kernel call]
+ *	Purpose:
+ *		Clones a send right for each of the thread/task's exception
+ *		ports specified in the mask and returns the behaviour
+ *		and flavor of said port.
+ *
+ *		Returns upto [in} CountCnt elements.
+ *
+ *	Conditions:
+ *		Nothing locked.
+ *	Returns:
+ *		KERN_SUCCESS		Extracted a send right.
+ *		KERN_INVALID_ARGUMENT	The thread is null,
+ *					Invalid special port,
+ *					Illegal mask bit set.
+ *		KERN_FAILURE		The thread is dead.
+ */
+
+kern_return_t
+host_get_exception_ports(
+	host_t			host,
+	exception_mask_t                exception_mask,
+	exception_mask_array_t		masks,
+	mach_msg_type_number_t		* CountCnt,
+	exception_port_array_t		ports,
+	exception_behavior_array_t      behaviors,
+	thread_state_flavor_array_t     flavors		)
+{
+	register int	i,
+			j,
+			count;
+
+	if (!host)
+		return KERN_INVALID_ARGUMENT;
+
+	if (exception_mask & ~EXC_MASK_ALL) {
+		return KERN_INVALID_ARGUMENT;
+	}
+
+	host_lock(host);
+	for (count = 0, i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++) {
+		if (exception_mask & (1 << i)) {
+			for (j = 0; j < count; j++) {
+/*
+ *				search for an identical entry, if found
+ *				set corresponding mask for this exception.
+ */
+				if (host->exc_actions[i].port == ports[j] &&
+				  host->exc_actions[i].behavior ==behaviors[j]
+				  && host->exc_actions[i].flavor == flavors[j])
+				{
+					masks[j] |= (1 << i);
+					break;
+				}
+			}/* for */
+			if (j == count) {
+				masks[j] = (1 << i);
+				ports[j] =
+				ipc_port_copy_send(host->exc_actions[i].port);
+				behaviors[j] = host->exc_actions[i].behavior;
+				flavors[j] = host->exc_actions[i].flavor;
+				count++;
+				if (count >= *CountCnt) {
+					break;
+				}
+			}
+		}
+	}/* for */
+
+	host_unlock(host);
+
+	*CountCnt = count;
+	return KERN_SUCCESS;
+}/* thread_get_exception_ports */
+
+kern_return_t
+task_get_exception_ports(
+	task_t				task,
+	exception_mask_t                exception_mask,
+	exception_mask_array_t		masks,
+	mach_msg_type_number_t		* CountCnt,
+	exception_port_array_t		ports,
+	exception_behavior_array_t      behaviors,
+	thread_state_flavor_array_t     flavors		)
+{
+	register int	i,
+			j,
+			count;
+
+	if (task == TASK_NULL)
+		return KERN_INVALID_ARGUMENT;
+
+	if (exception_mask & ~EXC_MASK_ALL) {
+		return KERN_INVALID_ARGUMENT;
+	}
+
+	itk_lock(task);
+	if (task->itk_self == IP_NULL) {
+		itk_unlock(task);
+		return KERN_FAILURE;
+	}
+
+	count = 0;
+
+	for (i = FIRST_EXCEPTION; i < EXC_TYPES_COUNT; i++) {
+		if (exception_mask & (1 << i)) {
+			for (j = 0; j < count; j++) {
+/*
+ *				search for an identical entry, if found
+ *				set corresponding mask for this exception.
+ */
+				if (task->exc_actions[i].port == ports[j] &&
+				  task->exc_actions[i].behavior == behaviors[j]
+				  && task->exc_actions[i].flavor == flavors[j])
+				{
+					masks[j] |= (1 << i);
+					break;
+				}
+			}/* for */
+			if (j == count) {
+				masks[j] = (1 << i);
+				ports[j] =
+				  ipc_port_copy_send(task->exc_actions[i].port);
+				behaviors[j] = task->exc_actions[i].behavior;
+				flavors[j] = task->exc_actions[i].flavor;
+				count++;
+				if (count > *CountCnt) {
+					break;
+				}
+			}
+		}
+	}/* for */
+
+	itk_unlock(task);
+
+	*CountCnt = count;
+	return KERN_SUCCESS;
+}/* task_get_exception_ports */


Property changes on: trunk/sys/compat/mach/kern/ipc_tt.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/kern/task.c
===================================================================
--- trunk/sys/compat/mach/kern/task.c	                        (rev 0)
+++ trunk/sys/compat/mach/kern/task.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,1368 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.16.5.3  92/09/15  17:22:54  jeffreyh
+ * 	Deadlock fix: Don't hold task lock across pset lock in task_create.
+ * 	[92/09/03            dlb]
+ * 	Cleanup for profiling.
+ * 	[92/07/24            bernadat]
+ * 
+ * Revision 2.16.5.2  92/05/27  00:46:20  jeffreyh
+ * 	Added system calls within MCMSG ifdefs
+ * 	[regnier at ssd.intel.com]
+ * 
+ * Revision 2.16.5.1  92/02/18  19:11:19  jeffreyh
+ * 	Fixed Profiling code. [emcmanus at gr.osf.org]
+ * 
+ * Revision 2.14.2.1  91/09/26  04:48:26  bernadat
+ * 	Task profiling fields initialization
+ * 	(Bernard Tabib & Andrei Danes @ gr.osf.org)
+ * 	[91/09/16            bernadat]
+ * 
+ * Revision 2.16  91/12/11  08:42:30  jsb
+ * 	Fixed assert_wait/thread_wakeup rendezvous in task_assign.
+ * 	[91/11/26            rpd]
+ * 
+ * Revision 2.15  91/11/15  14:11:59  rpd
+ * 	NORMA_TASK: initialize new child_node field in task upon creation.
+ * 	[91/09/23  09:20:23  jsb]
+ * 
+ * Revision 2.14  91/06/25  10:29:32  rpd
+ * 	Updated convert_thread_to_port usage.
+ * 	[91/05/27            rpd]
+ * 
+ * Revision 2.13  91/06/17  15:47:19  jsb
+ * 	Added norma_task hooks. See norma/kern_task.c for code.
+ * 	[91/06/17  10:53:30  jsb]
+ * 
+ * Revision 2.12  91/05/14  16:48:05  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.11  91/03/16  14:52:24  rpd
+ * 	Can't use thread_dowait on the current thread now.
+ * 	[91/01/20            rpd]
+ * 
+ * Revision 2.10  91/02/05  17:29:55  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  16:19:00  mrt]
+ * 
+ * Revision 2.9  91/01/08  15:17:44  rpd
+ * 	Added consider_task_collect, task_collect_scan.
+ * 	[91/01/03            rpd]
+ * 	Added continuation argument to thread_block.
+ * 	[90/12/08            rpd]
+ * 
+ * Revision 2.8  90/10/25  14:45:26  rwd
+ * 	From OSF: Add thread_block() to loop that forcibly terminates
+ * 	threads in task_terminate() to fix livelock.  Also hold
+ * 	reference to thread when calling thread_force_terminate().
+ * 	[90/10/19            rpd]
+ * 
+ * Revision 2.7  90/06/19  22:59:41  rpd
+ * 	Fixed task_info to return the correct base_priority.
+ * 	[90/06/18            rpd]
+ * 
+ * Revision 2.6  90/06/02  14:56:40  rpd
+ * 	Moved trap versions of kernel calls to kern/ipc_mig.c.
+ * 	[90/05/31            rpd]
+ * 
+ * 	Removed references to kernel_vm_space, keep_wired_memory.
+ * 	[90/04/29            rpd]
+ * 	Converted to new IPC and scheduling technology.
+ * 	[90/03/26  22:22:19  rpd]
+ * 
+ * Revision 2.5  90/05/29  18:36:51  rwd
+ * 	Added trap versions of task routines from rfr.
+ * 	[90/04/20            rwd]
+ * 	Add TASK_THREAD_TIMES_INFO flavor to task_info, to get times for
+ * 	all live threads.
+ * 	[90/04/03            dbg]
+ * 
+ * 	Use kmem_alloc_wired instead of vm_allocate in task_threads.
+ * 	[90/03/28            dbg]
+ * 
+ * Revision 2.4  90/05/03  15:46:58  dbg
+ * 	Add TASK_THREAD_TIMES_INFO flavor to task_info, to get times for
+ * 	all live threads.
+ * 	[90/04/03            dbg]
+ * 
+ * 	Use kmem_alloc_wired instead of vm_allocate in task_threads.
+ * 	[90/03/28            dbg]
+ * 
+ * Revision 2.3  90/01/11  11:44:17  dbg
+ * 	Removed task_halt (unused).  De-linted.
+ * 	[89/12/12            dbg]
+ * 
+ * Revision 2.2  89/09/08  11:26:37  dbg
+ * 	Initialize keep_wired_memory in task_create.
+ * 	[89/07/17            dbg]
+ * 
+ * 19-May-89  David Golub (dbg) at Carnegie-Mellon University
+ *	Changed task_info to check for kernel_task, not first_task.
+ *
+ * 19-Oct-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Moved all syscall_emulation routine calls here.  Removed
+ *	all non-MACH data structures.  Added routine to create
+ *	new tasks running in the kernel.  Changed kernel_task
+ *	creation to create it as a normal task.
+ *
+ * Revision 2.6  88/10/11  10:21:38  rpd
+ * 	Changed includes to the new style.
+ * 	Rewrote task_threads; the old version could return
+ * 	an inconsistent picture of the task.
+ * 	[88/10/05  10:28:13  rpd]
+ * 
+ * Revision 2.5  88/08/06  18:25:53  rpd
+ * Changed to use ipc_task_lock/ipc_task_unlock macros.
+ * Eliminated use of kern/mach_ipc_defs.h.
+ * Enable kernel_task for IPC access.  (See hack in task_by_unix_pid to
+ * allow a user to get the kernel_task's port.)
+ * Made kernel_task's ref_count > 0, so that task_reference/task_deallocate
+ * works on it.  (Previously the task_deallocate would try to destroy it.)
+ * 
+ * Revision 2.4  88/07/20  16:40:17  rpd
+ * Removed task_ports (replaced by port_names).
+ * Didn't leave xxx form, because it wasn't implemented.
+ * 
+ * Revision 2.3  88/07/17  17:55:52  mwyoung
+ * Split up uses of task.kernel_only field.  Condensed history.
+ * 
+ * Revision 2.2.1.1  88/06/28  20:46:20  mwyoung
+ * Split up uses of task.kernel_only field.  Condensed history.
+ * 
+ * 21-Jun-88  Michael Young (mwyoung) at Carnegie-Mellon University.
+ *	Split up uses of task.kernel_only field.
+ *
+ * 21-Jun-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Loop in task_terminate to terminate threads was incorrect; if
+ *	another component of the system had a reference to the thread,
+ *	the thread would remain in the thread_list for the task, and the
+ *	loop would never terminate.  Rewrote it to run down the list
+ *	like task_hold.  Thread_create terminates new thread if
+ *	task_terminate occurs simultaneously.
+ *
+ * 27-Jan-88  Douglas Orr (dorr) at Carnegie-Mellon University
+ *	Init user space library structures.
+ *
+ * 21-Jan-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Task_create no longer returns the data port.  Task_status and
+ *	task_set_notify are obsolete (use task_{get,set}_special_port).
+ *
+ * 21-Jan-88  Karl Hauth (hauth) at Carnegie-Mellon University
+ *	task_info(kernel_task, ...) now looks explicitly in the
+ *	kernel_map, so it actually returns useful numbers.
+ *
+ * 17-Jan-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Added new task interfaces: task_suspend, task_resume,
+ *	task_info, task_get_special_port, task_set_special_port.
+ *	Old interfaces remain (temporarily) for binary
+ *	compatibility, prefixed with 'xxx_'.
+ *
+ * 29-Dec-87  David Golub (dbg) at Carnegie-Mellon University
+ *	Delinted.
+ *
+ * 23-Dec-87  David Golub (dbg) at Carnegie-Mellon University
+ *	Added task_halt to halt all threads in a task.
+ *
+ * 15-Dec-87  David Golub (dbg) at Carnegie-Mellon University
+ *	Check for null task pointer in task_reference and
+ *	task_deallocate.
+ *
+ *  9-Dec-87  David Golub (dbg) at Carnegie-Mellon University
+ *	Removed extra thread reference from task_terminate for new thread
+ *	termination code.
+ *
+ *  8-Dec-87  David Black (dlb) at Carnegie-Mellon University
+ *	Added call to ipc_task_disable.
+ *
+ *  3-Dec-87  David Black (dlb) at Carnegie-Mellon University
+ *	Implemented better task termination base on task active field:
+ *		1.  task_terminate sets active field to false.
+ *		2.  All but the most simple task operations check the
+ *			active field and abort if it is false.
+ *		3.  task_{hold, dowait, release} now return kern_return_t's.
+ *		4.  task_dowait has a second parameter to ignore active
+ *			field if called from task_terminate.
+ *	Task terminate acquires extra reference to current thread before
+ *	terminating it (see thread_terminate()).
+ *
+ * 19-Nov-87  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Eliminated TT conditionals.
+ *
+ * 13-Oct-87  David Black (dlb) at Carnegie-Mellon University
+ *	Use counts for suspend and resume primitives.
+ *
+ * 13-Oct-87  David Golub (dbg) at Carnegie-Mellon University
+ *	Added port reference counting to task_set_notify.
+ *
+ *  5-Oct-87  David Golub (dbg) at Carnegie-Mellon University
+ *	Completely replaced old scheduling state machine.
+ *
+ * 14-Sep-87  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	De-linted.
+ *
+ * 25-Aug-87  Robert Baron (rvb) at Carnegie-Mellon University
+ *	Must initialize the kernel_task->lock (at least on the Sequent)
+ *
+ *  6-Aug-87  David Golub (dbg) at Carnegie-Mellon University
+ *	Moved ipc_task_terminate to task_terminate, to shut down other
+ *	threads that are manipulating the task via its task_port.
+ *	Changed task_terminate to terminate all threads in the task.
+ *
+ * 29-Jul-87  David Golub (dbg) at Carnegie-Mellon University
+ *	Fix task_suspend not to hold the task if the task has been
+ *	resumed.  Change task_hold/task_wait so that if the current
+ *	thread is in the task, it is not held until after all of the
+ *	other threads in the task have stopped.  Make task_terminate be
+ *	able to terminate the current task.
+ *
+ *  9-Jul-87  Karl Hauth (hauth) at Carnegie-Mellon University
+ *	Modified task_statistics to reflect changes in the structure.
+ *
+ * 10-Jun-87  Karl Hauth (hauth) at Carnegie-Mellon University
+ *	Added code to fill in the task_statistics structure with
+ *	zeros and to make mig happier by returning something.
+ *
+ *  1-Jun-87  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Added task_statistics stub.
+ *
+ * 27-Apr-87  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Move ipc_task_init into task_create; it *should* return
+ *	the data port (with a reference) at some point.
+ *
+ * 20-Apr-87  David Black (dlb) at Carnegie-Mellon University
+ *	Fixed task_suspend to ignore multiple suspends.
+ *	Fixed task_dowait to work if current thread is in the affected task.
+ *
+ * 24-Feb-87  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Rewrote task_suspend/task_hold and added task_wait for new user
+ *	synchronization paradigm.
+ *
+ * 10-Feb-87  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Add task.kernel_only initialization.
+ *
+ * 31-Jan-87  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Merged in my changes for real thread implementation.
+ *
+ *  7-Nov-86  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Fixed up stubs for eventual task calls.
+ *
+ * 30-Sep-86  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Make floating u-area work, add all_task list management.
+ *
+ * 26-Sep-86  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Added argument to ipc_task_init to get parent.
+ *
+ *  1-Aug-86  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Added initialization for Mach IPC.
+ *
+ * 20-Jul-86  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Added kernel_task.
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ *	File:	kern/task.c
+ *	Author:	Avadis Tevanian, Jr., Michael Wayne Young, David Golub,
+ *		David Black
+ *
+ *	Task management primitives implementation.
+ */
+/*
+ * Copyright (c) 1993 The University of Utah and
+ * the Computer Systems Laboratory (CSL).  All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist at cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/eventhandler.h>
+#include <sys/kernel.h>
+#include <sys/mach/vm_types.h>
+
+#include <sys/mach/task_info.h>
+#include <sys/mach/task_special_ports.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/rpc.h>
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/ipc/ipc_entry.h>
+#include <sys/mach/mach_param.h>
+
+#include <sys/mach/task.h>
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/thread.h>
+
+#include <sys/mach/sched_prim.h>	/* for thread_wakeup */
+#include <sys/mach/ipc_tt.h>
+#if 0
+#include <sys/mach/ledger.h>
+#endif
+#include <sys/mach/host_special_ports.h>
+#include <sys/mach/host.h>
+#include <vm/vm_kern.h>		/* for kernel_map, ipc_kernel_map */
+#include <vm/uma.h>
+#if	MACH_KDB
+#include <ddb/db_sym.h>
+#endif	/* MACH_KDB */
+
+#include <sys/mach/queue.h>
+/*
+ * Exported interfaces
+ */
+#include <sys/mach/task_server.h>
+#include <sys/mach/mach_host_server.h>
+#include <sys/mach/mach_port_server.h>
+
+struct processor_set default_pset;
+unsigned	int sched_ticks;
+task_t	kernel_task;
+uma_zone_t	task_zone;
+
+/* Forwards */
+
+
+kern_return_t	task_hold_locked(
+			task_t		task);
+void		task_wait_locked(
+			task_t		task);
+kern_return_t	task_release(
+			task_t		task);
+void		task_act_iterate(
+			task_t		 task,
+			kern_return_t	(*func)(thread_act_t inc));
+void		task_free(
+			task_t		task );
+void		task_synchronizer_destroy_all(
+			task_t		task);
+
+
+kern_return_t
+task_create(
+	task_t				parent_task,
+	__unused ledger_array_t	ledger_ports,
+	__unused mach_msg_type_number_t	num_ledger_ports,
+	__unused boolean_t		inherit_memory,
+	__unused task_t			*child_task)	/* OUT */
+{
+	if (parent_task == TASK_NULL)
+		return(KERN_INVALID_ARGUMENT);
+
+	return(KERN_FAILURE);
+}
+
+
+static kern_return_t
+task_create_internal(
+	task_t		parent_task,
+	task_t		new_task)
+{
+	register processor_set_t	pset;
+
+	/* one ref for just being alive; one for our caller */
+	new_task->ref_count = 2;
+	new_task->semaphores_owned = 0;
+
+	ipc_task_init(new_task, parent_task);
+
+	if (parent_task != TASK_NULL) {
+#ifdef notyet		
+		pset = parent_task->processor_set;
+		if (!pset->active)
+			pset = &default_pset;
+#endif
+		set_security_token(new_task);
+		new_task->policy = parent_task->policy;
+	} else {
+		pset = &default_pset;
+		new_task->policy = POLICY_TIMESHARE;
+		new_task->sec_token = KERNEL_SECURITY_TOKEN;
+		new_task->audit_token = KERNEL_AUDIT_TOKEN;
+	}
+	ipc_task_enable(new_task);
+	return(KERN_SUCCESS);
+}
+
+
+
+/*
+ *	task_free:
+ *
+ *	Called by task_deallocate when the task's reference count drops to zero.
+ *	Task is locked.
+ */
+void
+task_free( register task_t	task )
+{
+	register processor_set_t pset;
+
+	/* tasks are tied to proc structures so should only be freed if proc goes away */
+	task_unlock(task);
+	return;
+	/*
+	 * Temporarily restore the reference we dropped above, then
+	 * freeze the task so that the task->processor_set field
+	 * cannot change. In the !MACH_HOST case, the logic can be
+	 * simplified, since the default_pset is the only pset.
+	 */
+	++task->ref_count;
+	task_unlock(task);
+	pset = task->processor_set;
+	task_lock(task);
+	if (--task->ref_count > 0) {
+		/*
+		 * A new reference appeared (probably from the pset).
+		 * Back out. Must unfreeze inline since we'already
+		 * dropped our reference.
+		 */
+		task_unlock(task);
+		return;
+	}
+	task_unlock(task);
+	is_release(task->itk_space);
+	uma_zfree(task_zone, task);
+}
+
+
+void
+task_deallocate( task_t task )
+{
+	if (task != TASK_NULL) {
+	    int x;
+	    task_lock(task);
+	    x = --task->ref_count;
+	    if (x == 0)
+		task_free(task);	/* unlocks task */
+	    else
+		task_unlock(task);
+	}
+}
+
+void
+task_reference( register task_t task )
+{
+	if (task != TASK_NULL) {
+	    task_lock(task);
+	    task->ref_count++;
+	    task_unlock(task);
+	}
+}
+
+/*
+ *	task_terminate:
+ *
+ *	Terminate the specified task.  See comments on thread_terminate
+ *	(kern/thread.c) about problems with terminating the "current task."
+ */
+kern_return_t
+task_terminate(
+	register task_t	task)
+{
+#ifdef notyet	
+	register thread_t	thread, cur_thread;
+#if 0
+	register queue_head_t	*list;
+#endif	
+	register task_t		cur_task;
+	thread_act_t		thr_act, cur_thr_act;
+
+	if (task == TASK_NULL)
+		return(KERN_INVALID_ARGUMENT);
+
+	assert(task != kernel_task);
+#if 0
+	list = &task->thr_acts;
+	cur_task = current_task();
+	cur_thr_act = current_thread()->top_act;
+#endif
+
+	/*
+	 *	Deactivate task so that it can't be terminated again,
+	 *	and so lengthy operations in progress will abort.
+	 *
+	 *	If the current thread is in this task, remove it from
+	 *	the task's thread list to keep the thread-termination
+	 *	loop simple.
+	 */
+	if (task == cur_task) {
+		task_lock(task);
+		if (!task->active) {
+			/*
+			 *	Task is already being terminated.
+			 */
+			task_unlock(task);
+			thread_block();
+			return(KERN_FAILURE);
+		}
+
+		task_hold_locked(task);
+#if 0
+		task->active = FALSE;
+
+		/*
+		 *	Make sure current thread is not being terminated.
+		 */
+		mutex_lock(&task->act_list_lock);
+		cur_thread = act_lock_thread(cur_thr_act);
+		if (!cur_thr_act->active) {
+			act_unlock_thread(cur_thr_act);
+			mutex_unlock(&task->act_list_lock);
+			task_unlock(task);
+			thread_terminate(cur_thr_act);
+			return(KERN_FAILURE);
+		}
+
+		/*
+		 * make sure that this thread is the last one in the list
+		 */
+		queue_remove(list, cur_thr_act, thread_act_t, thr_acts);
+		queue_enter(list, cur_thr_act, thread_act_t, thr_acts);
+		act_unlock_thread(cur_thr_act);
+		mutex_unlock(&task->act_list_lock);
+		/*
+		 *	Shut down this thread's ipc now because it must
+		 *	be left alone to terminate the task.
+		 */
+		ipc_thr_act_disable(cur_thr_act);
+		ipc_thr_act_terminate(cur_thr_act);
+#endif
+	}
+	else {
+		/*
+		 *	Lock both current and victim task to check for
+		 *	potential deadlock.
+		 */
+		if (task < cur_task) {
+			task_lock(task);
+			task_lock(cur_task);
+		}
+		else {
+			task_lock(cur_task);
+			task_lock(task);
+		}
+		/*
+		 *	Check if current thread_act or task is being terminated.
+		 */
+		cur_thread = act_lock_thread(cur_thr_act);
+		if ((!cur_task->active) || (!cur_thr_act->active)) {
+			/*
+			 * Current task or thread is being terminated.
+			 */
+			act_unlock_thread(cur_thr_act);
+			task_unlock(task);
+			task_unlock(cur_task);
+			return(KERN_FAILURE);
+		}
+		act_unlock_thread(cur_thr_act);
+		task_unlock(cur_task);
+
+		if (!task->active) {
+			/*
+			 *	Task is already being terminated.
+			 */
+			task_unlock(task);
+			thread_block();
+			return(KERN_FAILURE);
+		}
+		task_hold_locked(task);
+		task->active = FALSE;
+	}
+
+	/*
+	 *	Prevent further execution of the task.  ipc_task_disable
+	 *	prevents further task operations via the task port.
+	 *	If this is the current task, the current thread will
+	 *	be left running.
+	 */
+	ipc_task_disable(task);
+	task_wait_locked(task);
+
+	/*
+	 *	Terminate each thread in the task.  Depending on the
+	 *	state of the thread, this can mean a number of things.
+	 *	However, we just call thread_terminate(), which
+	 *	takes care of all cases (see that code for details).
+	 *
+         *      The task_port is closed down, so no more thread_create
+         *      operations can be done.  Thread_terminate closes the
+         *      thread port for each thread; when that is done, the
+         *      thread will eventually disappear.  Thus the loop will
+         *      terminate.
+	 *	Need to call thread_block() inside loop because some
+         *      other thread (e.g., the reaper) may have to run to get rid
+         *      of all references to the thread; it won't vanish from
+         *      the task's thread list until the last one is gone.
+         */
+        while (!queue_empty(list)) {
+                thr_act = (thread_act_t) queue_first(list);
+                act_reference(thr_act);
+                task_unlock(task);
+                thread_terminate(thr_act);
+                act_deallocate(thr_act);
+                task_lock(task);
+        }
+        task_unlock(task);
+#endif
+	/*
+	 *	Destroy all synchronizers owned by the task.
+	 */
+	task_synchronizer_destroy_all(task);
+
+	/*
+	 *	Shut down IPC.
+	 */
+	ipc_task_terminate(task);
+
+	/*
+	 *	Deallocate the task's reference to itself.
+	 */
+	task_deallocate(task);
+
+	return(KERN_SUCCESS);
+}
+
+/*
+ *	task_hold_locked:
+ *
+ *	Suspend execution of the specified task.
+ *	This is a recursive-style suspension of the task, a count of
+ *	suspends is maintained.
+ *
+ * 	CONDITIONS: the task is locked.
+ */
+kern_return_t
+task_hold_locked(
+	register task_t	task)
+{
+#if 0
+	register queue_head_t	*list;
+	register thread_act_t	thr_act, cur_thr_act;
+
+	cur_thr_act = current_act();
+#endif	
+
+	if (!task->active) {
+		return(KERN_FAILURE);
+	}
+#if 0
+
+	task->suspend_count++;
+	/*
+	 *	Iterate through all the thread_act's and hold them.
+	 *	Do not hold the current thread_act if it is within the
+	 *	task.
+	 */
+	list = &task->thr_acts;
+	thr_act = (thread_act_t) queue_first(list);
+	while (!queue_end(list, (queue_entry_t) thr_act)) {
+		(void)act_lock_thread(thr_act);
+		thread_hold(thr_act);
+		act_unlock_thread(thr_act);
+		thr_act = (thread_act_t) queue_next(&thr_act->thr_acts);
+	}
+#endif	
+	return(KERN_SUCCESS);
+}
+
+
+kern_return_t
+task_release(
+	register task_t	task)
+{
+#if 0
+	register queue_head_t	*list;
+	register thread_act_t	thr_act, next;
+
+	task_lock(task);
+	if (!task->active) {
+		task_unlock(task);
+		return(KERN_FAILURE);
+	}
+
+	task->suspend_count--;
+
+	/*
+	 *	Iterate through all the thread_act's and release them.
+	 */
+	list = &task->thr_acts;
+	thr_act = (thread_act_t) queue_first(list);
+	while (!queue_end(list, (queue_entry_t) thr_act)) {
+		next = (thread_act_t) queue_next(&thr_act->thr_acts);
+		(void)act_lock_thread(thr_act);
+		thread_release(thr_act);
+		act_unlock_thread(thr_act);
+		thr_act = next;
+	}
+	task_unlock(task);
+#endif	
+	return(KERN_SUCCESS);
+}
+
+kern_return_t
+task_threads(
+	task_t			task,
+	thread_act_array_t	*thr_act_list,
+	mach_msg_type_number_t	*count)
+{
+#if 0
+	unsigned int		actual;	/* this many thr_acts */
+	thread_act_t		thr_act;
+	thread_act_t		*thr_acts;
+	thread_t		thread;
+	int			i, j;
+	boolean_t rt = FALSE; /* ### This boolean is FALSE, because there
+			       * currently exists no mechanism to determine
+			       * whether or not the reply port is an RT port
+			       */
+
+
+	vm_size_t size, size_needed;
+	vm_offset_t addr;
+
+	if (task == TASK_NULL)
+		return KERN_INVALID_ARGUMENT;
+
+	size = 0; addr = 0;
+
+	for (;;) {
+		task_lock(task);
+		if (!task->active) {
+			task_unlock(task);
+			if (size != 0)
+				KFREE(addr, size, rt);
+			return KERN_FAILURE;
+		}
+
+		actual = task->thr_act_count;
+
+		/* do we have the memory we need? */
+		size_needed = actual * sizeof(mach_port_t);
+		if (size_needed <= size)
+			break;
+
+		/* unlock the task and allocate more memory */
+		task_unlock(task);
+
+		if (size != 0)
+			KFREE(addr, size, rt);
+
+		assert(size_needed > 0);
+		size = size_needed;
+
+		addr = KALLOC(size, rt);
+		if (addr == 0)
+			return KERN_RESOURCE_SHORTAGE;
+	}
+
+	/* OK, have memory and the task is locked & active */
+	thr_acts = (thread_act_t *) addr;
+
+	for (i = j = 0, thr_act = (thread_act_t) queue_first(&task->thr_acts);
+	     i < actual;
+	     i++, thr_act = (thread_act_t) queue_next(&thr_act->thr_acts)) {
+		act_reference(thr_act);
+		thr_acts[j++] = thr_act;
+	}
+	assert(queue_end(&task->thr_acts, (queue_entry_t) thr_act));
+	actual = j;
+
+	/* can unlock task now that we've got the thr_act refs */
+	task_unlock(task);
+
+	if (actual == 0) {
+		/* no thr_acts, so return null pointer and deallocate memory */
+
+		*thr_act_list = 0;
+		*count = 0;
+
+		if (size != 0)
+			KFREE(addr, size, rt);
+	} else {
+		/* if we allocated too much, must copy */
+
+		if (size_needed < size) {
+			vm_offset_t newaddr;
+
+			newaddr = KALLOC(size_needed, rt);
+			if (newaddr == 0) {
+				for (i = 0; i < actual; i++)
+					act_deallocate(thr_acts[i]);
+				KFREE(addr, size, rt);
+				return KERN_RESOURCE_SHORTAGE;
+			}
+
+			bcopy((char *) addr, (char *) newaddr, size_needed);
+			KFREE(addr, size, rt);
+			thr_acts = (thread_act_t *) newaddr;
+		}
+
+		*thr_act_list = (mach_port_t *) thr_acts;
+		*count = actual;
+
+		/* do the conversion that Mig should handle */
+
+		for (i = 0; i < actual; i++)
+			((ipc_port_t *) thr_acts)[i] =
+				convert_act_to_port(thr_acts[i]);
+	}
+#endif
+	return KERN_SUCCESS;
+}
+
+kern_return_t
+task_suspend(
+	register task_t		task)
+{
+#if 0
+	if (task == TASK_NULL)
+		return (KERN_INVALID_ARGUMENT);
+
+	task_lock(task);
+	if (!task->active) {
+		task_unlock(task);
+		return (KERN_FAILURE);
+	}
+	if ((task->user_stop_count)++ > 0) {
+		/*
+		 *	If the stop count was positive, the task is
+		 *	already stopped and we can exit.
+		 */
+		task_unlock(task);
+		return (KERN_SUCCESS);
+	}
+
+	/*
+	 *	Hold all of the threads in the task, and wait for
+	 *	them to stop.  If the current thread is within
+	 *	this task, hold it separately so that all of the
+	 *	other threads can stop first.
+	 */
+	if (task_hold_locked(task) != KERN_SUCCESS) {
+		task_unlock(task);
+		return (KERN_FAILURE);
+	}
+
+	task_wait_locked(task);
+	task_unlock(task);
+#endif
+	return (KERN_SUCCESS);
+}
+
+/*
+ * Wait for all threads in task to stop.  Called with task locked.
+ */
+void
+task_wait_locked(
+	register task_t		task)
+{
+	#if 0
+	register queue_head_t	*list;
+	register thread_act_t	thr_act, refd_thr_act;
+	register thread_t	thread, cur_thr;
+
+	cur_thr = current_thread();
+	/*
+	 *	Iterate through all the thread's and wait for them to
+	 *	stop.  Do not wait for the current thread if it is within
+	 *	the task.
+	 */
+	list = &task->thr_acts;
+	refd_thr_act = THR_ACT_NULL;
+	while (1) {
+		thr_act = (thread_act_t) queue_first(list);
+		while (!queue_end(list, (queue_entry_t) thr_act)) {
+			thread = act_lock_thread(thr_act);
+			if (refd_thr_act != THR_ACT_NULL) {
+				act_deallocate(refd_thr_act);
+				refd_thr_act = THR_ACT_NULL;
+			}
+			if (thread &&
+				thr_act == thread->top_act && thread != cur_thr) {
+				refd_thr_act = thr_act;
+				act_locked_act_reference(thr_act);
+				act_unlock_thread(thr_act);
+				task_unlock(task);
+				(void)thread_wait(thread);
+				task_lock(task);
+				thread = act_lock_thread(thr_act);
+				if (!thr_act->active) {
+					act_unlock_thread(thr_act);
+					break;
+				}
+			}
+			act_unlock_thread(thr_act);
+			thr_act = (thread_act_t) queue_next(&thr_act->thr_acts);
+		}
+	    	if (queue_end(list, (queue_entry_t)thr_act))
+			break;
+	}
+	if (refd_thr_act != THR_ACT_NULL) {
+		act_deallocate(refd_thr_act);
+		refd_thr_act = THR_ACT_NULL;
+	}
+#endif
+}
+
+kern_return_t 
+task_resume(register task_t task)
+{
+	register boolean_t	release;
+
+	if (task == TASK_NULL)
+		return(KERN_INVALID_ARGUMENT);
+
+	release = FALSE;
+#if 0	
+	task_lock(task);
+	if (!task->active) {
+		task_unlock(task);
+		return(KERN_FAILURE);
+	}
+	if (task->user_stop_count > 0) {
+		if (--(task->user_stop_count) == 0)
+	    		release = TRUE;
+	}
+	else {
+		task_unlock(task);
+		return(KERN_FAILURE);
+	}
+	task_unlock(task);
+#endif
+	/*
+	 *	Release the task if necessary.
+	 */
+	if (release)
+		return(task_release(task));
+
+	return(KERN_SUCCESS);
+}
+
+kern_return_t
+task_set_info(
+	task_t		task,
+	task_flavor_t	flavor,
+	task_info_t	task_info_in __unused,		/* pointer to IN array */
+	mach_msg_type_number_t	task_info_count __unused)
+{
+
+	if (task == TASK_NULL)
+		return(KERN_INVALID_ARGUMENT);
+
+	switch (flavor) {
+	    default:
+			return (KERN_INVALID_ARGUMENT);
+	}
+	return (KERN_SUCCESS);
+}
+
+kern_return_t
+task_info(
+	task_t			task,
+	task_flavor_t		flavor,
+	task_info_t		task_info_out,
+	mach_msg_type_number_t	*task_info_count)
+{
+
+	if (task == TASK_NULL)
+		return(KERN_INVALID_ARGUMENT);
+
+	switch (flavor) {
+	    case TASK_BASIC_INFO:
+	    {
+		register task_basic_info_t	basic_info;
+
+		if (*task_info_count < TASK_BASIC_INFO_COUNT) {
+		    return(KERN_INVALID_ARGUMENT);
+		}
+
+		basic_info = (task_basic_info_t) task_info_out;
+#ifdef notyet
+		map = (task == kernel_task) ? kernel_map : task->map;
+
+		basic_info->virtual_size  = map->size;
+		basic_info->resident_size = pmap_resident_count(map->pmap)
+						   * PAGE_SIZE;
+		task_lock(task);
+		basic_info->policy = task->policy;
+		basic_info->suspend_count = task->user_stop_count;
+		basic_info->user_time.seconds
+				= task->total_user_time.seconds;
+		basic_info->user_time.microseconds
+				= task->total_user_time.microseconds;
+		basic_info->system_time.seconds
+				= task->total_system_time.seconds;
+		basic_info->system_time.microseconds 
+				= task->total_system_time.microseconds;
+		task_unlock(task);
+#endif
+
+		*task_info_count = TASK_BASIC_INFO_COUNT;
+		break;
+	    }
+
+	    case TASK_THREAD_TIMES_INFO:
+	    {
+		register task_thread_times_info_t times_info;
+
+		if (*task_info_count < TASK_THREAD_TIMES_INFO_COUNT) {
+		    return (KERN_INVALID_ARGUMENT);
+		}
+
+		times_info = (task_thread_times_info_t) task_info_out;
+		times_info->user_time.seconds = 0;
+		times_info->user_time.microseconds = 0;
+		times_info->system_time.seconds = 0;
+		times_info->system_time.microseconds = 0;
+
+#ifdef notyet
+		task_lock(task);
+		queue_iterate(&task->thr_acts, thr_act,
+			      thread_act_t, thr_acts)
+		{
+			thread_t thread;
+		    time_value_t user_time, system_time;
+		    spl_t	 s;
+
+		    thread = act_lock_thread(thr_act);
+
+		    /* Skip empty threads and threads that have migrated
+		     * into this task:
+		     */
+		    if (thr_act->ith_object) {
+				act_unlock_thread(thr_act);
+				continue;
+		    }
+		    assert(thread);	/* Must have thread, if no thread_pool*/
+		    s = splsched();
+		    thread_lock(thread);
+
+		    thread_read_times(thread, &user_time, &system_time);
+
+		    thread_unlock(thread);
+		    splx(s);
+		    act_unlock_thread(thr_act);
+
+		    time_value_add(&times_info->user_time, &user_time);
+		    time_value_add(&times_info->system_time, &system_time);
+		}
+		task_unlock(task);
+#endif
+		*task_info_count = TASK_THREAD_TIMES_INFO_COUNT;
+		break;
+	    }
+
+	    case TASK_SCHED_FIFO_INFO:
+	    {
+		register policy_fifo_base_t	fifo_base;
+
+		if (*task_info_count < POLICY_FIFO_BASE_COUNT)
+			return(KERN_INVALID_ARGUMENT);
+
+		fifo_base = (policy_fifo_base_t) task_info_out;
+
+		task_lock(task);
+		if (task->policy != POLICY_FIFO) {
+			task_unlock(task);
+			return(KERN_INVALID_POLICY);
+		}
+		fifo_base->base_priority = task->priority;
+		task_unlock(task);
+
+		*task_info_count = POLICY_FIFO_BASE_COUNT;
+		break;
+	    }
+
+	    case TASK_SCHED_RR_INFO:
+	    {
+		register policy_rr_base_t	rr_base;
+
+		if (*task_info_count < POLICY_RR_BASE_COUNT)
+			return(KERN_INVALID_ARGUMENT);
+
+		rr_base = (policy_rr_base_t) task_info_out;
+
+		task_lock(task);
+		if (task->policy != POLICY_RR) {
+			task_unlock(task);
+			return(KERN_INVALID_POLICY);
+		}
+		rr_base->base_priority = task->priority;
+		rr_base->quantum = (task->sched_data * ticks)/1000;
+		task_unlock(task);
+
+		*task_info_count = POLICY_RR_BASE_COUNT;
+		break;
+	    }
+
+	    case TASK_SCHED_TIMESHARE_INFO:
+	    {
+		register policy_timeshare_base_t	ts_base;
+
+		if (*task_info_count < POLICY_TIMESHARE_BASE_COUNT)
+			return(KERN_INVALID_ARGUMENT);
+
+		ts_base = (policy_timeshare_base_t) task_info_out;
+
+		task_lock(task);
+		if (task->policy != POLICY_TIMESHARE) {
+			task_unlock(task);
+			return(KERN_INVALID_POLICY);
+		}
+		ts_base->base_priority = task->priority;
+		task_unlock(task);
+
+		*task_info_count = POLICY_TIMESHARE_BASE_COUNT;
+		break;
+	    }
+
+            case TASK_SECURITY_TOKEN:
+	    {
+                register security_token_t	*sec_token_p;
+
+		if (*task_info_count < TASK_SECURITY_TOKEN_COUNT) {
+		    return(KERN_INVALID_ARGUMENT);
+		}
+
+		sec_token_p = (security_token_t *) task_info_out;
+
+		task_lock(task);
+		*sec_token_p = task->sec_token;
+		task_unlock(task);
+
+		*task_info_count = TASK_SECURITY_TOKEN_COUNT;
+                break;
+            }
+            
+	    default:
+		return (KERN_INVALID_ARGUMENT);
+	}
+
+	return(KERN_SUCCESS);
+}
+
+/*
+ *	task_assign:
+ *
+ *	Change the assigned processor set for the task
+ */
+kern_return_t
+task_assign(
+	task_t				task __unused,
+	processor_set_t			new_pset __unused,
+	boolean_t			assign_threads __unused)
+{
+
+	return (KERN_FAILURE);
+}
+
+/*
+ *	task_assign_default:
+ *
+ *	Version of task_assign to assign to default processor set.
+ */
+kern_return_t
+task_assign_default(
+	task_t		task,
+	boolean_t	assign_threads)
+{
+    return (task_assign(task, &default_pset, assign_threads));
+}
+
+/*
+ *	task_get_assignment
+ *
+ *	Return name of processor set that task is assigned to.
+ */
+kern_return_t
+task_get_assignment(
+	task_t		task,
+	processor_set_t	*pset)
+{
+	if (!task->active)
+		return(KERN_FAILURE);
+
+	*pset = task->processor_set;
+	pset_reference(*pset);
+	return(KERN_SUCCESS);
+}
+
+/*
+ * 	task_policy
+ *
+ *	Set scheduling policy and parameters, both base and limit, for
+ *	the given task. Policy must be a policy which is enabled for the
+ *	processor set. Change contained threads if requested. 
+ */
+kern_return_t
+task_policy(
+	task_t			task,
+        policy_t		policy,
+        policy_base_t		base,
+	mach_msg_type_number_t	count,
+        boolean_t		set_limit,
+        boolean_t		change)
+{
+
+	return (KERN_FAILURE);
+}
+
+kern_return_t
+task_set_policy(
+	task_t			task __unused,
+	processor_set_t		pset __unused,
+	policy_t		policy __unused,
+	policy_base_t		base __unused,
+	mach_msg_type_number_t	base_count __unused,
+	policy_limit_t		limit __unused,
+	mach_msg_type_number_t	limit_count __unused,
+	boolean_t		change __unused)
+{
+
+	return (KERN_FAILURE);
+}
+
+
+kern_return_t
+task_set_ras_pc(
+ 	task_t		task __unused,
+ 	vm_offset_t	pc __unused,
+ 	vm_offset_t	endpc __unused)
+{
+
+	return (KERN_FAILURE);
+}
+
+void
+task_synchronizer_destroy_all(task_t task)
+{
+	semaphore_t	semaphore;
+
+	/*
+	 *  Destroy owned semaphores
+	 */
+
+	while (!queue_empty(&task->semaphore_list)) {
+		semaphore = (semaphore_t) queue_first(&task->semaphore_list);
+		(void) semaphore_destroy(task, semaphore);
+	}
+}
+
+static long task_uniqueid;
+
+static void
+mach_task_init(void *arg __unused, struct proc *p)
+{
+	task_t task;
+
+	p->p_machdata = task = uma_zalloc(task_zone, M_WAITOK|M_ZERO);
+	task->itk_p = p;
+
+	mach_mutex_init(&task->lock, "ETAP_THREAD_TASK_NEW");
+	mach_mutex_init(&task->itk_lock_data, "ETAP_THREAD_TASK_ITK");
+	queue_init(&task->semaphore_list);
+
+	if (p == &proc0) {
+		kernel_task = task;
+		task_create_internal(TASK_NULL, task);
+	}
+}
+
+static void
+mach_task_fork(void *arg __unused, struct proc *p1, struct proc *p2, int flags __unused)
+{
+	task_t task = p2->p_machdata;
+	task_t parent_task = p1->p_machdata;
+
+	atomic_add_long(&task_uniqueid, 1);
+	task->itk_uniqueid = task_uniqueid;
+	task->itk_puniqueid = parent_task->itk_uniqueid;
+	task_create_internal(parent_task, task);
+}
+
+static int
+uma_task_init(void *_thread, int a, int b)
+{
+	/* allocate task substructures */
+	return (0);
+}
+
+static void
+uma_task_fini(void *_thread, int a)
+{
+	/* deallocate task substructures */
+}
+
+
+static void
+task_sysinit(void *arg __unused)
+{
+	task_zone = uma_zcreate("mach_task_zone",
+							sizeof(struct mach_task),
+							NULL, NULL, uma_task_init,
+							uma_task_fini, 1, 0);
+
+	EVENTHANDLER_REGISTER(process_init, mach_task_init, NULL, EVENTHANDLER_PRI_ANY);
+	EVENTHANDLER_REGISTER(process_fork, mach_task_fork, NULL, EVENTHANDLER_PRI_ANY);
+}
+
+/* before SI_SUB_INTRINSIC and after SI_SUB_EVENTHANDLER */
+SYSINIT(mach_thread, SI_SUB_KLD, SI_ORDER_ANY, task_sysinit, NULL);


Property changes on: trunk/sys/compat/mach/kern/task.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/kern/thread_pool.c
===================================================================
--- trunk/sys/compat/mach/kern/thread_pool.c	                        (rev 0)
+++ trunk/sys/compat/mach/kern/thread_pool.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,208 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/*
+ * Copyright (c) 1993 The University of Utah and
+ * the Computer Systems Laboratory (CSL).  All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist at cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ *      Author: Bryan Ford, University of Utah CSL
+ *
+ *	File:	thread_pool.c
+ *
+ *	thread_pool management routines
+ *
+ */
+
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/ipc_tt.h>
+
+#include <sys/mach/kern_return.h>
+#include <sys/mach/thread_pool.h>
+#include <sys/mach/thread.h>
+
+
+
+#define THR_ACT_NULL NULL
+/* Initialize a new EMPTY thread_pool.  */
+kern_return_t
+thread_pool_init(thread_pool_t new_thread_pool)
+{
+	assert(new_thread_pool != THREAD_POOL_NULL);
+
+	/* Start with one reference for the caller */
+	new_thread_pool->thr_acts = (struct thread_shuttle *)0;
+	return KERN_SUCCESS;
+}
+
+void
+thread_pool_remove(thread_act_t thread)
+{
+	thread_pool_t pool = &((struct rpc_common_data *)thread->ith_object)->rcd_thread_pool;
+	thread_act_t act = pool->thr_acts;
+	int found = 0;
+
+	mtx_assert(thread->ith_block_lock_data, MA_OWNED);
+	if (act == thread) {
+		pool->thr_acts = pool->thr_acts->ith_pool_next;
+		return;
+	}
+	
+	while (act != NULL) {
+		if (act->ith_pool_next == thread) {
+			act->ith_pool_next = thread->ith_pool_next;
+			found = 1;
+			break;
+		}
+		act = act->ith_pool_next;
+	}
+	assert(found);
+}
+
+
+/*
+ * Obtain an activation from a thread pool, blocking if
+ * necessary.  Return the activation locked, since it's
+ * in an inconsistent state (not in a pool, not attached
+ * to a thread).
+ *
+ * Called with io_lock() held for ith_object.  Returns
+ * the same way.
+ *
+ * If the thread pool port is destroyed while we are blocked,
+ * then return a null activation. Callers must check for this
+ * error case.
+ */
+thread_act_t
+thread_pool_get_act(ipc_object_t object, int block)
+{
+	thread_pool_t thread_pool = &((struct rpc_common_data *)object)->rcd_thread_pool;
+	thread_act_t thr_act;
+
+#if	MACH_ASSERT
+	assert(thread_pool != THREAD_POOL_NULL);
+	if (watchacts & WA_ACT_LNK)
+		printf("thread_pool_block: %x, waiting=%d\n",
+		       thread_pool, thread_pool->waiting);
+#endif
+	if (block == 0) {
+		if ((thr_act = thread_pool->thr_acts) != THR_ACT_NULL) {
+			thread_pool->thr_acts = thr_act->ith_pool_next;
+			return (thr_act);
+		} else
+			return (NULL);
+	}
+
+	while ((thr_act = thread_pool->thr_acts) == THR_ACT_NULL) {
+#if 0
+		if (!ip_active(pool_port))
+			return THR_ACT_NULL;
+#endif
+		thread_pool->waiting = 1;
+		assert_wait((event_t)thread_pool, FALSE);
+		io_unlock(object);
+		thread_block();       /* block self */
+		io_lock(object);
+	}
+	thread_pool->thr_acts = thr_act->ith_pool_next;
+	thr_act->ith_pool_next = NULL;
+
+#if	MACH_ASSERT
+	if (watchacts & WA_ACT_LNK)
+		printf("thread_pool_block: return %x, next=%x\n",
+		       thr_act, thread_pool->thr_acts);
+#endif
+	return thr_act;
+}
+
+/*
+ * 	thread_pool_put_act
+ *
+ *	Return an activation to its pool. Assumes the activation
+ *	and pool (if it exists) are locked.
+ */
+void
+thread_pool_put_act( thread_act_t thr_act )
+{
+	thread_pool_t   thr_pool;
+
+	mtx_assert(thr_act->ith_block_lock_data, MA_OWNED);
+		/*
+	 *	Find the thread pool for this activation.
+	 */	
+        if (thr_act->ith_object)
+            thr_pool = &((struct rpc_common_data *)thr_act->ith_object)->rcd_thread_pool;
+        else
+            thr_pool = THREAD_POOL_NULL;
+
+        /* 
+	 *	Return act to the thread_pool's list, if it is still
+	 *	alive. Otherwise, remove it from its thread_pool, which
+	 *	will deallocate it and destroy it.
+	 */
+        if (thr_act->ith_active) {
+                assert(thr_pool);
+                thr_act->ith_pool_next = thr_pool->thr_acts;
+                thr_pool->thr_acts = thr_act;
+                if (thr_pool->waiting)
+					thread_pool_wakeup(thr_pool);
+        } else if (thr_pool) {
+                assert(thr_act->ith_object);
+        }
+}
+ 
+
+/*
+ * Called with ip_lock() held for port containing thread_pool.
+ * Returns same way.
+ */
+void
+thread_pool_wakeup(thread_pool_t thread_pool)
+{
+#if	MACH_ASSERT
+	assert(thread_pool != THREAD_POOL_NULL);
+	if (watchacts & WA_ACT_LNK)
+		printf("thread_pool_wakeup: %x, waiting=%d, head=%x\n",
+		   thread_pool, thread_pool->waiting, thread_pool->thr_acts);
+#endif	/* MACH_ASSERT */
+
+	if (thread_pool->waiting) {
+#if 0
+		thread_wakeup((event_t)thread_pool);
+#endif
+		thread_pool->waiting = 0;
+	}
+}


Property changes on: trunk/sys/compat/mach/kern/thread_pool.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/kern_types.h
===================================================================
--- trunk/sys/compat/mach/kern_types.h	                        (rev 0)
+++ trunk/sys/compat/mach/kern_types.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+
+#ifndef	_KERN_KERN_TYPES_H_
+#define	_KERN_KERN_TYPES_H_
+#ifdef _KERNEL
+#include <sys/mach/port.h>
+
+typedef	mach_port_t			*thread_array_t;
+typedef	mach_port_t			*thread_port_array_t;
+typedef mach_port_t			thread_act_port_t;
+typedef	thread_act_port_t		*thread_act_port_array_t;
+typedef struct mach_task			*task_t;
+typedef struct clock *mach_clock_t;
+typedef struct processor		*processor_t;
+typedef struct subsystem		*subsystem_t;
+#endif
+#endif	/* _KERN_KERN_TYPES_H_ */


Property changes on: trunk/sys/compat/mach/kern_types.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_clock.c
===================================================================
--- trunk/sys/compat/mach/mach_clock.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_clock.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,150 @@
+/*-
+ * Copyright (c) 2014 Matthew Macy <kmacy at freebsd.org>
+ * Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Emmanuel Dreyfus
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/signal.h>
+#include <sys/proc.h>
+#include <sys/time.h>
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mach.h>
+
+#include <sys/mach/clock_types.h>
+#include <sys/mach/clock_server.h>
+
+#define timespecsub_netbsd(tsp, usp, vsp)                               \
+        do {                                                            \
+                (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec;          \
+                (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec;       \
+                if ((vsp)->tv_nsec < 0) {                               \
+                        (vsp)->tv_sec--;                                \
+                        (vsp)->tv_nsec += 1000000000L;                  \
+                }                                                       \
+        } while (/* CONSTCOND */ 0)
+
+
+
+kern_return_t
+clock_sleep(mach_port_name_t clock_name, mach_sleep_type_t type, int sleep_sec, int sleep_nsec, mach_timespec_t *wakeup_time)
+{
+	struct timespec mts, cts, tts;
+	mach_timespec_t mcts;
+#if 0
+	int dontcare;
+#endif
+	int error;
+	int ticks;
+
+	mts.tv_sec = sleep_sec;
+	mts.tv_nsec = sleep_nsec;
+
+	if (type == TIME_ABSOLUTE) {
+		nanotime(&cts);
+		timespecsub_netbsd(&mts, &cts, &tts);
+	} else {
+		tts.tv_sec = mts.tv_sec;
+		tts.tv_nsec = mts.tv_nsec;
+	}
+
+	ticks = tts.tv_sec * hz;
+	ticks += (tts.tv_nsec * hz) / 100000000L;
+
+	if (ticks <= 0)
+		return (EINVAL);
+	/* mach thread abort ignores uninterruptible sleep so this works */
+	pause("sleep", ticks);
+
+	if (wakeup_time != NULL) {
+		nanotime(&cts);
+		mcts.tv_sec = cts.tv_sec;
+		mcts.tv_nsec = cts.tv_nsec;
+		error = copyout(&mcts, wakeup_time, sizeof(mcts));
+		if (error != 0)
+			return (error);
+	}
+
+	return (0);
+}
+
+int
+mach_timebase_info(mach_timebase_info_t infop)
+{
+	/* {
+		syscallarg(mach_timebase_info_t) info;
+	} */
+	int error;
+	struct mach_timebase_info info;
+
+	/* XXX This is probably bus speed, fill it accurately */
+	info.numer = 4000000000UL;
+	info.denom = 75189611UL;
+
+	if ((error = copyout(&info, (void *)infop,
+	    sizeof(info))) != 0)
+		return (error);
+
+	return (0);
+}
+
+int
+clock_get_time(clock_serv_t clock_serv, mach_timespec_t *cur_time)
+{
+	struct timespec ts;
+
+	nanotime(&ts);
+
+	return (copyout(&ts, cur_time, sizeof(ts)));
+}
+
+int
+clock_get_attributes(
+	clock_serv_t clock_serv,
+	clock_flavor_t flavor,
+	clock_attr_t clock_attr,
+	mach_msg_type_number_t *clock_attrCnt
+)
+UNSUPPORTED;
+
+int
+clock_alarm(
+	clock_serv_t clock_serv,
+	alarm_type_t alarm_type,
+	mach_timespec_t alarm_time,
+	clock_reply_t alarm_port,
+	mach_msg_type_name_t alarm_portPoly
+)
+UNSUPPORTED;	


Property changes on: trunk/sys/compat/mach/mach_clock.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_convert.c
===================================================================
--- trunk/sys/compat/mach/mach_convert.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_convert.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,92 @@
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/param.h>
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/task.h>
+
+ipc_port_t
+convert_clock_ctrl_to_port(mach_clock_t clock)
+{
+	return (NULL);
+}
+
+ipc_port_t
+convert_clock_to_port(mach_clock_t clock)
+{
+	return (NULL);
+}
+
+vm_map_t
+convert_port_entry_to_map(ipc_port_t port)
+{
+	return (NULL);
+}
+
+
+mach_clock_t
+convert_port_to_clock(ipc_port_t port)
+{
+	return (NULL);
+}
+
+semaphore_t
+convert_port_to_semaphore(ipc_port_t port)
+{
+
+	return (NULL);
+}
+
+task_name_t
+convert_port_to_task_name(ipc_port_t port)
+{
+
+	return (NULL);
+}
+
+task_suspension_token_t
+convert_port_to_task_suspension_token(ipc_port_t port)
+{
+
+	return (NULL);
+}
+
+ipc_voucher_t
+convert_port_to_voucher(ipc_port_t port)
+{
+
+	return (NULL);
+}
+
+ipc_port_t
+convert_semaphore_to_port(semaphore_t sema)
+{
+
+	return (NULL);
+}
+
+ipc_port_t
+convert_task_suspension_token_to_port(task_suspension_token_t token)
+{
+
+	return (NULL);
+}
+
+ipc_port_t
+convert_voucher_attr_control_to_port(ipc_voucher_attr_control_t control)
+{
+
+	return (NULL);
+}
+
+ipc_port_t
+convert_voucher_to_port(ipc_voucher_t voucher)
+{
+
+	return (NULL);
+}


Property changes on: trunk/sys/compat/mach/mach_convert.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_host.c
===================================================================
--- trunk/sys/compat/mach/mach_host.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_host.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,167 @@
+
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/malloc.h>
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/signal.h>
+#include <sys/proc.h>
+
+#include <sys/mach/mach_types.h>
+
+
+#include <sys/mach/host_special_ports.h>
+#include <sys/mach/host.h>
+#include <sys/mach/mach_host_server.h>
+
+host_data_t	realhost;
+
+int
+host_create_mach_voucher(
+	host_t host,
+	mach_voucher_attr_raw_recipe_array_t recipes,
+	mach_msg_type_number_t recipesCnt,
+	ipc_voucher_t *voucher
+)
+UNSUPPORTED;
+
+int
+host_get_clock_service(
+	host_t host,
+	clock_id_t clock_id,
+	clock_serv_t *clock_serv
+)
+UNSUPPORTED;
+
+int
+host_info(
+	host_t host,
+	host_flavor_t flavor,
+	host_info_t host_info_out,
+	mach_msg_type_number_t *host_info_outCnt
+)
+UNSUPPORTED;
+
+int
+host_kernel_version(
+	host_t host,
+	kernel_version_t kernel_version
+)
+UNSUPPORTED;
+
+int
+host_page_size(
+	host_t host,
+	vm_size_t *out_page_size
+)
+UNSUPPORTED;
+
+int
+host_processor_info(
+	host_t host,
+	processor_flavor_t flavor,
+	natural_t *out_processor_count,
+	processor_info_array_t *out_processor_info,
+	mach_msg_type_number_t *out_processor_infoCnt
+)
+UNSUPPORTED;
+
+int
+host_register_mach_voucher_attr_manager(
+	host_t host,
+	mach_voucher_attr_manager_t attr_manager,
+	mach_voucher_attr_value_handle_t default_value,
+	mach_voucher_attr_key_t *new_key,
+	ipc_voucher_attr_control_t *new_attr_control
+)
+UNSUPPORTED;
+
+int
+host_register_well_known_mach_voucher_attr_manager(
+	host_t host,
+	mach_voucher_attr_manager_t attr_manager,
+	mach_voucher_attr_value_handle_t default_value,
+	mach_voucher_attr_key_t key,
+	ipc_voucher_attr_control_t *new_attr_control
+)
+UNSUPPORTED;
+
+int
+host_request_notification(
+	host_t host,
+	host_flavor_t notify_type,
+	mach_port_t notify_port
+)
+UNSUPPORTED;
+
+int
+host_statistics(
+	host_t host_priv,
+	host_flavor_t flavor,
+	host_info_t host_info_out,
+	mach_msg_type_number_t *host_info_outCnt
+)
+UNSUPPORTED;
+
+int
+host_statistics64(
+	host_t host_priv,
+	host_flavor_t flavor,
+	host_info64_t host_info64_out,
+	mach_msg_type_number_t *host_info64_outCnt
+)
+UNSUPPORTED;
+
+int
+host_virtual_physical_table_info(
+	host_t host,
+	hash_info_bucket_array_t *info,
+	mach_msg_type_number_t *infoCnt
+)
+UNSUPPORTED;
+
+int
+mach_memory_object_memory_entry(
+	host_t host,
+	boolean_t internal,
+	vm_size_t size,
+	vm_prot_t permission,
+	memory_object_t pager,
+	mach_port_t *entry_handle
+)
+UNSUPPORTED;
+
+int
+mach_memory_object_memory_entry_64(
+	host_t host,
+	boolean_t internal,
+	memory_object_size_t size,
+	vm_prot_t permission,
+	memory_object_t pager,
+	mach_port_t *entry_handle
+)
+UNSUPPORTED;
+
+int
+mach_zone_info(
+	host_priv_t host,
+	mach_zone_name_array_t *names,
+	mach_msg_type_number_t *namesCnt,
+	mach_zone_info_array_t *info,
+	mach_msg_type_number_t *infoCnt
+)
+UNSUPPORTED;
+
+int
+processor_set_create(
+	host_t host,
+	processor_set_t *new_set,
+	processor_set_name_t *new_name
+)
+UNSUPPORTED;
+
+


Property changes on: trunk/sys/compat/mach/mach_host.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_host_priv.c
===================================================================
--- trunk/sys/compat/mach/mach_host_priv.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_host_priv.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,146 @@
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/malloc.h>
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/signal.h>
+#include <sys/proc.h>
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/host_priv_server.h>
+
+
+int
+get_dp_control_port(
+	host_priv_t host,
+	mach_port_t *contorl_port
+)
+UNSUPPORTED;
+
+int
+host_default_memory_manager(
+	host_priv_t host_priv,
+	memory_object_default_t *default_manager,
+	memory_object_cluster_size_t cluster_size
+)
+UNSUPPORTED;
+
+int
+host_get_UNDServer(
+	host_priv_t host,
+	UNDServerRef *server
+)
+UNSUPPORTED;
+
+int
+host_get_boot_info(
+	host_priv_t host_priv,
+	kernel_boot_info_t boot_info
+)
+UNSUPPORTED;
+
+int
+host_get_clock_control(
+	host_priv_t host_priv,
+	clock_id_t clock_id,
+	clock_ctrl_t *clock_ctrl
+)
+UNSUPPORTED;
+
+int
+host_get_special_port(
+	host_priv_t host_priv,
+	int node,
+	int which,
+	mach_port_t *port
+)
+UNSUPPORTED;
+
+int
+host_priv_statistics(
+	host_priv_t host_priv,
+	host_flavor_t flavor,
+	host_info_t host_info_out,
+	mach_msg_type_number_t *host_info_outCnt
+)
+UNSUPPORTED;
+
+int
+host_processor_set_priv(
+	host_priv_t host_priv,
+	processor_set_name_t set_name,
+	processor_set_t *set
+)
+UNSUPPORTED;
+
+int
+host_processor_sets(
+	host_priv_t host_priv,
+	processor_set_name_array_t *processor_sets,
+	mach_msg_type_number_t *processor_setsCnt
+)
+UNSUPPORTED;
+
+int
+host_processors(
+	host_priv_t host_priv,
+	processor_array_t *out_processor_list,
+	mach_msg_type_number_t *out_processor_listCnt
+)
+UNSUPPORTED;
+
+int
+host_reboot(
+	host_priv_t host_priv,
+	int options
+)
+UNSUPPORTED;
+
+int
+host_set_UNDServer(
+	host_priv_t host,
+	UNDServerRef server
+)
+
+UNSUPPORTED;
+
+int
+host_set_special_port(
+	host_priv_t host_priv,
+	int which,
+	mach_port_t port
+)
+UNSUPPORTED;
+
+int
+kext_request(
+	host_priv_t host_priv,
+	uint32_t user_log_flags,
+	vm_offset_t request_data,
+	mach_msg_type_number_t request_dataCnt,
+	vm_offset_t *response_data,
+	mach_msg_type_number_t *response_dataCnt,
+	vm_offset_t *log_data,
+	mach_msg_type_number_t *log_dataCnt,
+	kern_return_t *op_result
+)
+UNSUPPORTED;
+
+int
+set_dp_control_port(
+	host_priv_t host,
+	mach_port_t control_port
+)
+UNSUPPORTED;
+
+int
+thread_wire(
+	host_priv_t host_priv,
+	thread_act_t thread,
+	boolean_t wired
+)
+UNSUPPORTED;


Property changes on: trunk/sys/compat/mach/mach_host_priv.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_host_server.c
===================================================================
--- trunk/sys/compat/mach/mach_host_server.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_host_server.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,3199 @@
+/*
+ * IDENTIFICATION:
+ * stub generated Thu Jun 11 18:17:44 2015
+ * with a MiG generated Thu Jun 11 16:16:11 PDT 2015 by kmacy at serenity
+ * OPTIONS: 
+ *	KernelServer
+ */
+
+/* Module mach_host */
+
+#define	__MIG_check__Request__mach_host_subsystem__ 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#ifdef _KERNEL
+#include <sys/mach/ndr.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#else /* !_KERNEL */
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#endif /*_KERNEL */
+
+#include <sys/mach/std_types.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc_mig.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach_debug/mach_debug_types.h>
+
+#ifndef	mig_internal
+#define	mig_internal	static __inline__
+#endif	/* mig_internal */
+
+#ifndef	mig_external
+#define mig_external
+#endif	/* mig_external */
+
+#if	!defined(__MigTypeCheck) && defined(TypeCheck)
+#define	__MigTypeCheck		TypeCheck	/* Legacy setting */
+#endif	/* !defined(__MigTypeCheck) */
+
+#if	!defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
+#define	__MigKernelSpecificCode	_MIG_KERNEL_SPECIFIC_CODE_	/* Legacy setting */
+#endif	/* !defined(__MigKernelSpecificCode) */
+
+#ifndef	LimitCheck
+#define	LimitCheck 0
+#endif	/* LimitCheck */
+
+#ifndef	min
+#define	min(a,b)  ( ((a) < (b))? (a): (b) )
+#endif	/* min */
+
+#if !defined(_WALIGN_)
+#define _WALIGN_(x) (((x) + 7) & ~7)
+#endif /* !defined(_WALIGN_) */
+
+#if !defined(_WALIGNSZ_)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#endif /* !defined(_WALIGNSZ_) */
+
+#ifndef	UseStaticTemplates
+#define	UseStaticTemplates	1
+#endif	/* UseStaticTemplates */
+
+#define _WALIGN_(x) (((x) + 7) & ~7)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#ifndef	__DeclareRcvRpc
+#define	__DeclareRcvRpc(_NUM_, _NAME_)
+#endif	/* __DeclareRcvRpc */
+
+#ifndef	__BeforeRcvRpc
+#define	__BeforeRcvRpc(_NUM_, _NAME_)
+#endif	/* __BeforeRcvRpc */
+
+#ifndef	__AfterRcvRpc
+#define	__AfterRcvRpc(_NUM_, _NAME_)
+#endif	/* __AfterRcvRpc */
+
+#ifndef	__DeclareRcvSimple
+#define	__DeclareRcvSimple(_NUM_, _NAME_)
+#endif	/* __DeclareRcvSimple */
+
+#ifndef	__BeforeRcvSimple
+#define	__BeforeRcvSimple(_NUM_, _NAME_)
+#endif	/* __BeforeRcvSimple */
+
+#ifndef	__AfterRcvSimple
+#define	__AfterRcvSimple(_NUM_, _NAME_)
+#endif	/* __AfterRcvSimple */
+
+#define novalue void
+#if	__MigKernelSpecificCode
+#define msgh_request_port	msgh_remote_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_REMOTE(bits)
+#define msgh_reply_port		msgh_local_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#else
+#define msgh_request_port	msgh_local_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#define msgh_reply_port		msgh_remote_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_REMOTE(bits)
+#endif /* __MigKernelSpecificCode */
+
+#define MIG_RETURN_ERROR(X, code)	{\
+				((mig_reply_error_t *)X)->RetCode = code;\
+				((mig_reply_error_t *)X)->NDR = NDR_record;\
+				return;\
+				}
+
+/* typedefs for all requests */
+
+#ifndef __Request__mach_host_subsystem__defined
+#define __Request__mach_host_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t flavor;
+		mach_msg_type_number_t host_info_outCnt;
+	} __Request__host_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__host_kernel_version_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__host_page_size_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t pager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t internal;
+		vm_size_t size;
+		vm_prot_t permission;
+	} __Request__mach_memory_object_memory_entry_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		processor_flavor_t flavor;
+	} __Request__host_processor_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		clock_id_t clock_id;
+	} __Request__host_get_clock_service_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__host_virtual_physical_table_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__processor_set_default_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__processor_set_create_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t pager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t internal;
+		memory_object_size_t size;
+		vm_prot_t permission;
+	} __Request__mach_memory_object_memory_entry_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t flavor;
+		mach_msg_type_number_t host_info_outCnt;
+	} __Request__host_statistics_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t notify_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t notify_type;
+	} __Request__host_request_notification_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t flavor;
+		mach_msg_type_number_t host_info64_outCnt;
+	} __Request__host_statistics64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__mach_zone_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t recipesCnt;
+		uint8_t recipes[5120];
+	} __Request__host_create_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t attr_manager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_voucher_attr_value_handle_t default_value;
+	} __Request__host_register_mach_voucher_attr_manager_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t attr_manager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_voucher_attr_value_handle_t default_value;
+		mach_voucher_attr_key_t key;
+	} __Request__host_register_well_known_mach_voucher_attr_manager_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__mach_host_subsystem__defined */
+
+/* typedefs for all replies */
+
+#ifndef __Reply__mach_host_subsystem__defined
+#define __Reply__mach_host_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t host_info_outCnt;
+		integer_t host_info_out[68];
+	} __Reply__host_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t kernel_versionOffset; /* MiG doesn't use it */
+		mach_msg_type_number_t kernel_versionCnt;
+		char kernel_version[512];
+	} __Reply__host_kernel_version_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_size_t out_page_size;
+	} __Reply__host_page_size_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t entry_handle;
+		/* end of the kernel processed data */
+	} __Reply__mach_memory_object_memory_entry_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t out_processor_info;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		natural_t out_processor_count;
+		mach_msg_type_number_t out_processor_infoCnt;
+	} __Reply__host_processor_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t clock_serv;
+		/* end of the kernel processed data */
+	} __Reply__host_get_clock_service_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t info;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t infoCnt;
+	} __Reply__host_virtual_physical_table_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t default_set;
+		/* end of the kernel processed data */
+	} __Reply__processor_set_default_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_set;
+		mach_msg_port_descriptor_t new_name;
+		/* end of the kernel processed data */
+	} __Reply__processor_set_create_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t entry_handle;
+		/* end of the kernel processed data */
+	} __Reply__mach_memory_object_memory_entry_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t host_info_outCnt;
+		integer_t host_info_out[68];
+	} __Reply__host_statistics_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__host_request_notification_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t host_info64_outCnt;
+		integer_t host_info64_out[256];
+	} __Reply__host_statistics64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t names;
+		mach_msg_ool_descriptor_t info;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t namesCnt;
+		mach_msg_type_number_t infoCnt;
+	} __Reply__mach_zone_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t voucher;
+		/* end of the kernel processed data */
+	} __Reply__host_create_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_attr_control;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_voucher_attr_key_t new_key;
+	} __Reply__host_register_mach_voucher_attr_manager_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_attr_control;
+		/* end of the kernel processed data */
+	} __Reply__host_register_well_known_mach_voucher_attr_manager_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__mach_host_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__mach_host_subsystem__defined
+#define __ReplyUnion__mach_host_subsystem__defined
+union __ReplyUnion__mach_host_subsystem {
+	__Reply__host_info_t Reply_host_info;
+	__Reply__host_kernel_version_t Reply_host_kernel_version;
+	__Reply__host_page_size_t Reply_host_page_size;
+	__Reply__mach_memory_object_memory_entry_t Reply_mach_memory_object_memory_entry;
+	__Reply__host_processor_info_t Reply_host_processor_info;
+	__Reply__host_get_clock_service_t Reply_host_get_clock_service;
+	__Reply__host_virtual_physical_table_info_t Reply_host_virtual_physical_table_info;
+	__Reply__processor_set_default_t Reply_processor_set_default;
+	__Reply__processor_set_create_t Reply_processor_set_create;
+	__Reply__mach_memory_object_memory_entry_64_t Reply_mach_memory_object_memory_entry_64;
+	__Reply__host_statistics_t Reply_host_statistics;
+	__Reply__host_request_notification_t Reply_host_request_notification;
+	__Reply__host_statistics64_t Reply_host_statistics64;
+	__Reply__mach_zone_info_t Reply_mach_zone_info;
+	__Reply__host_create_mach_voucher_t Reply_host_create_mach_voucher;
+	__Reply__host_register_mach_voucher_attr_manager_t Reply_host_register_mach_voucher_attr_manager;
+	__Reply__host_register_well_known_mach_voucher_attr_manager_t Reply_host_register_well_known_mach_voucher_attr_manager;
+};
+#endif /* __RequestUnion__mach_host_subsystem__defined */
+/* Forward Declarations */
+
+
+mig_internal novalue _Xhost_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_kernel_version
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_page_size
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_memory_object_memory_entry
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_processor_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_get_clock_service
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_virtual_physical_table_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xprocessor_set_default
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xprocessor_set_create
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_memory_object_memory_entry_64
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_statistics
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_request_notification
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_statistics64
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_zone_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_create_mach_voucher
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_register_mach_voucher_attr_manager
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xhost_register_well_known_mach_voucher_attr_manager
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__host_info_t__defined)
+#define __MIG_check__Request__host_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_info_t(__attribute__((__unused__)) __Request__host_info_t *In0P)
+{
+
+	typedef __Request__host_info_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_info_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_info
+#if	defined(LINTLIBRARY)
+    (host, flavor, host_info_out, host_info_outCnt)
+	host_t host;
+	host_flavor_t flavor;
+	host_info_t host_info_out;
+	mach_msg_type_number_t *host_info_outCnt;
+{ return host_info(host, flavor, host_info_out, host_info_outCnt); }
+#else
+(
+	host_t host,
+	host_flavor_t flavor,
+	host_info_t host_info_out,
+	mach_msg_type_number_t *host_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_info */
+mig_internal novalue _Xhost_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t flavor;
+		mach_msg_type_number_t host_info_outCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_info_t __Request;
+	typedef __Reply__host_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(200, "host_info")
+	__BeforeRcvRpc(200, "host_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_info_t__defined)
+	check_result = __MIG_check__Request__host_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_info_t__defined) */
+
+	OutP->host_info_outCnt = 68;
+	if (In0P->host_info_outCnt < OutP->host_info_outCnt)
+		OutP->host_info_outCnt = In0P->host_info_outCnt;
+
+	OutP->RetCode = host_info(convert_port_to_host(In0P->Head.msgh_request_port), In0P->flavor, OutP->host_info_out, &OutP->host_info_outCnt);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+	OutP->Head.msgh_size = (sizeof(Reply) - 272) + (_WALIGN_((4 * OutP->host_info_outCnt)));
+
+	__AfterRcvRpc(200, "host_info")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__host_kernel_version_t__defined)
+#define __MIG_check__Request__host_kernel_version_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_kernel_version_t(__attribute__((__unused__)) __Request__host_kernel_version_t *In0P)
+{
+
+	typedef __Request__host_kernel_version_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_kernel_version_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_kernel_version */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_kernel_version
+#if	defined(LINTLIBRARY)
+    (host, kernel_version)
+	host_t host;
+	kernel_version_t kernel_version;
+{ return host_kernel_version(host, kernel_version); }
+#else
+(
+	host_t host,
+	kernel_version_t kernel_version
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_kernel_version */
+mig_internal novalue _Xhost_kernel_version
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_kernel_version_t __Request;
+	typedef __Reply__host_kernel_version_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_kernel_version_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_kernel_version_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(201, "host_kernel_version")
+	__BeforeRcvRpc(201, "host_kernel_version")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_kernel_version_t__defined)
+	check_result = __MIG_check__Request__host_kernel_version_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_kernel_version_t__defined) */
+
+	OutP->RetCode = host_kernel_version(convert_port_to_host(In0P->Head.msgh_request_port), OutP->kernel_version);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+#ifdef __LP64__
+	{
+		size_t strLength = strlen(OutP->kernel_version) + 1;
+		if (strLength > 0xffffffff)
+			MIG_RETURN_ERROR(OutP, MIG_BAD_ARGUMENTS);
+		OutP->kernel_versionCnt = (mach_msg_type_number_t) strLength;
+	}
+#else
+	OutP->kernel_versionCnt = (mach_msg_type_number_t) strlen(OutP->kernel_version) + 1;
+#endif /* __LP64__ */
+	OutP->Head.msgh_size = (sizeof(Reply) - 512) + (_WALIGN_((OutP->kernel_versionCnt + 3) & ~3));
+
+	__AfterRcvRpc(201, "host_kernel_version")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__host_page_size_t__defined)
+#define __MIG_check__Request__host_page_size_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_page_size_t(__attribute__((__unused__)) __Request__host_page_size_t *In0P)
+{
+
+	typedef __Request__host_page_size_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_page_size_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_page_size */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_page_size
+#if	defined(LINTLIBRARY)
+    (host, out_page_size)
+	host_t host;
+	vm_size_t *out_page_size;
+{ return host_page_size(host, out_page_size); }
+#else
+(
+	host_t host,
+	vm_size_t *out_page_size
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_page_size */
+mig_internal novalue _Xhost_page_size
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_page_size_t __Request;
+	typedef __Reply__host_page_size_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_page_size_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_page_size_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(202, "host_page_size")
+	__BeforeRcvRpc(202, "host_page_size")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_page_size_t__defined)
+	check_result = __MIG_check__Request__host_page_size_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_page_size_t__defined) */
+
+	OutP->RetCode = host_page_size(convert_port_to_host(In0P->Head.msgh_request_port), &OutP->out_page_size);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(202, "host_page_size")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__mach_memory_object_memory_entry_t__defined)
+#define __MIG_check__Request__mach_memory_object_memory_entry_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_memory_object_memory_entry_t(__attribute__((__unused__)) __Request__mach_memory_object_memory_entry_t *In0P)
+{
+
+	typedef __Request__mach_memory_object_memory_entry_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->pager.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->pager.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_memory_object_memory_entry_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_memory_object_memory_entry */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_memory_object_memory_entry
+#if	defined(LINTLIBRARY)
+    (host, internal, size, permission, pager, entry_handle)
+	host_t host;
+	boolean_t internal;
+	vm_size_t size;
+	vm_prot_t permission;
+	memory_object_t pager;
+	mach_port_t *entry_handle;
+{ return mach_memory_object_memory_entry(host, internal, size, permission, pager, entry_handle); }
+#else
+(
+	host_t host,
+	boolean_t internal,
+	vm_size_t size,
+	vm_prot_t permission,
+	memory_object_t pager,
+	mach_port_t *entry_handle
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_memory_object_memory_entry */
+mig_internal novalue _Xmach_memory_object_memory_entry
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t pager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t internal;
+		vm_size_t size;
+		vm_prot_t permission;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_memory_object_memory_entry_t __Request;
+	typedef __Reply__mach_memory_object_memory_entry_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_memory_object_memory_entry_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_memory_object_memory_entry_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t entry_handleTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t entry_handleTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	__DeclareRcvRpc(203, "mach_memory_object_memory_entry")
+	__BeforeRcvRpc(203, "mach_memory_object_memory_entry")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_memory_object_memory_entry_t__defined)
+	check_result = __MIG_check__Request__mach_memory_object_memory_entry_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_memory_object_memory_entry_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->entry_handle = entry_handleTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->entry_handle.disposition = 17;
+#else
+	OutP->entry_handle.disposition = 17;
+#endif /* __MigKernelSpecificCode */
+	OutP->entry_handle.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = mach_memory_object_memory_entry(convert_port_to_host(In0P->Head.msgh_request_port), In0P->internal, In0P->size, In0P->permission, In0P->pager.name, &OutP->entry_handle.name);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(203, "mach_memory_object_memory_entry")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__host_processor_info_t__defined)
+#define __MIG_check__Request__host_processor_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_processor_info_t(__attribute__((__unused__)) __Request__host_processor_info_t *In0P)
+{
+
+	typedef __Request__host_processor_info_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_processor_info_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_processor_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_processor_info
+#if	defined(LINTLIBRARY)
+    (host, flavor, out_processor_count, out_processor_info, out_processor_infoCnt)
+	host_t host;
+	processor_flavor_t flavor;
+	natural_t *out_processor_count;
+	processor_info_array_t *out_processor_info;
+	mach_msg_type_number_t *out_processor_infoCnt;
+{ return host_processor_info(host, flavor, out_processor_count, out_processor_info, out_processor_infoCnt); }
+#else
+(
+	host_t host,
+	processor_flavor_t flavor,
+	natural_t *out_processor_count,
+	processor_info_array_t *out_processor_info,
+	mach_msg_type_number_t *out_processor_infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_processor_info */
+mig_internal novalue _Xhost_processor_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		processor_flavor_t flavor;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_processor_info_t __Request;
+	typedef __Reply__host_processor_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_processor_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_processor_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t out_processor_infoTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t out_processor_infoTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	__DeclareRcvRpc(204, "host_processor_info")
+	__BeforeRcvRpc(204, "host_processor_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_processor_info_t__defined)
+	check_result = __MIG_check__Request__host_processor_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_processor_info_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->out_processor_info = out_processor_infoTemplate;
+#else	/* UseStaticTemplates */
+	OutP->out_processor_info.deallocate =  FALSE;
+	OutP->out_processor_info.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->out_processor_info.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = host_processor_info(convert_port_to_host(In0P->Head.msgh_request_port), In0P->flavor, &OutP->out_processor_count, (processor_info_array_t *)&(OutP->out_processor_info.address), &OutP->out_processor_infoCnt);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->out_processor_info.size = OutP->out_processor_infoCnt * 4;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(204, "host_processor_info")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__host_get_clock_service_t__defined)
+#define __MIG_check__Request__host_get_clock_service_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_get_clock_service_t(__attribute__((__unused__)) __Request__host_get_clock_service_t *In0P)
+{
+
+	typedef __Request__host_get_clock_service_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_get_clock_service_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_get_clock_service */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_clock_service
+#if	defined(LINTLIBRARY)
+    (host, clock_id, clock_serv)
+	host_t host;
+	clock_id_t clock_id;
+	clock_serv_t *clock_serv;
+{ return host_get_clock_service(host, clock_id, clock_serv); }
+#else
+(
+	host_t host,
+	clock_id_t clock_id,
+	clock_serv_t *clock_serv
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_clock_service */
+mig_internal novalue _Xhost_get_clock_service
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		clock_id_t clock_id;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_get_clock_service_t __Request;
+	typedef __Reply__host_get_clock_service_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_get_clock_service_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_get_clock_service_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t clock_servTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t clock_servTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	clock_serv_t clock_serv;
+
+	__DeclareRcvRpc(206, "host_get_clock_service")
+	__BeforeRcvRpc(206, "host_get_clock_service")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_get_clock_service_t__defined)
+	check_result = __MIG_check__Request__host_get_clock_service_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_get_clock_service_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->clock_serv = clock_servTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->clock_serv.disposition = 17;
+#else
+	OutP->clock_serv.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->clock_serv.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = host_get_clock_service(convert_port_to_host(In0P->Head.msgh_request_port), In0P->clock_id, &clock_serv);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->clock_serv.name = (mach_port_t)convert_clock_to_port(clock_serv);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(206, "host_get_clock_service")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__host_virtual_physical_table_info_t__defined)
+#define __MIG_check__Request__host_virtual_physical_table_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_virtual_physical_table_info_t(__attribute__((__unused__)) __Request__host_virtual_physical_table_info_t *In0P)
+{
+
+	typedef __Request__host_virtual_physical_table_info_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_virtual_physical_table_info_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_virtual_physical_table_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_virtual_physical_table_info
+#if	defined(LINTLIBRARY)
+    (host, info, infoCnt)
+	host_t host;
+	hash_info_bucket_array_t *info;
+	mach_msg_type_number_t *infoCnt;
+{ return host_virtual_physical_table_info(host, info, infoCnt); }
+#else
+(
+	host_t host,
+	hash_info_bucket_array_t *info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_virtual_physical_table_info */
+mig_internal novalue _Xhost_virtual_physical_table_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_virtual_physical_table_info_t __Request;
+	typedef __Reply__host_virtual_physical_table_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_virtual_physical_table_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_virtual_physical_table_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t infoTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = TRUE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t infoTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = TRUE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	__DeclareRcvRpc(209, "host_virtual_physical_table_info")
+	__BeforeRcvRpc(209, "host_virtual_physical_table_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_virtual_physical_table_info_t__defined)
+	check_result = __MIG_check__Request__host_virtual_physical_table_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_virtual_physical_table_info_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->info = infoTemplate;
+#else	/* UseStaticTemplates */
+	OutP->info.deallocate =  TRUE;
+	OutP->info.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->info.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	OutP->infoCnt = 0;
+
+	RetCode = host_virtual_physical_table_info(convert_port_to_host(In0P->Head.msgh_request_port), (hash_info_bucket_array_t *)&(OutP->info.address), &OutP->infoCnt);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->info.size = OutP->infoCnt * 4;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(209, "host_virtual_physical_table_info")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__processor_set_default_t__defined)
+#define __MIG_check__Request__processor_set_default_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__processor_set_default_t(__attribute__((__unused__)) __Request__processor_set_default_t *In0P)
+{
+
+	typedef __Request__processor_set_default_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__processor_set_default_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine processor_set_default */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t processor_set_default
+#if	defined(LINTLIBRARY)
+    (host, default_set)
+	host_t host;
+	processor_set_name_t *default_set;
+{ return processor_set_default(host, default_set); }
+#else
+(
+	host_t host,
+	processor_set_name_t *default_set
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine processor_set_default */
+mig_internal novalue _Xprocessor_set_default
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__processor_set_default_t __Request;
+	typedef __Reply__processor_set_default_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__processor_set_default_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__processor_set_default_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t default_setTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t default_setTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	processor_set_name_t default_set;
+
+	__DeclareRcvRpc(213, "processor_set_default")
+	__BeforeRcvRpc(213, "processor_set_default")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__processor_set_default_t__defined)
+	check_result = __MIG_check__Request__processor_set_default_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__processor_set_default_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->default_set = default_setTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->default_set.disposition = 17;
+#else
+	OutP->default_set.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->default_set.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = processor_set_default(convert_port_to_host(In0P->Head.msgh_request_port), &default_set);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->default_set.name = (mach_port_t)convert_pset_name_to_port(default_set);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(213, "processor_set_default")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__processor_set_create_t__defined)
+#define __MIG_check__Request__processor_set_create_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__processor_set_create_t(__attribute__((__unused__)) __Request__processor_set_create_t *In0P)
+{
+
+	typedef __Request__processor_set_create_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__processor_set_create_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine processor_set_create */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t processor_set_create
+#if	defined(LINTLIBRARY)
+    (host, new_set, new_name)
+	host_t host;
+	processor_set_t *new_set;
+	processor_set_name_t *new_name;
+{ return processor_set_create(host, new_set, new_name); }
+#else
+(
+	host_t host,
+	processor_set_t *new_set,
+	processor_set_name_t *new_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine processor_set_create */
+mig_internal novalue _Xprocessor_set_create
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__processor_set_create_t __Request;
+	typedef __Reply__processor_set_create_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__processor_set_create_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__processor_set_create_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t new_setTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t new_nameTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t new_setTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t new_nameTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	processor_set_t new_set;
+	processor_set_name_t new_name;
+
+	__DeclareRcvRpc(214, "processor_set_create")
+	__BeforeRcvRpc(214, "processor_set_create")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__processor_set_create_t__defined)
+	check_result = __MIG_check__Request__processor_set_create_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__processor_set_create_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->new_set = new_setTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->new_set.disposition = 17;
+#else
+	OutP->new_set.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->new_set.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+#if	UseStaticTemplates
+	OutP->new_name = new_nameTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->new_name.disposition = 17;
+#else
+	OutP->new_name.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->new_name.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = processor_set_create(convert_port_to_host(In0P->Head.msgh_request_port), &new_set, &new_name);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->new_set.name = (mach_port_t)convert_pset_to_port(new_set);
+
+	OutP->new_name.name = (mach_port_t)convert_pset_name_to_port(new_name);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 2;
+	__AfterRcvRpc(214, "processor_set_create")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__mach_memory_object_memory_entry_64_t__defined)
+#define __MIG_check__Request__mach_memory_object_memory_entry_64_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_memory_object_memory_entry_64_t(__attribute__((__unused__)) __Request__mach_memory_object_memory_entry_64_t *In0P)
+{
+
+	typedef __Request__mach_memory_object_memory_entry_64_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->pager.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->pager.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_memory_object_memory_entry_64_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_memory_object_memory_entry_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_memory_object_memory_entry_64
+#if	defined(LINTLIBRARY)
+    (host, internal, size, permission, pager, entry_handle)
+	host_t host;
+	boolean_t internal;
+	memory_object_size_t size;
+	vm_prot_t permission;
+	memory_object_t pager;
+	mach_port_t *entry_handle;
+{ return mach_memory_object_memory_entry_64(host, internal, size, permission, pager, entry_handle); }
+#else
+(
+	host_t host,
+	boolean_t internal,
+	memory_object_size_t size,
+	vm_prot_t permission,
+	memory_object_t pager,
+	mach_port_t *entry_handle
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_memory_object_memory_entry_64 */
+mig_internal novalue _Xmach_memory_object_memory_entry_64
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t pager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t internal;
+		memory_object_size_t size;
+		vm_prot_t permission;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_memory_object_memory_entry_64_t __Request;
+	typedef __Reply__mach_memory_object_memory_entry_64_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_memory_object_memory_entry_64_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_memory_object_memory_entry_64_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t entry_handleTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t entry_handleTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	__DeclareRcvRpc(215, "mach_memory_object_memory_entry_64")
+	__BeforeRcvRpc(215, "mach_memory_object_memory_entry_64")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_memory_object_memory_entry_64_t__defined)
+	check_result = __MIG_check__Request__mach_memory_object_memory_entry_64_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_memory_object_memory_entry_64_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->entry_handle = entry_handleTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->entry_handle.disposition = 17;
+#else
+	OutP->entry_handle.disposition = 17;
+#endif /* __MigKernelSpecificCode */
+	OutP->entry_handle.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = mach_memory_object_memory_entry_64(convert_port_to_host(In0P->Head.msgh_request_port), In0P->internal, In0P->size, In0P->permission, In0P->pager.name, &OutP->entry_handle.name);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(215, "mach_memory_object_memory_entry_64")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__host_statistics_t__defined)
+#define __MIG_check__Request__host_statistics_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_statistics_t(__attribute__((__unused__)) __Request__host_statistics_t *In0P)
+{
+
+	typedef __Request__host_statistics_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_statistics_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_statistics */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_statistics
+#if	defined(LINTLIBRARY)
+    (host_priv, flavor, host_info_out, host_info_outCnt)
+	host_t host_priv;
+	host_flavor_t flavor;
+	host_info_t host_info_out;
+	mach_msg_type_number_t *host_info_outCnt;
+{ return host_statistics(host_priv, flavor, host_info_out, host_info_outCnt); }
+#else
+(
+	host_t host_priv,
+	host_flavor_t flavor,
+	host_info_t host_info_out,
+	mach_msg_type_number_t *host_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_statistics */
+mig_internal novalue _Xhost_statistics
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t flavor;
+		mach_msg_type_number_t host_info_outCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_statistics_t __Request;
+	typedef __Reply__host_statistics_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_statistics_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_statistics_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(216, "host_statistics")
+	__BeforeRcvRpc(216, "host_statistics")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_statistics_t__defined)
+	check_result = __MIG_check__Request__host_statistics_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_statistics_t__defined) */
+
+	OutP->host_info_outCnt = 68;
+	if (In0P->host_info_outCnt < OutP->host_info_outCnt)
+		OutP->host_info_outCnt = In0P->host_info_outCnt;
+
+	OutP->RetCode = host_statistics(convert_port_to_host(In0P->Head.msgh_request_port), In0P->flavor, OutP->host_info_out, &OutP->host_info_outCnt);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+	OutP->Head.msgh_size = (sizeof(Reply) - 272) + (_WALIGN_((4 * OutP->host_info_outCnt)));
+
+	__AfterRcvRpc(216, "host_statistics")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__host_request_notification_t__defined)
+#define __MIG_check__Request__host_request_notification_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_request_notification_t(__attribute__((__unused__)) __Request__host_request_notification_t *In0P)
+{
+
+	typedef __Request__host_request_notification_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->notify_port.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->notify_port.disposition != 18)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_request_notification_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_request_notification */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_request_notification
+#if	defined(LINTLIBRARY)
+    (host, notify_type, notify_port)
+	host_t host;
+	host_flavor_t notify_type;
+	mach_port_t notify_port;
+{ return host_request_notification(host, notify_type, notify_port); }
+#else
+(
+	host_t host,
+	host_flavor_t notify_type,
+	mach_port_t notify_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_request_notification */
+mig_internal novalue _Xhost_request_notification
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t notify_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t notify_type;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_request_notification_t __Request;
+	typedef __Reply__host_request_notification_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_request_notification_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_request_notification_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(217, "host_request_notification")
+	__BeforeRcvRpc(217, "host_request_notification")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_request_notification_t__defined)
+	check_result = __MIG_check__Request__host_request_notification_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_request_notification_t__defined) */
+
+	OutP->RetCode = host_request_notification(convert_port_to_host(In0P->Head.msgh_request_port), In0P->notify_type, In0P->notify_port.name);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(217, "host_request_notification")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__host_statistics64_t__defined)
+#define __MIG_check__Request__host_statistics64_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_statistics64_t(__attribute__((__unused__)) __Request__host_statistics64_t *In0P)
+{
+
+	typedef __Request__host_statistics64_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_statistics64_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_statistics64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_statistics64
+#if	defined(LINTLIBRARY)
+    (host_priv, flavor, host_info64_out, host_info64_outCnt)
+	host_t host_priv;
+	host_flavor_t flavor;
+	host_info64_t host_info64_out;
+	mach_msg_type_number_t *host_info64_outCnt;
+{ return host_statistics64(host_priv, flavor, host_info64_out, host_info64_outCnt); }
+#else
+(
+	host_t host_priv,
+	host_flavor_t flavor,
+	host_info64_t host_info64_out,
+	mach_msg_type_number_t *host_info64_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_statistics64 */
+mig_internal novalue _Xhost_statistics64
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t flavor;
+		mach_msg_type_number_t host_info64_outCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_statistics64_t __Request;
+	typedef __Reply__host_statistics64_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_statistics64_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_statistics64_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(219, "host_statistics64")
+	__BeforeRcvRpc(219, "host_statistics64")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_statistics64_t__defined)
+	check_result = __MIG_check__Request__host_statistics64_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_statistics64_t__defined) */
+
+	OutP->host_info64_outCnt = 256;
+	if (In0P->host_info64_outCnt < OutP->host_info64_outCnt)
+		OutP->host_info64_outCnt = In0P->host_info64_outCnt;
+
+	OutP->RetCode = host_statistics64(convert_port_to_host(In0P->Head.msgh_request_port), In0P->flavor, OutP->host_info64_out, &OutP->host_info64_outCnt);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+	OutP->Head.msgh_size = (sizeof(Reply) - 1024) + (_WALIGN_((4 * OutP->host_info64_outCnt)));
+
+	__AfterRcvRpc(219, "host_statistics64")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__mach_zone_info_t__defined)
+#define __MIG_check__Request__mach_zone_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_zone_info_t(__attribute__((__unused__)) __Request__mach_zone_info_t *In0P)
+{
+
+	typedef __Request__mach_zone_info_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_zone_info_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_zone_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_zone_info
+#if	defined(LINTLIBRARY)
+    (host, names, namesCnt, info, infoCnt)
+	host_priv_t host;
+	mach_zone_name_array_t *names;
+	mach_msg_type_number_t *namesCnt;
+	mach_zone_info_array_t *info;
+	mach_msg_type_number_t *infoCnt;
+{ return mach_zone_info(host, names, namesCnt, info, infoCnt); }
+#else
+(
+	host_priv_t host,
+	mach_zone_name_array_t *names,
+	mach_msg_type_number_t *namesCnt,
+	mach_zone_info_array_t *info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_zone_info */
+mig_internal novalue _Xmach_zone_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_zone_info_t __Request;
+	typedef __Reply__mach_zone_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_zone_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_zone_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t namesTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = TRUE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t infoTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = TRUE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t namesTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = TRUE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t infoTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = TRUE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	__DeclareRcvRpc(220, "mach_zone_info")
+	__BeforeRcvRpc(220, "mach_zone_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_zone_info_t__defined)
+	check_result = __MIG_check__Request__mach_zone_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_zone_info_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->names = namesTemplate;
+#else	/* UseStaticTemplates */
+	OutP->names.deallocate =  TRUE;
+	OutP->names.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->names.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+#if	UseStaticTemplates
+	OutP->info = infoTemplate;
+#else	/* UseStaticTemplates */
+	OutP->info.deallocate =  TRUE;
+	OutP->info.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->info.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	OutP->namesCnt = 0;
+
+	OutP->infoCnt = 0;
+
+	RetCode = mach_zone_info(convert_port_to_host_priv(In0P->Head.msgh_request_port), (mach_zone_name_array_t *)&(OutP->names.address), &OutP->namesCnt, (mach_zone_info_array_t *)&(OutP->info.address), &OutP->infoCnt);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->names.size = OutP->namesCnt * 80;
+
+	OutP->info.size = OutP->infoCnt * 64;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 2;
+	__AfterRcvRpc(220, "mach_zone_info")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__host_create_mach_voucher_t__defined)
+#define __MIG_check__Request__host_create_mach_voucher_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_create_mach_voucher_t(__attribute__((__unused__)) __Request__host_create_mach_voucher_t *In0P)
+{
+
+	typedef __Request__host_create_mach_voucher_t __Request;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	msgh_size = In0P->Head.msgh_size;
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (msgh_size < (sizeof(__Request) - 5120)) ||  (msgh_size > (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if defined(__NDR_convert__int_rep__Request__host_create_mach_voucher_t__recipesCnt__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep)
+		__NDR_convert__int_rep__Request__host_create_mach_voucher_t__recipesCnt(&In0P->recipesCnt, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__host_create_mach_voucher_t__recipesCnt__defined */
+#if	__MigTypeCheck
+	if ( In0P->recipesCnt > 5120 )
+		return MIG_BAD_ARGUMENTS;
+	if (((msgh_size - (sizeof(__Request) - 5120)) < In0P->recipesCnt) ||
+	    (msgh_size != (sizeof(__Request) - 5120) + _WALIGN_(In0P->recipesCnt)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_create_mach_voucher_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_create_mach_voucher */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_create_mach_voucher
+#if	defined(LINTLIBRARY)
+    (host, recipes, recipesCnt, voucher)
+	host_t host;
+	mach_voucher_attr_raw_recipe_array_t recipes;
+	mach_msg_type_number_t recipesCnt;
+	ipc_voucher_t *voucher;
+{ return host_create_mach_voucher(host, recipes, recipesCnt, voucher); }
+#else
+(
+	host_t host,
+	mach_voucher_attr_raw_recipe_array_t recipes,
+	mach_msg_type_number_t recipesCnt,
+	ipc_voucher_t *voucher
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_create_mach_voucher */
+mig_internal novalue _Xhost_create_mach_voucher
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t recipesCnt;
+		uint8_t recipes[5120];
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_create_mach_voucher_t __Request;
+	typedef __Reply__host_create_mach_voucher_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_create_mach_voucher_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_create_mach_voucher_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t voucherTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t voucherTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	ipc_voucher_t voucher;
+
+	__DeclareRcvRpc(222, "host_create_mach_voucher")
+	__BeforeRcvRpc(222, "host_create_mach_voucher")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_create_mach_voucher_t__defined)
+	check_result = __MIG_check__Request__host_create_mach_voucher_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_create_mach_voucher_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->voucher = voucherTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->voucher.disposition = 17;
+#else
+	OutP->voucher.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->voucher.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = host_create_mach_voucher(convert_port_to_host(In0P->Head.msgh_request_port), In0P->recipes, In0P->recipesCnt, &voucher);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->voucher.name = (mach_port_t)convert_voucher_to_port(voucher);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(222, "host_create_mach_voucher")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__host_register_mach_voucher_attr_manager_t__defined)
+#define __MIG_check__Request__host_register_mach_voucher_attr_manager_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_register_mach_voucher_attr_manager_t(__attribute__((__unused__)) __Request__host_register_mach_voucher_attr_manager_t *In0P)
+{
+
+	typedef __Request__host_register_mach_voucher_attr_manager_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->attr_manager.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->attr_manager.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_register_mach_voucher_attr_manager_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_register_mach_voucher_attr_manager */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_register_mach_voucher_attr_manager
+#if	defined(LINTLIBRARY)
+    (host, attr_manager, default_value, new_key, new_attr_control)
+	host_t host;
+	mach_voucher_attr_manager_t attr_manager;
+	mach_voucher_attr_value_handle_t default_value;
+	mach_voucher_attr_key_t *new_key;
+	ipc_voucher_attr_control_t *new_attr_control;
+{ return host_register_mach_voucher_attr_manager(host, attr_manager, default_value, new_key, new_attr_control); }
+#else
+(
+	host_t host,
+	mach_voucher_attr_manager_t attr_manager,
+	mach_voucher_attr_value_handle_t default_value,
+	mach_voucher_attr_key_t *new_key,
+	ipc_voucher_attr_control_t *new_attr_control
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_register_mach_voucher_attr_manager */
+mig_internal novalue _Xhost_register_mach_voucher_attr_manager
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t attr_manager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_voucher_attr_value_handle_t default_value;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_register_mach_voucher_attr_manager_t __Request;
+	typedef __Reply__host_register_mach_voucher_attr_manager_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_register_mach_voucher_attr_manager_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_register_mach_voucher_attr_manager_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t new_attr_controlTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t new_attr_controlTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	ipc_voucher_attr_control_t new_attr_control;
+
+	__DeclareRcvRpc(223, "host_register_mach_voucher_attr_manager")
+	__BeforeRcvRpc(223, "host_register_mach_voucher_attr_manager")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_register_mach_voucher_attr_manager_t__defined)
+	check_result = __MIG_check__Request__host_register_mach_voucher_attr_manager_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_register_mach_voucher_attr_manager_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->new_attr_control = new_attr_controlTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->new_attr_control.disposition = 17;
+#else
+	OutP->new_attr_control.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->new_attr_control.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = host_register_mach_voucher_attr_manager(convert_port_to_host(In0P->Head.msgh_request_port), In0P->attr_manager.name, In0P->default_value, &OutP->new_key, &new_attr_control);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->new_attr_control.name = (mach_port_t)convert_voucher_attr_control_to_port(new_attr_control);
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(223, "host_register_mach_voucher_attr_manager")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_host_subsystem__
+#if !defined(__MIG_check__Request__host_register_well_known_mach_voucher_attr_manager_t__defined)
+#define __MIG_check__Request__host_register_well_known_mach_voucher_attr_manager_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__host_register_well_known_mach_voucher_attr_manager_t(__attribute__((__unused__)) __Request__host_register_well_known_mach_voucher_attr_manager_t *In0P)
+{
+
+	typedef __Request__host_register_well_known_mach_voucher_attr_manager_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->attr_manager.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->attr_manager.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__host_register_well_known_mach_voucher_attr_manager_t__defined) */
+#endif /* __MIG_check__Request__mach_host_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine host_register_well_known_mach_voucher_attr_manager */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_register_well_known_mach_voucher_attr_manager
+#if	defined(LINTLIBRARY)
+    (host, attr_manager, default_value, key, new_attr_control)
+	host_t host;
+	mach_voucher_attr_manager_t attr_manager;
+	mach_voucher_attr_value_handle_t default_value;
+	mach_voucher_attr_key_t key;
+	ipc_voucher_attr_control_t *new_attr_control;
+{ return host_register_well_known_mach_voucher_attr_manager(host, attr_manager, default_value, key, new_attr_control); }
+#else
+(
+	host_t host,
+	mach_voucher_attr_manager_t attr_manager,
+	mach_voucher_attr_value_handle_t default_value,
+	mach_voucher_attr_key_t key,
+	ipc_voucher_attr_control_t *new_attr_control
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_register_well_known_mach_voucher_attr_manager */
+mig_internal novalue _Xhost_register_well_known_mach_voucher_attr_manager
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t attr_manager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_voucher_attr_value_handle_t default_value;
+		mach_voucher_attr_key_t key;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__host_register_well_known_mach_voucher_attr_manager_t __Request;
+	typedef __Reply__host_register_well_known_mach_voucher_attr_manager_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__host_register_well_known_mach_voucher_attr_manager_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__host_register_well_known_mach_voucher_attr_manager_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t new_attr_controlTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t new_attr_controlTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	ipc_voucher_attr_control_t new_attr_control;
+
+	__DeclareRcvRpc(224, "host_register_well_known_mach_voucher_attr_manager")
+	__BeforeRcvRpc(224, "host_register_well_known_mach_voucher_attr_manager")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__host_register_well_known_mach_voucher_attr_manager_t__defined)
+	check_result = __MIG_check__Request__host_register_well_known_mach_voucher_attr_manager_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__host_register_well_known_mach_voucher_attr_manager_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->new_attr_control = new_attr_controlTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->new_attr_control.disposition = 17;
+#else
+	OutP->new_attr_control.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->new_attr_control.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = host_register_well_known_mach_voucher_attr_manager(convert_port_to_host(In0P->Head.msgh_request_port), In0P->attr_manager.name, In0P->default_value, In0P->key, &new_attr_control);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->new_attr_control.name = (mach_port_t)convert_voucher_attr_control_to_port(new_attr_control);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(224, "host_register_well_known_mach_voucher_attr_manager")
+}
+
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+boolean_t mach_host_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+mig_routine_t mach_host_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+extern const struct mach_host_subsystem mach_host_subsystem;
+const struct mach_host_subsystem {
+	mig_server_routine_t 	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[25];
+} mach_host_subsystem = {
+	mach_host_server_routine,
+	200,
+	225,
+	(mach_msg_size_t)sizeof(union __ReplyUnion__mach_host_subsystem),
+	(vm_address_t)0,
+	{
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_info, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_info_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_kernel_version, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_kernel_version_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_page_size, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_page_size_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_memory_object_memory_entry, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_memory_object_memory_entry_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_processor_info, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_processor_info_t) },
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_get_clock_service, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_get_clock_service_t) },
+		{0, 0, 0, 0, 0, 0},
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_virtual_physical_table_info, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_virtual_physical_table_info_t) },
+		{0, 0, 0, 0, 0, 0},
+		{0, 0, 0, 0, 0, 0},
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xprocessor_set_default, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__processor_set_default_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xprocessor_set_create, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__processor_set_create_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_memory_object_memory_entry_64, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_memory_object_memory_entry_64_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_statistics, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_statistics_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_request_notification, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_request_notification_t) },
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_statistics64, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_statistics64_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_zone_info, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_zone_info_t) },
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_create_mach_voucher, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_create_mach_voucher_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_register_mach_voucher_attr_manager, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_register_mach_voucher_attr_manager_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xhost_register_well_known_mach_voucher_attr_manager, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__host_register_well_known_mach_voucher_attr_manager_t) },
+	}
+};
+
+mig_external boolean_t mach_host_server
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	register mig_routine_t routine;
+
+	OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0);
+	OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port;
+	/* Minimal size: routine() will update it if different */
+	OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t);
+	OutHeadP->msgh_local_port = MACH_PORT_NULL;
+	OutHeadP->msgh_id = InHeadP->msgh_id + 100;
+
+	if ((InHeadP->msgh_id > 224) || (InHeadP->msgh_id < 200) ||
+	    ((routine = mach_host_subsystem.routine[InHeadP->msgh_id - 200].stub_routine) == 0)) {
+		((mig_reply_error_t *)OutHeadP)->NDR = NDR_record;
+		((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID;
+		return FALSE;
+	}
+	(*routine) (InHeadP, OutHeadP);
+	return TRUE;
+}
+
+mig_external mig_routine_t mach_host_server_routine
+	(mach_msg_header_t *InHeadP)
+{
+	register int msgh_id;
+
+	msgh_id = InHeadP->msgh_id - 200;
+
+	if ((msgh_id > 24) || (msgh_id < 0))
+		return 0;
+
+	return mach_host_subsystem.routine[msgh_id].stub_routine;
+}


Property changes on: trunk/sys/compat/mach/mach_host_server.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_misc.c
===================================================================
--- trunk/sys/compat/mach/mach_misc.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_misc.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,186 @@
+
+/*
+ * MACH compatibility module.
+ *
+ * We actually don't implement anything here yet!
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/namei.h>
+#include <sys/dirent.h>
+#include <sys/eventhandler.h>
+#include <sys/proc.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/filedesc.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/resource.h>
+#include <sys/resourcevar.h>
+#include <sys/socket.h>
+#include <sys/vnode.h>
+#include <sys/uio.h>
+#include <sys/wait.h>
+#include <sys/utsname.h>
+#include <sys/unistd.h>
+#include <sys/times.h>
+#include <sys/sem.h>
+#include <sys/msg.h>
+#include <sys/ptrace.h>
+#include <sys/signalvar.h>
+
+#include <netinet/in.h>
+#include <sys/sysproto.h>
+
+#include <vm/vm.h>
+#include <vm/vm_param.h>
+#include <vm/pmap.h>
+#include <vm/vm_map.h>
+#include <vm/vm_extern.h>
+
+#include <sys/mach/mach_types.h>
+
+#ifdef INVARIANTS
+MALLOC_DEFINE(M_MACH_TMP, "mach temp", "mach compatibility subsystem temp");
+#else
+MALLOC_DEFINE(M_MACH_TMP, "mach temp", "mach compatibility subsystem temp");
+MALLOC_DEFINE(M_MACH_IPC_KMSG, "mach kmsg", "mach compatibility subsystem kmsg");
+MALLOC_DEFINE(M_MACH_IPC_ENTRY, "mach entry", "mach compatibility subsystem ipc_entry");
+MALLOC_DEFINE(M_MACH_IPC_TABLE, "mach table", "mach compatibility subsystem ipc_table");
+MALLOC_DEFINE(M_MACH_KALLOC, "mach kalloc", "mach compatibility subsystem kalloc");
+MALLOC_DEFINE(M_MACH_VM, "mach vm", "mach compatibility subsystem vm");
+#endif
+
+int
+sys_semaphore_timedwait_trap(struct thread *td, struct semaphore_timedwait_trap_args *uap)
+{
+
+	MDPRINTF(("%s(0x%x, %d, %d);\n",
+			 __FUNCTION__, uap->wait_name, uap->sec, uap->nsec));
+	return (ENOSYS);
+}
+
+
+int
+sys_semaphore_timedwait_signal_trap(struct thread *td, struct semaphore_timedwait_signal_trap_args *uap)
+{
+
+	MDPRINTF(("%s(0x%x, 0x%x, %d, %d);\n", __FUNCTION__,
+	    uap->wait_name, uap->signal_name, uap->sec,
+	    uap->nsec));
+	return (ENOSYS);
+}
+
+
+int
+sys_pid_for_task(struct thread *td, struct pid_for_task_args *uap)
+{
+
+	MDPRINTF(("sys_mach_pid_for_task(0x%x, %p);\n",
+	    uap->t, uap->pid));
+	return (ENOSYS);
+}
+
+
+int
+sys_macx_swapon(struct thread *td, struct macx_swapon_args *uap)
+{
+
+	MDPRINTF(("sys_mach_macx_swapon(%p, %d, %d, %d);\n",
+	    uap->name, uap->flags, uap->size,
+			 uap->priority));
+	return (ENOSYS);
+}
+
+int
+sys_macx_swapoff(struct thread *td, struct macx_swapoff_args *uap)
+{
+
+	MDPRINTF(("sys_mach_macx_swapoff(%p, %d);\n",
+			 uap->name, uap->flags));
+	return (ENOSYS);
+}
+
+int
+sys_macx_triggers(struct thread *td, struct macx_triggers_args *uap)
+{
+
+	MDPRINTF(("sys_mach_macx_triggers(%d, %d, %d, 0x%x);\n",
+	    uap->hi_water, uap->low_water, uap->flags,
+			 uap->alert_port));
+	return (ENOSYS);
+}
+
+
+int
+sys_mach_wait_until(struct thread *td, struct mach_wait_until_args *uap)
+{
+
+	MDPRINTF(("sys_mach_wait_until(%lu);\n", uap->deadline));
+	return (ENOSYS);
+}
+
+
+int
+sys_mk_timer_create(struct thread *td, struct mk_timer_create_args *uap)
+{
+	MDPRINTF(("sys_mach_timer_create();\n"));
+	return (ENOSYS);
+}
+
+
+int
+sys_mk_timer_destroy(struct thread *td, struct mk_timer_destroy_args *uap)
+{
+
+	MDPRINTF(("sys_mach_timer_destroy(0x%x);\n", uap->name));
+	return (ENOSYS);
+}
+
+
+int
+sys_mk_timer_arm(struct thread *td, struct mk_timer_arm_args *uap)
+{
+
+	MDPRINTF(("sys_mach_timer_arm(0x%x, %d);\n",
+	    uap->name, uap->expire_time));
+	return (ENOSYS);
+}
+
+int
+sys_mk_timer_cancel(struct thread *td, struct mk_timer_cancel_args *uap)
+{
+
+	MDPRINTF(("sys_mach_timer_cancel(0x%x, %p);\n",
+	    uap->name, uap->result_time));
+	return (ENOSYS);
+}
+
+int
+sys_task_name_for_pid(struct thread *td, struct task_name_for_pid_args *uap)
+{
+	return (ENOSYS);
+}
+
+int
+sys_macx_backing_store_suspend(struct thread *td, struct macx_backing_store_suspend_args *uap)
+{
+	return (ENOSYS);
+}
+
+int
+sys_macx_backing_store_recovery(struct thread *td, struct macx_backing_store_recovery_args *uap)
+{
+	return (ENOSYS);
+}
+
+
+


Property changes on: trunk/sys/compat/mach/mach_misc.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_module.c
===================================================================
--- trunk/sys/compat/mach/mach_module.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_module.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,115 @@
+#include <sys/param.h>
+#include <sys/event.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/syscall.h>
+#include <sys/sysent.h>
+#include <sys/sysproto.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+
+extern struct filterops machport_filtops;
+
+static struct syscall_helper_data osx_syscalls[] = {
+	SYSCALL_INIT_HELPER(__proc_info),
+	SYSCALL_INIT_HELPER(__iopolicysys),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_vm_allocate_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_vm_deallocate_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_vm_protect_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_vm_map_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_port_allocate_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_port_destroy_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_port_deallocate_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_port_mod_refs_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_port_move_member_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_port_insert_right_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_port_insert_member_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_port_extract_member_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_port_construct_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_port_destruct_trap),
+	SYSCALL_INIT_HELPER(mach_reply_port),
+	SYSCALL_INIT_HELPER(thread_self_trap),
+	SYSCALL_INIT_HELPER(task_self_trap),
+	SYSCALL_INIT_HELPER(host_self_trap),
+	SYSCALL_INIT_HELPER(mach_msg_trap),
+	SYSCALL_INIT_HELPER(mach_msg_overwrite_trap),
+	SYSCALL_INIT_HELPER(semaphore_signal_trap),
+	SYSCALL_INIT_HELPER(semaphore_signal_all_trap),
+	SYSCALL_INIT_HELPER(semaphore_signal_thread_trap),
+	SYSCALL_INIT_HELPER(semaphore_wait_trap),
+	SYSCALL_INIT_HELPER(semaphore_wait_signal_trap),
+	SYSCALL_INIT_HELPER(semaphore_timedwait_signal_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_port_guard_trap),
+	SYSCALL_INIT_HELPER(_kernelrpc_mach_port_unguard_trap),
+	SYSCALL_INIT_HELPER(task_for_pid),
+	SYSCALL_INIT_HELPER(pid_for_task),
+	SYSCALL_INIT_HELPER(macx_swapon),
+	SYSCALL_INIT_HELPER(macx_swapoff),
+	SYSCALL_INIT_HELPER(macx_triggers),
+	SYSCALL_INIT_HELPER(macx_backing_store_suspend),
+	SYSCALL_INIT_HELPER(macx_backing_store_recovery),
+	SYSCALL_INIT_HELPER(swtch_pri),
+	SYSCALL_INIT_HELPER(swtch),
+	SYSCALL_INIT_HELPER(thread_switch),
+	SYSCALL_INIT_HELPER(clock_sleep_trap),
+	SYSCALL_INIT_HELPER(mach_timebase_info),
+	SYSCALL_INIT_HELPER(mach_wait_until),
+	SYSCALL_INIT_HELPER(mk_timer_create),
+	SYSCALL_INIT_HELPER(mk_timer_destroy),
+	SYSCALL_INIT_HELPER(mk_timer_arm),
+	SYSCALL_INIT_HELPER(mk_timer_cancel),
+	SYSCALL_INIT_LAST
+};
+
+static int
+mach_mod_init(void)
+{
+	int err;
+
+	if (!cold) {
+		printf("mach services can only be loaded at boot time\n");
+		return (EINVAL);
+	}
+
+	if ((err = syscall_helper_register(osx_syscalls))) {
+		printf("failed to register osx calls: %d\n", err);
+		return (EINVAL);
+	}
+	if (kqueue_add_filteropts(EVFILT_MACHPORT, &machport_filtops)) {
+		printf("failed to register machport_filtops\n");
+		return (EINVAL);
+	}
+	return (0);
+}
+
+static int
+mach_module_event_handler(module_t mod, int what, void *arg)
+{
+	int err;
+
+	switch (what) {
+	case MOD_LOAD:
+		if ((err = mach_mod_init()) != 0) {
+			printf("mach services failed to load - mach system calls will not be available\n");
+			return (err);
+		}
+		break;
+	case MOD_UNLOAD:
+		return (EBUSY);
+	default:
+		return (EOPNOTSUPP);
+	}
+	printf("mach services loaded - mach system calls available\n");
+	return (0);
+}
+
+static moduledata_t mach_moduledata = {
+	"mach",
+	mach_module_event_handler,
+	NULL
+};
+
+DECLARE_MODULE(mach, mach_moduledata, SI_SUB_KLD, SI_ORDER_ANY);
+
+
+


Property changes on: trunk/sys/compat/mach/mach_module.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_port_server.c
===================================================================
--- trunk/sys/compat/mach/mach_port_server.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_port_server.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,5720 @@
+/*
+ * IDENTIFICATION:
+ * stub generated Thu Jun 11 18:17:45 2015
+ * with a MiG generated Thu Jun 11 16:16:11 PDT 2015 by kmacy at serenity
+ * OPTIONS: 
+ *	KernelServer
+ */
+
+/* Module mach_port */
+
+#define	__MIG_check__Request__mach_port_subsystem__ 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#ifdef _KERNEL
+#include <sys/mach/ndr.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#else /* !_KERNEL */
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#endif /*_KERNEL */
+
+#include <sys/mach/std_types.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc_mig.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach_debug/mach_debug_types.h>
+
+#ifndef	mig_internal
+#define	mig_internal	static __inline__
+#endif	/* mig_internal */
+
+#ifndef	mig_external
+#define mig_external
+#endif	/* mig_external */
+
+#if	!defined(__MigTypeCheck) && defined(TypeCheck)
+#define	__MigTypeCheck		TypeCheck	/* Legacy setting */
+#endif	/* !defined(__MigTypeCheck) */
+
+#if	!defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
+#define	__MigKernelSpecificCode	_MIG_KERNEL_SPECIFIC_CODE_	/* Legacy setting */
+#endif	/* !defined(__MigKernelSpecificCode) */
+
+#ifndef	LimitCheck
+#define	LimitCheck 0
+#endif	/* LimitCheck */
+
+#ifndef	min
+#define	min(a,b)  ( ((a) < (b))? (a): (b) )
+#endif	/* min */
+
+#if !defined(_WALIGN_)
+#define _WALIGN_(x) (((x) + 7) & ~7)
+#endif /* !defined(_WALIGN_) */
+
+#if !defined(_WALIGNSZ_)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#endif /* !defined(_WALIGNSZ_) */
+
+#ifndef	UseStaticTemplates
+#define	UseStaticTemplates	1
+#endif	/* UseStaticTemplates */
+
+#define _WALIGN_(x) (((x) + 7) & ~7)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#ifndef	__DeclareRcvRpc
+#define	__DeclareRcvRpc(_NUM_, _NAME_)
+#endif	/* __DeclareRcvRpc */
+
+#ifndef	__BeforeRcvRpc
+#define	__BeforeRcvRpc(_NUM_, _NAME_)
+#endif	/* __BeforeRcvRpc */
+
+#ifndef	__AfterRcvRpc
+#define	__AfterRcvRpc(_NUM_, _NAME_)
+#endif	/* __AfterRcvRpc */
+
+#ifndef	__DeclareRcvSimple
+#define	__DeclareRcvSimple(_NUM_, _NAME_)
+#endif	/* __DeclareRcvSimple */
+
+#ifndef	__BeforeRcvSimple
+#define	__BeforeRcvSimple(_NUM_, _NAME_)
+#endif	/* __BeforeRcvSimple */
+
+#ifndef	__AfterRcvSimple
+#define	__AfterRcvSimple(_NUM_, _NAME_)
+#endif	/* __AfterRcvSimple */
+
+#define novalue void
+#if	__MigKernelSpecificCode
+#define msgh_request_port	msgh_remote_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_REMOTE(bits)
+#define msgh_reply_port		msgh_local_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#else
+#define msgh_request_port	msgh_local_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#define msgh_reply_port		msgh_remote_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_REMOTE(bits)
+#endif /* __MigKernelSpecificCode */
+
+#define MIG_RETURN_ERROR(X, code)	{\
+				((mig_reply_error_t *)X)->RetCode = code;\
+				((mig_reply_error_t *)X)->NDR = NDR_record;\
+				return;\
+				}
+
+/* typedefs for all requests */
+
+#ifndef __Request__mach_port_subsystem__defined
+#define __Request__mach_port_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__mach_port_names_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_type_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t old_name;
+		mach_port_name_t new_name;
+	} __Request__mach_port_rename_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_right_t right;
+		mach_port_name_t name;
+	} __Request__mach_port_allocate_name_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_right_t right;
+	} __Request__mach_port_allocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_deallocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t poly;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_insert_right_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_type_name_t msgt_name;
+	} __Request__mach_port_extract_right_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_right_t right;
+		mach_port_delta_t delta;
+	} __Request__mach_port_mod_refs_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t member;
+		mach_port_name_t after;
+	} __Request__mach_port_move_member_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_destroy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_right_t right;
+	} __Request__mach_port_get_refs_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_trailer_type_t trailer_type;
+		mach_port_seqno_t request_seqnop;
+		mach_msg_type_number_t trailer_infopCnt;
+	} __Request__mach_port_peek_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_mscount_t mscount;
+	} __Request__mach_port_set_mscount_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_get_set_status_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t notify;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_id_t msgid;
+		mach_port_mscount_t sync;
+	} __Request__mach_port_request_notification_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_seqno_t seqno;
+	} __Request__mach_port_set_seqno_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_flavor_t flavor;
+		mach_msg_type_number_t port_info_outCnt;
+	} __Request__mach_port_get_attributes_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_flavor_t flavor;
+		mach_msg_type_number_t port_infoCnt;
+		integer_t port_info[17];
+	} __Request__mach_port_set_attributes_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_right_t right;
+		mach_port_qos_t qos;
+	} __Request__mach_port_allocate_qos_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t proto;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_right_t right;
+		mach_port_qos_t qos;
+		mach_port_name_t name;
+	} __Request__mach_port_allocate_full_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int table_entries;
+	} __Request__task_set_port_space_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_get_srights_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__mach_port_space_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_dnrequest_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_name_t pset;
+	} __Request__mach_port_insert_member_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_name_t pset;
+	} __Request__mach_port_extract_member_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_get_context_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_vm_address_t context;
+	} __Request__mach_port_set_context_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_kobject_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t options;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		uint64_t context;
+	} __Request__mach_port_construct_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_delta_t srdelta;
+		uint64_t guard;
+	} __Request__mach_port_destruct_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		uint64_t guard;
+		boolean_t strict;
+	} __Request__mach_port_guard_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		uint64_t guard;
+	} __Request__mach_port_unguard_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__mach_port_space_basic_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__mach_port_subsystem__defined */
+
+/* typedefs for all replies */
+
+#ifndef __Reply__mach_port_subsystem__defined
+#define __Reply__mach_port_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t names;
+		mach_msg_ool_descriptor_t types;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t namesCnt;
+		mach_msg_type_number_t typesCnt;
+	} __Reply__mach_port_names_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_type_t ptype;
+	} __Reply__mach_port_type_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_rename_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_allocate_name_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_name_t name;
+	} __Reply__mach_port_allocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_deallocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_insert_right_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t poly;
+		/* end of the kernel processed data */
+	} __Reply__mach_port_extract_right_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_mod_refs_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_move_member_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_destroy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_urefs_t refs;
+	} __Reply__mach_port_get_refs_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_seqno_t request_seqnop;
+		mach_msg_size_t msg_sizep;
+		mach_msg_id_t msg_idp;
+		mach_msg_type_number_t trailer_infopCnt;
+		char trailer_infop[68];
+	} __Reply__mach_port_peek_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_set_mscount_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t members;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t membersCnt;
+	} __Reply__mach_port_get_set_status_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t previous;
+		/* end of the kernel processed data */
+	} __Reply__mach_port_request_notification_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_set_seqno_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t port_info_outCnt;
+		integer_t port_info_out[17];
+	} __Reply__mach_port_get_attributes_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_set_attributes_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_qos_t qos;
+		mach_port_name_t name;
+	} __Reply__mach_port_allocate_qos_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_qos_t qos;
+		mach_port_name_t name;
+	} __Reply__mach_port_allocate_full_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_port_space_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_rights_t srights;
+	} __Reply__mach_port_get_srights_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t table_info;
+		mach_msg_ool_descriptor_t tree_info;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		ipc_info_space_t space_info;
+		mach_msg_type_number_t table_infoCnt;
+		mach_msg_type_number_t tree_infoCnt;
+	} __Reply__mach_port_space_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		unsigned dnr_total;
+		unsigned dnr_used;
+	} __Reply__mach_port_dnrequest_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_insert_member_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_extract_member_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_vm_address_t context;
+	} __Reply__mach_port_get_context_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_set_context_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		natural_t object_type;
+		mach_vm_address_t object_addr;
+	} __Reply__mach_port_kobject_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_name_t name;
+	} __Reply__mach_port_construct_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_destruct_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_guard_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_unguard_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		ipc_info_space_basic_t basic_info;
+	} __Reply__mach_port_space_basic_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__mach_port_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__mach_port_subsystem__defined
+#define __ReplyUnion__mach_port_subsystem__defined
+union __ReplyUnion__mach_port_subsystem {
+	__Reply__mach_port_names_t Reply_mach_port_names;
+	__Reply__mach_port_type_t Reply_mach_port_type;
+	__Reply__mach_port_rename_t Reply_mach_port_rename;
+	__Reply__mach_port_allocate_name_t Reply_mach_port_allocate_name;
+	__Reply__mach_port_allocate_t Reply_mach_port_allocate;
+	__Reply__mach_port_deallocate_t Reply_mach_port_deallocate;
+	__Reply__mach_port_insert_right_t Reply_mach_port_insert_right;
+	__Reply__mach_port_extract_right_t Reply_mach_port_extract_right;
+	__Reply__mach_port_mod_refs_t Reply_mach_port_mod_refs;
+	__Reply__mach_port_move_member_t Reply_mach_port_move_member;
+	__Reply__mach_port_destroy_t Reply_mach_port_destroy;
+	__Reply__mach_port_get_refs_t Reply_mach_port_get_refs;
+	__Reply__mach_port_peek_t Reply_mach_port_peek;
+	__Reply__mach_port_set_mscount_t Reply_mach_port_set_mscount;
+	__Reply__mach_port_get_set_status_t Reply_mach_port_get_set_status;
+	__Reply__mach_port_request_notification_t Reply_mach_port_request_notification;
+	__Reply__mach_port_set_seqno_t Reply_mach_port_set_seqno;
+	__Reply__mach_port_get_attributes_t Reply_mach_port_get_attributes;
+	__Reply__mach_port_set_attributes_t Reply_mach_port_set_attributes;
+	__Reply__mach_port_allocate_qos_t Reply_mach_port_allocate_qos;
+	__Reply__mach_port_allocate_full_t Reply_mach_port_allocate_full;
+	__Reply__task_set_port_space_t Reply_task_set_port_space;
+	__Reply__mach_port_get_srights_t Reply_mach_port_get_srights;
+	__Reply__mach_port_space_info_t Reply_mach_port_space_info;
+	__Reply__mach_port_dnrequest_info_t Reply_mach_port_dnrequest_info;
+	__Reply__mach_port_insert_member_t Reply_mach_port_insert_member;
+	__Reply__mach_port_extract_member_t Reply_mach_port_extract_member;
+	__Reply__mach_port_get_context_t Reply_mach_port_get_context;
+	__Reply__mach_port_set_context_t Reply_mach_port_set_context;
+	__Reply__mach_port_kobject_t Reply_mach_port_kobject;
+	__Reply__mach_port_construct_t Reply_mach_port_construct;
+	__Reply__mach_port_destruct_t Reply_mach_port_destruct;
+	__Reply__mach_port_guard_t Reply_mach_port_guard;
+	__Reply__mach_port_unguard_t Reply_mach_port_unguard;
+	__Reply__mach_port_space_basic_info_t Reply_mach_port_space_basic_info;
+};
+#endif /* __RequestUnion__mach_port_subsystem__defined */
+/* Forward Declarations */
+
+
+mig_internal novalue _Xmach_port_names
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_type
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_rename
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_allocate_name
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_allocate
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_deallocate
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_insert_right
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_extract_right
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_mod_refs
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_move_member
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_destroy
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_get_refs
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_peek
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_set_mscount
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_get_set_status
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_request_notification
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_set_seqno
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_get_attributes
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_set_attributes
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_allocate_qos
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_allocate_full
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_set_port_space
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_get_srights
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_space_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_dnrequest_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_insert_member
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_extract_member
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_get_context
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_set_context
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_kobject
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_construct
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_destruct
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_guard
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_unguard
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_port_space_basic_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_names_t__defined)
+#define __MIG_check__Request__mach_port_names_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_names_t(__attribute__((__unused__)) __Request__mach_port_names_t *In0P)
+{
+
+	typedef __Request__mach_port_names_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_names_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_names */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_names
+#if	defined(LINTLIBRARY)
+    (task, names, namesCnt, types, typesCnt)
+	ipc_space_t task;
+	mach_port_name_array_t *names;
+	mach_msg_type_number_t *namesCnt;
+	mach_port_type_array_t *types;
+	mach_msg_type_number_t *typesCnt;
+{ return mach_port_names(task, names, namesCnt, types, typesCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_array_t *names,
+	mach_msg_type_number_t *namesCnt,
+	mach_port_type_array_t *types,
+	mach_msg_type_number_t *typesCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_names */
+mig_internal novalue _Xmach_port_names
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_names_t __Request;
+	typedef __Reply__mach_port_names_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_names_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_names_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t namesTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t typesTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t namesTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t typesTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3200, "mach_port_names")
+	__BeforeRcvRpc(3200, "mach_port_names")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_names_t__defined)
+	check_result = __MIG_check__Request__mach_port_names_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_names_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->names = namesTemplate;
+#else	/* UseStaticTemplates */
+	OutP->names.deallocate =  FALSE;
+	OutP->names.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->names.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+#if	UseStaticTemplates
+	OutP->types = typesTemplate;
+#else	/* UseStaticTemplates */
+	OutP->types.deallocate =  FALSE;
+	OutP->types.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->types.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->namesCnt = 0;
+
+	OutP->typesCnt = 0;
+
+	RetCode = mach_port_names(task, (mach_port_name_array_t *)&(OutP->names.address), &OutP->namesCnt, (mach_port_type_array_t *)&(OutP->types.address), &OutP->typesCnt);
+	space_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->names.size = OutP->namesCnt * 4;
+
+	OutP->types.size = OutP->typesCnt * 4;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 2;
+	__AfterRcvRpc(3200, "mach_port_names")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_type_t__defined)
+#define __MIG_check__Request__mach_port_type_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_type_t(__attribute__((__unused__)) __Request__mach_port_type_t *In0P)
+{
+
+	typedef __Request__mach_port_type_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_type_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_type */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_type
+#if	defined(LINTLIBRARY)
+    (task, name, ptype)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_type_t *ptype;
+{ return mach_port_type(task, name, ptype); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_type_t *ptype
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_type */
+mig_internal novalue _Xmach_port_type
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_type_t __Request;
+	typedef __Reply__mach_port_type_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_type_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_type_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3201, "mach_port_type")
+	__BeforeRcvRpc(3201, "mach_port_type")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_type_t__defined)
+	check_result = __MIG_check__Request__mach_port_type_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_type_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_type(task, In0P->name, &OutP->ptype);
+	space_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3201, "mach_port_type")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_rename_t__defined)
+#define __MIG_check__Request__mach_port_rename_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_rename_t(__attribute__((__unused__)) __Request__mach_port_rename_t *In0P)
+{
+
+	typedef __Request__mach_port_rename_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_rename_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_rename */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_rename
+#if	defined(LINTLIBRARY)
+    (task, old_name, new_name)
+	ipc_space_t task;
+	mach_port_name_t old_name;
+	mach_port_name_t new_name;
+{ return mach_port_rename(task, old_name, new_name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t old_name,
+	mach_port_name_t new_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_rename */
+mig_internal novalue _Xmach_port_rename
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t old_name;
+		mach_port_name_t new_name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_rename_t __Request;
+	typedef __Reply__mach_port_rename_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_rename_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_rename_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3202, "mach_port_rename")
+	__BeforeRcvRpc(3202, "mach_port_rename")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_rename_t__defined)
+	check_result = __MIG_check__Request__mach_port_rename_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_rename_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_rename(task, In0P->old_name, In0P->new_name);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3202, "mach_port_rename")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_allocate_name_t__defined)
+#define __MIG_check__Request__mach_port_allocate_name_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_allocate_name_t(__attribute__((__unused__)) __Request__mach_port_allocate_name_t *In0P)
+{
+
+	typedef __Request__mach_port_allocate_name_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_allocate_name_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_allocate_name */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_allocate_name
+#if	defined(LINTLIBRARY)
+    (task, right, name)
+	ipc_space_t task;
+	mach_port_right_t right;
+	mach_port_name_t name;
+{ return mach_port_allocate_name(task, right, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_right_t right,
+	mach_port_name_t name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_allocate_name */
+mig_internal novalue _Xmach_port_allocate_name
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_right_t right;
+		mach_port_name_t name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_allocate_name_t __Request;
+	typedef __Reply__mach_port_allocate_name_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_allocate_name_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_allocate_name_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3203, "mach_port_allocate_name")
+	__BeforeRcvRpc(3203, "mach_port_allocate_name")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_allocate_name_t__defined)
+	check_result = __MIG_check__Request__mach_port_allocate_name_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_allocate_name_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_allocate_name(task, In0P->right, In0P->name);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3203, "mach_port_allocate_name")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_allocate_t__defined)
+#define __MIG_check__Request__mach_port_allocate_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_allocate_t(__attribute__((__unused__)) __Request__mach_port_allocate_t *In0P)
+{
+
+	typedef __Request__mach_port_allocate_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_allocate_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_allocate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_allocate
+#if	defined(LINTLIBRARY)
+    (task, right, name)
+	ipc_space_t task;
+	mach_port_right_t right;
+	mach_port_name_t *name;
+{ return mach_port_allocate(task, right, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_right_t right,
+	mach_port_name_t *name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_allocate */
+mig_internal novalue _Xmach_port_allocate
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_right_t right;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_allocate_t __Request;
+	typedef __Reply__mach_port_allocate_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_allocate_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_allocate_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3204, "mach_port_allocate")
+	__BeforeRcvRpc(3204, "mach_port_allocate")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_allocate_t__defined)
+	check_result = __MIG_check__Request__mach_port_allocate_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_allocate_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_allocate(task, In0P->right, &OutP->name);
+	space_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3204, "mach_port_allocate")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_deallocate_t__defined)
+#define __MIG_check__Request__mach_port_deallocate_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_deallocate_t(__attribute__((__unused__)) __Request__mach_port_deallocate_t *In0P)
+{
+
+	typedef __Request__mach_port_deallocate_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_deallocate_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_deallocate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_deallocate
+#if	defined(LINTLIBRARY)
+    (task, name)
+	ipc_space_t task;
+	mach_port_name_t name;
+{ return mach_port_deallocate(task, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_deallocate */
+mig_internal novalue _Xmach_port_deallocate
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_deallocate_t __Request;
+	typedef __Reply__mach_port_deallocate_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_deallocate_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_deallocate_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3205, "mach_port_deallocate")
+	__BeforeRcvRpc(3205, "mach_port_deallocate")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_deallocate_t__defined)
+	check_result = __MIG_check__Request__mach_port_deallocate_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_deallocate_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_deallocate(task, In0P->name);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3205, "mach_port_deallocate")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_insert_right_t__defined)
+#define __MIG_check__Request__mach_port_insert_right_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_insert_right_t(__attribute__((__unused__)) __Request__mach_port_insert_right_t *In0P)
+{
+
+	typedef __Request__mach_port_insert_right_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->poly.type != MACH_MSG_PORT_DESCRIPTOR)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_insert_right_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_insert_right */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_insert_right
+#if	defined(LINTLIBRARY)
+    (task, name, poly, polyPoly)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_t poly;
+	mach_msg_type_name_t polyPoly;
+{ return mach_port_insert_right(task, name, poly, polyPoly); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_t poly,
+	mach_msg_type_name_t polyPoly
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_insert_right */
+mig_internal novalue _Xmach_port_insert_right
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t poly;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_insert_right_t __Request;
+	typedef __Reply__mach_port_insert_right_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_insert_right_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_insert_right_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3206, "mach_port_insert_right")
+	__BeforeRcvRpc(3206, "mach_port_insert_right")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_insert_right_t__defined)
+	check_result = __MIG_check__Request__mach_port_insert_right_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_insert_right_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_insert_right(task, In0P->name, In0P->poly.name, In0P->poly.disposition);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3206, "mach_port_insert_right")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_extract_right_t__defined)
+#define __MIG_check__Request__mach_port_extract_right_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_extract_right_t(__attribute__((__unused__)) __Request__mach_port_extract_right_t *In0P)
+{
+
+	typedef __Request__mach_port_extract_right_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_extract_right_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_extract_right */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_extract_right
+#if	defined(LINTLIBRARY)
+    (task, name, msgt_name, poly, polyPoly)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_msg_type_name_t msgt_name;
+	mach_port_t *poly;
+	mach_msg_type_name_t *polyPoly;
+{ return mach_port_extract_right(task, name, msgt_name, poly, polyPoly); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_msg_type_name_t msgt_name,
+	mach_port_t *poly,
+	mach_msg_type_name_t *polyPoly
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_extract_right */
+mig_internal novalue _Xmach_port_extract_right
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_type_name_t msgt_name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_extract_right_t __Request;
+	typedef __Reply__mach_port_extract_right_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_extract_right_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_extract_right_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t polyTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = ((mach_msg_type_name_t) -1),
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t polyTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = ((mach_msg_type_name_t) -1),
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	ipc_space_t task;
+	mach_msg_type_name_t polyPoly;
+
+	__DeclareRcvRpc(3207, "mach_port_extract_right")
+	__BeforeRcvRpc(3207, "mach_port_extract_right")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_extract_right_t__defined)
+	check_result = __MIG_check__Request__mach_port_extract_right_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_extract_right_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->poly = polyTemplate;
+#else	/* UseStaticTemplates */
+	OutP->poly.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	RetCode = mach_port_extract_right(task, In0P->name, In0P->msgt_name, &OutP->poly.name, &polyPoly);
+	space_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->poly.disposition = polyPoly;
+
+#if	__MigKernelSpecificCode
+	if (polyPoly == MACH_MSG_TYPE_PORT_RECEIVE)
+	  if (IP_VALID((ipc_port_t) In0P->Head.msgh_reply_port) &&
+	    IP_VALID((ipc_port_t) OutP->poly.name) &&
+	    ipc_port_check_circularity((ipc_port_t) OutP->poly.name, (ipc_port_t) In0P->Head.msgh_reply_port))
+		OutP->Head.msgh_bits |= MACH_MSGH_BITS_CIRCULAR;
+#endif /* __MigKernelSpecificCode */
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3207, "mach_port_extract_right")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_mod_refs_t__defined)
+#define __MIG_check__Request__mach_port_mod_refs_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_mod_refs_t(__attribute__((__unused__)) __Request__mach_port_mod_refs_t *In0P)
+{
+
+	typedef __Request__mach_port_mod_refs_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_mod_refs_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_mod_refs */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_mod_refs
+#if	defined(LINTLIBRARY)
+    (task, name, right, delta)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_right_t right;
+	mach_port_delta_t delta;
+{ return mach_port_mod_refs(task, name, right, delta); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_right_t right,
+	mach_port_delta_t delta
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_mod_refs */
+mig_internal novalue _Xmach_port_mod_refs
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_right_t right;
+		mach_port_delta_t delta;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_mod_refs_t __Request;
+	typedef __Reply__mach_port_mod_refs_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_mod_refs_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_mod_refs_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3208, "mach_port_mod_refs")
+	__BeforeRcvRpc(3208, "mach_port_mod_refs")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_mod_refs_t__defined)
+	check_result = __MIG_check__Request__mach_port_mod_refs_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_mod_refs_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_mod_refs(task, In0P->name, In0P->right, In0P->delta);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3208, "mach_port_mod_refs")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_move_member_t__defined)
+#define __MIG_check__Request__mach_port_move_member_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_move_member_t(__attribute__((__unused__)) __Request__mach_port_move_member_t *In0P)
+{
+
+	typedef __Request__mach_port_move_member_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_move_member_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_move_member */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_move_member
+#if	defined(LINTLIBRARY)
+    (task, member, after)
+	ipc_space_t task;
+	mach_port_name_t member;
+	mach_port_name_t after;
+{ return mach_port_move_member(task, member, after); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t member,
+	mach_port_name_t after
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_move_member */
+mig_internal novalue _Xmach_port_move_member
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t member;
+		mach_port_name_t after;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_move_member_t __Request;
+	typedef __Reply__mach_port_move_member_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_move_member_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_move_member_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3209, "mach_port_move_member")
+	__BeforeRcvRpc(3209, "mach_port_move_member")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_move_member_t__defined)
+	check_result = __MIG_check__Request__mach_port_move_member_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_move_member_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_move_member(task, In0P->member, In0P->after);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3209, "mach_port_move_member")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_destroy_t__defined)
+#define __MIG_check__Request__mach_port_destroy_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_destroy_t(__attribute__((__unused__)) __Request__mach_port_destroy_t *In0P)
+{
+
+	typedef __Request__mach_port_destroy_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_destroy_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_destroy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_destroy
+#if	defined(LINTLIBRARY)
+    (task, name)
+	ipc_space_t task;
+	mach_port_name_t name;
+{ return mach_port_destroy(task, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_destroy */
+mig_internal novalue _Xmach_port_destroy
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_destroy_t __Request;
+	typedef __Reply__mach_port_destroy_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_destroy_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_destroy_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3210, "mach_port_destroy")
+	__BeforeRcvRpc(3210, "mach_port_destroy")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_destroy_t__defined)
+	check_result = __MIG_check__Request__mach_port_destroy_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_destroy_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_destroy(task, In0P->name);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3210, "mach_port_destroy")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_get_refs_t__defined)
+#define __MIG_check__Request__mach_port_get_refs_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_get_refs_t(__attribute__((__unused__)) __Request__mach_port_get_refs_t *In0P)
+{
+
+	typedef __Request__mach_port_get_refs_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_get_refs_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_get_refs */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_refs
+#if	defined(LINTLIBRARY)
+    (task, name, right, refs)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_right_t right;
+	mach_port_urefs_t *refs;
+{ return mach_port_get_refs(task, name, right, refs); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_right_t right,
+	mach_port_urefs_t *refs
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_refs */
+mig_internal novalue _Xmach_port_get_refs
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_right_t right;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_get_refs_t __Request;
+	typedef __Reply__mach_port_get_refs_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_get_refs_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_get_refs_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3211, "mach_port_get_refs")
+	__BeforeRcvRpc(3211, "mach_port_get_refs")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_get_refs_t__defined)
+	check_result = __MIG_check__Request__mach_port_get_refs_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_get_refs_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_get_refs(task, In0P->name, In0P->right, &OutP->refs);
+	space_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3211, "mach_port_get_refs")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_peek_t__defined)
+#define __MIG_check__Request__mach_port_peek_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_peek_t(__attribute__((__unused__)) __Request__mach_port_peek_t *In0P)
+{
+
+	typedef __Request__mach_port_peek_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_peek_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_peek */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_peek
+#if	defined(LINTLIBRARY)
+    (task, name, trailer_type, request_seqnop, msg_sizep, msg_idp, trailer_infop, trailer_infopCnt)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_msg_trailer_type_t trailer_type;
+	mach_port_seqno_t *request_seqnop;
+	mach_msg_size_t *msg_sizep;
+	mach_msg_id_t *msg_idp;
+	mach_msg_trailer_info_t trailer_infop;
+	mach_msg_type_number_t *trailer_infopCnt;
+{ return mach_port_peek(task, name, trailer_type, request_seqnop, msg_sizep, msg_idp, trailer_infop, trailer_infopCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_msg_trailer_type_t trailer_type,
+	mach_port_seqno_t *request_seqnop,
+	mach_msg_size_t *msg_sizep,
+	mach_msg_id_t *msg_idp,
+	mach_msg_trailer_info_t trailer_infop,
+	mach_msg_type_number_t *trailer_infopCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_peek */
+mig_internal novalue _Xmach_port_peek
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_trailer_type_t trailer_type;
+		mach_port_seqno_t request_seqnop;
+		mach_msg_type_number_t trailer_infopCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_peek_t __Request;
+	typedef __Reply__mach_port_peek_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_peek_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_peek_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3212, "mach_port_peek")
+	__BeforeRcvRpc(3212, "mach_port_peek")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_peek_t__defined)
+	check_result = __MIG_check__Request__mach_port_peek_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_peek_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->trailer_infopCnt = 68;
+	if (In0P->trailer_infopCnt < OutP->trailer_infopCnt)
+		OutP->trailer_infopCnt = In0P->trailer_infopCnt;
+
+	OutP->RetCode = mach_port_peek(task, In0P->name, In0P->trailer_type, &In0P->request_seqnop, &OutP->msg_sizep, &OutP->msg_idp, OutP->trailer_infop, &OutP->trailer_infopCnt);
+	space_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->request_seqnop = In0P->request_seqnop;
+	OutP->Head.msgh_size = (sizeof(Reply) - 68) + (_WALIGN_((OutP->trailer_infopCnt + 3) & ~3));
+
+	__AfterRcvRpc(3212, "mach_port_peek")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_set_mscount_t__defined)
+#define __MIG_check__Request__mach_port_set_mscount_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_set_mscount_t(__attribute__((__unused__)) __Request__mach_port_set_mscount_t *In0P)
+{
+
+	typedef __Request__mach_port_set_mscount_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_set_mscount_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_set_mscount */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_set_mscount
+#if	defined(LINTLIBRARY)
+    (task, name, mscount)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_mscount_t mscount;
+{ return mach_port_set_mscount(task, name, mscount); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_mscount_t mscount
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_set_mscount */
+mig_internal novalue _Xmach_port_set_mscount
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_mscount_t mscount;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_set_mscount_t __Request;
+	typedef __Reply__mach_port_set_mscount_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_set_mscount_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_set_mscount_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3213, "mach_port_set_mscount")
+	__BeforeRcvRpc(3213, "mach_port_set_mscount")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_set_mscount_t__defined)
+	check_result = __MIG_check__Request__mach_port_set_mscount_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_set_mscount_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_set_mscount(task, In0P->name, In0P->mscount);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3213, "mach_port_set_mscount")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_get_set_status_t__defined)
+#define __MIG_check__Request__mach_port_get_set_status_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_get_set_status_t(__attribute__((__unused__)) __Request__mach_port_get_set_status_t *In0P)
+{
+
+	typedef __Request__mach_port_get_set_status_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_get_set_status_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_get_set_status */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_set_status
+#if	defined(LINTLIBRARY)
+    (task, name, members, membersCnt)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_name_array_t *members;
+	mach_msg_type_number_t *membersCnt;
+{ return mach_port_get_set_status(task, name, members, membersCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_name_array_t *members,
+	mach_msg_type_number_t *membersCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_set_status */
+mig_internal novalue _Xmach_port_get_set_status
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_get_set_status_t __Request;
+	typedef __Reply__mach_port_get_set_status_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_get_set_status_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_get_set_status_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t membersTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t membersTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3214, "mach_port_get_set_status")
+	__BeforeRcvRpc(3214, "mach_port_get_set_status")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_get_set_status_t__defined)
+	check_result = __MIG_check__Request__mach_port_get_set_status_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_get_set_status_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->members = membersTemplate;
+#else	/* UseStaticTemplates */
+	OutP->members.deallocate =  FALSE;
+	OutP->members.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->members.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->membersCnt = 0;
+
+	RetCode = mach_port_get_set_status(task, In0P->name, (mach_port_name_array_t *)&(OutP->members.address), &OutP->membersCnt);
+	space_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->members.size = OutP->membersCnt * 4;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3214, "mach_port_get_set_status")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_request_notification_t__defined)
+#define __MIG_check__Request__mach_port_request_notification_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_request_notification_t(__attribute__((__unused__)) __Request__mach_port_request_notification_t *In0P)
+{
+
+	typedef __Request__mach_port_request_notification_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->notify.type != MACH_MSG_PORT_DESCRIPTOR || (
+	    In0P->notify.disposition != MACH_MSG_TYPE_MOVE_SEND_ONCE &&  
+	    In0P->notify.disposition != MACH_MSG_TYPE_MAKE_SEND_ONCE))
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_request_notification_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_request_notification */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_request_notification
+#if	defined(LINTLIBRARY)
+    (task, name, msgid, sync, notify, previous)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_msg_id_t msgid;
+	mach_port_mscount_t sync;
+	mach_port_t notify;
+	mach_port_t *previous;
+{ return mach_port_request_notification(task, name, msgid, sync, notify, previous); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_msg_id_t msgid,
+	mach_port_mscount_t sync,
+	mach_port_t notify,
+	mach_port_t *previous
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_request_notification */
+mig_internal novalue _Xmach_port_request_notification
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t notify;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_id_t msgid;
+		mach_port_mscount_t sync;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_request_notification_t __Request;
+	typedef __Reply__mach_port_request_notification_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_request_notification_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_request_notification_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t previousTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 18,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t previousTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 18,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3215, "mach_port_request_notification")
+	__BeforeRcvRpc(3215, "mach_port_request_notification")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_request_notification_t__defined)
+	check_result = __MIG_check__Request__mach_port_request_notification_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_request_notification_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->previous = previousTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->previous.disposition = 18;
+#else
+	OutP->previous.disposition = 18;
+#endif /* __MigKernelSpecificCode */
+	OutP->previous.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	RetCode = mach_port_request_notification(task, In0P->name, In0P->msgid, In0P->sync, In0P->notify.name, &OutP->previous.name);
+	space_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3215, "mach_port_request_notification")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_set_seqno_t__defined)
+#define __MIG_check__Request__mach_port_set_seqno_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_set_seqno_t(__attribute__((__unused__)) __Request__mach_port_set_seqno_t *In0P)
+{
+
+	typedef __Request__mach_port_set_seqno_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_set_seqno_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_set_seqno */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_set_seqno
+#if	defined(LINTLIBRARY)
+    (task, name, seqno)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_seqno_t seqno;
+{ return mach_port_set_seqno(task, name, seqno); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_seqno_t seqno
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_set_seqno */
+mig_internal novalue _Xmach_port_set_seqno
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_seqno_t seqno;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_set_seqno_t __Request;
+	typedef __Reply__mach_port_set_seqno_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_set_seqno_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_set_seqno_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3216, "mach_port_set_seqno")
+	__BeforeRcvRpc(3216, "mach_port_set_seqno")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_set_seqno_t__defined)
+	check_result = __MIG_check__Request__mach_port_set_seqno_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_set_seqno_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_set_seqno(task, In0P->name, In0P->seqno);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3216, "mach_port_set_seqno")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_get_attributes_t__defined)
+#define __MIG_check__Request__mach_port_get_attributes_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_get_attributes_t(__attribute__((__unused__)) __Request__mach_port_get_attributes_t *In0P)
+{
+
+	typedef __Request__mach_port_get_attributes_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_get_attributes_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_get_attributes */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_attributes
+#if	defined(LINTLIBRARY)
+    (task, name, flavor, port_info_out, port_info_outCnt)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_flavor_t flavor;
+	mach_port_info_t port_info_out;
+	mach_msg_type_number_t *port_info_outCnt;
+{ return mach_port_get_attributes(task, name, flavor, port_info_out, port_info_outCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_flavor_t flavor,
+	mach_port_info_t port_info_out,
+	mach_msg_type_number_t *port_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_attributes */
+mig_internal novalue _Xmach_port_get_attributes
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_flavor_t flavor;
+		mach_msg_type_number_t port_info_outCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_get_attributes_t __Request;
+	typedef __Reply__mach_port_get_attributes_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_get_attributes_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_get_attributes_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3217, "mach_port_get_attributes")
+	__BeforeRcvRpc(3217, "mach_port_get_attributes")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_get_attributes_t__defined)
+	check_result = __MIG_check__Request__mach_port_get_attributes_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_get_attributes_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->port_info_outCnt = 17;
+	if (In0P->port_info_outCnt < OutP->port_info_outCnt)
+		OutP->port_info_outCnt = In0P->port_info_outCnt;
+
+	OutP->RetCode = mach_port_get_attributes(task, In0P->name, In0P->flavor, OutP->port_info_out, &OutP->port_info_outCnt);
+	space_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+	OutP->Head.msgh_size = (sizeof(Reply) - 68) + (_WALIGN_((4 * OutP->port_info_outCnt)));
+
+	__AfterRcvRpc(3217, "mach_port_get_attributes")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_set_attributes_t__defined)
+#define __MIG_check__Request__mach_port_set_attributes_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_set_attributes_t(__attribute__((__unused__)) __Request__mach_port_set_attributes_t *In0P)
+{
+
+	typedef __Request__mach_port_set_attributes_t __Request;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	msgh_size = In0P->Head.msgh_size;
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (msgh_size < (sizeof(__Request) - 68)) ||  (msgh_size > (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if defined(__NDR_convert__int_rep__Request__mach_port_set_attributes_t__port_infoCnt__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep)
+		__NDR_convert__int_rep__Request__mach_port_set_attributes_t__port_infoCnt(&In0P->port_infoCnt, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__mach_port_set_attributes_t__port_infoCnt__defined */
+#if	__MigTypeCheck
+	if ( In0P->port_infoCnt > 17 )
+		return MIG_BAD_ARGUMENTS;
+	if (((msgh_size - (sizeof(__Request) - 68)) / 4 < In0P->port_infoCnt) ||
+	    (msgh_size != (sizeof(__Request) - 68) + _WALIGN_(4 * In0P->port_infoCnt)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_set_attributes_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_set_attributes */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_set_attributes
+#if	defined(LINTLIBRARY)
+    (task, name, flavor, port_info, port_infoCnt)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_flavor_t flavor;
+	mach_port_info_t port_info;
+	mach_msg_type_number_t port_infoCnt;
+{ return mach_port_set_attributes(task, name, flavor, port_info, port_infoCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_flavor_t flavor,
+	mach_port_info_t port_info,
+	mach_msg_type_number_t port_infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_set_attributes */
+mig_internal novalue _Xmach_port_set_attributes
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_flavor_t flavor;
+		mach_msg_type_number_t port_infoCnt;
+		integer_t port_info[17];
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_set_attributes_t __Request;
+	typedef __Reply__mach_port_set_attributes_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_set_attributes_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_set_attributes_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3218, "mach_port_set_attributes")
+	__BeforeRcvRpc(3218, "mach_port_set_attributes")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_set_attributes_t__defined)
+	check_result = __MIG_check__Request__mach_port_set_attributes_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_set_attributes_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_set_attributes(task, In0P->name, In0P->flavor, In0P->port_info, In0P->port_infoCnt);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3218, "mach_port_set_attributes")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_allocate_qos_t__defined)
+#define __MIG_check__Request__mach_port_allocate_qos_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_allocate_qos_t(__attribute__((__unused__)) __Request__mach_port_allocate_qos_t *In0P)
+{
+
+	typedef __Request__mach_port_allocate_qos_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_allocate_qos_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_allocate_qos */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_allocate_qos
+#if	defined(LINTLIBRARY)
+    (task, right, qos, name)
+	ipc_space_t task;
+	mach_port_right_t right;
+	mach_port_qos_t *qos;
+	mach_port_name_t *name;
+{ return mach_port_allocate_qos(task, right, qos, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_right_t right,
+	mach_port_qos_t *qos,
+	mach_port_name_t *name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_allocate_qos */
+mig_internal novalue _Xmach_port_allocate_qos
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_right_t right;
+		mach_port_qos_t qos;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_allocate_qos_t __Request;
+	typedef __Reply__mach_port_allocate_qos_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_allocate_qos_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_allocate_qos_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3219, "mach_port_allocate_qos")
+	__BeforeRcvRpc(3219, "mach_port_allocate_qos")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_allocate_qos_t__defined)
+	check_result = __MIG_check__Request__mach_port_allocate_qos_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_allocate_qos_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_allocate_qos(task, In0P->right, &In0P->qos, &OutP->name);
+	space_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->qos = In0P->qos;
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3219, "mach_port_allocate_qos")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_allocate_full_t__defined)
+#define __MIG_check__Request__mach_port_allocate_full_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_allocate_full_t(__attribute__((__unused__)) __Request__mach_port_allocate_full_t *In0P)
+{
+
+	typedef __Request__mach_port_allocate_full_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->proto.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->proto.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_allocate_full_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_allocate_full */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_allocate_full
+#if	defined(LINTLIBRARY)
+    (task, right, proto, qos, name)
+	ipc_space_t task;
+	mach_port_right_t right;
+	mach_port_t proto;
+	mach_port_qos_t *qos;
+	mach_port_name_t *name;
+{ return mach_port_allocate_full(task, right, proto, qos, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_right_t right,
+	mach_port_t proto,
+	mach_port_qos_t *qos,
+	mach_port_name_t *name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_allocate_full */
+mig_internal novalue _Xmach_port_allocate_full
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t proto;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_right_t right;
+		mach_port_qos_t qos;
+		mach_port_name_t name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_allocate_full_t __Request;
+	typedef __Reply__mach_port_allocate_full_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_allocate_full_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_allocate_full_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3220, "mach_port_allocate_full")
+	__BeforeRcvRpc(3220, "mach_port_allocate_full")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_allocate_full_t__defined)
+	check_result = __MIG_check__Request__mach_port_allocate_full_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_allocate_full_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_allocate_full(task, In0P->right, In0P->proto.name, &In0P->qos, &In0P->name);
+	space_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->qos = In0P->qos;
+
+	OutP->name = In0P->name;
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3220, "mach_port_allocate_full")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__task_set_port_space_t__defined)
+#define __MIG_check__Request__task_set_port_space_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_set_port_space_t(__attribute__((__unused__)) __Request__task_set_port_space_t *In0P)
+{
+
+	typedef __Request__task_set_port_space_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_set_port_space_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_set_port_space */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_port_space
+#if	defined(LINTLIBRARY)
+    (task, table_entries)
+	ipc_space_t task;
+	int table_entries;
+{ return task_set_port_space(task, table_entries); }
+#else
+(
+	ipc_space_t task,
+	int table_entries
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_port_space */
+mig_internal novalue _Xtask_set_port_space
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int table_entries;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_set_port_space_t __Request;
+	typedef __Reply__task_set_port_space_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_set_port_space_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_set_port_space_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3221, "task_set_port_space")
+	__BeforeRcvRpc(3221, "task_set_port_space")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_set_port_space_t__defined)
+	check_result = __MIG_check__Request__task_set_port_space_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_set_port_space_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_set_port_space(task, In0P->table_entries);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3221, "task_set_port_space")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_get_srights_t__defined)
+#define __MIG_check__Request__mach_port_get_srights_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_get_srights_t(__attribute__((__unused__)) __Request__mach_port_get_srights_t *In0P)
+{
+
+	typedef __Request__mach_port_get_srights_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_get_srights_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_get_srights */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_srights
+#if	defined(LINTLIBRARY)
+    (task, name, srights)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_rights_t *srights;
+{ return mach_port_get_srights(task, name, srights); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_rights_t *srights
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_srights */
+mig_internal novalue _Xmach_port_get_srights
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_get_srights_t __Request;
+	typedef __Reply__mach_port_get_srights_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_get_srights_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_get_srights_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3222, "mach_port_get_srights")
+	__BeforeRcvRpc(3222, "mach_port_get_srights")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_get_srights_t__defined)
+	check_result = __MIG_check__Request__mach_port_get_srights_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_get_srights_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_get_srights(task, In0P->name, &OutP->srights);
+	space_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3222, "mach_port_get_srights")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_space_info_t__defined)
+#define __MIG_check__Request__mach_port_space_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_space_info_t(__attribute__((__unused__)) __Request__mach_port_space_info_t *In0P)
+{
+
+	typedef __Request__mach_port_space_info_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_space_info_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_space_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_space_info
+#if	defined(LINTLIBRARY)
+    (task, space_info, table_info, table_infoCnt, tree_info, tree_infoCnt)
+	ipc_space_t task;
+	ipc_info_space_t *space_info;
+	ipc_info_name_array_t *table_info;
+	mach_msg_type_number_t *table_infoCnt;
+	ipc_info_tree_name_array_t *tree_info;
+	mach_msg_type_number_t *tree_infoCnt;
+{ return mach_port_space_info(task, space_info, table_info, table_infoCnt, tree_info, tree_infoCnt); }
+#else
+(
+	ipc_space_t task,
+	ipc_info_space_t *space_info,
+	ipc_info_name_array_t *table_info,
+	mach_msg_type_number_t *table_infoCnt,
+	ipc_info_tree_name_array_t *tree_info,
+	mach_msg_type_number_t *tree_infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_space_info */
+mig_internal novalue _Xmach_port_space_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_space_info_t __Request;
+	typedef __Reply__mach_port_space_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_space_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_space_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t table_infoTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t tree_infoTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t table_infoTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t tree_infoTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3223, "mach_port_space_info")
+	__BeforeRcvRpc(3223, "mach_port_space_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_space_info_t__defined)
+	check_result = __MIG_check__Request__mach_port_space_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_space_info_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->table_info = table_infoTemplate;
+#else	/* UseStaticTemplates */
+	OutP->table_info.deallocate =  FALSE;
+	OutP->table_info.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->table_info.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+#if	UseStaticTemplates
+	OutP->tree_info = tree_infoTemplate;
+#else	/* UseStaticTemplates */
+	OutP->tree_info.deallocate =  FALSE;
+	OutP->tree_info.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->tree_info.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->table_infoCnt = 0;
+
+	OutP->tree_infoCnt = 0;
+
+	RetCode = mach_port_space_info(task, &OutP->space_info, (ipc_info_name_array_t *)&(OutP->table_info.address), &OutP->table_infoCnt, (ipc_info_tree_name_array_t *)&(OutP->tree_info.address), &OutP->tree_infoCnt);
+	space_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->table_info.size = OutP->table_infoCnt * 28;
+
+	OutP->tree_info.size = OutP->tree_infoCnt * 36;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 2;
+	__AfterRcvRpc(3223, "mach_port_space_info")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_dnrequest_info_t__defined)
+#define __MIG_check__Request__mach_port_dnrequest_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_dnrequest_info_t(__attribute__((__unused__)) __Request__mach_port_dnrequest_info_t *In0P)
+{
+
+	typedef __Request__mach_port_dnrequest_info_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_dnrequest_info_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_dnrequest_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_dnrequest_info
+#if	defined(LINTLIBRARY)
+    (task, name, dnr_total, dnr_used)
+	ipc_space_t task;
+	mach_port_name_t name;
+	unsigned *dnr_total;
+	unsigned *dnr_used;
+{ return mach_port_dnrequest_info(task, name, dnr_total, dnr_used); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	unsigned *dnr_total,
+	unsigned *dnr_used
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_dnrequest_info */
+mig_internal novalue _Xmach_port_dnrequest_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_dnrequest_info_t __Request;
+	typedef __Reply__mach_port_dnrequest_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_dnrequest_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_dnrequest_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3224, "mach_port_dnrequest_info")
+	__BeforeRcvRpc(3224, "mach_port_dnrequest_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_dnrequest_info_t__defined)
+	check_result = __MIG_check__Request__mach_port_dnrequest_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_dnrequest_info_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_dnrequest_info(task, In0P->name, &OutP->dnr_total, &OutP->dnr_used);
+	space_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3224, "mach_port_dnrequest_info")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_insert_member_t__defined)
+#define __MIG_check__Request__mach_port_insert_member_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_insert_member_t(__attribute__((__unused__)) __Request__mach_port_insert_member_t *In0P)
+{
+
+	typedef __Request__mach_port_insert_member_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_insert_member_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_insert_member */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_insert_member
+#if	defined(LINTLIBRARY)
+    (task, name, pset)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_name_t pset;
+{ return mach_port_insert_member(task, name, pset); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_name_t pset
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_insert_member */
+mig_internal novalue _Xmach_port_insert_member
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_name_t pset;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_insert_member_t __Request;
+	typedef __Reply__mach_port_insert_member_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_insert_member_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_insert_member_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3226, "mach_port_insert_member")
+	__BeforeRcvRpc(3226, "mach_port_insert_member")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_insert_member_t__defined)
+	check_result = __MIG_check__Request__mach_port_insert_member_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_insert_member_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_insert_member(task, In0P->name, In0P->pset);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3226, "mach_port_insert_member")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_extract_member_t__defined)
+#define __MIG_check__Request__mach_port_extract_member_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_extract_member_t(__attribute__((__unused__)) __Request__mach_port_extract_member_t *In0P)
+{
+
+	typedef __Request__mach_port_extract_member_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_extract_member_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_extract_member */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_extract_member
+#if	defined(LINTLIBRARY)
+    (task, name, pset)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_name_t pset;
+{ return mach_port_extract_member(task, name, pset); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_name_t pset
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_extract_member */
+mig_internal novalue _Xmach_port_extract_member
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_name_t pset;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_extract_member_t __Request;
+	typedef __Reply__mach_port_extract_member_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_extract_member_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_extract_member_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3227, "mach_port_extract_member")
+	__BeforeRcvRpc(3227, "mach_port_extract_member")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_extract_member_t__defined)
+	check_result = __MIG_check__Request__mach_port_extract_member_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_extract_member_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_extract_member(task, In0P->name, In0P->pset);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3227, "mach_port_extract_member")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_get_context_t__defined)
+#define __MIG_check__Request__mach_port_get_context_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_get_context_t(__attribute__((__unused__)) __Request__mach_port_get_context_t *In0P)
+{
+
+	typedef __Request__mach_port_get_context_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_get_context_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_get_context */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_context
+#if	defined(LINTLIBRARY)
+    (task, name, context)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_vm_address_t *context;
+{ return mach_port_get_context(task, name, context); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_vm_address_t *context
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_context */
+mig_internal novalue _Xmach_port_get_context
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_get_context_t __Request;
+	typedef __Reply__mach_port_get_context_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_get_context_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_get_context_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3228, "mach_port_get_context")
+	__BeforeRcvRpc(3228, "mach_port_get_context")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_get_context_t__defined)
+	check_result = __MIG_check__Request__mach_port_get_context_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_get_context_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_get_context(task, In0P->name, &OutP->context);
+	space_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3228, "mach_port_get_context")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_set_context_t__defined)
+#define __MIG_check__Request__mach_port_set_context_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_set_context_t(__attribute__((__unused__)) __Request__mach_port_set_context_t *In0P)
+{
+
+	typedef __Request__mach_port_set_context_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_set_context_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_set_context */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_set_context
+#if	defined(LINTLIBRARY)
+    (task, name, context)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_vm_address_t context;
+{ return mach_port_set_context(task, name, context); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_vm_address_t context
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_set_context */
+mig_internal novalue _Xmach_port_set_context
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_vm_address_t context;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_set_context_t __Request;
+	typedef __Reply__mach_port_set_context_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_set_context_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_set_context_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3229, "mach_port_set_context")
+	__BeforeRcvRpc(3229, "mach_port_set_context")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_set_context_t__defined)
+	check_result = __MIG_check__Request__mach_port_set_context_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_set_context_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_set_context(task, In0P->name, In0P->context);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3229, "mach_port_set_context")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_kobject_t__defined)
+#define __MIG_check__Request__mach_port_kobject_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_kobject_t(__attribute__((__unused__)) __Request__mach_port_kobject_t *In0P)
+{
+
+	typedef __Request__mach_port_kobject_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_kobject_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_kobject */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_kobject
+#if	defined(LINTLIBRARY)
+    (task, name, object_type, object_addr)
+	ipc_space_t task;
+	mach_port_name_t name;
+	natural_t *object_type;
+	mach_vm_address_t *object_addr;
+{ return mach_port_kobject(task, name, object_type, object_addr); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	natural_t *object_type,
+	mach_vm_address_t *object_addr
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_kobject */
+mig_internal novalue _Xmach_port_kobject
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_kobject_t __Request;
+	typedef __Reply__mach_port_kobject_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_kobject_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_kobject_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3230, "mach_port_kobject")
+	__BeforeRcvRpc(3230, "mach_port_kobject")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_kobject_t__defined)
+	check_result = __MIG_check__Request__mach_port_kobject_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_kobject_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_kobject(task, In0P->name, &OutP->object_type, &OutP->object_addr);
+	space_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3230, "mach_port_kobject")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_construct_t__defined)
+#define __MIG_check__Request__mach_port_construct_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_construct_t(__attribute__((__unused__)) __Request__mach_port_construct_t *In0P)
+{
+
+	typedef __Request__mach_port_construct_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->options.type != MACH_MSG_OOL_DESCRIPTOR ||
+	    In0P->options.size != 24)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+#if __MigTypeCheck
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_construct_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_construct */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_construct
+#if	defined(LINTLIBRARY)
+    (task, options, context, name)
+	ipc_space_t task;
+	mach_port_options_ptr_t options;
+	uint64_t context;
+	mach_port_name_t *name;
+{ return mach_port_construct(task, options, context, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_options_ptr_t options,
+	uint64_t context,
+	mach_port_name_t *name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_construct */
+mig_internal novalue _Xmach_port_construct
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t options;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		uint64_t context;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_construct_t __Request;
+	typedef __Reply__mach_port_construct_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_construct_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_construct_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3231, "mach_port_construct")
+	__BeforeRcvRpc(3231, "mach_port_construct")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_construct_t__defined)
+	check_result = __MIG_check__Request__mach_port_construct_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_construct_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_construct(task, (mach_port_options_ptr_t)(In0P->options.address), In0P->context, &OutP->name);
+	space_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3231, "mach_port_construct")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_destruct_t__defined)
+#define __MIG_check__Request__mach_port_destruct_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_destruct_t(__attribute__((__unused__)) __Request__mach_port_destruct_t *In0P)
+{
+
+	typedef __Request__mach_port_destruct_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_destruct_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_destruct */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_destruct
+#if	defined(LINTLIBRARY)
+    (task, name, srdelta, guard)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_delta_t srdelta;
+	uint64_t guard;
+{ return mach_port_destruct(task, name, srdelta, guard); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_delta_t srdelta,
+	uint64_t guard
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_destruct */
+mig_internal novalue _Xmach_port_destruct
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_delta_t srdelta;
+		uint64_t guard;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_destruct_t __Request;
+	typedef __Reply__mach_port_destruct_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_destruct_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_destruct_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3232, "mach_port_destruct")
+	__BeforeRcvRpc(3232, "mach_port_destruct")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_destruct_t__defined)
+	check_result = __MIG_check__Request__mach_port_destruct_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_destruct_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_destruct(task, In0P->name, In0P->srdelta, In0P->guard);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3232, "mach_port_destruct")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_guard_t__defined)
+#define __MIG_check__Request__mach_port_guard_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_guard_t(__attribute__((__unused__)) __Request__mach_port_guard_t *In0P)
+{
+
+	typedef __Request__mach_port_guard_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_guard_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_guard */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_guard
+#if	defined(LINTLIBRARY)
+    (task, name, guard, strict)
+	ipc_space_t task;
+	mach_port_name_t name;
+	uint64_t guard;
+	boolean_t strict;
+{ return mach_port_guard(task, name, guard, strict); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	uint64_t guard,
+	boolean_t strict
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_guard */
+mig_internal novalue _Xmach_port_guard
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		uint64_t guard;
+		boolean_t strict;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_guard_t __Request;
+	typedef __Reply__mach_port_guard_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_guard_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_guard_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3233, "mach_port_guard")
+	__BeforeRcvRpc(3233, "mach_port_guard")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_guard_t__defined)
+	check_result = __MIG_check__Request__mach_port_guard_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_guard_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_guard(task, In0P->name, In0P->guard, In0P->strict);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3233, "mach_port_guard")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_unguard_t__defined)
+#define __MIG_check__Request__mach_port_unguard_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_unguard_t(__attribute__((__unused__)) __Request__mach_port_unguard_t *In0P)
+{
+
+	typedef __Request__mach_port_unguard_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_unguard_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_unguard */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_unguard
+#if	defined(LINTLIBRARY)
+    (task, name, guard)
+	ipc_space_t task;
+	mach_port_name_t name;
+	uint64_t guard;
+{ return mach_port_unguard(task, name, guard); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	uint64_t guard
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_unguard */
+mig_internal novalue _Xmach_port_unguard
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		uint64_t guard;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_unguard_t __Request;
+	typedef __Reply__mach_port_unguard_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_unguard_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_unguard_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3234, "mach_port_unguard")
+	__BeforeRcvRpc(3234, "mach_port_unguard")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_unguard_t__defined)
+	check_result = __MIG_check__Request__mach_port_unguard_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_unguard_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_unguard(task, In0P->name, In0P->guard);
+	space_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3234, "mach_port_unguard")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_port_subsystem__
+#if !defined(__MIG_check__Request__mach_port_space_basic_info_t__defined)
+#define __MIG_check__Request__mach_port_space_basic_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_port_space_basic_info_t(__attribute__((__unused__)) __Request__mach_port_space_basic_info_t *In0P)
+{
+
+	typedef __Request__mach_port_space_basic_info_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_port_space_basic_info_t__defined) */
+#endif /* __MIG_check__Request__mach_port_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_port_space_basic_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_space_basic_info
+#if	defined(LINTLIBRARY)
+    (task, basic_info)
+	ipc_space_t task;
+	ipc_info_space_basic_t *basic_info;
+{ return mach_port_space_basic_info(task, basic_info); }
+#else
+(
+	ipc_space_t task,
+	ipc_info_space_basic_t *basic_info
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_space_basic_info */
+mig_internal novalue _Xmach_port_space_basic_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_port_space_basic_info_t __Request;
+	typedef __Reply__mach_port_space_basic_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_port_space_basic_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_port_space_basic_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	ipc_space_t task;
+
+	__DeclareRcvRpc(3235, "mach_port_space_basic_info")
+	__BeforeRcvRpc(3235, "mach_port_space_basic_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_port_space_basic_info_t__defined)
+	check_result = __MIG_check__Request__mach_port_space_basic_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_port_space_basic_info_t__defined) */
+
+	task = convert_port_to_space(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_port_space_basic_info(task, &OutP->basic_info);
+	space_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3235, "mach_port_space_basic_info")
+}
+
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+boolean_t mach_port_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+mig_routine_t mach_port_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+extern const struct mach_port_subsystem mach_port_subsystem;
+const struct mach_port_subsystem {
+	mig_server_routine_t 	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[36];
+} mach_port_subsystem = {
+	mach_port_server_routine,
+	3200,
+	3236,
+	(mach_msg_size_t)sizeof(union __ReplyUnion__mach_port_subsystem),
+	(vm_address_t)0,
+	{
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_names, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_names_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_type, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_type_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_rename, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_rename_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_allocate_name, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_allocate_name_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_allocate, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_allocate_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_deallocate, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_deallocate_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_insert_right, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_insert_right_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_extract_right, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_extract_right_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_mod_refs, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_mod_refs_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_move_member, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_move_member_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_destroy, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_destroy_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_get_refs, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_get_refs_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_peek, 8, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_peek_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_set_mscount, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_set_mscount_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_get_set_status, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_get_set_status_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_request_notification, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_request_notification_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_set_seqno, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_set_seqno_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_get_attributes, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_get_attributes_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_set_attributes, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_set_attributes_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_allocate_qos, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_allocate_qos_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_allocate_full, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_allocate_full_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_set_port_space, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_set_port_space_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_get_srights, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_get_srights_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_space_info, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_space_info_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_dnrequest_info, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_dnrequest_info_t) },
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_insert_member, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_insert_member_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_extract_member, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_extract_member_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_get_context, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_get_context_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_set_context, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_set_context_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_kobject, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_kobject_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_construct, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_construct_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_destruct, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_destruct_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_guard, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_guard_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_unguard, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_unguard_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_port_space_basic_info, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_port_space_basic_info_t) },
+	}
+};
+
+mig_external boolean_t mach_port_server
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	register mig_routine_t routine;
+
+	OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0);
+	OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port;
+	/* Minimal size: routine() will update it if different */
+	OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t);
+	OutHeadP->msgh_local_port = MACH_PORT_NULL;
+	OutHeadP->msgh_id = InHeadP->msgh_id + 100;
+
+	if ((InHeadP->msgh_id > 3235) || (InHeadP->msgh_id < 3200) ||
+	    ((routine = mach_port_subsystem.routine[InHeadP->msgh_id - 3200].stub_routine) == 0)) {
+		((mig_reply_error_t *)OutHeadP)->NDR = NDR_record;
+		((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID;
+		return FALSE;
+	}
+	(*routine) (InHeadP, OutHeadP);
+	return TRUE;
+}
+
+mig_external mig_routine_t mach_port_server_routine
+	(mach_msg_header_t *InHeadP)
+{
+	register int msgh_id;
+
+	msgh_id = InHeadP->msgh_id - 3200;
+
+	if ((msgh_id > 35) || (msgh_id < 0))
+		return 0;
+
+	return mach_port_subsystem.routine[msgh_id].stub_routine;
+}


Property changes on: trunk/sys/compat/mach/mach_port_server.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_processor.c
===================================================================
--- trunk/sys/compat/mach/mach_processor.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_processor.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,41 @@
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/malloc.h>
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/signal.h>
+#include <sys/proc.h>
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/processor.h>
+
+
+processor_t		master_processor;
+
+void
+pset_add_task(processor_set_t	pset, task_t		task)
+{
+	;
+}
+
+void
+pset_remove_task(processor_set_t	pset, task_t		task)
+{
+
+}
+
+void
+pset_deallocate(processor_set_t	pset)
+{
+	;
+}
+
+void
+pset_reference(processor_set_t	pset)
+{
+	;
+}
+


Property changes on: trunk/sys/compat/mach/mach_processor.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_semaphore.c
===================================================================
--- trunk/sys/compat/mach/mach_semaphore.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_semaphore.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,43 @@
+
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/proc.h>
+#include <sys/rwlock.h>
+#include <sys/signal.h>
+
+#include <vm/uma.h>
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/task_server.h>
+
+int
+semaphore_create(
+	task_t task,
+	semaphore_t *semaphore,
+	int policy,
+	int value
+)
+UNSUPPORTED;
+
+int
+semaphore_destroy(
+	task_t task,
+	semaphore_t semaphore
+	)
+UNSUPPORTED;
+
+
+void
+semaphore_dereference(semaphore_t semaphore)
+{
+	;
+}
+
+


Property changes on: trunk/sys/compat/mach/mach_semaphore.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_task.c
===================================================================
--- trunk/sys/compat/mach/mach_task.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_task.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,146 @@
+
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/exec.h>
+#include <sys/systm.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/mount.h>
+#include <sys/mutex.h>
+#include <sys/priv.h>
+#include <sys/proc.h>
+#include <sys/resourcevar.h>
+#include <sys/sysproto.h>
+#include <sys/uio.h>
+#include <sys/ktrace.h>
+
+
+#include <vm/vm.h>
+#include <vm/vm_param.h>
+#include <vm/pmap.h>
+#include <vm/vm_map.h>
+#include <vm/vm_extern.h>
+
+#include <sys/mach/mach_types.h>
+
+#include <sys/mach/task_server.h>
+
+int
+task_get_mach_voucher(
+	task_t task,
+	mach_voucher_selector_t which,
+	ipc_voucher_t *voucher
+)
+UNSUPPORTED;
+
+int
+task_get_state(
+	task_t task,
+	thread_state_flavor_t flavor,
+	thread_state_t old_state,
+	mach_msg_type_number_t *old_stateCnt
+)
+UNSUPPORTED;
+
+int
+task_policy_get(
+	task_t task,
+	task_policy_flavor_t flavor,
+	task_policy_t policy_info,
+	mach_msg_type_number_t *policy_infoCnt,
+	boolean_t *get_default
+)
+UNSUPPORTED;
+
+int
+task_policy_set(
+	task_t task,
+	task_policy_flavor_t flavor,
+	task_policy_t policy_info,
+	mach_msg_type_number_t policy_infoCnt
+)
+UNSUPPORTED;
+
+int
+task_purgable_info(
+	task_t task,
+	task_purgable_info_t *stats
+)
+UNSUPPORTED;
+
+int
+task_resume2(
+	task_suspension_token_t suspend_token
+)
+UNSUPPORTED;
+
+int
+task_set_mach_voucher(
+	task_t task,
+	ipc_voucher_t voucher
+	)
+UNSUPPORTED;
+
+int
+task_set_phys_footprint_limit(
+	task_t task,
+	int new_limit,
+	int *old_limit
+)
+UNSUPPORTED;
+
+int
+task_set_state(
+	task_t task,
+	thread_state_flavor_t flavor,
+	thread_state_t new_state,
+	mach_msg_type_number_t new_stateCnt
+)
+UNSUPPORTED;
+
+int
+task_suspend2(
+	task_t target_task,
+	task_suspension_token_t *suspend_token
+)
+UNSUPPORTED;
+
+int
+task_swap_mach_voucher(
+	task_t task,
+	ipc_voucher_t new_voucher,
+	ipc_voucher_t *old_voucher
+)
+UNSUPPORTED;
+
+int
+task_zone_info(
+	task_t target_task,
+	mach_zone_name_array_t *names,
+	mach_msg_type_number_t *namesCnt,
+	task_zone_info_array_t *info,
+	mach_msg_type_number_t *infoCnt
+)
+UNSUPPORTED;
+
+int
+thread_create_from_user(
+	task_t parent_task,
+	thread_act_t *child_act
+)
+UNSUPPORTED;
+
+int
+thread_create_running_from_user(
+	task_t parent_task,
+	thread_state_flavor_t flavor,
+	thread_state_t new_state,
+	mach_msg_type_number_t new_stateCnt,
+	thread_act_t *child_act
+)
+UNSUPPORTED;
+


Property changes on: trunk/sys/compat/mach/mach_task.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_thread.c
===================================================================
--- trunk/sys/compat/mach/mach_thread.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_thread.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,246 @@
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/eventhandler.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/proc.h>
+#include <sys/queue.h>
+#include <sys/resource.h>
+#include <sys/resourcevar.h>
+#include <sys/rwlock.h>
+#include <sys/sched.h>
+#include <sys/sleepqueue.h>
+#include <sys/signal.h>
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/mach_traps.h>
+
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/thread.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/thread_switch.h>
+
+#define MT_SETRUNNABLE 0x1
+
+#ifdef notyet
+/*
+ * Am assuming that Mach lacks the concept of uninterruptible
+ * sleep - this may need to be changed back to what is in pci_pass.c
+ */
+static int
+_intr_tdsigwakeup(struct thread *td, int intrval)
+{
+	struct proc *p = td->td_proc;
+	int rc = 0;
+
+	PROC_SLOCK(p);
+	thread_lock(td);
+	if (TD_ON_SLEEPQ(td)) {
+		/*
+		 * Give low priority threads a better chance to run.
+		 */
+		if (td->td_priority > PUSER)
+			sched_prio(td, PUSER);
+
+		sleepq_abort(td, intrval);
+		rc = 1;
+	}
+	PROC_SUNLOCK(p);
+	thread_unlock(td);
+	return (rc);
+}
+#endif
+
+
+int
+mach_thread_switch(mach_port_name_t thread_name, int option, mach_msg_timeout_t option_time)
+{
+       int timeout;
+       struct mach_emuldata *med;
+	   struct thread *td = curthread;
+
+       med = (struct mach_emuldata *)td->td_proc->p_emuldata;
+       timeout = option_time * hz / 1000;
+
+       /*
+        * The day we will be able to find out the struct proc from
+        * the port number, try to use preempt() to call the right thread.
+        * [- but preempt() is for _involuntary_ context switches.]
+        */
+       switch(option) {
+       case SWITCH_OPTION_NONE:
+               sched_relinquish(curthread);
+               break;
+
+       case SWITCH_OPTION_WAIT:
+#ifdef notyet		   
+               med->med_thpri = 1;
+               while (med->med_thpri != 0) {
+                       rw_wlock(&med->med_rightlock);
+                       (void)msleep(&med->med_thpri, &med->med_rightlock, PZERO|PCATCH,
+                                                "thread_switch", timeout);
+                       rw_wunlock(&med->med_rightlock);
+              }
+               break;
+#endif
+       case SWITCH_OPTION_DEPRESS:
+               /* Use a callout to restore the priority after depression? */
+               td->td_priority = PRI_MAX_TIMESHARE;
+               break;
+
+       default:
+              uprintf("sys_mach_syscall_thread_switch(): unknown option %d\n", option);
+               break;
+       }
+       return (0);
+}
+
+void
+thread_go(thread_t thread)
+{
+	int needunlock = 0;
+	struct mtx *block_lock = thread->ith_block_lock_data;
+
+	MPASS(thread->ith_state != MACH_SEND_IN_PROGRESS &&
+		  thread->ith_state != MACH_RCV_IN_PROGRESS &&
+		  thread->ith_state != MACH_RCV_IN_PROGRESS_TIMED);
+
+	if (block_lock != NULL && !mtx_owned(block_lock)) {
+		needunlock = 1;
+		mtx_lock(block_lock);
+	}
+	wakeup(thread);
+	if (needunlock)
+		mtx_unlock(block_lock);
+}
+
+void
+thread_block(void)
+{
+	thread_t thread = current_thread();
+	int rc;
+
+	MPASS(curthread == thread->ith_td);
+
+	rc = msleep(thread, thread->ith_block_lock_data, PCATCH|PSOCK, "thread_block", thread->timeout);
+	switch (rc) {
+	case EINTR:
+	case ERESTART:
+		thread->wait_result = THREAD_INTERRUPTED;
+		break;
+	case EWOULDBLOCK:
+		thread->wait_result = THREAD_TIMED_OUT;
+		break;
+	case 0:
+		thread->wait_result = THREAD_AWAKENED;
+		break;
+	default:
+		panic("unexpected return from msleep: %d\n", rc);
+	}
+#ifdef INVARIANTS
+	if (thread->timeout == 0) {
+		if(rc == 0)
+			MPASS(thread->ith_state == MACH_MSG_SUCCESS);
+		else
+			MPASS(rc == EINTR || rc == ERESTART);
+	}
+#endif
+}
+
+void
+thread_will_wait_with_timeout(thread_t thread, int timeout)
+{
+
+	thread->sleep_stamp = ticks;
+	thread->timeout = timeout;
+}
+
+
+void
+thread_will_wait(thread_t thread)
+{
+
+	thread->sleep_stamp = ticks;
+	thread->timeout = 0;
+}
+
+static void
+mach_thread_create(struct thread *td, thread_t thread)
+{
+
+	thread->ref_count = 1;
+	ipc_thread_init(thread);
+}
+
+
+static uma_zone_t thread_shuttle_zone;
+
+static int
+uma_thread_init(void *_thread, int a, int b)
+{
+	/* allocate thread substructures */
+	return (0);
+}
+
+static void
+uma_thread_fini(void *_thread, int a)
+{
+	/* deallocate thread substructures */
+}
+
+static void
+mach_thread_init(void *arg __unused, struct thread *td)
+{
+	thread_t thread;
+
+	thread = uma_zalloc(thread_shuttle_zone, M_WAITOK|M_ZERO);
+	mtx_init(&thread->ith_lock_data, "mach_thread lock", NULL, MTX_DEF);
+
+	MPASS(td->td_machdata == NULL);
+	td->td_machdata = thread;
+	thread->ith_td = td;
+	ipc_thr_act_init(thread);
+}
+
+static void
+mach_thread_fini(void *arg __unused, struct thread *td)
+{
+	thread_t thread = td->td_machdata;
+
+	MPASS(thread->ith_kmsg == NULL);
+	MPASS(thread->ith_td == td);
+	ipc_thr_act_terminate(thread);
+	mtx_destroy(&thread->ith_lock_data);
+	uma_zfree(thread_shuttle_zone, thread);
+}
+
+static void
+mach_thread_ctor(void *arg __unused, struct thread *td)
+{
+	thread_t thread = td->td_machdata;
+
+	MPASS(thread->ith_td == td);
+	mach_thread_create(td, thread);
+	thread->ith_block_lock_data = NULL;
+}
+
+static void
+thread_sysinit(void *arg __unused)
+{
+	thread_shuttle_zone = uma_zcreate("thread_shuttle_zone",
+									  sizeof(struct thread_shuttle),
+									  NULL, NULL, uma_thread_init,
+									  uma_thread_fini, 1, 0);
+
+	EVENTHANDLER_REGISTER(thread_ctor, mach_thread_ctor, NULL, EVENTHANDLER_PRI_ANY);
+	EVENTHANDLER_REGISTER(thread_init, mach_thread_init, NULL, EVENTHANDLER_PRI_ANY);
+	EVENTHANDLER_REGISTER(thread_fini, mach_thread_fini, NULL, EVENTHANDLER_PRI_ANY);
+}
+
+/* before SI_SUB_INTRINSIC and after SI_SUB_EVENTHANDLER */
+SYSINIT(mach_thread, SI_SUB_KLD, SI_ORDER_ANY, thread_sysinit, NULL);


Property changes on: trunk/sys/compat/mach/mach_thread.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_traps.c
===================================================================
--- trunk/sys/compat/mach/mach_traps.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_traps.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,346 @@
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/namei.h>
+#include <sys/dirent.h>
+#include <sys/eventhandler.h>
+#include <sys/proc.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/filedesc.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/resource.h>
+#include <sys/resourcevar.h>
+#include <sys/socket.h>
+#include <sys/vnode.h>
+#include <sys/uio.h>
+#include <sys/wait.h>
+#include <sys/utsname.h>
+#include <sys/unistd.h>
+#include <sys/times.h>
+#include <sys/sem.h>
+#include <sys/msg.h>
+#include <sys/ptrace.h>
+#include <sys/signalvar.h>
+
+#include <netinet/in.h>
+#include <sys/sysproto.h>
+
+#include <vm/vm.h>
+#include <vm/vm_param.h>
+#include <vm/pmap.h>
+#include <vm/vm_map.h>
+#include <vm/vm_extern.h>
+
+#include <sys/mach/mach_types.h>
+
+#include <sys/mach/ipc/ipc_types.h>
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/ipc/mach_msg.h>
+#include <sys/mach/thread.h>
+#include <sys/mach/mach_port_server.h>
+#include <sys/mach/mach_vm_server.h>
+#include <sys/mach/task_server.h>
+#include <sys/mach/thread_switch.h>
+
+#include <sys/mach/mach_init.h>
+
+#include <sys/mach/mach_vm.h>
+#include <sys/mach/mach.h>
+
+
+#pragma clang diagnostic ignored "-Wunused-parameter"
+
+int
+sys_clock_sleep_trap(struct thread *td __unused, struct clock_sleep_trap_args *uap)
+{
+
+	td->td_retval[0] = clock_sleep(uap->clock_name, uap->sleep_type, uap->sleep_sec, uap->sleep_nsec, uap->wakeup_time);
+	return (0);
+}
+
+int
+sys_mach_timebase_info(struct thread *td __unused, struct mach_timebase_info_args *uap)
+{
+
+	return (mach_timebase_info(uap->info));
+}
+
+int
+sys_mach_msg_overwrite_trap(struct thread *td __unused, struct mach_msg_overwrite_trap_args *uap)
+{
+	td->td_retval[0] = mach_msg_overwrite_trap(
+		uap->msg, uap->option, uap->send_size, uap->rcv_size,
+		uap->rcv_name, uap->timeout, uap->notify, uap->rcv_msg,
+		uap->scatter_list_size);
+	return (0);
+}
+
+int
+sys_mach_msg_trap(struct thread *td __unused, struct mach_msg_trap_args *uap)
+{
+	struct mach_msg_overwrite_trap_args uap0;
+
+	bcopy(uap, &uap0, sizeof(*uap));
+	uap0.rcv_msg = NULL;
+	return (sys_mach_msg_overwrite_trap(td, &uap0));
+}
+	
+int
+sys_semaphore_wait_trap(struct thread *td, struct semaphore_wait_trap_args *uap)
+	UNSUPPORTED;
+
+int
+sys_semaphore_signal_trap(struct thread *td, struct semaphore_signal_trap_args *uap)
+	UNSUPPORTED;
+int
+sys_semaphore_wait_signal_trap(struct thread *td, struct semaphore_wait_signal_trap_args *uap)
+	UNSUPPORTED;
+
+int
+sys_semaphore_signal_thread_trap(struct thread *td, struct semaphore_signal_thread_trap_args *uap)
+	UNSUPPORTED;
+
+int
+sys_semaphore_signal_all_trap(struct thread *td, struct semaphore_signal_all_trap_args *uap)
+	UNSUPPORTED;
+
+int
+sys_task_for_pid(struct thread *td, struct task_for_pid_args *uap)
+	UNSUPPORTED;
+
+int
+sys_thread_switch(struct thread *td __unused, struct thread_switch_args *uap)
+{
+
+	return (mach_thread_switch(uap->thread_name, uap->option, uap->option_time));
+}	
+
+static int
+_swtch_pri(struct thread *td)
+{
+	thread_lock(td);
+	if (td->td_state == TDS_RUNNING)
+		td->td_proc->p_stats->p_cru.ru_nivcsw++;        /* XXXSMP */
+	mi_switch(SW_VOL, NULL);
+	thread_unlock(td);
+	return (0);
+}
+
+int
+sys_swtch_pri(struct thread *td, struct swtch_pri_args *uap __unused)
+{
+	
+	return (_swtch_pri(td));
+}
+
+int
+sys_swtch(struct thread *td, struct swtch_args *v __unused)
+{
+
+	return (_swtch_pri(td));
+}
+
+int
+sys_mach_reply_port(struct thread *td, struct mach_reply_port_args *uap __unused)
+{
+
+	td->td_retval[0] = mach_reply_port();
+	return (0);
+}
+
+int
+sys_thread_self_trap(struct thread *td, struct thread_self_trap_args *uap)
+{
+
+	td->td_retval[0] = mach_thread_self();
+	return (0);
+}
+
+int
+sys_task_self_trap(struct thread *td, struct task_self_trap_args *uap)
+{
+
+	td->td_retval[0] = mach_task_self();
+	return (0);
+}
+
+int
+sys_host_self_trap(struct thread *td, struct host_self_trap_args *uap)
+{
+
+	td->td_retval[0] = mach_host_self();
+	return (0);
+}
+
+int
+sys__kernelrpc_mach_port_allocate_trap(struct thread *td __unused, struct _kernelrpc_mach_port_allocate_trap_args *uap)
+{
+	ipc_space_t space = current_task()->itk_space;
+	mach_port_name_t name;
+	int error;
+
+	if ((error = mach_port_allocate(space, uap->right, &name)) != 0)
+		return (error);
+	
+	return (copyout(&name, uap->name, sizeof(*uap->name)));
+}
+
+int
+sys__kernelrpc_mach_port_deallocate_trap(struct thread *td, struct _kernelrpc_mach_port_deallocate_trap_args *uap)
+{
+	ipc_space_t space = current_task()->itk_space;
+
+	mach_port_deallocate(space, uap->name);
+	return (0);
+}
+
+int
+sys__kernelrpc_mach_port_insert_right_trap(struct thread *td, struct _kernelrpc_mach_port_insert_right_trap_args *uap)
+{
+	task_t task = current_task(); /* port_name_to_task(uap->target); */
+	ipc_port_t port;
+	mach_msg_type_name_t disp;
+	int rv = MACH_SEND_INVALID_DEST;
+
+	if (task != current_task())
+		goto done;
+
+	rv = ipc_object_copyin(task->itk_space, uap->poly, uap->polyPoly, (ipc_object_t *)&port);
+	if (rv != KERN_SUCCESS)
+		goto done;
+	disp = ipc_object_copyin_type(uap->polyPoly);
+	rv = mach_port_insert_right(task->itk_space, uap->name, port, disp);
+done:
+	if (task)
+		task_deallocate(task);
+	td->td_retval[0] = rv;
+	return (0);
+}
+
+int
+sys__kernelrpc_mach_port_mod_refs_trap(struct thread *td, struct _kernelrpc_mach_port_mod_refs_trap_args *uap)
+{
+	ipc_space_t space = current_task()->itk_space;
+	/*
+	  mach_port_name_t target = uap->target;
+	  mach_port_name_t *name = uap->name;
+	  mach_port_right_t right = uap->right;
+	  mach_port_delta_t delta = uap->delta;
+	*/
+	td->td_retval[0] = mach_port_mod_refs(space, uap->name, uap->right, uap->delta);
+	return (0);
+}
+
+int
+sys__kernelrpc_mach_port_move_member_trap(struct thread *td, struct _kernelrpc_mach_port_move_member_trap_args *uap)
+{
+	ipc_space_t space = current_task()->itk_space;
+
+	td->td_retval[0] = mach_port_move_member(space, uap->member, uap->after);
+	return (0);
+}
+
+int
+sys__kernelrpc_mach_port_insert_member_trap(struct thread *td, struct _kernelrpc_mach_port_insert_member_trap_args *uap)
+{
+	ipc_space_t space = current_task()->itk_space;
+
+	td->td_retval[0] = mach_port_move_member(space, uap->name, uap->pset);
+	return (0);
+}
+
+int
+sys__kernelrpc_mach_port_extract_member_trap(struct thread *td, struct _kernelrpc_mach_port_extract_member_trap_args *uap)
+{
+	ipc_space_t space = current_task()->itk_space;
+
+	td->td_retval[0] = mach_port_move_member(space, uap->name, MACH_PORT_NAME_NULL);
+	return (0);
+}
+
+int
+sys__kernelrpc_mach_port_construct_trap(struct thread *td, struct _kernelrpc_mach_port_construct_trap_args *uap)
+	UNSUPPORTED;
+
+int
+sys__kernelrpc_mach_port_destruct_trap(struct thread *td, struct _kernelrpc_mach_port_destruct_trap_args *uap)
+	UNSUPPORTED;
+
+int
+sys__kernelrpc_mach_port_destroy_trap(struct thread *td, struct _kernelrpc_mach_port_destroy_trap_args *uap)
+{
+	ipc_space_t space = current_task()->itk_space;
+
+	return (mach_port_destroy(space, uap->name));
+}
+
+int
+sys__kernelrpc_mach_port_guard_trap(struct thread *td, struct _kernelrpc_mach_port_guard_trap_args *uap)
+	UNSUPPORTED;
+
+
+int
+sys__kernelrpc_mach_port_unguard_trap(struct thread *td, struct _kernelrpc_mach_port_unguard_trap_args *uap)
+	UNSUPPORTED;
+
+int
+sys__kernelrpc_mach_vm_map_trap(struct thread *td, struct _kernelrpc_mach_vm_map_trap_args *uap)
+{
+	int error;
+	vm_offset_t addr;
+
+	if ((error = copyin(uap->address, &addr, sizeof(addr))) != 0)
+		return (error);
+	error = mach_vm_map(&curthread->td_proc->p_vmspace->vm_map, &addr, uap->size, uap->mask, uap->flags, NULL, 0, 0, uap->cur_protection,
+						VM_PROT_ALL, VM_INHERIT_NONE);
+	if (error)
+		return (error);
+	return (copyout(&addr, uap->address, sizeof(addr)));
+}
+
+int
+sys__kernelrpc_mach_vm_allocate_trap(struct thread *td, struct _kernelrpc_mach_vm_allocate_trap_args *uap)
+{
+	/* mach_port_name_t target = uap->target; current task only */
+	mach_vm_offset_t *address = uap->address;
+	mach_vm_offset_t uaddr;
+	mach_vm_size_t size = uap->size;
+	int flags = uap->flags;
+	int error;
+
+	if ((error = copyin(address, &uaddr, sizeof(mach_vm_offset_t))))
+		return (error);
+
+	if ((error = mach_vm_allocate(&td->td_proc->p_vmspace->vm_map,
+								  &uaddr, size, flags)))
+		return (error);
+	if ((error = copyout(&uaddr, address, sizeof(mach_vm_offset_t))))
+		return (error);
+	return (0);
+}
+
+int
+sys__kernelrpc_mach_vm_deallocate_trap(struct thread *td, struct _kernelrpc_mach_vm_deallocate_trap_args *uap)
+{
+	/* mach_port_name_t target = uap->target; current task only */
+
+	return (mach_vm_deallocate(&td->td_proc->p_vmspace->vm_map, uap->address, uap->size));
+}
+
+int
+sys__kernelrpc_mach_vm_protect_trap(struct thread *td, struct _kernelrpc_mach_vm_protect_trap_args *uap)
+{
+	/* mach_port_name_t target = uap->target */
+	/* int set_maximum = uap->set_maximum */
+
+	return (mach_vm_protect(&td->td_proc->p_vmspace->vm_map, uap->address, uap->size, FALSE, uap->new_protection));
+}
+


Property changes on: trunk/sys/compat/mach/mach_traps.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_vm.c
===================================================================
--- trunk/sys/compat/mach/mach_vm.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_vm.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,1369 @@
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mount.h>
+#include <sys/proc.h>
+#include <sys/mman.h>
+#include <sys/malloc.h>
+#include <sys/file.h>
+#include <sys/filedesc.h>
+#include <sys/exec.h>
+#include <sys/sysproto.h>
+#include <sys/uio.h>
+#include <sys/vnode.h>
+
+#include <sys/ktrace.h>
+
+#include <vm/vm.h>
+#include <vm/vm_param.h>
+#include <vm/pmap.h>
+#include <vm/vm_map.h>
+#include <vm/vm_extern.h>
+#include <vm/vm_kern.h>
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/mach_vm.h>
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/thread.h>
+#include <sys/mach/mach_vm_server.h>
+#include <sys/mach/vm_map_server.h>
+#include <sys/mach/host_priv_server.h>
+
+
+extern vm_size_t	msg_ool_size_small;
+void _vm_map_clip_end(vm_map_t map, vm_map_entry_t entry, vm_offset_t end);
+void _vm_map_clip_start(vm_map_t map, vm_map_entry_t entry, vm_offset_t start);
+
+
+/*
+ *	vm_map_clip_start:	[ internal use only ]
+ *
+ *	Asserts that the given entry begins at or after
+ *	the specified address; if necessary,
+ *	it splits the entry into two.
+ */
+#define vm_map_clip_start(map, entry, startaddr) \
+{ \
+	if (startaddr > entry->start) \
+		_vm_map_clip_start(map, entry, startaddr); \
+}
+
+/*
+ *	vm_map_clip_end:	[ internal use only ]
+ *
+ *	Asserts that the given entry ends at or before
+ *	the specified address; if necessary,
+ *	it splits the entry into two.
+ */
+#define vm_map_clip_end(map, entry, endaddr) \
+{ \
+	if ((endaddr) < (entry->end)) \
+		_vm_map_clip_end((map), (entry), (endaddr)); \
+}
+
+
+int mach_vm_map_page_query(vm_map_t target_map, vm_offset_t offset, integer_t *disposition, integer_t *ref_count);
+int mach_vm_mapped_pages_info(vm_map_t task, page_address_array_t *pages, mach_msg_type_number_t *pagesCnt);
+int mach_vm_wire_32(
+	host_priv_t host_priv,
+	vm_map_t task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_prot_t desired_access
+	);
+
+
+static kern_return_t
+vm_map_copyout_internal(
+	register vm_map_t	dst_map,
+	vm_offset_t		*dst_addr,	/* OUT */
+	register vm_map_copy_t	copy,
+	boolean_t consume_on_success,
+	vm_prot_t cur_protection,
+	vm_prot_t max_protection,
+	vm_inherit_t inheritance);
+
+
+#ifdef INVARIANTS
+static int
+first_free_is_valid(vm_map_t map)
+{
+	return TRUE;
+}
+#endif	
+
+int
+mach_vm_map(vm_map_t map, mach_vm_address_t *address, mach_vm_size_t _size,
+			mach_vm_offset_t _mask, int _flags, mem_entry_name_port_t object __unused,
+			memory_object_offset_t offset __unused, boolean_t copy __unused,
+			vm_prot_t cur_protection, vm_prot_t max_protection, vm_inherit_t inh)
+{
+	vm_offset_t addr = 0;
+	size_t size;
+	int flags;
+	int docow, error, find_space;
+
+	/* XXX Darwin fails on mapping a page at address 0 */
+	if ((_flags & VM_FLAGS_ANYWHERE) == 0 && *address == 0)
+		return (ENOMEM);
+
+	size = round_page(_size);
+	docow = error = 0;
+
+	if (!(_mask & (_mask + 1)) && _mask != 0)
+		_mask++;
+
+	find_space = _mask ? VMFS_ALIGNED_SPACE(ffs(_mask)) : VMFS_ANY_SPACE;
+	flags = MAP_ANON;
+	if ((_flags & VM_FLAGS_ANYWHERE) == 0) {
+		flags |= MAP_FIXED;
+		addr = trunc_page(*address);
+	} else
+		addr = 0;
+
+	switch(inh) {
+	case VM_INHERIT_SHARE:
+		flags |= MAP_INHERIT_SHARE;
+		break;
+	case VM_INHERIT_COPY:
+		flags |= MAP_COPY_ON_WRITE;
+		docow = MAP_COPY_ON_WRITE;
+		break;
+	case VM_INHERIT_NONE:
+		break;
+	case VM_INHERIT_DONATE_COPY:
+	default:
+		uprintf("mach_vm_map: unsupported inheritance flag %d\n", inh);
+		break;
+	}
+
+	if (vm_map_find(map, NULL, 0, &addr, size, 0, find_space,
+	    cur_protection, max_protection, docow) != KERN_SUCCESS) {
+		error = ENOMEM;
+		goto done;
+	}
+
+	*address = addr;
+done:
+	return (error);
+}
+
+int
+mach_vm_allocate(vm_map_t map, vm_offset_t *addr, size_t _size, int flags)
+{
+	size_t size = round_page(_size);
+	vm_offset_t start, daddr;
+	vm_prot_t prot, protmax;
+	int err;
+
+	prot = VM_PROT_READ|VM_PROT_WRITE;
+	protmax = VM_PROT_ALL;
+	KASSERT(addr != NULL, ("invalid addr passed"));
+#if defined(INVARIANTS) && defined(__LP64__)
+	start = 1UL<<32;
+#else
+	start = 0;
+#endif
+
+	daddr = trunc_page(*addr);
+	vm_map_lock(map);
+	if ((flags & VM_FLAGS_ANYWHERE) &&
+		(vm_map_findspace(map, 0, size, &daddr))) {
+	  err = ENOMEM;
+	  goto error;
+	} else {
+	  err = EINVAL;
+		/* Address range must be all in user VM space. */
+		if (daddr < vm_map_min(map) ||
+		    daddr + size > vm_map_max(map))
+		  goto error;
+		if (daddr + size < daddr)
+		  goto error;
+	}
+	if (vm_map_insert(map, NULL, 0, daddr, daddr + size, prot, protmax, 0)) {
+	  err = EFAULT;
+	  goto error;
+	}
+	vm_map_unlock(map);
+	*addr = daddr;
+	return (0);
+ error:
+	vm_map_unlock(map);
+	return (err);
+}
+
+
+
+int
+mach_vm_deallocate(vm_map_t target __unused, mach_vm_address_t addr, mach_vm_size_t len)
+{
+	struct munmap_args cup;
+
+	cup.addr = (void *)addr;
+	cup.len = len;
+	return (sys_munmap(curthread, &cup));
+}
+
+int
+mach_vm_protect(vm_map_t target_task __unused, vm_offset_t addr, size_t len,
+				boolean_t setmax __unused, vm_prot_t prot)
+{
+	struct mprotect_args cup;
+
+	cup.addr = (void *)addr;
+	cup.len = len;
+	cup.prot = prot;
+
+	return (sys_mprotect(curthread, &cup));
+}
+
+
+int
+mach_vm_inherit(vm_map_t target_task, mach_vm_address_t address, mach_vm_size_t size,
+				vm_inherit_t new_inheritance)
+{
+	struct minherit_args cup;
+	int error;
+
+	cup.addr = (void *)address;
+	cup.len = size;
+	/* Flags map well between Mach and NetBSD */
+	cup.inherit = new_inheritance;
+
+	if ((error = sys_minherit(curthread, &cup)) != 0)
+		return (KERN_FAILURE);
+
+	return (0);
+}
+
+int
+mach_vm_map_page_query(
+	vm_map_t target_map,
+	vm_offset_t offset,
+	integer_t *disposition,
+	integer_t *ref_count
+)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+_mach_make_memory_entry(
+	vm_map_t target_task,
+	memory_object_size_t *size,
+	memory_object_offset_t offset,
+	vm_prot_t permission,
+	mem_entry_name_port_t *object_handle,
+	mem_entry_name_port_t parent_handle
+)
+{	
+
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_make_memory_entry(vm_map_t target_task, vm_size_t *size,
+					   vm_offset_t offset, vm_prot_t permission,
+					   mem_entry_name_port_t *object_handle,
+					   mem_entry_name_port_t parent_handle)
+{	
+
+	return (KERN_NOT_SUPPORTED);
+}
+
+
+int
+mach_make_memory_entry_64(vm_map_t target_task, memory_object_size_t *size,
+						  memory_object_offset_t offset, vm_prot_t permission,
+						  mach_port_t *object_handle,
+						  mem_entry_name_port_t parent_handle)
+{	
+
+	return (KERN_NOT_SUPPORTED);
+}
+
+
+int
+mach_vm_msync(vm_map_t target_task __unused, mach_vm_address_t addr, mach_vm_size_t size,
+		vm_sync_t flags)
+{
+	struct msync_args cup;
+	int error;
+
+	cup.addr = (void *)addr;
+	cup.len = size;
+	cup.flags = 0;
+	if (flags & VM_SYNC_ASYNCHRONOUS)
+		cup.flags |= MS_ASYNC;
+	if (flags & VM_SYNC_SYNCHRONOUS)
+		cup.flags |= MS_SYNC;
+	if (flags & VM_SYNC_INVALIDATE)
+		cup.flags |= MS_INVALIDATE;
+	error = sys_msync(curthread, &cup);
+	
+	if (error)
+		return (KERN_FAILURE);
+	return (0);
+}
+
+/* XXX Do it for remote task */
+int
+mach_vm_copy(vm_map_t target_task, mach_vm_address_t src, mach_vm_size_t size,
+		mach_vm_address_t dst)
+		
+{
+	char *tmpbuf;
+	int error;
+
+#ifdef DEBUG_MACH_VM
+	printf("mach_vm_copy: src = 0x%08lx, size = 0x%08lx, addr = 0x%08lx\n",
+	    (long)req->req_src, (long)req->req_size, (long)req->req_addr);
+#endif
+	if ((src & (PAGE_SIZE - 1)) ||
+	    (dst & (PAGE_SIZE - 1)) ||
+	    (size & (PAGE_SIZE - 1)))
+		return (KERN_INVALID_ARGUMENT);
+
+
+	tmpbuf = malloc(PAGE_SIZE, M_TEMP, M_WAITOK);
+
+	/* Is there an easy way of dealing with that efficiently? */
+	do {
+		if ((error = copyin((void*)src, tmpbuf, PAGE_SIZE)) != 0)
+			goto out;
+
+		if ((error = copyout(tmpbuf, (void *)dst, PAGE_SIZE)) != 0)
+			goto out;
+
+		src += PAGE_SIZE;
+		dst += PAGE_SIZE;
+		size -= PAGE_SIZE;
+	} while (size > 0);
+
+	free(tmpbuf, M_TEMP);
+	return (0);
+
+out:
+	free(tmpbuf, M_TEMP);
+	return (KERN_FAILURE);
+}
+
+int
+mach_vm_read(vm_map_t map, mach_vm_address_t addr, mach_vm_size_t size,
+			 vm_offset_t *data, mach_msg_type_number_t *dataCnt)
+{
+	caddr_t tbuf;
+	vm_offset_t dstaddr;
+	vm_prot_t prot, protmax;
+	int error;
+
+	size = round_page(size);
+	prot = VM_PROT_READ|VM_PROT_WRITE;
+	protmax = VM_PROT_ALL;
+
+	if ((error = mach_vm_allocate(map, &dstaddr, size, 0)))
+		return (KERN_NO_SPACE);
+	/*
+	 * Copy the data from the target process to the current process
+	 * This is reasonable for small chunk of data, but we should
+	 * remap COW for areas bigger than a page.
+	 */
+	tbuf = malloc(size, M_MACH_TMP, M_WAITOK);
+#ifdef notyet
+	if ((error = copyin_vm_map(map, (caddr_t)addr, tbuf, size)) != 0) {
+		printf("copyin_proc error = %d, addr = %lx, size = %zx\n", error, addr, size);
+		free(tbuf, M_MACH_TMP);
+		return (KERN_PROTECTION_FAILURE);
+	}
+#endif
+	if ((error = copyout(tbuf, (void *)dstaddr, size)) != 0) {
+		printf("copyout error = %d\n", error);
+		free(tbuf, M_MACH_TMP);
+		return (KERN_PROTECTION_FAILURE);
+	}
+
+	free(tbuf, M_MACH_TMP);
+	return (0);
+}
+
+
+/*
+ * mach_vm_write -
+ * Overwrite the specified address range with the data provided
+ * (from the current map).
+ */
+kern_return_t
+mach_vm_write(
+	vm_map_t			map,
+	mach_vm_address_t		address,
+	vm_offset_t			data,
+	mach_msg_type_number_t	size __unused)
+{
+	if (map == VM_MAP_NULL)
+		return KERN_INVALID_ARGUMENT;
+
+	return vm_map_copy_overwrite(map, (vm_map_address_t)address,
+		(vm_map_copy_t) data, FALSE /* interruptible XXX */);
+}
+
+int
+mach_vm_machine_attribute(vm_map_t target_task, mach_vm_address_t addr, mach_vm_size_t size,
+						  vm_machine_attribute_t attribute, vm_machine_attribute_val_t *valuep)
+{
+	int error = 0;
+	vm_machine_attribute_val_t value;
+
+	
+	if ((error = copyin(valuep, &value, sizeof(value))))
+		return (KERN_PROTECTION_FAILURE);
+
+	switch (attribute) {
+	case MATTR_CACHE:
+		switch(value) {
+		case MATTR_VAL_CACHE_FLUSH:
+		case MATTR_VAL_DCACHE_FLUSH:
+		case MATTR_VAL_ICACHE_FLUSH:
+		case MATTR_VAL_CACHE_SYNC:
+#ifdef notyet
+			error = cpu_mach_vm_machine_attribute(target_task, addr, size, &value);
+#endif
+			break;
+		default:
+#ifdef DEBUG_MACH
+			printf("unimplemented value %d\n", value);
+#endif
+			error = EINVAL;
+			break;
+		}
+		break;
+
+	case MATTR_MIGRATE:
+	case MATTR_REPLICATE:
+	default:
+#ifdef DEBUG_MACH
+		printf("unimplemented attribute %d\n", attribute);
+#endif
+		error = EINVAL;
+		break;
+	}
+
+
+	if (error)
+		return (KERN_FAILURE);
+
+	return (copyout(&value, valuep, sizeof(value)));
+}
+
+/*
+ *	vm_map_entry_dispose:	[ internal use only ]
+ *
+ *	Inverse of vm_map_entry_create.
+ */
+#define	vm_map_entry_dispose(map, entry)		\
+MACRO_BEGIN						\
+	assert((entry) != (map)->first_free &&		\
+	       (entry) != (map)->hint);			\
+	_vm_map_entry_dispose(&(map)->hdr, (entry));	\
+MACRO_END
+
+#define	vm_map_copy_entry_dispose(map, entry) \
+	_vm_map_entry_dispose(&(copy)->cpy_hdr, (entry))
+
+static uma_zone_t vm_map_entry_zone;
+static uma_zone_t vm_map_kentry_zone;
+
+static void
+_vm_map_entry_dispose(
+	register struct vm_map_header	*map_header,
+	register vm_map_entry_t		entry)
+{
+	uma_zone_t		zone;
+
+	if (map_header->entries_pageable)
+	    zone = vm_map_entry_zone;
+	else
+	    zone = vm_map_kentry_zone;
+
+	uma_zfree(zone, entry);
+}
+
+/*
+ *	Routine: vm_map_copyin_internal [internal use only]
+ *
+ *	Description:
+ *		Copy in data to a kernel buffer from space in the
+ *		source map. The original space may be optionally
+ *		deallocated.
+ *
+ *		If successful, returns a new copy object.
+ */
+static kern_return_t
+vm_map_copyin_internal(
+	vm_map_t	src_map,
+	vm_map_offset_t	src_addr,
+	vm_map_size_t	len,
+	boolean_t	src_destroy,
+	vm_map_copy_t	*copy_result)
+{
+	kern_return_t kr;
+	vm_map_copy_t copy;
+	vm_size_t size;
+
+	if ((vm_size_t) len != len) {
+		/* "len" is too big and doesn't fit in a "vm_size_t" */
+		return KERN_RESOURCE_SHORTAGE;
+	}
+	if (src_map == kernel_map)
+		size = (vm_size_t) sizeof(struct vm_map_copy);
+	else
+		size =  (vm_size_t) (sizeof(struct vm_map_copy) + len);
+	copy = (vm_map_copy_t) malloc(size, M_MACH_VM, M_NOWAIT);
+	if (copy == VM_MAP_COPY_NULL) {
+		return KERN_RESOURCE_SHORTAGE;
+	}
+	copy->type = VM_MAP_COPY_KERNEL_BUFFER;
+	copy->size = len;
+	copy->offset = 0;
+	copy->cpy_kalloc_size = size;
+	if (src_map == kernel_map) {
+		copy->cpy_kdata = src_addr;
+		copy->type = VM_MAP_COPY_OBJECT_PREALLOC;
+	} else {
+		copy->cpy_kdata = (vm_offset_t) (copy + 1);
+
+		kr = copyinmap(src_map, src_addr, copy->cpy_kdata, (vm_size_t) len);
+		if (kr != KERN_SUCCESS) {
+			free(copy, M_MACH_VM);
+			return kr;
+		}
+		if (src_destroy) {
+			(void) vm_map_remove(
+				src_map,
+				trunc_page(src_addr),
+				round_page(src_addr));
+		}
+	}
+	*copy_result = copy;
+	return KERN_SUCCESS;
+}
+
+/*
+ *	Routine:	vm_map_copyout_kernel_buffer
+ *
+ *	Description:
+ *		Copy out data from a kernel buffer into space in the
+ *		destination map. The space may be otpionally dynamically
+ *		allocated.
+ *
+ *		If successful, consumes the copy object.
+ *		Otherwise, the caller is responsible for it.
+ */
+static kern_return_t
+vm_map_copyout_kernel_buffer(
+	vm_map_t	map,
+	vm_offset_t	*addr,	/* IN/OUT */
+	vm_map_copy_t	copy,
+	boolean_t	overwrite)
+{
+	kern_return_t kr = KERN_SUCCESS;
+
+	if (!overwrite) {
+
+		/*
+		 * Allocate space in the target map for the data
+		 */
+		*addr = 0;
+		kr = mach_vm_allocate(map, addr, round_page(copy->size), VM_FLAGS_ANYWHERE);
+		if (kr != KERN_SUCCESS)
+			return(kr);
+	}
+
+	/*
+	 * Copyout the data from the kernel buffer to the target map.
+	 */
+	if (current_map() == map) {
+		/*
+		 * If the target map is the current map, just do
+		 * the copy.
+		 */
+		if (copyout((char *)copy->cpy_kdata, (char *)*addr,
+				copy->size)) {
+			kr = KERN_INVALID_ADDRESS;
+		}
+	}
+	else {
+		panic("unexpected map %p", map);
+#if 0
+		vm_map_t oldmap;
+
+		/*
+		 * If the target map is another map, assume the
+		 * target's address space identity for the duration
+		 * of the copy.
+		 */
+		vm_map_reference(map);
+		oldmap = vm_map_switch(map);
+
+		if (copyout((char *)copy->cpy_kdata, (char *)*addr,
+				copy->size)) {
+			kr = KERN_INVALID_ADDRESS;
+		}
+
+		(void) vm_map_switch(oldmap);
+		vm_map_deallocate(map);
+#endif
+		kr = KERN_NOT_SUPPORTED;
+	}
+
+	if (copy->type == VM_MAP_COPY_OBJECT_PREALLOC)
+		free((void *)copy->cpy_kdata, M_MACH_VM);
+	free(copy, M_MACH_VM);
+
+	return(kr);
+}
+
+
+
+/*
+ *	vm_map_copyin_object:
+ *
+ *	Create a copy object from an object.
+ *	Our caller donates an object reference.
+ */
+
+static kern_return_t
+vm_map_copyin_object(
+	vm_object_t	object,
+	vm_offset_t	offset,		/* offset of region in object */
+	vm_size_t	size,		/* size of region in object */
+	vm_map_copy_t	*copy_result)	/* OUT */
+{
+	vm_map_copy_t	copy;		/* Resulting copy */
+
+	/*
+	 *	We drop the object into a special copy object
+	 *	that contains the object directly.
+	 */
+
+	copy = (vm_map_copy_t) malloc(sizeof(vm_map_copy_t), M_MACH_VM, M_WAITOK);
+	copy->type = VM_MAP_COPY_OBJECT;
+	copy->cpy_object = object;
+
+	copy->offset = offset;
+	copy->size = size;
+
+	*copy_result = copy;
+	return(KERN_SUCCESS);
+}
+
+kern_return_t	vm_map_copyin(
+				vm_map_t			src_map,
+				vm_map_address_t	src_addr,
+				vm_map_size_t		len,
+				boolean_t			src_destroy,
+				vm_map_copy_t		*copy_result)
+{
+	vm_map_entry_t	tmp_entry;	/* Result of last map lookup --
+					 * in multi-level lookup, this
+					 * entry contains the actual
+					 * vm_object/offset.
+					 */
+#if 0
+	vm_map_entry_t	new_entry = NULL;	/* Map entry for copy */
+#endif
+	vm_object_t object;
+	vm_offset_t prev_end;
+
+	vm_offset_t	src_start;	/* Start of current entry --
+					 * where copy is taking place now
+					 */
+	vm_offset_t src_end;
+	vm_offset_t offset;
+
+	/*
+	 * three possibilities:
+	 * - len is less than  MSG_OOL_SIZE_SMALL:
+	 *   allocate memory and copyin with header
+	 * - len is greater but src_map is the special copy map:
+	 *   allocate just a header and point at src_addr
+	 * - len is greater:
+	 *     lookup entry
+	 *     while entry does not cover full range && entry changed:
+	 *       simplify entry
+	 *     if entry edges extend outside of range:
+	 *       clip
+	 *     if no object:
+	 *       add object
+	 *     reference object
+	 *     if src_destroy is not true:
+	 *       mark entry needs COW && NEEDS_COPY
+	 *       pmap_protect range
+	 *       create shadow object
+	 *     else:
+	 *       split object
+	 *       delete entry from source map
+	 *       if data is not aligned copy edge pages and insert
+	 *         into source map
+	 *     create map copy object w/ object
+	 */
+
+
+	if (len == 0) {
+		*copy_result = VM_MAP_COPY_NULL;
+		return(KERN_SUCCESS);
+	}
+
+	src_start = trunc_page(src_addr);
+	src_end = round_page(src_addr + len);
+	if (src_end < src_addr)
+		return KERN_INVALID_ADDRESS;
+
+	if (len < msg_ool_size_small || src_map == kernel_map)
+		return vm_map_copyin_internal(src_map, src_addr, len,
+										   src_destroy, copy_result);
+
+	/*
+	 *	Find the beginning of the region.
+	 */
+	vm_map_lock(src_map);
+
+	if (!vm_map_lookup_entry(src_map, src_start, &tmp_entry)) {
+		vm_map_unlock(src_map);
+		return KERN_INVALID_ADDRESS;
+	}
+	prev_end = 0;
+	while (prev_end != tmp_entry->end  && tmp_entry->end < src_end) {
+		prev_end = tmp_entry->end;
+		vm_map_simplify_entry(src_map, tmp_entry);
+	}
+	/* only handle single map entry for now */
+	if (tmp_entry->end < src_end) {
+		vm_map_unlock(src_map);
+		return KERN_NOT_SUPPORTED;
+	}
+	object = tmp_entry->object.vm_object;
+
+	if (src_destroy) {
+		offset = 0;
+		vm_map_clip_start(src_map, tmp_entry, src_start);
+		vm_map_clip_end(src_map, tmp_entry, src_end);
+		VM_OBJECT_WLOCK(object);
+		vm_object_reference_locked(object);
+		vm_object_split(tmp_entry);
+		object = tmp_entry->object.vm_object;
+		VM_OBJECT_WUNLOCK(object);
+		vm_map_delete(src_map, src_start, src_end);
+		vm_map_unlock(src_map);
+	} else {
+		offset = tmp_entry->offset;
+		vm_map_unlock(src_map);
+		vm_object_reference(object);
+		vm_map_protect(src_map, src_start, src_end, tmp_entry->protection & ~VM_PROT_WRITE, 0);
+		tmp_entry->eflags |= MAP_ENTRY_NEEDS_COPY | MAP_ENTRY_COW;
+	}
+
+	vm_map_copyin_object(object, offset, src_end - src_start, copy_result);
+	/* neither mach nor osx does anything to prevent information leakage
+	 * in unaligned sends
+	 */
+	return KERN_SUCCESS;
+}
+
+
+
+/*
+ *	Routine:	vm_map_copyout
+ *
+ *	Description:
+ *		Copy out a copy chain ("copy") into newly-allocated
+ *		space in the destination map.
+ *
+ *		If successful, consumes the copy object.
+ *		Otherwise, the caller is responsible for it.
+ */
+
+
+kern_return_t
+vm_map_copyout(
+	vm_map_t		dst_map,
+	vm_map_address_t	*dst_addr,	/* OUT */
+	vm_map_copy_t		copy)
+{
+	int cow;
+
+	*dst_addr = 0;
+/*
+	 *	Check for special kernel buffer allocated
+	 *	by new_ipc_kmsg_copyin.
+	 */
+
+	if (copy->type == VM_MAP_COPY_KERNEL_BUFFER || copy->type == VM_MAP_COPY_OBJECT_PREALLOC) {
+		return (vm_map_copyout_kernel_buffer(dst_map, dst_addr,
+						    copy, FALSE));
+	}
+	if (copy->type == VM_MAP_COPY_OBJECT) {
+		cow = copy->cpy_object->ref_count > 1 ? MAP_COPY_ON_WRITE : 0;
+		return vm_map_find(dst_map, copy->cpy_object, copy->offset,
+		    dst_addr, round_page(copy->size), 0, VMFS_ANY_SPACE,
+		    VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE,
+		    cow);
+	}
+	return KERN_NOT_SUPPORTED;
+#if 0
+	return vm_map_copyout_internal(dst_map, dst_addr, copy,
+				       TRUE, /* consume_on_success */
+				       VM_PROT_DEFAULT,
+				       VM_PROT_ALL,
+				       VM_INHERIT_DEFAULT);
+#endif
+}
+
+#if 0
+static kern_return_t
+vm_map_copyout_internal(
+	register vm_map_t	dst_map,
+	vm_offset_t		*dst_addr,	/* OUT */
+	register vm_map_copy_t	copy,
+	boolean_t consume_on_success,
+	vm_prot_t cur_protection,
+	vm_prot_t max_protection,
+	vm_inherit_t inheritance)
+{
+	vm_size_t	size;
+	vm_size_t	adjustment;
+	vm_offset_t	start;
+	vm_offset_t	vm_copy_start;
+	vm_map_entry_t	last;
+	vm_map_entry_t	entry;
+
+	/*
+	 *	Check for null copy object.
+	 */
+
+	if (copy == VM_MAP_COPY_NULL) {
+		*dst_addr = 0;
+		return(KERN_SUCCESS);
+	}
+
+	/*
+	 *	Check for special copy object, created
+	 *	by vm_map_copyin_object.
+	 */
+
+	if (copy->type == VM_MAP_COPY_OBJECT) {
+		vm_object_t object = copy->cpy_object;
+		kern_return_t kr;
+		vm_size_t offset;
+
+		offset = trunc_page(copy->offset);
+		size = round_page(copy->size + copy->offset - offset);
+		*dst_addr = 0;
+		kr = vm_map_enter(dst_map, dst_addr, size,
+				  (vm_offset_t) 0, TRUE,
+				  object, offset, FALSE,
+				  VM_PROT_DEFAULT, VM_PROT_ALL,
+				  VM_INHERIT_DEFAULT);
+		if (kr != KERN_SUCCESS)
+			return(kr);
+		/* Account for non-pagealigned copy object */
+		*dst_addr += copy->offset - offset;
+		uma_zfree(vm_map_copy_zone, copy);
+		return(KERN_SUCCESS);
+	}
+
+	/*
+	 *	Check for special kernel buffer allocated
+	 *	by new_ipc_kmsg_copyin.
+	 */
+
+	if (copy->type == VM_MAP_COPY_KERNEL_BUFFER) {
+		return(vm_map_copyout_kernel_buffer(dst_map, dst_addr, 
+						    copy, FALSE));
+	}
+
+	/*
+	 *	Find space for the data
+	 */
+
+	vm_copy_start = trunc_page(copy->offset);
+	size =	round_page(copy->offset + copy->size) - vm_copy_start;
+
+ StartAgain: ;
+
+	vm_map_lock(dst_map);
+	assert(first_free_is_valid(dst_map));
+	start = ((last = dst_map->first_free) == vm_map_to_entry(dst_map)) ?
+		vm_map_min(dst_map) : last->vme_end;
+
+	while (TRUE) {
+		vm_map_entry_t	next = last->vme_next;
+		vm_offset_t	end = start + size;
+
+		if ((end > dst_map->max_offset) || (end < start)) {
+			if (dst_map->wait_for_space) {
+				if (size <= (dst_map->max_offset - dst_map->min_offset)) {
+					assert_wait((event_t) dst_map, TRUE);
+					vm_map_unlock(dst_map);
+					thread_block((void (*)(void))0);
+					goto StartAgain;
+				}
+			}
+			vm_map_unlock(dst_map);
+			return(KERN_NO_SPACE);
+		}
+
+		if ((next == vm_map_to_entry(dst_map)) ||
+		    (next->vme_start >= end))
+			break;
+
+		last = next;
+		start = last->vme_end;
+	}
+
+	/*
+	 *	Since we're going to just drop the map
+	 *	entries from the copy into the destination
+	 *	map, they must come from the same pool.
+	 */
+
+	if (copy->cpy_hdr.entries_pageable != dst_map->hdr.entries_pageable) {
+	    /*
+	     * Mismatches occur when dealing with the default
+	     * pager.
+	     */
+	    zone_t		old_zone;
+	    vm_map_entry_t	next, new;
+
+	    /*
+	     * Find the zone that the copies were allocated from
+	     */
+	    old_zone = (copy->cpy_hdr.entries_pageable)
+			? vm_map_entry_zone
+			: vm_map_kentry_zone;
+	    entry = vm_map_copy_first_entry(copy);
+
+	    /*
+	     * Reinitialize the copy so that vm_map_copy_entry_link
+	     * will work.
+	     */
+	    copy->cpy_hdr.nentries = 0;
+	    copy->cpy_hdr.entries_pageable = dst_map->hdr.entries_pageable;
+	    vm_map_copy_first_entry(copy) =
+	     vm_map_copy_last_entry(copy) =
+		vm_map_copy_to_entry(copy);
+
+	    /*
+	     * Copy each entry.
+	     */
+	    while (entry != vm_map_copy_to_entry(copy)) {
+		new = vm_map_copy_entry_create(copy);
+		vm_map_entry_copy_full(new, entry);
+		vm_map_copy_entry_link(copy,
+				vm_map_copy_last_entry(copy),
+				new);
+		next = entry->vme_next;
+		uma_zfree(old_zone, entry);
+		entry = next;
+	    }
+	}
+
+	/*
+	 *	Adjust the addresses in the copy chain, and
+	 *	reset the region attributes.
+	 */
+
+	adjustment = start - vm_copy_start;
+	for (entry = vm_map_copy_first_entry(copy);
+	     entry != vm_map_copy_to_entry(copy);
+	     entry = entry->vme_next) {
+		entry->vme_start += adjustment;
+		entry->vme_end += adjustment;
+
+		entry->inheritance = VM_INHERIT_DEFAULT;
+		entry->protection = VM_PROT_DEFAULT;
+		entry->max_protection = VM_PROT_ALL;
+		entry->behavior = VM_BEHAVIOR_DEFAULT;
+
+		/*
+		 * If the entry is now wired,
+		 * map the pages into the destination map.
+		 */
+		if (entry->wired_count != 0) {
+		    register vm_offset_t va;
+		    vm_offset_t		 offset;
+		    register vm_object_t object;
+
+		    object = entry->object.vm_object;
+		    offset = entry->offset;
+		    va = entry->vme_start;
+
+		    pmap_pageable(dst_map->pmap,
+				  entry->vme_start,
+				  entry->vme_end,
+				  TRUE);
+
+		    while (va < entry->vme_end) {
+			register vm_page_t	m;
+
+			/*
+			 * Look up the page in the object.
+			 * Assert that the page will be found in the
+			 * top object:
+			 * either
+			 *	the object was newly created by
+			 *	vm_object_copy_slowly, and has
+			 *	copies of all of the pages from
+			 *	the source object
+			 * or
+			 *	the object was moved from the old
+			 *	map entry; because the old map
+			 *	entry was wired, all of the pages
+			 *	were in the top-level object.
+			 *	(XXX not true if we wire pages for
+			 *	 reading)
+			 */
+			vm_object_lock(object);
+			vm_object_paging_begin(object);
+
+			m = vm_page_lookup(object, offset);
+			if (m == VM_PAGE_NULL || m->wire_count == 0 ||
+			    m->absent)
+			    panic("vm_map_copyout: wiring 0x%x", m);
+
+			m->busy = TRUE;
+			vm_object_unlock(object);
+
+			PMAP_ENTER(dst_map->pmap, va, m,
+				   entry->protection, TRUE);
+
+			vm_object_lock(object);
+			PAGE_WAKEUP_DONE(m);
+			/* the page is wired, so we don't have to activate */
+			vm_object_paging_end(object);
+			vm_object_unlock(object);
+
+			offset += PAGE_SIZE;
+			va += PAGE_SIZE;
+		    }
+		}
+		else if (size <= vm_map_aggressive_enter_max) {
+
+			register vm_offset_t	va;
+			vm_offset_t		offset;
+			register vm_object_t	object;
+			vm_prot_t		prot;
+
+			object = entry->object.vm_object;
+			if (object != VM_OBJECT_NULL) {
+
+				offset = entry->offset;
+				va = entry->vme_start;
+				while (va < entry->vme_end) {
+					register vm_page_t	m;
+				    
+					/*
+					 * Look up the page in the object.
+					 * Assert that the page will be found
+					 * in the top object if at all...
+					 */
+					vm_object_lock(object);
+					vm_object_paging_begin(object);
+
+					if (((m = vm_page_lookup(object,
+								 offset))
+					     != VM_PAGE_NULL) &&
+					    !m->busy && !m->fictitious &&
+					    !m->absent && !m->error) {
+						m->busy = TRUE;
+						vm_object_unlock(object);
+
+						/* honor cow obligations */
+						prot = entry->protection;
+						if (entry->needs_copy)
+							prot &= ~VM_PROT_WRITE;
+
+						PMAP_ENTER(dst_map->pmap, va, 
+							   m, prot, FALSE);
+
+						vm_object_lock(object);
+						vm_page_lock_queues();
+						if (!m->active && !m->inactive)
+							vm_page_activate(m);
+						vm_page_unlock_queues();
+						PAGE_WAKEUP_DONE(m);
+					}
+					vm_object_paging_end(object);
+					vm_object_unlock(object);
+
+					offset += PAGE_SIZE;
+					va += PAGE_SIZE;
+				}
+			}
+		}
+	}
+
+	/*
+	 *	Correct the page alignment for the result
+	 */
+
+	*dst_addr = start + (copy->offset - vm_copy_start);
+
+	/*
+	 *	Update the hints and the map size
+	 */
+
+	SAVE_HINT(dst_map, vm_map_copy_last_entry(copy));
+
+	dst_map->size += size;
+
+	/*
+	 *	Link in the copy
+	 */
+
+	vm_map_copy_insert(dst_map, last, copy);
+
+	vm_map_unlock(dst_map);
+
+	/*
+	 * XXX	If wiring_required, call vm_map_pageable
+	 */
+
+	return(KERN_SUCCESS);
+}
+#endif
+/*
+ *	Routine:	vm_map_copy_discard
+ *
+ *	Description:
+ *		Dispose of a map copy object (returned by
+ *		vm_map_copyin).
+ */
+void
+vm_map_copy_discard(
+	vm_map_copy_t	copy)
+{
+
+	if (copy == VM_MAP_COPY_NULL)
+		return;
+
+	if (copy->type == VM_MAP_COPY_OBJECT_PREALLOC)
+		free((void *)copy->cpy_kdata, M_MACH_VM);
+	if (copy->type == VM_MAP_COPY_OBJECT)
+		vm_object_deallocate(copy->cpy_object);
+	free(copy, M_MACH_VM);
+}
+
+kern_return_t
+vm_map_copy_overwrite(vm_map_t                dst_map,
+					  vm_map_address_t        dst_addr,
+					  vm_map_copy_t           copy,
+					  boolean_t               interruptible)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_vm_behavior_set(vm_map_t target_task, mach_vm_address_t address, mach_vm_size_t size, vm_behavior_t new_behavior)
+{
+
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_vm_page_info(vm_map_t target_task, mach_vm_address_t address,
+				  vm_page_info_flavor_t flavor, vm_page_info_t info,
+				  mach_msg_type_number_t *infoCnt)
+{
+
+		return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_vm_page_query(
+	vm_map_t target_map,
+	mach_vm_offset_t offset,
+	integer_t *disposition,
+	integer_t *ref_count
+)
+{
+
+		return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_vm_purgable_control(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	vm_purgable_t control,
+	int *state
+	)
+{
+
+	return (KERN_NOT_SUPPORTED);
+}
+	
+int
+mach_vm_read_list(
+	vm_map_t target_task,
+	mach_vm_read_entry_t data_list,
+	natural_t count
+	)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+
+int
+vm_read_list(
+	vm_map_t target_task,
+	vm_read_entry_t data_list,
+	natural_t count
+	)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_vm_read_overwrite(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	mach_vm_address_t data,
+	mach_vm_size_t *outsize
+)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_vm_region(
+	vm_map_t target_task,
+	mach_vm_address_t *address,
+	mach_vm_size_t *size,
+	vm_region_flavor_t flavor,
+	vm_region_info_t info,
+	mach_msg_type_number_t *infoCnt,
+	mach_port_t *object_name
+	)
+{
+	/*
+	 * MACH_VM_REGION_BASIC_INFO is the only
+	 * supported flavor in Darwin.
+	 */
+
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_vm_region_info(
+	vm_map_t task,
+	vm_address_t address,
+	vm_info_region_t *region,
+	vm_info_object_array_t *objects,
+	mach_msg_type_number_t *objectsCnt
+)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_vm_region_info_64(
+	vm_map_t task,
+	vm_address_t address,
+	vm_info_region_64_t *region,
+	vm_info_object_array_t *objects,
+	mach_msg_type_number_t *objectsCnt
+)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_vm_region_recurse(
+	vm_map_t target_task,
+	mach_vm_address_t *address,
+	mach_vm_size_t *size,
+	natural_t *nesting_depth,
+	vm_region_recurse_info_t info,
+	mach_msg_type_number_t *infoCnt
+	)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_vm_mapped_pages_info(
+	vm_map_t task,
+	page_address_array_t *pages,
+	mach_msg_type_number_t *pagesCnt
+)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+	
+int
+mach_vm_remap(
+	vm_map_t target_task,
+	mach_vm_address_t *target_address,
+	mach_vm_size_t size,
+	mach_vm_offset_t mask,
+	int flags,
+	vm_map_t src_task,
+	mach_vm_address_t src_address,
+	boolean_t copy,
+	vm_prot_t *cur_protection,
+	vm_prot_t *max_protection,
+	vm_inherit_t inheritance
+	)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_vm_wire(
+	host_priv_t host_priv,
+	vm_map_t task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_prot_t desired_access
+)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+mach_vm_wire_32(
+	host_priv_t host_priv,
+	vm_map_t task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_prot_t desired_access
+)
+{
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+task_wire(vm_map_t target_task, boolean_t must_wire)
+{
+
+	return (KERN_NOT_SUPPORTED);
+}
+
+int
+vm_allocate_cpm
+(
+	host_priv_t host_priv,
+	vm_map_t task,
+	vm_address_t *address,
+	vm_size_t size,
+	int flags
+)
+{
+
+	return (KERN_NOT_SUPPORTED);
+}


Property changes on: trunk/sys/compat/mach/mach_vm.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/mach_vm_server.c
===================================================================
--- trunk/sys/compat/mach/mach_vm_server.c	                        (rev 0)
+++ trunk/sys/compat/mach/mach_vm_server.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,3028 @@
+/*
+ * IDENTIFICATION:
+ * stub generated Thu Jun 11 18:17:45 2015
+ * with a MiG generated Thu Jun 11 16:16:11 PDT 2015 by kmacy at serenity
+ * OPTIONS: 
+ *	KernelServer
+ */
+
+/* Module mach_vm */
+
+#define	__MIG_check__Request__mach_vm_subsystem__ 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#ifdef _KERNEL
+#include <sys/mach/ndr.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#else /* !_KERNEL */
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#endif /*_KERNEL */
+
+#include <sys/mach/std_types.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc_mig.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach_debug/mach_debug_types.h>
+
+#ifndef	mig_internal
+#define	mig_internal	static __inline__
+#endif	/* mig_internal */
+
+#ifndef	mig_external
+#define mig_external
+#endif	/* mig_external */
+
+#if	!defined(__MigTypeCheck) && defined(TypeCheck)
+#define	__MigTypeCheck		TypeCheck	/* Legacy setting */
+#endif	/* !defined(__MigTypeCheck) */
+
+#if	!defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
+#define	__MigKernelSpecificCode	_MIG_KERNEL_SPECIFIC_CODE_	/* Legacy setting */
+#endif	/* !defined(__MigKernelSpecificCode) */
+
+#ifndef	LimitCheck
+#define	LimitCheck 0
+#endif	/* LimitCheck */
+
+#ifndef	min
+#define	min(a,b)  ( ((a) < (b))? (a): (b) )
+#endif	/* min */
+
+#if !defined(_WALIGN_)
+#define _WALIGN_(x) (((x) + 7) & ~7)
+#endif /* !defined(_WALIGN_) */
+
+#if !defined(_WALIGNSZ_)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#endif /* !defined(_WALIGNSZ_) */
+
+#ifndef	UseStaticTemplates
+#define	UseStaticTemplates	1
+#endif	/* UseStaticTemplates */
+
+#define _WALIGN_(x) (((x) + 7) & ~7)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#ifndef	__DeclareRcvRpc
+#define	__DeclareRcvRpc(_NUM_, _NAME_)
+#endif	/* __DeclareRcvRpc */
+
+#ifndef	__BeforeRcvRpc
+#define	__BeforeRcvRpc(_NUM_, _NAME_)
+#endif	/* __BeforeRcvRpc */
+
+#ifndef	__AfterRcvRpc
+#define	__AfterRcvRpc(_NUM_, _NAME_)
+#endif	/* __AfterRcvRpc */
+
+#ifndef	__DeclareRcvSimple
+#define	__DeclareRcvSimple(_NUM_, _NAME_)
+#endif	/* __DeclareRcvSimple */
+
+#ifndef	__BeforeRcvSimple
+#define	__BeforeRcvSimple(_NUM_, _NAME_)
+#endif	/* __BeforeRcvSimple */
+
+#ifndef	__AfterRcvSimple
+#define	__AfterRcvSimple(_NUM_, _NAME_)
+#endif	/* __AfterRcvSimple */
+
+#define novalue void
+#if	__MigKernelSpecificCode
+#define msgh_request_port	msgh_remote_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_REMOTE(bits)
+#define msgh_reply_port		msgh_local_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#else
+#define msgh_request_port	msgh_local_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#define msgh_reply_port		msgh_remote_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_REMOTE(bits)
+#endif /* __MigKernelSpecificCode */
+
+#define MIG_RETURN_ERROR(X, code)	{\
+				((mig_reply_error_t *)X)->RetCode = code;\
+				((mig_reply_error_t *)X)->NDR = NDR_record;\
+				return;\
+				}
+
+/* typedefs for all requests */
+
+#ifndef __Request__mach_vm_subsystem__defined
+#define __Request__mach_vm_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		boolean_t set_maximum;
+		vm_prot_t new_protection;
+	} __Request__mach_vm_protect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_inherit_t new_inheritance;
+	} __Request__mach_vm_inherit_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+	} __Request__mach_vm_read_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_read_entry_t data_list;
+		natural_t count;
+	} __Request__mach_vm_read_list_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_msg_type_number_t dataCnt;
+	} __Request__mach_vm_write_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t source_address;
+		mach_vm_size_t size;
+		mach_vm_address_t dest_address;
+	} __Request__mach_vm_copy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		mach_vm_address_t data;
+	} __Request__mach_vm_read_overwrite_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_sync_t sync_flags;
+	} __Request__mach_vm_msync_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_behavior_t new_behavior;
+	} __Request__mach_vm_behavior_set_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_machine_attribute_t attribute;
+		vm_machine_attribute_val_t value;
+	} __Request__mach_vm_machine_attribute_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t src_task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t target_address;
+		mach_vm_size_t size;
+		mach_vm_offset_t mask;
+		int flags;
+		mach_vm_address_t src_address;
+		boolean_t copy;
+		vm_inherit_t inheritance;
+	} __Request__mach_vm_remap_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_offset_t offset;
+	} __Request__mach_vm_page_query_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+	} __Request__mach_vm_region_recurse_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		vm_region_flavor_t flavor;
+		mach_msg_type_number_t infoCnt;
+	} __Request__mach_vm_region_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t parent_handle;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		memory_object_size_t size;
+		memory_object_offset_t offset;
+		vm_prot_t permission;
+	} __Request___mach_make_memory_entry_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		vm_purgable_t control;
+		int state;
+	} __Request__mach_vm_purgable_control_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		vm_page_info_flavor_t flavor;
+		mach_msg_type_number_t infoCnt;
+	} __Request__mach_vm_page_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__mach_vm_subsystem__defined */
+
+/* typedefs for all replies */
+
+#ifndef __Reply__mach_vm_subsystem__defined
+#define __Reply__mach_vm_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_vm_protect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_vm_inherit_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t dataCnt;
+	} __Reply__mach_vm_read_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_vm_read_entry_t data_list;
+	} __Reply__mach_vm_read_list_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_vm_write_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_vm_copy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_vm_size_t outsize;
+	} __Reply__mach_vm_read_overwrite_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_vm_msync_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_vm_behavior_set_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_machine_attribute_val_t value;
+	} __Reply__mach_vm_machine_attribute_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_vm_address_t target_address;
+		vm_prot_t cur_protection;
+		vm_prot_t max_protection;
+	} __Reply__mach_vm_remap_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		integer_t disposition;
+		integer_t ref_count;
+	} __Reply__mach_vm_page_query_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+		int info[19];
+	} __Reply__mach_vm_region_recurse_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t object_name;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		mach_msg_type_number_t infoCnt;
+		int info[10];
+	} __Reply__mach_vm_region_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t object_handle;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		memory_object_size_t size;
+	} __Reply___mach_make_memory_entry_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int state;
+	} __Reply__mach_vm_purgable_control_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t infoCnt;
+		int info[32];
+	} __Reply__mach_vm_page_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__mach_vm_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__mach_vm_subsystem__defined
+#define __ReplyUnion__mach_vm_subsystem__defined
+union __ReplyUnion__mach_vm_subsystem {
+	__Reply__mach_vm_protect_t Reply_mach_vm_protect;
+	__Reply__mach_vm_inherit_t Reply_mach_vm_inherit;
+	__Reply__mach_vm_read_t Reply_mach_vm_read;
+	__Reply__mach_vm_read_list_t Reply_mach_vm_read_list;
+	__Reply__mach_vm_write_t Reply_mach_vm_write;
+	__Reply__mach_vm_copy_t Reply_mach_vm_copy;
+	__Reply__mach_vm_read_overwrite_t Reply_mach_vm_read_overwrite;
+	__Reply__mach_vm_msync_t Reply_mach_vm_msync;
+	__Reply__mach_vm_behavior_set_t Reply_mach_vm_behavior_set;
+	__Reply__mach_vm_machine_attribute_t Reply_mach_vm_machine_attribute;
+	__Reply__mach_vm_remap_t Reply_mach_vm_remap;
+	__Reply__mach_vm_page_query_t Reply_mach_vm_page_query;
+	__Reply__mach_vm_region_recurse_t Reply_mach_vm_region_recurse;
+	__Reply__mach_vm_region_t Reply_mach_vm_region;
+	__Reply___mach_make_memory_entry_t Reply__mach_make_memory_entry;
+	__Reply__mach_vm_purgable_control_t Reply_mach_vm_purgable_control;
+	__Reply__mach_vm_page_info_t Reply_mach_vm_page_info;
+};
+#endif /* __RequestUnion__mach_vm_subsystem__defined */
+/* Forward Declarations */
+
+
+mig_internal novalue _Xmach_vm_protect
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_inherit
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_read
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_read_list
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_write
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_copy
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_read_overwrite
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_msync
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_behavior_set
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_machine_attribute
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_remap
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_page_query
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_region_recurse
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_region
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _X_mach_make_memory_entry
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_purgable_control
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_page_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_protect_t__defined)
+#define __MIG_check__Request__mach_vm_protect_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_protect_t(__attribute__((__unused__)) __Request__mach_vm_protect_t *In0P)
+{
+
+	typedef __Request__mach_vm_protect_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_protect_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_protect */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_protect
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, set_maximum, new_protection)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	boolean_t set_maximum;
+	vm_prot_t new_protection;
+{ return mach_vm_protect(target_task, address, size, set_maximum, new_protection); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	boolean_t set_maximum,
+	vm_prot_t new_protection
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_protect */
+mig_internal novalue _Xmach_vm_protect
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		boolean_t set_maximum;
+		vm_prot_t new_protection;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_protect_t __Request;
+	typedef __Reply__mach_vm_protect_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_protect_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_protect_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(4802, "mach_vm_protect")
+	__BeforeRcvRpc(4802, "mach_vm_protect")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_protect_t__defined)
+	check_result = __MIG_check__Request__mach_vm_protect_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_protect_t__defined) */
+
+	target_task = convert_port_entry_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_vm_protect(target_task, In0P->address, In0P->size, In0P->set_maximum, In0P->new_protection);
+	vm_map_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(4802, "mach_vm_protect")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_inherit_t__defined)
+#define __MIG_check__Request__mach_vm_inherit_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_inherit_t(__attribute__((__unused__)) __Request__mach_vm_inherit_t *In0P)
+{
+
+	typedef __Request__mach_vm_inherit_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_inherit_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_inherit */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_inherit
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, new_inheritance)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_inherit_t new_inheritance;
+{ return mach_vm_inherit(target_task, address, size, new_inheritance); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_inherit_t new_inheritance
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_inherit */
+mig_internal novalue _Xmach_vm_inherit
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_inherit_t new_inheritance;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_inherit_t __Request;
+	typedef __Reply__mach_vm_inherit_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_inherit_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_inherit_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(4803, "mach_vm_inherit")
+	__BeforeRcvRpc(4803, "mach_vm_inherit")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_inherit_t__defined)
+	check_result = __MIG_check__Request__mach_vm_inherit_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_inherit_t__defined) */
+
+	target_task = convert_port_entry_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_vm_inherit(target_task, In0P->address, In0P->size, In0P->new_inheritance);
+	vm_map_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(4803, "mach_vm_inherit")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_read_t__defined)
+#define __MIG_check__Request__mach_vm_read_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_read_t(__attribute__((__unused__)) __Request__mach_vm_read_t *In0P)
+{
+
+	typedef __Request__mach_vm_read_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_read_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_read */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_read
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, data, dataCnt)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_offset_t *data;
+	mach_msg_type_number_t *dataCnt;
+{ return mach_vm_read(target_task, address, size, data, dataCnt); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_offset_t *data,
+	mach_msg_type_number_t *dataCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_read */
+mig_internal novalue _Xmach_vm_read
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_read_t __Request;
+	typedef __Reply__mach_vm_read_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_read_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_read_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t dataTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t dataTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(4804, "mach_vm_read")
+	__BeforeRcvRpc(4804, "mach_vm_read")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_read_t__defined)
+	check_result = __MIG_check__Request__mach_vm_read_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_read_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->data = dataTemplate;
+#else	/* UseStaticTemplates */
+	OutP->data.deallocate =  FALSE;
+	OutP->data.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->data.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	RetCode = mach_vm_read(target_task, In0P->address, In0P->size, (vm_offset_t *)&(OutP->data.address), &OutP->dataCnt);
+	vm_map_deallocate(target_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->data.size = OutP->dataCnt;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(4804, "mach_vm_read")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_read_list_t__defined)
+#define __MIG_check__Request__mach_vm_read_list_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_read_list_t(__attribute__((__unused__)) __Request__mach_vm_read_list_t *In0P)
+{
+
+	typedef __Request__mach_vm_read_list_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_read_list_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_read_list */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_read_list
+#if	defined(LINTLIBRARY)
+    (target_task, data_list, count)
+	vm_map_t target_task;
+	mach_vm_read_entry_t data_list;
+	natural_t count;
+{ return mach_vm_read_list(target_task, data_list, count); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_read_entry_t data_list,
+	natural_t count
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_read_list */
+mig_internal novalue _Xmach_vm_read_list
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_read_entry_t data_list;
+		natural_t count;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_read_list_t __Request;
+	typedef __Reply__mach_vm_read_list_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_read_list_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_read_list_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(4805, "mach_vm_read_list")
+	__BeforeRcvRpc(4805, "mach_vm_read_list")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_read_list_t__defined)
+	check_result = __MIG_check__Request__mach_vm_read_list_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_read_list_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_vm_read_list(target_task, In0P->data_list, In0P->count);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	{   typedef struct { char data[4096]; } *sp;
+	    * (sp) OutP->data_list = * (sp) In0P->data_list;
+	}
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(4805, "mach_vm_read_list")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_write_t__defined)
+#define __MIG_check__Request__mach_vm_write_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_write_t(__attribute__((__unused__)) __Request__mach_vm_write_t *In0P)
+{
+
+	typedef __Request__mach_vm_write_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->data.type != MACH_MSG_OOL_DESCRIPTOR)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+#if __MigTypeCheck
+	if (In0P->data.size != In0P->dataCnt)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_write_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_write */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_write
+#if	defined(LINTLIBRARY)
+    (target_task, address, data, dataCnt)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	vm_offset_t data;
+	mach_msg_type_number_t dataCnt;
+{ return mach_vm_write(target_task, address, data, dataCnt); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	vm_offset_t data,
+	mach_msg_type_number_t dataCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_write */
+mig_internal novalue _Xmach_vm_write
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_msg_type_number_t dataCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_write_t __Request;
+	typedef __Reply__mach_vm_write_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_write_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_write_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(4806, "mach_vm_write")
+	__BeforeRcvRpc(4806, "mach_vm_write")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_write_t__defined)
+	check_result = __MIG_check__Request__mach_vm_write_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_write_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_vm_write(target_task, In0P->address, (vm_offset_t)(In0P->data.address), In0P->dataCnt);
+	vm_map_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(4806, "mach_vm_write")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_copy_t__defined)
+#define __MIG_check__Request__mach_vm_copy_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_copy_t(__attribute__((__unused__)) __Request__mach_vm_copy_t *In0P)
+{
+
+	typedef __Request__mach_vm_copy_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_copy_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_copy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_copy
+#if	defined(LINTLIBRARY)
+    (target_task, source_address, size, dest_address)
+	vm_map_t target_task;
+	mach_vm_address_t source_address;
+	mach_vm_size_t size;
+	mach_vm_address_t dest_address;
+{ return mach_vm_copy(target_task, source_address, size, dest_address); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t source_address,
+	mach_vm_size_t size,
+	mach_vm_address_t dest_address
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_copy */
+mig_internal novalue _Xmach_vm_copy
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t source_address;
+		mach_vm_size_t size;
+		mach_vm_address_t dest_address;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_copy_t __Request;
+	typedef __Reply__mach_vm_copy_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_copy_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_copy_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(4807, "mach_vm_copy")
+	__BeforeRcvRpc(4807, "mach_vm_copy")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_copy_t__defined)
+	check_result = __MIG_check__Request__mach_vm_copy_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_copy_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_vm_copy(target_task, In0P->source_address, In0P->size, In0P->dest_address);
+	vm_map_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(4807, "mach_vm_copy")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_read_overwrite_t__defined)
+#define __MIG_check__Request__mach_vm_read_overwrite_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_read_overwrite_t(__attribute__((__unused__)) __Request__mach_vm_read_overwrite_t *In0P)
+{
+
+	typedef __Request__mach_vm_read_overwrite_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_read_overwrite_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_read_overwrite */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_read_overwrite
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, data, outsize)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	mach_vm_address_t data;
+	mach_vm_size_t *outsize;
+{ return mach_vm_read_overwrite(target_task, address, size, data, outsize); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	mach_vm_address_t data,
+	mach_vm_size_t *outsize
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_read_overwrite */
+mig_internal novalue _Xmach_vm_read_overwrite
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		mach_vm_address_t data;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_read_overwrite_t __Request;
+	typedef __Reply__mach_vm_read_overwrite_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_read_overwrite_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_read_overwrite_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(4808, "mach_vm_read_overwrite")
+	__BeforeRcvRpc(4808, "mach_vm_read_overwrite")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_read_overwrite_t__defined)
+	check_result = __MIG_check__Request__mach_vm_read_overwrite_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_read_overwrite_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_vm_read_overwrite(target_task, In0P->address, In0P->size, In0P->data, &OutP->outsize);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(4808, "mach_vm_read_overwrite")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_msync_t__defined)
+#define __MIG_check__Request__mach_vm_msync_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_msync_t(__attribute__((__unused__)) __Request__mach_vm_msync_t *In0P)
+{
+
+	typedef __Request__mach_vm_msync_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_msync_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_msync */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_msync
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, sync_flags)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_sync_t sync_flags;
+{ return mach_vm_msync(target_task, address, size, sync_flags); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_sync_t sync_flags
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_msync */
+mig_internal novalue _Xmach_vm_msync
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_sync_t sync_flags;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_msync_t __Request;
+	typedef __Reply__mach_vm_msync_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_msync_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_msync_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(4809, "mach_vm_msync")
+	__BeforeRcvRpc(4809, "mach_vm_msync")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_msync_t__defined)
+	check_result = __MIG_check__Request__mach_vm_msync_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_msync_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_vm_msync(target_task, In0P->address, In0P->size, In0P->sync_flags);
+	vm_map_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(4809, "mach_vm_msync")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_behavior_set_t__defined)
+#define __MIG_check__Request__mach_vm_behavior_set_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_behavior_set_t(__attribute__((__unused__)) __Request__mach_vm_behavior_set_t *In0P)
+{
+
+	typedef __Request__mach_vm_behavior_set_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_behavior_set_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_behavior_set */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_behavior_set
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, new_behavior)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_behavior_t new_behavior;
+{ return mach_vm_behavior_set(target_task, address, size, new_behavior); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_behavior_t new_behavior
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_behavior_set */
+mig_internal novalue _Xmach_vm_behavior_set
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_behavior_t new_behavior;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_behavior_set_t __Request;
+	typedef __Reply__mach_vm_behavior_set_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_behavior_set_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_behavior_set_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(4810, "mach_vm_behavior_set")
+	__BeforeRcvRpc(4810, "mach_vm_behavior_set")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_behavior_set_t__defined)
+	check_result = __MIG_check__Request__mach_vm_behavior_set_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_behavior_set_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_vm_behavior_set(target_task, In0P->address, In0P->size, In0P->new_behavior);
+	vm_map_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(4810, "mach_vm_behavior_set")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_machine_attribute_t__defined)
+#define __MIG_check__Request__mach_vm_machine_attribute_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_machine_attribute_t(__attribute__((__unused__)) __Request__mach_vm_machine_attribute_t *In0P)
+{
+
+	typedef __Request__mach_vm_machine_attribute_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_machine_attribute_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_machine_attribute */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_machine_attribute
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, attribute, value)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_machine_attribute_t attribute;
+	vm_machine_attribute_val_t *value;
+{ return mach_vm_machine_attribute(target_task, address, size, attribute, value); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_machine_attribute_t attribute,
+	vm_machine_attribute_val_t *value
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_machine_attribute */
+mig_internal novalue _Xmach_vm_machine_attribute
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_machine_attribute_t attribute;
+		vm_machine_attribute_val_t value;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_machine_attribute_t __Request;
+	typedef __Reply__mach_vm_machine_attribute_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_machine_attribute_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_machine_attribute_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(4812, "mach_vm_machine_attribute")
+	__BeforeRcvRpc(4812, "mach_vm_machine_attribute")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_machine_attribute_t__defined)
+	check_result = __MIG_check__Request__mach_vm_machine_attribute_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_machine_attribute_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_vm_machine_attribute(target_task, In0P->address, In0P->size, In0P->attribute, &In0P->value);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->value = In0P->value;
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(4812, "mach_vm_machine_attribute")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_remap_t__defined)
+#define __MIG_check__Request__mach_vm_remap_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_remap_t(__attribute__((__unused__)) __Request__mach_vm_remap_t *In0P)
+{
+
+	typedef __Request__mach_vm_remap_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->src_task.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->src_task.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_remap_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_remap */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_remap
+#if	defined(LINTLIBRARY)
+    (target_task, target_address, size, mask, flags, src_task, src_address, copy, cur_protection, max_protection, inheritance)
+	vm_map_t target_task;
+	mach_vm_address_t *target_address;
+	mach_vm_size_t size;
+	mach_vm_offset_t mask;
+	int flags;
+	vm_map_t src_task;
+	mach_vm_address_t src_address;
+	boolean_t copy;
+	vm_prot_t *cur_protection;
+	vm_prot_t *max_protection;
+	vm_inherit_t inheritance;
+{ return mach_vm_remap(target_task, target_address, size, mask, flags, src_task, src_address, copy, cur_protection, max_protection, inheritance); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t *target_address,
+	mach_vm_size_t size,
+	mach_vm_offset_t mask,
+	int flags,
+	vm_map_t src_task,
+	mach_vm_address_t src_address,
+	boolean_t copy,
+	vm_prot_t *cur_protection,
+	vm_prot_t *max_protection,
+	vm_inherit_t inheritance
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_remap */
+mig_internal novalue _Xmach_vm_remap
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t src_task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t target_address;
+		mach_vm_size_t size;
+		mach_vm_offset_t mask;
+		int flags;
+		mach_vm_address_t src_address;
+		boolean_t copy;
+		vm_inherit_t inheritance;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_remap_t __Request;
+	typedef __Reply__mach_vm_remap_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_remap_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_remap_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+	vm_map_t src_task;
+
+	__DeclareRcvRpc(4813, "mach_vm_remap")
+	__BeforeRcvRpc(4813, "mach_vm_remap")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_remap_t__defined)
+	check_result = __MIG_check__Request__mach_vm_remap_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_remap_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	src_task = convert_port_to_map(In0P->src_task.name);
+
+	OutP->RetCode = mach_vm_remap(target_task, &In0P->target_address, In0P->size, In0P->mask, In0P->flags, src_task, In0P->src_address, In0P->copy, &OutP->cur_protection, &OutP->max_protection, In0P->inheritance);
+	vm_map_deallocate(src_task);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+
+	if (IP_VALID((ipc_port_t)In0P->src_task.name))
+		ipc_port_release_send((ipc_port_t)In0P->src_task.name);
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->target_address = In0P->target_address;
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(4813, "mach_vm_remap")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_page_query_t__defined)
+#define __MIG_check__Request__mach_vm_page_query_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_page_query_t(__attribute__((__unused__)) __Request__mach_vm_page_query_t *In0P)
+{
+
+	typedef __Request__mach_vm_page_query_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_page_query_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_page_query */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_page_query
+#if	defined(LINTLIBRARY)
+    (target_map, offset, disposition, ref_count)
+	vm_map_t target_map;
+	mach_vm_offset_t offset;
+	integer_t *disposition;
+	integer_t *ref_count;
+{ return mach_vm_page_query(target_map, offset, disposition, ref_count); }
+#else
+(
+	vm_map_t target_map,
+	mach_vm_offset_t offset,
+	integer_t *disposition,
+	integer_t *ref_count
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_page_query */
+mig_internal novalue _Xmach_vm_page_query
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_offset_t offset;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_page_query_t __Request;
+	typedef __Reply__mach_vm_page_query_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_page_query_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_page_query_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_map;
+
+	__DeclareRcvRpc(4814, "mach_vm_page_query")
+	__BeforeRcvRpc(4814, "mach_vm_page_query")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_page_query_t__defined)
+	check_result = __MIG_check__Request__mach_vm_page_query_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_page_query_t__defined) */
+
+	target_map = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_vm_page_query(target_map, In0P->offset, &OutP->disposition, &OutP->ref_count);
+	vm_map_deallocate(target_map);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(4814, "mach_vm_page_query")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_region_recurse_t__defined)
+#define __MIG_check__Request__mach_vm_region_recurse_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_region_recurse_t(__attribute__((__unused__)) __Request__mach_vm_region_recurse_t *In0P)
+{
+
+	typedef __Request__mach_vm_region_recurse_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_region_recurse_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_region_recurse */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_region_recurse
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, nesting_depth, info, infoCnt)
+	vm_map_t target_task;
+	mach_vm_address_t *address;
+	mach_vm_size_t *size;
+	natural_t *nesting_depth;
+	vm_region_recurse_info_t info;
+	mach_msg_type_number_t *infoCnt;
+{ return mach_vm_region_recurse(target_task, address, size, nesting_depth, info, infoCnt); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t *address,
+	mach_vm_size_t *size,
+	natural_t *nesting_depth,
+	vm_region_recurse_info_t info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_region_recurse */
+mig_internal novalue _Xmach_vm_region_recurse
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_region_recurse_t __Request;
+	typedef __Reply__mach_vm_region_recurse_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_region_recurse_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_region_recurse_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(4815, "mach_vm_region_recurse")
+	__BeforeRcvRpc(4815, "mach_vm_region_recurse")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_region_recurse_t__defined)
+	check_result = __MIG_check__Request__mach_vm_region_recurse_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_region_recurse_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->infoCnt = 19;
+	if (In0P->infoCnt < OutP->infoCnt)
+		OutP->infoCnt = In0P->infoCnt;
+
+	OutP->RetCode = mach_vm_region_recurse(target_task, &In0P->address, &OutP->size, &In0P->nesting_depth, OutP->info, &OutP->infoCnt);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->address = In0P->address;
+
+	OutP->nesting_depth = In0P->nesting_depth;
+	OutP->Head.msgh_size = (sizeof(Reply) - 76) + (_WALIGN_((4 * OutP->infoCnt)));
+
+	__AfterRcvRpc(4815, "mach_vm_region_recurse")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_region_t__defined)
+#define __MIG_check__Request__mach_vm_region_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_region_t(__attribute__((__unused__)) __Request__mach_vm_region_t *In0P)
+{
+
+	typedef __Request__mach_vm_region_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_region_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_region */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_region
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, flavor, info, infoCnt, object_name)
+	vm_map_t target_task;
+	mach_vm_address_t *address;
+	mach_vm_size_t *size;
+	vm_region_flavor_t flavor;
+	vm_region_info_t info;
+	mach_msg_type_number_t *infoCnt;
+	mach_port_t *object_name;
+{ return mach_vm_region(target_task, address, size, flavor, info, infoCnt, object_name); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t *address,
+	mach_vm_size_t *size,
+	vm_region_flavor_t flavor,
+	vm_region_info_t info,
+	mach_msg_type_number_t *infoCnt,
+	mach_port_t *object_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_region */
+mig_internal novalue _Xmach_vm_region
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		vm_region_flavor_t flavor;
+		mach_msg_type_number_t infoCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_region_t __Request;
+	typedef __Reply__mach_vm_region_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_region_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_region_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t object_nameTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t object_nameTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(4816, "mach_vm_region")
+	__BeforeRcvRpc(4816, "mach_vm_region")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_region_t__defined)
+	check_result = __MIG_check__Request__mach_vm_region_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_region_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->object_name = object_nameTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->object_name.disposition = 17;
+#else
+	OutP->object_name.disposition = 17;
+#endif /* __MigKernelSpecificCode */
+	OutP->object_name.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->infoCnt = 10;
+	if (In0P->infoCnt < OutP->infoCnt)
+		OutP->infoCnt = In0P->infoCnt;
+
+	RetCode = mach_vm_region(target_task, &In0P->address, &OutP->size, In0P->flavor, OutP->info, &OutP->infoCnt, &OutP->object_name.name);
+	vm_map_deallocate(target_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->address = In0P->address;
+	OutP->Head.msgh_size = (sizeof(Reply) - 40) + (_WALIGN_((4 * OutP->infoCnt)));
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(4816, "mach_vm_region")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request___mach_make_memory_entry_t__defined)
+#define __MIG_check__Request___mach_make_memory_entry_t__defined
+
+mig_internal kern_return_t __MIG_check__Request___mach_make_memory_entry_t(__attribute__((__unused__)) __Request___mach_make_memory_entry_t *In0P)
+{
+
+	typedef __Request___mach_make_memory_entry_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->parent_handle.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->parent_handle.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request___mach_make_memory_entry_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine _mach_make_memory_entry */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t _mach_make_memory_entry
+#if	defined(LINTLIBRARY)
+    (target_task, size, offset, permission, object_handle, parent_handle)
+	vm_map_t target_task;
+	memory_object_size_t *size;
+	memory_object_offset_t offset;
+	vm_prot_t permission;
+	mem_entry_name_port_t *object_handle;
+	mem_entry_name_port_t parent_handle;
+{ return _mach_make_memory_entry(target_task, size, offset, permission, object_handle, parent_handle); }
+#else
+(
+	vm_map_t target_task,
+	memory_object_size_t *size,
+	memory_object_offset_t offset,
+	vm_prot_t permission,
+	mem_entry_name_port_t *object_handle,
+	mem_entry_name_port_t parent_handle
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine _mach_make_memory_entry */
+mig_internal novalue _X_mach_make_memory_entry
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t parent_handle;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		memory_object_size_t size;
+		memory_object_offset_t offset;
+		vm_prot_t permission;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request___mach_make_memory_entry_t __Request;
+	typedef __Reply___mach_make_memory_entry_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request___mach_make_memory_entry_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request___mach_make_memory_entry_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t object_handleTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t object_handleTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	vm_map_t target_task;
+	mem_entry_name_port_t object_handle;
+
+	__DeclareRcvRpc(4817, "_mach_make_memory_entry")
+	__BeforeRcvRpc(4817, "_mach_make_memory_entry")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request___mach_make_memory_entry_t__defined)
+	check_result = __MIG_check__Request___mach_make_memory_entry_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request___mach_make_memory_entry_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->object_handle = object_handleTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->object_handle.disposition = 17;
+#else
+	OutP->object_handle.disposition = 17;
+#endif /* __MigKernelSpecificCode */
+	OutP->object_handle.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	RetCode = _mach_make_memory_entry(target_task, &In0P->size, In0P->offset, In0P->permission, &object_handle, null_conversion(In0P->parent_handle.name));
+	vm_map_deallocate(target_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+
+	if (IP_VALID((ipc_port_t)In0P->parent_handle.name))
+		ipc_port_release_send((ipc_port_t)In0P->parent_handle.name);
+#endif /* __MigKernelSpecificCode */
+	OutP->object_handle.name = (mach_port_t)null_conversion(object_handle);
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->size = In0P->size;
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(4817, "_mach_make_memory_entry")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_purgable_control_t__defined)
+#define __MIG_check__Request__mach_vm_purgable_control_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_purgable_control_t(__attribute__((__unused__)) __Request__mach_vm_purgable_control_t *In0P)
+{
+
+	typedef __Request__mach_vm_purgable_control_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_purgable_control_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_purgable_control */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_purgable_control
+#if	defined(LINTLIBRARY)
+    (target_task, address, control, state)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	vm_purgable_t control;
+	int *state;
+{ return mach_vm_purgable_control(target_task, address, control, state); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	vm_purgable_t control,
+	int *state
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_purgable_control */
+mig_internal novalue _Xmach_vm_purgable_control
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		vm_purgable_t control;
+		int state;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_purgable_control_t __Request;
+	typedef __Reply__mach_vm_purgable_control_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_purgable_control_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_purgable_control_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(4818, "mach_vm_purgable_control")
+	__BeforeRcvRpc(4818, "mach_vm_purgable_control")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_purgable_control_t__defined)
+	check_result = __MIG_check__Request__mach_vm_purgable_control_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_purgable_control_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_vm_purgable_control(target_task, In0P->address, In0P->control, &In0P->state);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->state = In0P->state;
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(4818, "mach_vm_purgable_control")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__mach_vm_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_page_info_t__defined)
+#define __MIG_check__Request__mach_vm_page_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_page_info_t(__attribute__((__unused__)) __Request__mach_vm_page_info_t *In0P)
+{
+
+	typedef __Request__mach_vm_page_info_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_page_info_t__defined) */
+#endif /* __MIG_check__Request__mach_vm_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_page_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_page_info
+#if	defined(LINTLIBRARY)
+    (target_task, address, flavor, info, infoCnt)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	vm_page_info_flavor_t flavor;
+	vm_page_info_t info;
+	mach_msg_type_number_t *infoCnt;
+{ return mach_vm_page_info(target_task, address, flavor, info, infoCnt); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	vm_page_info_flavor_t flavor,
+	vm_page_info_t info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_page_info */
+mig_internal novalue _Xmach_vm_page_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		vm_page_info_flavor_t flavor;
+		mach_msg_type_number_t infoCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_page_info_t __Request;
+	typedef __Reply__mach_vm_page_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_page_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_page_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(4819, "mach_vm_page_info")
+	__BeforeRcvRpc(4819, "mach_vm_page_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_page_info_t__defined)
+	check_result = __MIG_check__Request__mach_vm_page_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_page_info_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->infoCnt = 32;
+	if (In0P->infoCnt < OutP->infoCnt)
+		OutP->infoCnt = In0P->infoCnt;
+
+	OutP->RetCode = mach_vm_page_info(target_task, In0P->address, In0P->flavor, OutP->info, &OutP->infoCnt);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+	OutP->Head.msgh_size = (sizeof(Reply) - 128) + (_WALIGN_((4 * OutP->infoCnt)));
+
+	__AfterRcvRpc(4819, "mach_vm_page_info")
+}
+
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+boolean_t mach_vm_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+mig_routine_t mach_vm_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+extern const struct mach_vm_subsystem mach_vm_subsystem;
+const struct mach_vm_subsystem {
+	mig_server_routine_t 	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[20];
+} mach_vm_subsystem = {
+	mach_vm_server_routine,
+	4800,
+	4820,
+	(mach_msg_size_t)sizeof(union __ReplyUnion__mach_vm_subsystem),
+	(vm_address_t)0,
+	{
+		{0, 0, 0, 0, 0, 0},
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_protect, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_protect_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_inherit, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_inherit_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_read, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_read_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_read_list, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_read_list_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_write, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_write_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_copy, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_copy_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_read_overwrite, 8, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_read_overwrite_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_msync, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_msync_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_behavior_set, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_behavior_set_t) },
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_machine_attribute, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_machine_attribute_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_remap, 14, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_remap_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_page_query, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_page_query_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_region_recurse, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_region_recurse_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_region, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_region_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _X_mach_make_memory_entry, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply___mach_make_memory_entry_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_purgable_control, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_purgable_control_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_page_info, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_page_info_t) },
+	}
+};
+
+mig_external boolean_t mach_vm_server
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	register mig_routine_t routine;
+
+	OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0);
+	OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port;
+	/* Minimal size: routine() will update it if different */
+	OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t);
+	OutHeadP->msgh_local_port = MACH_PORT_NULL;
+	OutHeadP->msgh_id = InHeadP->msgh_id + 100;
+
+	if ((InHeadP->msgh_id > 4819) || (InHeadP->msgh_id < 4800) ||
+	    ((routine = mach_vm_subsystem.routine[InHeadP->msgh_id - 4800].stub_routine) == 0)) {
+		((mig_reply_error_t *)OutHeadP)->NDR = NDR_record;
+		((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID;
+		return FALSE;
+	}
+	(*routine) (InHeadP, OutHeadP);
+	return TRUE;
+}
+
+mig_external mig_routine_t mach_vm_server_routine
+	(mach_msg_header_t *InHeadP)
+{
+	register int msgh_id;
+
+	msgh_id = InHeadP->msgh_id - 4800;
+
+	if ((msgh_id > 19) || (msgh_id < 0))
+		return 0;
+
+	return mach_vm_subsystem.routine[msgh_id].stub_routine;
+}


Property changes on: trunk/sys/compat/mach/mach_vm_server.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/proc_info.c
===================================================================
--- trunk/sys/compat/mach/proc_info.c	                        (rev 0)
+++ trunk/sys/compat/mach/proc_info.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,491 @@
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/filedesc.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/mutex.h>
+#include <sys/priv.h>
+#include <sys/proc.h>
+//TODO: LAH include <sys/procctl.h>
+#include <sys/ptrace.h>
+#include <sys/rwlock.h>
+#include <sys/syscallsubr.h>
+#include <sys/sysent.h>
+#include <sys/sysproto.h>
+#include <sys/vnode.h>
+#include <sys/sx.h>
+#include <sys/signalvar.h>
+#include <sys/tty.h>
+
+#include <vm/vm.h>
+#include <vm/pmap.h>
+#include <vm/vm_extern.h>
+#include <vm/vm_map.h>
+#include <vm/vm_kern.h>
+#include <vm/vm_object.h>
+#include <vm/vm_page.h>
+#include <vm/vm_param.h>
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/thread.h>
+#define PRIVATE
+#include <sys/proc_info.h>
+
+
+int set_security_token(task_t);
+
+
+static int
+proc_terminate(int pid)
+{
+	int err;
+	struct proc *p;
+
+	err = 0;
+	if (pid <= 0)
+		return (EINVAL);
+	if (pid == curproc->p_pid)
+		return (EPERM);
+	if ((p = pfind(pid)) == NULL)
+		return (ESRCH);
+	if ((err = p_cansignal(curthread, p, SIGKILL)) == 0) {
+		/* p_cansignal returns 0 if you can, or an error if you can't. */
+		kern_psignal(p, SIGTERM);
+	}
+	PROC_UNLOCK(p);
+	return (err);
+}
+
+static int
+proc_listpids(uint32_t type, uint32_t flavor, void *ubuffer, uint32_t buffersize)
+{
+	struct proc *p;
+	struct proclist *list;
+	struct pgrp *pgrpp;	
+	int err, count, incr, maxpidcount, numpids;
+	pid_t *buf, *ptr;
+	uid_t uid;
+	struct thread *td;
+
+	if (type == PROC_TTY_ONLY)
+		return (EINVAL);
+
+	td = curthread;
+	if (ubuffer == NULL) {
+		td->td_retval[0] = (nprocs + 30)*sizeof(pid_t);
+		return (0);
+	}	
+	if (buffersize < sizeof(pid_t))
+		return (ENOMEM);
+
+	maxpidcount = buffersize/sizeof(pid_t);
+	numpids = nprocs + 30;
+	err = count = 0;
+	if (numpids > maxpidcount)
+		numpids = maxpidcount;
+
+	buf = malloc(numpids *sizeof(pid_t), M_DEVBUF, M_WAITOK);
+
+	ptr = buf;
+	if (type == PROC_PGRP_ONLY) {
+		count = 0;
+		pgrpp = pgfind(flavor);
+		if (pgrpp == NULL)
+			return (ENOENT);
+		list = (struct proclist *)&pgrpp->pg_members;
+		LIST_FOREACH(p, list, p_pglist) {
+			if (count == numpids)
+				break;
+			*ptr++ = p->p_pid;
+			count++;
+		}
+		PGRP_UNLOCK(pgrpp);
+		goto done;
+	}
+
+	list = &allproc;
+	sx_slock(&allproc_lock);
+scan_next:	
+	LIST_FOREACH(p, list, p_list) {
+		incr = 0;
+		switch (type) {
+		case PROC_ALL_PIDS:
+			incr = 1;
+			break;
+		case PROC_PPID_ONLY:
+			if (((p->p_pptr && (p->p_pptr->p_pid == flavor)) &&
+				 ((p->p_flag & P_TRACED) == 0)) ||
+				p->p_oppid == flavor)
+				incr = 1;
+			break;
+		case PROC_UID_ONLY:
+			if (p->p_ucred != NULL) {
+				uid = p->p_ucred->cr_uid;
+				if (uid == flavor)
+					incr = 1;
+			}
+			break;
+		case PROC_RUID_ONLY:
+			if (p->p_ucred != NULL) {
+				uid = p->p_ucred->cr_ruid;
+				if (uid == flavor)
+					incr = 1;
+			}
+			break;
+		default:
+			err = EINVAL;
+			goto done;
+		}
+		if (incr) {
+			*ptr++ = p->p_pid;
+			count++;
+		}
+		if (count >= numpids)
+			break;
+	}
+	if ((count < numpids) && (list == &allproc)) {
+		list = &zombproc;
+		goto scan_next;
+	}
+done:
+	sx_sunlock(&allproc_lock);
+	if (err)
+		return (err);
+
+	err = copyout(buf, ubuffer, count * sizeof(pid_t));
+	if (err == 0)
+		td->td_retval[0] = count * sizeof(pid_t);
+	free(buf, M_DEVBUF);
+
+	return (err);
+}
+
+static int
+proc_pidbsdinfo(struct proc *p, struct proc_bsdinfo * pbsd, int zombie)
+{
+	register struct tty *tp;
+	struct  session *sessionp = NULL;
+	struct pgrp * pg;
+	struct ucred *cred;
+
+	pg = p->p_pgrp;
+	if (pg)
+		sessionp = pg->pg_session;
+
+	bzero(pbsd, sizeof(struct proc_bsdinfo));
+	pbsd->pbi_status = p->p_state;
+	pbsd->pbi_xstatus = p->p_xstat;
+	pbsd->pbi_pid = p->p_pid;
+	if (p->p_pptr)
+		pbsd->pbi_ppid = p->p_pptr->p_pid;
+	crhold(p->p_ucred);
+	cred = p->p_ucred;
+	pbsd->pbi_uid = cred->cr_uid;
+	pbsd->pbi_gid = cred->cr_gid;
+	pbsd->pbi_ruid =  cred->cr_ruid;
+	pbsd->pbi_rgid = cred->cr_rgid;
+	pbsd->pbi_svuid =  cred->cr_svuid;
+	pbsd->pbi_svgid = cred->cr_svgid;
+	crfree(cred);
+	
+	pbsd->pbi_nice = p->p_nice;
+#ifdef notyet	
+	pbsd->pbi_start_tvsec = p->p_start.tv_sec;
+	pbsd->pbi_start_tvusec = p->p_start.tv_usec;
+#endif	
+	bcopy(&p->p_comm, &pbsd->pbi_comm[0], MAXCOMLEN);
+	pbsd->pbi_comm[MAXCOMLEN - 1] = '\0';
+	pbsd->pbi_flags = 0;	
+	if ((p->p_flag & P_SYSTEM) == P_SYSTEM) 
+		pbsd->pbi_flags |= PROC_FLAG_SYSTEM;
+	if ((p->p_flag & P_TRACED) == P_TRACED)
+		pbsd->pbi_flags |= PROC_FLAG_TRACED;
+	if ((p->p_flag & P_WEXIT) == P_WEXIT) 
+		pbsd->pbi_flags |= PROC_FLAG_INEXIT;
+	if ((p->p_flag & P_PPWAIT) == P_PPWAIT) 
+		pbsd->pbi_flags |= PROC_FLAG_PPWAIT;
+#ifdef notyet	
+	if ((p->p_flag & P_LP64) == P_LP64)
+#endif
+#ifdef __LP64__		
+		pbsd->pbi_flags |= PROC_FLAG_LP64;
+#endif	
+	if ((p->p_flag & P_CONTROLT) == P_CONTROLT) 
+		pbsd->pbi_flags |= PROC_FLAG_CONTROLT;
+	if ((p->p_flag & P_SUGID) == P_SUGID) 
+		pbsd->pbi_flags |= PROC_FLAG_PSUGID;
+	if ((p->p_flag & P_EXEC) == P_EXEC) 
+		pbsd->pbi_flags |= PROC_FLAG_EXEC;
+
+	if (sessionp != NULL) {
+		if (p == sessionp->s_leader)
+			pbsd->pbi_flags |= PROC_FLAG_SLEADER;
+		if (sessionp->s_ttyvp)
+			pbsd->pbi_flags |= PROC_FLAG_CTTY;
+	}
+		
+	if (zombie == 0)
+		pbsd->pbi_nfiles = p->p_fd->fd_nfiles;
+	
+	pbsd->e_tdev = NODEV;
+	if (pg != NULL) {
+		pbsd->pbi_pgid = pg->pg_id;
+		pbsd->pbi_pjobc = pg->pg_jobc;
+		if ((p->p_flag & P_CONTROLT) && (sessionp != NULL) && (tp = sessionp->s_ttyp)) {
+#ifdef notyet
+			pbsd->e_tdev = tp->t_dev;
+#endif
+			if (tp->t_pgrp)
+				pbsd->e_tpgid = tp->t_pgrp->pg_id;
+		}
+	} 
+	return(0);
+}
+
+static int
+proc_pidshortbsdinfo(struct proc *p, struct proc_bsdshortinfo * pbsd_shortp, int zombie)
+{
+	struct ucred *cred;
+	
+	bzero(pbsd_shortp, sizeof(struct proc_bsdshortinfo));
+	pbsd_shortp->pbsi_pid = p->p_pid;
+	if (p->p_pptr)
+		pbsd_shortp->pbsi_ppid = p->p_pptr->p_pid;
+	if (p->p_pgrp)
+	pbsd_shortp->pbsi_pgid = p->p_pgrp->pg_id;
+	pbsd_shortp->pbsi_status = p->p_state;
+	bcopy(&p->p_comm, &pbsd_shortp->pbsi_comm[0], MAXCOMLEN);
+	pbsd_shortp->pbsi_comm[MAXCOMLEN - 1] = '\0';
+
+	pbsd_shortp->pbsi_flags = 0;	
+	if ((p->p_flag & P_SYSTEM) == P_SYSTEM) 
+		pbsd_shortp->pbsi_flags |= PROC_FLAG_SYSTEM;
+	if ((p->p_flag & P_TRACED) == P_TRACED)
+		pbsd_shortp->pbsi_flags |= PROC_FLAG_TRACED;
+	if ((p->p_flag & P_WEXIT) == P_WEXIT) 
+		pbsd_shortp->pbsi_flags |= PROC_FLAG_INEXIT;
+	if ((p->p_flag & P_PPWAIT) == P_PPWAIT) 
+		pbsd_shortp->pbsi_flags |= PROC_FLAG_PPWAIT;
+#ifdef notyet
+	if ((p->p_flag & P_LP64) == P_LP64)
+#endif		
+#ifdef __LP64__
+		pbsd_shortp->pbsi_flags |= PROC_FLAG_LP64;
+#endif	
+	if ((p->p_flag & P_CONTROLT) == P_CONTROLT) 
+		pbsd_shortp->pbsi_flags |= PROC_FLAG_CONTROLT;
+	if ((p->p_flag & P_SUGID) == P_SUGID) 
+		pbsd_shortp->pbsi_flags |= PROC_FLAG_PSUGID;
+	if ((p->p_flag & P_EXEC) == P_EXEC) 
+		pbsd_shortp->pbsi_flags |= PROC_FLAG_EXEC;
+
+	crhold(p->p_ucred);
+	cred = p->p_ucred;
+	pbsd_shortp->pbsi_uid = cred->cr_uid;
+	pbsd_shortp->pbsi_gid = cred->cr_gid;
+	pbsd_shortp->pbsi_ruid =  cred->cr_ruid;
+	pbsd_shortp->pbsi_rgid = cred->cr_rgid;
+	pbsd_shortp->pbsi_svuid =  cred->cr_svuid;
+	pbsd_shortp->pbsi_svgid = cred->cr_svgid;
+	crfree(cred);
+	
+	return(0);
+}
+
+static uint64_t
+proc_puniqueid(struct proc *p)
+{
+	task_t task;
+	
+	task = p->p_machdata;
+	return (task->itk_puniqueid);
+}
+
+static uint64_t
+proc_uniqueid(struct proc *p)
+{
+	task_t task;
+
+	task = p->p_machdata;
+	return (task->itk_uniqueid);
+}
+
+static void
+proc_getexecutableuuid(struct proc *p __unused, unsigned char *uuid, int size)
+{
+
+	bzero(uuid, size);
+}
+
+static void
+proc_piduniqidentifierinfo(struct proc *p, struct proc_uniqidentifierinfo *p_uniqidinfo)
+{
+	p_uniqidinfo->p_uniqueid = proc_uniqueid(p);
+	proc_getexecutableuuid(p, (unsigned char *)&p_uniqidinfo->p_uuid, sizeof(p_uniqidinfo->p_uuid));
+	p_uniqidinfo->p_puniqueid = proc_puniqueid(p);
+	p_uniqidinfo->p_reserve2 = 0;
+	p_uniqidinfo->p_reserve3 = 0;
+	p_uniqidinfo->p_reserve4 = 0;
+}
+
+static int
+proc_pidinfo(int pid, int flavor, uint64_t arg, void *buffer, uint32_t  buffersize)
+{
+	struct proc *p;
+	int err, size, findzomb, iszomb, shortversion, uniqidversion;
+	void *kbuf;
+	
+	switch (flavor) {
+	case PROC_PIDTBSDINFO:
+		size = PROC_PIDTBSDINFO_SIZE;
+		break;
+	case PROC_PIDT_SHORTBSDINFO:
+		size = PROC_PIDT_SHORTBSDINFO_SIZE;
+		break;
+	case PROC_PIDUNIQIDENTIFIERINFO:
+		size = PROC_PIDUNIQIDENTIFIERINFO_SIZE;
+		break;
+	case PROC_PIDT_BSDINFOWITHUNIQID:
+		size = PROC_PIDT_BSDINFOWITHUNIQID_SIZE;
+		break;
+	default:
+		return (EINVAL);
+	}
+
+	if (buffersize < size)
+		return (ENOMEM);
+
+	kbuf = malloc(size, M_DEVBUF, M_WAITOK);
+	uniqidversion = shortversion = err = findzomb = iszomb = 0;
+	if ((flavor == PROC_PIDTBSDINFO) || (flavor == PROC_PIDT_SHORTBSDINFO) || (flavor == PROC_PIDT_BSDINFOWITHUNIQID) 
+	    || (flavor == PROC_PIDUNIQIDENTIFIERINFO)) {
+		if (arg)
+			findzomb = 1;
+	}
+	if ((p = pfind(pid)) == NULL) {
+		if (!findzomb || ((p = zpfind(pid)) == NULL)) {
+			err = ESRCH;
+			goto done;
+		}
+		iszomb = 1;
+	}
+
+	switch (flavor) {
+	case PROC_PIDUNIQIDENTIFIERINFO: {
+		struct proc_uniqidentifierinfo p_uniqidinfo;
+		
+		proc_piduniqidentifierinfo(p, &p_uniqidinfo);
+		bcopy(&p_uniqidinfo, kbuf, sizeof(struct proc_uniqidentifierinfo));
+	}
+		break;
+	case PROC_PIDT_SHORTBSDINFO:
+		shortversion = 1;
+	case PROC_PIDT_BSDINFOWITHUNIQID: 
+	case PROC_PIDTBSDINFO: {
+		struct proc_bsdinfo pbsd;
+		struct proc_bsdshortinfo pbsd_short;
+		struct proc_bsdinfowithuniqid pbsd_uniqid;
+		
+		if (flavor == PROC_PIDT_BSDINFOWITHUNIQID)
+			uniqidversion = 1;
+			
+		if (shortversion != 0) {
+			err = proc_pidshortbsdinfo(p, &pbsd_short, iszomb);
+		} else {
+			err = proc_pidbsdinfo(p, &pbsd, iszomb);
+			if (uniqidversion != 0) { 
+				proc_piduniqidentifierinfo(p, &pbsd_uniqid.p_uniqidentifier);
+				pbsd_uniqid.pbsd = pbsd;
+			}
+		}
+		
+		if (err == 0) {
+			if (shortversion != 0) {
+				bcopy(&pbsd_short, kbuf, sizeof(struct proc_bsdshortinfo));
+			} else if (uniqidversion != 0) {
+				bcopy(&pbsd_uniqid, kbuf, sizeof(struct proc_bsdinfowithuniqid));
+			} else {
+				bcopy(&pbsd, kbuf, sizeof(struct proc_bsdinfo));
+			}
+		}	
+	}
+		break;
+	default:
+		err = ENOTSUP;
+	}
+	PROC_UNLOCK(p);
+	if (err == 0)
+		err = copyout(kbuf, buffer, size);
+	if (err == 0)
+		curthread->td_retval[0] = size;
+done:
+	free(kbuf, M_DEVBUF);
+	return (err);
+}
+
+static int
+proc_info(int op, pid_t pid, uint32_t flavor, uint64_t arg, void *addr,
+		  uint32_t buffersize)
+{
+
+	switch (op) {
+	case PROC_INFO_CALL_LISTPIDS:
+		return (proc_listpids(pid, flavor, addr, buffersize));
+		break;
+	case PROC_INFO_CALL_TERMINATE:
+		return (proc_terminate(pid));
+		break;
+	case PROC_INFO_CALL_PIDINFO:
+		return (proc_pidinfo(pid, flavor, arg, addr, buffersize));
+		break;
+	default:
+		return (EOPNOTSUPP);
+	}
+	/* NOT REACHED */
+	return (0);
+}
+
+int
+set_security_token(task_t task)
+{
+	struct proc *p;
+	security_token_t sec_token;
+	audit_token_t audit_token;
+
+	p = task->itk_p;
+
+	sec_token.val[0] = sec_token.val[1] = 0;
+	audit_token.val[0] = 0; /* wat: p->p_ucred->cr_au.ai_auid; */
+	audit_token.val[1] = p->p_ucred->cr_uid;
+	audit_token.val[2] = p->p_ucred->cr_gid;
+	audit_token.val[3] = p->p_ucred->cr_ruid;
+	audit_token.val[4] = p->p_ucred->cr_rgid;
+	audit_token.val[5] = p->p_pid;
+	audit_token.val[6] = 0; /* wat: p->p_ucred->cr_au.ai_asid; */
+	audit_token.val[7] = 0; /* wat: p->p_ucred->cr_au.ai_termid.port; */
+
+	task->audit_token = audit_token;
+	task->sec_token = sec_token;
+
+	return (0);
+}
+
+int
+sys___proc_info(struct thread *td __unused, struct __proc_info_args *uap)
+{
+
+	return (proc_info(uap->callnum, uap->pid, uap->flavor, uap->arg, uap->buffer,
+					  uap->buffersize));
+}
+
+
+int
+sys___iopolicysys(struct thread *td __unused, struct __iopolicysys_args *uap __unused)
+{
+ 
+	return (ENOSYS);
+}


Property changes on: trunk/sys/compat/mach/proc_info.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/task_server.c
===================================================================
--- trunk/sys/compat/mach/task_server.c	                        (rev 0)
+++ trunk/sys/compat/mach/task_server.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,6376 @@
+/*
+ * IDENTIFICATION:
+ * stub generated Thu Jun 11 18:17:45 2015
+ * with a MiG generated Thu Jun 11 16:16:11 PDT 2015 by kmacy at serenity
+ * OPTIONS: 
+ *	KernelServer
+ */
+
+/* Module task */
+
+#define	__MIG_check__Request__task_subsystem__ 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#ifdef _KERNEL
+#include <sys/mach/ndr.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#else /* !_KERNEL */
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#endif /*_KERNEL */
+
+#include <sys/mach/std_types.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc_mig.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach_debug/mach_debug_types.h>
+#include <sys/mach/task.h>
+
+#ifndef	mig_internal
+#define	mig_internal	static __inline__
+#endif	/* mig_internal */
+
+#ifndef	mig_external
+#define mig_external
+#endif	/* mig_external */
+
+#if	!defined(__MigTypeCheck) && defined(TypeCheck)
+#define	__MigTypeCheck		TypeCheck	/* Legacy setting */
+#endif	/* !defined(__MigTypeCheck) */
+
+#if	!defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
+#define	__MigKernelSpecificCode	_MIG_KERNEL_SPECIFIC_CODE_	/* Legacy setting */
+#endif	/* !defined(__MigKernelSpecificCode) */
+
+#ifndef	LimitCheck
+#define	LimitCheck 0
+#endif	/* LimitCheck */
+
+#ifndef	min
+#define	min(a,b)  ( ((a) < (b))? (a): (b) )
+#endif	/* min */
+
+#if !defined(_WALIGN_)
+#define _WALIGN_(x) (((x) + 7) & ~7)
+#endif /* !defined(_WALIGN_) */
+
+#if !defined(_WALIGNSZ_)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#endif /* !defined(_WALIGNSZ_) */
+
+#ifndef	UseStaticTemplates
+#define	UseStaticTemplates	1
+#endif	/* UseStaticTemplates */
+
+#define _WALIGN_(x) (((x) + 7) & ~7)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#ifndef	__DeclareRcvRpc
+#define	__DeclareRcvRpc(_NUM_, _NAME_)
+#endif	/* __DeclareRcvRpc */
+
+#ifndef	__BeforeRcvRpc
+#define	__BeforeRcvRpc(_NUM_, _NAME_)
+#endif	/* __BeforeRcvRpc */
+
+#ifndef	__AfterRcvRpc
+#define	__AfterRcvRpc(_NUM_, _NAME_)
+#endif	/* __AfterRcvRpc */
+
+#ifndef	__DeclareRcvSimple
+#define	__DeclareRcvSimple(_NUM_, _NAME_)
+#endif	/* __DeclareRcvSimple */
+
+#ifndef	__BeforeRcvSimple
+#define	__BeforeRcvSimple(_NUM_, _NAME_)
+#endif	/* __BeforeRcvSimple */
+
+#ifndef	__AfterRcvSimple
+#define	__AfterRcvSimple(_NUM_, _NAME_)
+#endif	/* __AfterRcvSimple */
+
+#define novalue void
+#if	__MigKernelSpecificCode
+#define msgh_request_port	msgh_remote_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_REMOTE(bits)
+#define msgh_reply_port		msgh_local_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#else
+#define msgh_request_port	msgh_local_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#define msgh_reply_port		msgh_remote_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_REMOTE(bits)
+#endif /* __MigKernelSpecificCode */
+
+#define MIG_RETURN_ERROR(X, code)	{\
+				((mig_reply_error_t *)X)->RetCode = code;\
+				((mig_reply_error_t *)X)->NDR = NDR_record;\
+				return;\
+				}
+
+/* typedefs for all requests */
+
+#ifndef __Request__task_subsystem__defined
+#define __Request__task_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_ports_descriptor_t ledgers;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t ledgersCnt;
+		boolean_t inherit_memory;
+	} __Request__task_create_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_terminate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_threads_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_ports_descriptor_t init_port_set;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t init_port_setCnt;
+	} __Request__mach_ports_register_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__mach_ports_lookup_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		task_flavor_t flavor;
+		mach_msg_type_number_t task_info_outCnt;
+	} __Request__task_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		task_flavor_t flavor;
+		mach_msg_type_number_t task_info_inCnt;
+		integer_t task_info_in[52];
+	} __Request__task_set_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_suspend_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_resume_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int which_port;
+	} __Request__task_get_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t special_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int which_port;
+	} __Request__task_set_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__thread_create_from_user_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		thread_state_flavor_t flavor;
+		mach_msg_type_number_t new_stateCnt;
+		natural_t new_state[32];
+	} __Request__thread_create_running_from_user_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+		exception_behavior_t behavior;
+		thread_state_flavor_t new_flavor;
+	} __Request__task_set_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+	} __Request__task_get_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+		exception_behavior_t behavior;
+		thread_state_flavor_t new_flavor;
+	} __Request__task_swap_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int policy;
+		int value;
+	} __Request__semaphore_create_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t semaphore;
+		/* end of the kernel processed data */
+	} __Request__semaphore_destroy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		task_policy_flavor_t flavor;
+		mach_msg_type_number_t policy_infoCnt;
+		integer_t policy_info[16];
+	} __Request__task_policy_set_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		task_policy_flavor_t flavor;
+		mach_msg_type_number_t policy_infoCnt;
+		boolean_t get_default;
+	} __Request__task_policy_get_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		policy_t policy;
+		mach_msg_type_number_t baseCnt;
+		integer_t base[5];
+		boolean_t set_limit;
+		boolean_t change;
+	} __Request__task_policy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t basepc;
+		vm_address_t boundspc;
+	} __Request__task_set_ras_pc_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_zone_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_set;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t assign_threads;
+	} __Request__task_assign_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t assign_threads;
+	} __Request__task_assign_default_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_get_assignment_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t pset;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		policy_t policy;
+		mach_msg_type_number_t baseCnt;
+		integer_t base[5];
+		mach_msg_type_number_t limitCnt;
+		integer_t limit[1];
+		boolean_t change;
+	} __Request__task_set_policy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		thread_state_flavor_t flavor;
+		mach_msg_type_number_t old_stateCnt;
+	} __Request__task_get_state_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		thread_state_flavor_t flavor;
+		mach_msg_type_number_t new_stateCnt;
+		natural_t new_state[32];
+	} __Request__task_set_state_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int new_limit;
+	} __Request__task_set_phys_footprint_limit_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_suspend2_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_resume2_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_purgable_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_voucher_selector_t which;
+	} __Request__task_get_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t voucher;
+		/* end of the kernel processed data */
+	} __Request__task_set_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_voucher;
+		mach_msg_port_descriptor_t old_voucher;
+		/* end of the kernel processed data */
+	} __Request__task_swap_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__task_subsystem__defined */
+
+/* typedefs for all replies */
+
+#ifndef __Reply__task_subsystem__defined
+#define __Reply__task_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t child_task;
+		/* end of the kernel processed data */
+	} __Reply__task_create_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_terminate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_ports_descriptor_t act_list;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t act_listCnt;
+	} __Reply__task_threads_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_ports_register_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_ports_descriptor_t init_port_set;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t init_port_setCnt;
+	} __Reply__mach_ports_lookup_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t task_info_outCnt;
+		integer_t task_info_out[52];
+	} __Reply__task_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_suspend_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_resume_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t special_port;
+		/* end of the kernel processed data */
+	} __Reply__task_get_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t child_act;
+		/* end of the kernel processed data */
+	} __Reply__thread_create_from_user_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t child_act;
+		/* end of the kernel processed data */
+	} __Reply__thread_create_running_from_user_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t old_handlers[32];
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t masksCnt;
+		exception_mask_t masks[32];
+		exception_behavior_t old_behaviors[32];
+		thread_state_flavor_t old_flavors[32];
+	} __Reply__task_get_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t old_handlerss[32];
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t masksCnt;
+		exception_mask_t masks[32];
+		exception_behavior_t old_behaviors[32];
+		thread_state_flavor_t old_flavors[32];
+	} __Reply__task_swap_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t semaphore;
+		/* end of the kernel processed data */
+	} __Reply__semaphore_create_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__semaphore_destroy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_policy_set_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t policy_infoCnt;
+		integer_t policy_info[16];
+		boolean_t get_default;
+	} __Reply__task_policy_get_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_policy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_ras_pc_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t names;
+		mach_msg_ool_descriptor_t info;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t namesCnt;
+		mach_msg_type_number_t infoCnt;
+	} __Reply__task_zone_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_assign_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_assign_default_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t assigned_set;
+		/* end of the kernel processed data */
+	} __Reply__task_get_assignment_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_policy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t old_stateCnt;
+		natural_t old_state[32];
+	} __Reply__task_get_state_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_state_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int old_limit;
+	} __Reply__task_set_phys_footprint_limit_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t suspend_token;
+		/* end of the kernel processed data */
+	} __Reply__task_suspend2_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_resume2_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		task_purgable_info_t stats;
+	} __Reply__task_purgable_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t voucher;
+		/* end of the kernel processed data */
+	} __Reply__task_get_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t old_voucher;
+		/* end of the kernel processed data */
+	} __Reply__task_swap_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__task_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__task_subsystem__defined
+#define __ReplyUnion__task_subsystem__defined
+union __ReplyUnion__task_subsystem {
+	__Reply__task_create_t Reply_task_create;
+	__Reply__task_terminate_t Reply_task_terminate;
+	__Reply__task_threads_t Reply_task_threads;
+	__Reply__mach_ports_register_t Reply_mach_ports_register;
+	__Reply__mach_ports_lookup_t Reply_mach_ports_lookup;
+	__Reply__task_info_t Reply_task_info;
+	__Reply__task_set_info_t Reply_task_set_info;
+	__Reply__task_suspend_t Reply_task_suspend;
+	__Reply__task_resume_t Reply_task_resume;
+	__Reply__task_get_special_port_t Reply_task_get_special_port;
+	__Reply__task_set_special_port_t Reply_task_set_special_port;
+	__Reply__thread_create_from_user_t Reply_thread_create_from_user;
+	__Reply__thread_create_running_from_user_t Reply_thread_create_running_from_user;
+	__Reply__task_set_exception_ports_t Reply_task_set_exception_ports;
+	__Reply__task_get_exception_ports_t Reply_task_get_exception_ports;
+	__Reply__task_swap_exception_ports_t Reply_task_swap_exception_ports;
+	__Reply__semaphore_create_t Reply_semaphore_create;
+	__Reply__semaphore_destroy_t Reply_semaphore_destroy;
+	__Reply__task_policy_set_t Reply_task_policy_set;
+	__Reply__task_policy_get_t Reply_task_policy_get;
+	__Reply__task_policy_t Reply_task_policy;
+	__Reply__task_set_ras_pc_t Reply_task_set_ras_pc;
+	__Reply__task_zone_info_t Reply_task_zone_info;
+	__Reply__task_assign_t Reply_task_assign;
+	__Reply__task_assign_default_t Reply_task_assign_default;
+	__Reply__task_get_assignment_t Reply_task_get_assignment;
+	__Reply__task_set_policy_t Reply_task_set_policy;
+	__Reply__task_get_state_t Reply_task_get_state;
+	__Reply__task_set_state_t Reply_task_set_state;
+	__Reply__task_set_phys_footprint_limit_t Reply_task_set_phys_footprint_limit;
+	__Reply__task_suspend2_t Reply_task_suspend2;
+	__Reply__task_resume2_t Reply_task_resume2;
+	__Reply__task_purgable_info_t Reply_task_purgable_info;
+	__Reply__task_get_mach_voucher_t Reply_task_get_mach_voucher;
+	__Reply__task_set_mach_voucher_t Reply_task_set_mach_voucher;
+	__Reply__task_swap_mach_voucher_t Reply_task_swap_mach_voucher;
+};
+#endif /* __RequestUnion__task_subsystem__defined */
+/* Forward Declarations */
+
+
+mig_internal novalue _Xtask_create
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_terminate
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_threads
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_ports_register
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_ports_lookup
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_set_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_suspend
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_resume
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_get_special_port
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_set_special_port
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xthread_create_from_user
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xthread_create_running_from_user
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_set_exception_ports
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_get_exception_ports
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_swap_exception_ports
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xsemaphore_create
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xsemaphore_destroy
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_policy_set
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_policy_get
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_policy
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_set_ras_pc
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_zone_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_assign
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_assign_default
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_get_assignment
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_set_policy
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_get_state
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_set_state
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_set_phys_footprint_limit
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_suspend2
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_resume2
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_purgable_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_get_mach_voucher
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_set_mach_voucher
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_swap_mach_voucher
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_create_t__defined)
+#define __MIG_check__Request__task_create_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_create_t(__attribute__((__unused__)) __Request__task_create_t *In0P)
+{
+
+	typedef __Request__task_create_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->ledgers.type != MACH_MSG_OOL_PORTS_DESCRIPTOR ||
+	    In0P->ledgers.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_create_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_create */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_create
+#if	defined(LINTLIBRARY)
+    (target_task, ledgers, ledgersCnt, inherit_memory, child_task)
+	task_t target_task;
+	ledger_array_t ledgers;
+	mach_msg_type_number_t ledgersCnt;
+	boolean_t inherit_memory;
+	task_t *child_task;
+{ return task_create(target_task, ledgers, ledgersCnt, inherit_memory, child_task); }
+#else
+(
+	task_t target_task,
+	ledger_array_t ledgers,
+	mach_msg_type_number_t ledgersCnt,
+	boolean_t inherit_memory,
+	task_t *child_task
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_create */
+mig_internal novalue _Xtask_create
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_ports_descriptor_t ledgers;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t ledgersCnt;
+		boolean_t inherit_memory;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_create_t __Request;
+	typedef __Reply__task_create_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_create_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_create_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t child_taskTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t child_taskTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	task_t target_task;
+	task_t child_task;
+
+	__DeclareRcvRpc(3400, "task_create")
+	__BeforeRcvRpc(3400, "task_create")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_create_t__defined)
+	check_result = __MIG_check__Request__task_create_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_create_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->child_task = child_taskTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->child_task.disposition = 17;
+#else
+	OutP->child_task.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->child_task.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	target_task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	RetCode = task_create(target_task, (ledger_array_t)(In0P->ledgers.address), In0P->ledgersCnt, In0P->inherit_memory, &child_task);
+	task_deallocate(target_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->child_task.name = (mach_port_t)convert_task_to_port(child_task);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3400, "task_create")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_terminate_t__defined)
+#define __MIG_check__Request__task_terminate_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_terminate_t(__attribute__((__unused__)) __Request__task_terminate_t *In0P)
+{
+
+	typedef __Request__task_terminate_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_terminate_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_terminate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_terminate
+#if	defined(LINTLIBRARY)
+    (target_task)
+	task_t target_task;
+{ return task_terminate(target_task); }
+#else
+(
+	task_t target_task
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_terminate */
+mig_internal novalue _Xtask_terminate
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_terminate_t __Request;
+	typedef __Reply__task_terminate_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_terminate_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_terminate_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t target_task;
+
+	__DeclareRcvRpc(3401, "task_terminate")
+	__BeforeRcvRpc(3401, "task_terminate")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_terminate_t__defined)
+	check_result = __MIG_check__Request__task_terminate_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_terminate_t__defined) */
+
+	target_task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_terminate(target_task);
+	task_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3401, "task_terminate")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_threads_t__defined)
+#define __MIG_check__Request__task_threads_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_threads_t(__attribute__((__unused__)) __Request__task_threads_t *In0P)
+{
+
+	typedef __Request__task_threads_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_threads_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_threads */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_threads
+#if	defined(LINTLIBRARY)
+    (target_task, act_list, act_listCnt)
+	task_t target_task;
+	thread_act_array_t *act_list;
+	mach_msg_type_number_t *act_listCnt;
+{ return task_threads(target_task, act_list, act_listCnt); }
+#else
+(
+	task_t target_task,
+	thread_act_array_t *act_list,
+	mach_msg_type_number_t *act_listCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_threads */
+mig_internal novalue _Xtask_threads
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_threads_t __Request;
+	typedef __Reply__task_threads_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_threads_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_threads_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_ports_descriptor_t act_listTemplate = {
+		.address = (void *)0,
+		.count = 0,
+		.deallocate = FALSE,
+		/* copy is meaningful only in overwrite mode */
+		.copy = MACH_MSG_PHYSICAL_COPY,
+		.disposition = 17,
+		.type = MACH_MSG_OOL_PORTS_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_ports_descriptor_t act_listTemplate = {
+		.address = (void *)0,
+		.count = 0,
+		.deallocate = FALSE,
+		/* copy is meaningful only in overwrite mode */
+		.copy = MACH_MSG_PHYSICAL_COPY,
+		.disposition = 19,
+		.type = MACH_MSG_OOL_PORTS_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	task_t target_task;
+
+	__DeclareRcvRpc(3402, "task_threads")
+	__BeforeRcvRpc(3402, "task_threads")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_threads_t__defined)
+	check_result = __MIG_check__Request__task_threads_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_threads_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->act_list = act_listTemplate;
+#else	/* UseStaticTemplates */
+#if	__MigKernelSpecificCode
+	OutP->act_list.disposition = 17;
+#else
+	OutP->act_list.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->act_list.deallocate =  FALSE;
+	OutP->act_list.type = MACH_MSG_OOL_PORTS_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	target_task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	RetCode = task_threads(target_task, (thread_act_array_t *)&(OutP->act_list.address), &OutP->act_listCnt);
+	task_deallocate(target_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->act_list.count = OutP->act_listCnt;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3402, "task_threads")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__mach_ports_register_t__defined)
+#define __MIG_check__Request__mach_ports_register_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_ports_register_t(__attribute__((__unused__)) __Request__mach_ports_register_t *In0P)
+{
+
+	typedef __Request__mach_ports_register_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->init_port_set.type != MACH_MSG_OOL_PORTS_DESCRIPTOR ||
+	    In0P->init_port_set.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_ports_register_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_ports_register */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_ports_register
+#if	defined(LINTLIBRARY)
+    (target_task, init_port_set, init_port_setCnt)
+	task_t target_task;
+	mach_port_array_t init_port_set;
+	mach_msg_type_number_t init_port_setCnt;
+{ return mach_ports_register(target_task, init_port_set, init_port_setCnt); }
+#else
+(
+	task_t target_task,
+	mach_port_array_t init_port_set,
+	mach_msg_type_number_t init_port_setCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_ports_register */
+mig_internal novalue _Xmach_ports_register
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_ports_descriptor_t init_port_set;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t init_port_setCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_ports_register_t __Request;
+	typedef __Reply__mach_ports_register_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_ports_register_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_ports_register_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t target_task;
+
+	__DeclareRcvRpc(3403, "mach_ports_register")
+	__BeforeRcvRpc(3403, "mach_ports_register")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_ports_register_t__defined)
+	check_result = __MIG_check__Request__mach_ports_register_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_ports_register_t__defined) */
+
+	target_task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = mach_ports_register(target_task, (mach_port_array_t)(In0P->init_port_set.address), In0P->init_port_setCnt);
+	task_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3403, "mach_ports_register")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__mach_ports_lookup_t__defined)
+#define __MIG_check__Request__mach_ports_lookup_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_ports_lookup_t(__attribute__((__unused__)) __Request__mach_ports_lookup_t *In0P)
+{
+
+	typedef __Request__mach_ports_lookup_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_ports_lookup_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_ports_lookup */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_ports_lookup
+#if	defined(LINTLIBRARY)
+    (target_task, init_port_set, init_port_setCnt)
+	task_t target_task;
+	mach_port_array_t *init_port_set;
+	mach_msg_type_number_t *init_port_setCnt;
+{ return mach_ports_lookup(target_task, init_port_set, init_port_setCnt); }
+#else
+(
+	task_t target_task,
+	mach_port_array_t *init_port_set,
+	mach_msg_type_number_t *init_port_setCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_ports_lookup */
+mig_internal novalue _Xmach_ports_lookup
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_ports_lookup_t __Request;
+	typedef __Reply__mach_ports_lookup_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_ports_lookup_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_ports_lookup_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_ports_descriptor_t init_port_setTemplate = {
+		.address = (void *)0,
+		.count = 0,
+		.deallocate = FALSE,
+		/* copy is meaningful only in overwrite mode */
+		.copy = MACH_MSG_PHYSICAL_COPY,
+		.disposition = 17,
+		.type = MACH_MSG_OOL_PORTS_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_ports_descriptor_t init_port_setTemplate = {
+		.address = (void *)0,
+		.count = 0,
+		.deallocate = FALSE,
+		/* copy is meaningful only in overwrite mode */
+		.copy = MACH_MSG_PHYSICAL_COPY,
+		.disposition = 19,
+		.type = MACH_MSG_OOL_PORTS_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	task_t target_task;
+
+	__DeclareRcvRpc(3404, "mach_ports_lookup")
+	__BeforeRcvRpc(3404, "mach_ports_lookup")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_ports_lookup_t__defined)
+	check_result = __MIG_check__Request__mach_ports_lookup_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_ports_lookup_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->init_port_set = init_port_setTemplate;
+#else	/* UseStaticTemplates */
+#if	__MigKernelSpecificCode
+	OutP->init_port_set.disposition = 17;
+#else
+	OutP->init_port_set.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->init_port_set.deallocate =  FALSE;
+	OutP->init_port_set.type = MACH_MSG_OOL_PORTS_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	target_task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	RetCode = mach_ports_lookup(target_task, (mach_port_array_t *)&(OutP->init_port_set.address), &OutP->init_port_setCnt);
+	task_deallocate(target_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->init_port_set.count = OutP->init_port_setCnt;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3404, "mach_ports_lookup")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_info_t__defined)
+#define __MIG_check__Request__task_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_info_t(__attribute__((__unused__)) __Request__task_info_t *In0P)
+{
+
+	typedef __Request__task_info_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_info_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_info
+#if	defined(LINTLIBRARY)
+    (target_task, flavor, task_info_out, task_info_outCnt)
+	task_name_t target_task;
+	task_flavor_t flavor;
+	task_info_t task_info_out;
+	mach_msg_type_number_t *task_info_outCnt;
+{ return task_info(target_task, flavor, task_info_out, task_info_outCnt); }
+#else
+(
+	task_name_t target_task,
+	task_flavor_t flavor,
+	task_info_t task_info_out,
+	mach_msg_type_number_t *task_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_info */
+mig_internal novalue _Xtask_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		task_flavor_t flavor;
+		mach_msg_type_number_t task_info_outCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_info_t __Request;
+	typedef __Reply__task_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_name_t target_task;
+
+	__DeclareRcvRpc(3405, "task_info")
+	__BeforeRcvRpc(3405, "task_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_info_t__defined)
+	check_result = __MIG_check__Request__task_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_info_t__defined) */
+
+	target_task = convert_port_to_task_name(In0P->Head.msgh_request_port);
+
+	OutP->task_info_outCnt = 52;
+	if (In0P->task_info_outCnt < OutP->task_info_outCnt)
+		OutP->task_info_outCnt = In0P->task_info_outCnt;
+
+	OutP->RetCode = task_info(target_task, In0P->flavor, OutP->task_info_out, &OutP->task_info_outCnt);
+	task_name_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+	OutP->Head.msgh_size = (sizeof(Reply) - 208) + (_WALIGN_((4 * OutP->task_info_outCnt)));
+
+	__AfterRcvRpc(3405, "task_info")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_set_info_t__defined)
+#define __MIG_check__Request__task_set_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_set_info_t(__attribute__((__unused__)) __Request__task_set_info_t *In0P)
+{
+
+	typedef __Request__task_set_info_t __Request;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	msgh_size = In0P->Head.msgh_size;
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (msgh_size < (sizeof(__Request) - 208)) ||  (msgh_size > (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if defined(__NDR_convert__int_rep__Request__task_set_info_t__task_info_inCnt__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep)
+		__NDR_convert__int_rep__Request__task_set_info_t__task_info_inCnt(&In0P->task_info_inCnt, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__task_set_info_t__task_info_inCnt__defined */
+#if	__MigTypeCheck
+	if ( In0P->task_info_inCnt > 52 )
+		return MIG_BAD_ARGUMENTS;
+	if (((msgh_size - (sizeof(__Request) - 208)) / 4 < In0P->task_info_inCnt) ||
+	    (msgh_size != (sizeof(__Request) - 208) + _WALIGN_(4 * In0P->task_info_inCnt)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_set_info_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_set_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_info
+#if	defined(LINTLIBRARY)
+    (target_task, flavor, task_info_in, task_info_inCnt)
+	task_t target_task;
+	task_flavor_t flavor;
+	task_info_t task_info_in;
+	mach_msg_type_number_t task_info_inCnt;
+{ return task_set_info(target_task, flavor, task_info_in, task_info_inCnt); }
+#else
+(
+	task_t target_task,
+	task_flavor_t flavor,
+	task_info_t task_info_in,
+	mach_msg_type_number_t task_info_inCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_info */
+mig_internal novalue _Xtask_set_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		task_flavor_t flavor;
+		mach_msg_type_number_t task_info_inCnt;
+		integer_t task_info_in[52];
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_set_info_t __Request;
+	typedef __Reply__task_set_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_set_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_set_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t target_task;
+
+	__DeclareRcvRpc(3406, "task_set_info")
+	__BeforeRcvRpc(3406, "task_set_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_set_info_t__defined)
+	check_result = __MIG_check__Request__task_set_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_set_info_t__defined) */
+
+	target_task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_set_info(target_task, In0P->flavor, In0P->task_info_in, In0P->task_info_inCnt);
+	task_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3406, "task_set_info")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_suspend_t__defined)
+#define __MIG_check__Request__task_suspend_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_suspend_t(__attribute__((__unused__)) __Request__task_suspend_t *In0P)
+{
+
+	typedef __Request__task_suspend_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_suspend_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_suspend */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_suspend
+#if	defined(LINTLIBRARY)
+    (target_task)
+	task_t target_task;
+{ return task_suspend(target_task); }
+#else
+(
+	task_t target_task
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_suspend */
+mig_internal novalue _Xtask_suspend
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_suspend_t __Request;
+	typedef __Reply__task_suspend_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_suspend_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_suspend_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t target_task;
+
+	__DeclareRcvRpc(3407, "task_suspend")
+	__BeforeRcvRpc(3407, "task_suspend")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_suspend_t__defined)
+	check_result = __MIG_check__Request__task_suspend_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_suspend_t__defined) */
+
+	target_task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_suspend(target_task);
+	task_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3407, "task_suspend")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_resume_t__defined)
+#define __MIG_check__Request__task_resume_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_resume_t(__attribute__((__unused__)) __Request__task_resume_t *In0P)
+{
+
+	typedef __Request__task_resume_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_resume_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_resume */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_resume
+#if	defined(LINTLIBRARY)
+    (target_task)
+	task_t target_task;
+{ return task_resume(target_task); }
+#else
+(
+	task_t target_task
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_resume */
+mig_internal novalue _Xtask_resume
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_resume_t __Request;
+	typedef __Reply__task_resume_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_resume_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_resume_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t target_task;
+
+	__DeclareRcvRpc(3408, "task_resume")
+	__BeforeRcvRpc(3408, "task_resume")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_resume_t__defined)
+	check_result = __MIG_check__Request__task_resume_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_resume_t__defined) */
+
+	target_task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_resume(target_task);
+	task_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3408, "task_resume")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_get_special_port_t__defined)
+#define __MIG_check__Request__task_get_special_port_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_get_special_port_t(__attribute__((__unused__)) __Request__task_get_special_port_t *In0P)
+{
+
+	typedef __Request__task_get_special_port_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_get_special_port_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_get_special_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_special_port
+#if	defined(LINTLIBRARY)
+    (task, which_port, special_port)
+	task_t task;
+	int which_port;
+	mach_port_t *special_port;
+{ return task_get_special_port(task, which_port, special_port); }
+#else
+(
+	task_t task,
+	int which_port,
+	mach_port_t *special_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_special_port */
+mig_internal novalue _Xtask_get_special_port
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int which_port;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_get_special_port_t __Request;
+	typedef __Reply__task_get_special_port_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_get_special_port_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_get_special_port_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t special_portTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t special_portTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	task_t task;
+
+	__DeclareRcvRpc(3409, "task_get_special_port")
+	__BeforeRcvRpc(3409, "task_get_special_port")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_get_special_port_t__defined)
+	check_result = __MIG_check__Request__task_get_special_port_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_get_special_port_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->special_port = special_portTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->special_port.disposition = 17;
+#else
+	OutP->special_port.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->special_port.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	RetCode = task_get_special_port(task, In0P->which_port, &OutP->special_port.name);
+	task_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3409, "task_get_special_port")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_set_special_port_t__defined)
+#define __MIG_check__Request__task_set_special_port_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_set_special_port_t(__attribute__((__unused__)) __Request__task_set_special_port_t *In0P)
+{
+
+	typedef __Request__task_set_special_port_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->special_port.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->special_port.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_set_special_port_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_set_special_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_special_port
+#if	defined(LINTLIBRARY)
+    (task, which_port, special_port)
+	task_t task;
+	int which_port;
+	mach_port_t special_port;
+{ return task_set_special_port(task, which_port, special_port); }
+#else
+(
+	task_t task,
+	int which_port,
+	mach_port_t special_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_special_port */
+mig_internal novalue _Xtask_set_special_port
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t special_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int which_port;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_set_special_port_t __Request;
+	typedef __Reply__task_set_special_port_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_set_special_port_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_set_special_port_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t task;
+
+	__DeclareRcvRpc(3410, "task_set_special_port")
+	__BeforeRcvRpc(3410, "task_set_special_port")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_set_special_port_t__defined)
+	check_result = __MIG_check__Request__task_set_special_port_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_set_special_port_t__defined) */
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_set_special_port(task, In0P->which_port, In0P->special_port.name);
+	task_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3410, "task_set_special_port")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__thread_create_from_user_t__defined)
+#define __MIG_check__Request__thread_create_from_user_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__thread_create_from_user_t(__attribute__((__unused__)) __Request__thread_create_from_user_t *In0P)
+{
+
+	typedef __Request__thread_create_from_user_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__thread_create_from_user_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine thread_create_from_user */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t thread_create_from_user
+#if	defined(LINTLIBRARY)
+    (parent_task, child_act)
+	task_t parent_task;
+	thread_act_t *child_act;
+{ return thread_create_from_user(parent_task, child_act); }
+#else
+(
+	task_t parent_task,
+	thread_act_t *child_act
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine thread_create_from_user */
+mig_internal novalue _Xthread_create_from_user
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__thread_create_from_user_t __Request;
+	typedef __Reply__thread_create_from_user_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__thread_create_from_user_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__thread_create_from_user_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t child_actTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t child_actTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	task_t parent_task;
+	thread_act_t child_act;
+
+	__DeclareRcvRpc(3411, "thread_create_from_user")
+	__BeforeRcvRpc(3411, "thread_create_from_user")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__thread_create_from_user_t__defined)
+	check_result = __MIG_check__Request__thread_create_from_user_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__thread_create_from_user_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->child_act = child_actTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->child_act.disposition = 17;
+#else
+	OutP->child_act.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->child_act.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	parent_task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	RetCode = thread_create_from_user(parent_task, &child_act);
+	task_deallocate(parent_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->child_act.name = (mach_port_t)convert_thread_to_port(child_act);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3411, "thread_create_from_user")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__thread_create_running_from_user_t__defined)
+#define __MIG_check__Request__thread_create_running_from_user_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__thread_create_running_from_user_t(__attribute__((__unused__)) __Request__thread_create_running_from_user_t *In0P)
+{
+
+	typedef __Request__thread_create_running_from_user_t __Request;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	msgh_size = In0P->Head.msgh_size;
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (msgh_size < (sizeof(__Request) - 128)) ||  (msgh_size > (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if defined(__NDR_convert__int_rep__Request__thread_create_running_from_user_t__new_stateCnt__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep)
+		__NDR_convert__int_rep__Request__thread_create_running_from_user_t__new_stateCnt(&In0P->new_stateCnt, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__thread_create_running_from_user_t__new_stateCnt__defined */
+#if	__MigTypeCheck
+	if ( In0P->new_stateCnt > 32 )
+		return MIG_BAD_ARGUMENTS;
+	if (((msgh_size - (sizeof(__Request) - 128)) / 4 < In0P->new_stateCnt) ||
+	    (msgh_size != (sizeof(__Request) - 128) + _WALIGN_(4 * In0P->new_stateCnt)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__thread_create_running_from_user_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine thread_create_running_from_user */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t thread_create_running_from_user
+#if	defined(LINTLIBRARY)
+    (parent_task, flavor, new_state, new_stateCnt, child_act)
+	task_t parent_task;
+	thread_state_flavor_t flavor;
+	thread_state_t new_state;
+	mach_msg_type_number_t new_stateCnt;
+	thread_act_t *child_act;
+{ return thread_create_running_from_user(parent_task, flavor, new_state, new_stateCnt, child_act); }
+#else
+(
+	task_t parent_task,
+	thread_state_flavor_t flavor,
+	thread_state_t new_state,
+	mach_msg_type_number_t new_stateCnt,
+	thread_act_t *child_act
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine thread_create_running_from_user */
+mig_internal novalue _Xthread_create_running_from_user
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		thread_state_flavor_t flavor;
+		mach_msg_type_number_t new_stateCnt;
+		natural_t new_state[32];
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__thread_create_running_from_user_t __Request;
+	typedef __Reply__thread_create_running_from_user_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__thread_create_running_from_user_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__thread_create_running_from_user_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t child_actTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t child_actTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	task_t parent_task;
+	thread_act_t child_act;
+
+	__DeclareRcvRpc(3412, "thread_create_running_from_user")
+	__BeforeRcvRpc(3412, "thread_create_running_from_user")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__thread_create_running_from_user_t__defined)
+	check_result = __MIG_check__Request__thread_create_running_from_user_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__thread_create_running_from_user_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->child_act = child_actTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->child_act.disposition = 17;
+#else
+	OutP->child_act.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->child_act.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	parent_task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	RetCode = thread_create_running_from_user(parent_task, In0P->flavor, In0P->new_state, In0P->new_stateCnt, &child_act);
+	task_deallocate(parent_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->child_act.name = (mach_port_t)convert_thread_to_port(child_act);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3412, "thread_create_running_from_user")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_set_exception_ports_t__defined)
+#define __MIG_check__Request__task_set_exception_ports_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_set_exception_ports_t(__attribute__((__unused__)) __Request__task_set_exception_ports_t *In0P)
+{
+
+	typedef __Request__task_set_exception_ports_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->new_port.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->new_port.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_set_exception_ports_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_set_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_exception_ports
+#if	defined(LINTLIBRARY)
+    (task, exception_mask, new_port, behavior, new_flavor)
+	task_t task;
+	exception_mask_t exception_mask;
+	mach_port_t new_port;
+	exception_behavior_t behavior;
+	thread_state_flavor_t new_flavor;
+{ return task_set_exception_ports(task, exception_mask, new_port, behavior, new_flavor); }
+#else
+(
+	task_t task,
+	exception_mask_t exception_mask,
+	mach_port_t new_port,
+	exception_behavior_t behavior,
+	thread_state_flavor_t new_flavor
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_exception_ports */
+mig_internal novalue _Xtask_set_exception_ports
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+		exception_behavior_t behavior;
+		thread_state_flavor_t new_flavor;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_set_exception_ports_t __Request;
+	typedef __Reply__task_set_exception_ports_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_set_exception_ports_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_set_exception_ports_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t task;
+
+	__DeclareRcvRpc(3413, "task_set_exception_ports")
+	__BeforeRcvRpc(3413, "task_set_exception_ports")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_set_exception_ports_t__defined)
+	check_result = __MIG_check__Request__task_set_exception_ports_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_set_exception_ports_t__defined) */
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_set_exception_ports(task, In0P->exception_mask, In0P->new_port.name, In0P->behavior, In0P->new_flavor);
+	task_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3413, "task_set_exception_ports")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_get_exception_ports_t__defined)
+#define __MIG_check__Request__task_get_exception_ports_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_get_exception_ports_t(__attribute__((__unused__)) __Request__task_get_exception_ports_t *In0P)
+{
+
+	typedef __Request__task_get_exception_ports_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_get_exception_ports_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_get_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_exception_ports
+#if	defined(LINTLIBRARY)
+    (task, exception_mask, masks, masksCnt, old_handlers, old_behaviors, old_flavors)
+	task_t task;
+	exception_mask_t exception_mask;
+	exception_mask_array_t masks;
+	mach_msg_type_number_t *masksCnt;
+	exception_handler_array_t old_handlers;
+	exception_behavior_array_t old_behaviors;
+	exception_flavor_array_t old_flavors;
+{ return task_get_exception_ports(task, exception_mask, masks, masksCnt, old_handlers, old_behaviors, old_flavors); }
+#else
+(
+	task_t task,
+	exception_mask_t exception_mask,
+	exception_mask_array_t masks,
+	mach_msg_type_number_t *masksCnt,
+	exception_handler_array_t old_handlers,
+	exception_behavior_array_t old_behaviors,
+	exception_flavor_array_t old_flavors
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_exception_ports */
+mig_internal novalue _Xtask_get_exception_ports
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_get_exception_ports_t __Request;
+	typedef __Reply__task_get_exception_ports_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+	unsigned int msgh_size;
+	unsigned int msgh_size_delta;
+
+#ifdef	__MIG_check__Request__task_get_exception_ports_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_get_exception_ports_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t old_handlersTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t old_handlersTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	task_t task;
+	mach_msg_type_number_t masksCnt;
+	exception_handler_t old_handlers[32];
+	exception_behavior_t old_behaviors[32];
+	thread_state_flavor_t old_flavors[32];
+
+	__DeclareRcvRpc(3414, "task_get_exception_ports")
+	__BeforeRcvRpc(3414, "task_get_exception_ports")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_get_exception_ports_t__defined)
+	check_result = __MIG_check__Request__task_get_exception_ports_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_get_exception_ports_t__defined) */
+
+	{
+	    register	mach_msg_port_descriptor_t	*ptr;
+	    register int	i;
+
+	    ptr = &OutP->old_handlers[0];
+	    for (i = 0; i < 32; ptr++, i++) {
+#if	UseStaticTemplates
+		*ptr = old_handlersTemplate;
+#else	/* UseStaticTemplates */
+		ptr->name = MACH_PORT_NULL;
+#if __MigKernelSpecificCode
+		ptr->disposition = 17;
+#else
+		ptr->disposition = 19;
+#endif /* __MigKernelSpecificCode */
+		ptr->type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+	    }
+	}
+
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	masksCnt = 32;
+
+	RetCode = task_get_exception_ports(task, In0P->exception_mask, OutP->masks, &masksCnt, old_handlers, old_behaviors, old_flavors);
+	task_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	{
+	    register	mach_msg_port_descriptor_t	*ptr;
+	    register int	i, j;
+
+	    ptr = &OutP->old_handlers[0];
+	    j = min(32, masksCnt);
+	    for (i = 0; i < j; ptr++, i++) {
+		ptr->name = old_handlers[i];
+	    }
+	}
+
+
+	OutP->NDR = NDR_record;
+
+	OutP->masksCnt = masksCnt;
+	msgh_size_delta = _WALIGN_((4 * masksCnt));
+	msgh_size = (sizeof(Reply) - 384) + msgh_size_delta;
+	OutP = (Reply *) ((pointer_t) OutP + msgh_size_delta - 128);
+	(void)memcpy((char *) OutP->old_behaviors, (const char *) old_behaviors, 4 * masksCnt);
+	msgh_size_delta = _WALIGN_((4 * masksCnt));
+	msgh_size += msgh_size_delta;
+	OutP = (Reply *) ((pointer_t) OutP + msgh_size_delta - 128);
+	(void)memcpy((char *) OutP->old_flavors, (const char *) old_flavors, 4 * masksCnt);
+	msgh_size += _WALIGN_((4 * masksCnt));
+
+	OutP = (Reply *) OutHeadP;
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = msgh_size;
+	OutP->msgh_body.msgh_descriptor_count = 32;
+	__AfterRcvRpc(3414, "task_get_exception_ports")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_swap_exception_ports_t__defined)
+#define __MIG_check__Request__task_swap_exception_ports_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_swap_exception_ports_t(__attribute__((__unused__)) __Request__task_swap_exception_ports_t *In0P)
+{
+
+	typedef __Request__task_swap_exception_ports_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->new_port.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->new_port.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_swap_exception_ports_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_swap_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_swap_exception_ports
+#if	defined(LINTLIBRARY)
+    (task, exception_mask, new_port, behavior, new_flavor, masks, masksCnt, old_handlerss, old_behaviors, old_flavors)
+	task_t task;
+	exception_mask_t exception_mask;
+	mach_port_t new_port;
+	exception_behavior_t behavior;
+	thread_state_flavor_t new_flavor;
+	exception_mask_array_t masks;
+	mach_msg_type_number_t *masksCnt;
+	exception_handler_array_t old_handlerss;
+	exception_behavior_array_t old_behaviors;
+	exception_flavor_array_t old_flavors;
+{ return task_swap_exception_ports(task, exception_mask, new_port, behavior, new_flavor, masks, masksCnt, old_handlerss, old_behaviors, old_flavors); }
+#else
+(
+	task_t task,
+	exception_mask_t exception_mask,
+	mach_port_t new_port,
+	exception_behavior_t behavior,
+	thread_state_flavor_t new_flavor,
+	exception_mask_array_t masks,
+	mach_msg_type_number_t *masksCnt,
+	exception_handler_array_t old_handlerss,
+	exception_behavior_array_t old_behaviors,
+	exception_flavor_array_t old_flavors
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_swap_exception_ports */
+mig_internal novalue _Xtask_swap_exception_ports
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+		exception_behavior_t behavior;
+		thread_state_flavor_t new_flavor;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_swap_exception_ports_t __Request;
+	typedef __Reply__task_swap_exception_ports_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+	unsigned int msgh_size;
+	unsigned int msgh_size_delta;
+
+#ifdef	__MIG_check__Request__task_swap_exception_ports_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_swap_exception_ports_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t old_handlerssTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t old_handlerssTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	task_t task;
+	mach_msg_type_number_t masksCnt;
+	exception_handler_t old_handlerss[32];
+	exception_behavior_t old_behaviors[32];
+	thread_state_flavor_t old_flavors[32];
+
+	__DeclareRcvRpc(3415, "task_swap_exception_ports")
+	__BeforeRcvRpc(3415, "task_swap_exception_ports")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_swap_exception_ports_t__defined)
+	check_result = __MIG_check__Request__task_swap_exception_ports_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_swap_exception_ports_t__defined) */
+
+	{
+	    register	mach_msg_port_descriptor_t	*ptr;
+	    register int	i;
+
+	    ptr = &OutP->old_handlerss[0];
+	    for (i = 0; i < 32; ptr++, i++) {
+#if	UseStaticTemplates
+		*ptr = old_handlerssTemplate;
+#else	/* UseStaticTemplates */
+		ptr->name = MACH_PORT_NULL;
+#if __MigKernelSpecificCode
+		ptr->disposition = 17;
+#else
+		ptr->disposition = 19;
+#endif /* __MigKernelSpecificCode */
+		ptr->type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+	    }
+	}
+
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	masksCnt = 32;
+
+	RetCode = task_swap_exception_ports(task, In0P->exception_mask, In0P->new_port.name, In0P->behavior, In0P->new_flavor, OutP->masks, &masksCnt, old_handlerss, old_behaviors, old_flavors);
+	task_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	{
+	    register	mach_msg_port_descriptor_t	*ptr;
+	    register int	i, j;
+
+	    ptr = &OutP->old_handlerss[0];
+	    j = min(32, masksCnt);
+	    for (i = 0; i < j; ptr++, i++) {
+		ptr->name = old_handlerss[i];
+	    }
+	}
+
+
+	OutP->NDR = NDR_record;
+
+	OutP->masksCnt = masksCnt;
+	msgh_size_delta = _WALIGN_((4 * masksCnt));
+	msgh_size = (sizeof(Reply) - 384) + msgh_size_delta;
+	OutP = (Reply *) ((pointer_t) OutP + msgh_size_delta - 128);
+	(void)memcpy((char *) OutP->old_behaviors, (const char *) old_behaviors, 4 * masksCnt);
+	msgh_size_delta = _WALIGN_((4 * masksCnt));
+	msgh_size += msgh_size_delta;
+	OutP = (Reply *) ((pointer_t) OutP + msgh_size_delta - 128);
+	(void)memcpy((char *) OutP->old_flavors, (const char *) old_flavors, 4 * masksCnt);
+	msgh_size += _WALIGN_((4 * masksCnt));
+
+	OutP = (Reply *) OutHeadP;
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = msgh_size;
+	OutP->msgh_body.msgh_descriptor_count = 32;
+	__AfterRcvRpc(3415, "task_swap_exception_ports")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__semaphore_create_t__defined)
+#define __MIG_check__Request__semaphore_create_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__semaphore_create_t(__attribute__((__unused__)) __Request__semaphore_create_t *In0P)
+{
+
+	typedef __Request__semaphore_create_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__semaphore_create_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine semaphore_create */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t semaphore_create
+#if	defined(LINTLIBRARY)
+    (task, semaphore, policy, value)
+	task_t task;
+	semaphore_t *semaphore;
+	int policy;
+	int value;
+{ return semaphore_create(task, semaphore, policy, value); }
+#else
+(
+	task_t task,
+	semaphore_t *semaphore,
+	int policy,
+	int value
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine semaphore_create */
+mig_internal novalue _Xsemaphore_create
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int policy;
+		int value;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__semaphore_create_t __Request;
+	typedef __Reply__semaphore_create_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__semaphore_create_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__semaphore_create_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t semaphoreTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t semaphoreTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	task_t task;
+	semaphore_t semaphore;
+
+	__DeclareRcvRpc(3418, "semaphore_create")
+	__BeforeRcvRpc(3418, "semaphore_create")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__semaphore_create_t__defined)
+	check_result = __MIG_check__Request__semaphore_create_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__semaphore_create_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->semaphore = semaphoreTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->semaphore.disposition = 17;
+#else
+	OutP->semaphore.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->semaphore.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	RetCode = semaphore_create(task, &semaphore, In0P->policy, In0P->value);
+	task_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->semaphore.name = (mach_port_t)convert_semaphore_to_port(semaphore);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3418, "semaphore_create")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__semaphore_destroy_t__defined)
+#define __MIG_check__Request__semaphore_destroy_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__semaphore_destroy_t(__attribute__((__unused__)) __Request__semaphore_destroy_t *In0P)
+{
+
+	typedef __Request__semaphore_destroy_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->semaphore.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->semaphore.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__semaphore_destroy_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine semaphore_destroy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t semaphore_destroy
+#if	defined(LINTLIBRARY)
+    (task, semaphore)
+	task_t task;
+	semaphore_t semaphore;
+{ return semaphore_destroy(task, semaphore); }
+#else
+(
+	task_t task,
+	semaphore_t semaphore
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine semaphore_destroy */
+mig_internal novalue _Xsemaphore_destroy
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t semaphore;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__semaphore_destroy_t __Request;
+	typedef __Reply__semaphore_destroy_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__semaphore_destroy_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__semaphore_destroy_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t task;
+	semaphore_t semaphore;
+
+	__DeclareRcvRpc(3419, "semaphore_destroy")
+	__BeforeRcvRpc(3419, "semaphore_destroy")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__semaphore_destroy_t__defined)
+	check_result = __MIG_check__Request__semaphore_destroy_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__semaphore_destroy_t__defined) */
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	semaphore = convert_port_to_semaphore(In0P->semaphore.name);
+
+	OutP->RetCode = semaphore_destroy(task, semaphore);
+	semaphore_dereference(semaphore);
+	task_deallocate(task);
+#if	__MigKernelSpecificCode
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	if (IP_VALID((ipc_port_t)In0P->semaphore.name))
+		ipc_port_release_send((ipc_port_t)In0P->semaphore.name);
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3419, "semaphore_destroy")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_policy_set_t__defined)
+#define __MIG_check__Request__task_policy_set_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_policy_set_t(__attribute__((__unused__)) __Request__task_policy_set_t *In0P)
+{
+
+	typedef __Request__task_policy_set_t __Request;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	msgh_size = In0P->Head.msgh_size;
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (msgh_size < (sizeof(__Request) - 64)) ||  (msgh_size > (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if defined(__NDR_convert__int_rep__Request__task_policy_set_t__policy_infoCnt__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep)
+		__NDR_convert__int_rep__Request__task_policy_set_t__policy_infoCnt(&In0P->policy_infoCnt, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__task_policy_set_t__policy_infoCnt__defined */
+#if	__MigTypeCheck
+	if ( In0P->policy_infoCnt > 16 )
+		return MIG_BAD_ARGUMENTS;
+	if (((msgh_size - (sizeof(__Request) - 64)) / 4 < In0P->policy_infoCnt) ||
+	    (msgh_size != (sizeof(__Request) - 64) + _WALIGN_(4 * In0P->policy_infoCnt)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_policy_set_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_policy_set */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_policy_set
+#if	defined(LINTLIBRARY)
+    (task, flavor, policy_info, policy_infoCnt)
+	task_t task;
+	task_policy_flavor_t flavor;
+	task_policy_t policy_info;
+	mach_msg_type_number_t policy_infoCnt;
+{ return task_policy_set(task, flavor, policy_info, policy_infoCnt); }
+#else
+(
+	task_t task,
+	task_policy_flavor_t flavor,
+	task_policy_t policy_info,
+	mach_msg_type_number_t policy_infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_policy_set */
+mig_internal novalue _Xtask_policy_set
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		task_policy_flavor_t flavor;
+		mach_msg_type_number_t policy_infoCnt;
+		integer_t policy_info[16];
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_policy_set_t __Request;
+	typedef __Reply__task_policy_set_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_policy_set_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_policy_set_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t task;
+
+	__DeclareRcvRpc(3420, "task_policy_set")
+	__BeforeRcvRpc(3420, "task_policy_set")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_policy_set_t__defined)
+	check_result = __MIG_check__Request__task_policy_set_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_policy_set_t__defined) */
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_policy_set(task, In0P->flavor, In0P->policy_info, In0P->policy_infoCnt);
+	task_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3420, "task_policy_set")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_policy_get_t__defined)
+#define __MIG_check__Request__task_policy_get_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_policy_get_t(__attribute__((__unused__)) __Request__task_policy_get_t *In0P)
+{
+
+	typedef __Request__task_policy_get_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_policy_get_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_policy_get */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_policy_get
+#if	defined(LINTLIBRARY)
+    (task, flavor, policy_info, policy_infoCnt, get_default)
+	task_t task;
+	task_policy_flavor_t flavor;
+	task_policy_t policy_info;
+	mach_msg_type_number_t *policy_infoCnt;
+	boolean_t *get_default;
+{ return task_policy_get(task, flavor, policy_info, policy_infoCnt, get_default); }
+#else
+(
+	task_t task,
+	task_policy_flavor_t flavor,
+	task_policy_t policy_info,
+	mach_msg_type_number_t *policy_infoCnt,
+	boolean_t *get_default
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_policy_get */
+mig_internal novalue _Xtask_policy_get
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		task_policy_flavor_t flavor;
+		mach_msg_type_number_t policy_infoCnt;
+		boolean_t get_default;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_policy_get_t __Request;
+	typedef __Reply__task_policy_get_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+	unsigned int msgh_size_delta;
+
+#ifdef	__MIG_check__Request__task_policy_get_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_policy_get_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t task;
+
+	__DeclareRcvRpc(3421, "task_policy_get")
+	__BeforeRcvRpc(3421, "task_policy_get")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_policy_get_t__defined)
+	check_result = __MIG_check__Request__task_policy_get_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_policy_get_t__defined) */
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->policy_infoCnt = 16;
+	if (In0P->policy_infoCnt < OutP->policy_infoCnt)
+		OutP->policy_infoCnt = In0P->policy_infoCnt;
+
+	OutP->RetCode = task_policy_get(task, In0P->flavor, OutP->policy_info, &OutP->policy_infoCnt, &In0P->get_default);
+	task_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+	msgh_size_delta = _WALIGN_((4 * OutP->policy_infoCnt));
+	OutP->Head.msgh_size = (sizeof(Reply) - 64) + msgh_size_delta;
+	OutP = (Reply *) ((pointer_t) OutP + msgh_size_delta - 64);
+
+	OutP->get_default = In0P->get_default;
+
+	OutP = (Reply *) OutHeadP;
+	__AfterRcvRpc(3421, "task_policy_get")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_policy_t__defined)
+#define __MIG_check__Request__task_policy_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_policy_t(__attribute__((__unused__)) __Request__task_policy_t *In0P, __attribute__((__unused__)) __Request__task_policy_t **In1PP)
+{
+
+	typedef __Request__task_policy_t __Request;
+	__Request *In1P;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	unsigned int msgh_size_delta;
+
+#if	__MigTypeCheck
+	msgh_size = In0P->Head.msgh_size;
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (msgh_size < (sizeof(__Request) - 20)) ||  (msgh_size > (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if defined(__NDR_convert__int_rep__Request__task_policy_t__baseCnt__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep)
+		__NDR_convert__int_rep__Request__task_policy_t__baseCnt(&In0P->baseCnt, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__task_policy_t__baseCnt__defined */
+	msgh_size_delta = _WALIGN_(4 * In0P->baseCnt);
+#if	__MigTypeCheck
+	if ( In0P->baseCnt > 5 )
+		return MIG_BAD_ARGUMENTS;
+	if (((msgh_size - (sizeof(__Request) - 20)) / 4 < In0P->baseCnt) ||
+	    (msgh_size != (sizeof(__Request) - 20) + _WALIGN_(4 * In0P->baseCnt)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	*In1PP = In1P = (__Request *) ((pointer_t) In0P + msgh_size_delta - 20);
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_policy_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_policy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_policy
+#if	defined(LINTLIBRARY)
+    (task, policy, base, baseCnt, set_limit, change)
+	task_t task;
+	policy_t policy;
+	policy_base_t base;
+	mach_msg_type_number_t baseCnt;
+	boolean_t set_limit;
+	boolean_t change;
+{ return task_policy(task, policy, base, baseCnt, set_limit, change); }
+#else
+(
+	task_t task,
+	policy_t policy,
+	policy_base_t base,
+	mach_msg_type_number_t baseCnt,
+	boolean_t set_limit,
+	boolean_t change
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_policy */
+mig_internal novalue _Xtask_policy
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		policy_t policy;
+		mach_msg_type_number_t baseCnt;
+		integer_t base[5];
+		boolean_t set_limit;
+		boolean_t change;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_policy_t __Request;
+	typedef __Reply__task_policy_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Request *In1P = NULL;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_policy_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_policy_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t task;
+
+	__DeclareRcvRpc(3423, "task_policy")
+	__BeforeRcvRpc(3423, "task_policy")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_policy_t__defined)
+	check_result = __MIG_check__Request__task_policy_t((__Request *)In0P, (__Request **)&In1P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_policy_t__defined) */
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_policy(task, In0P->policy, In0P->base, In0P->baseCnt, In1P->set_limit, In1P->change);
+	task_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3423, "task_policy")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_set_ras_pc_t__defined)
+#define __MIG_check__Request__task_set_ras_pc_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_set_ras_pc_t(__attribute__((__unused__)) __Request__task_set_ras_pc_t *In0P)
+{
+
+	typedef __Request__task_set_ras_pc_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_set_ras_pc_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_set_ras_pc */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_ras_pc
+#if	defined(LINTLIBRARY)
+    (target_task, basepc, boundspc)
+	task_t target_task;
+	vm_address_t basepc;
+	vm_address_t boundspc;
+{ return task_set_ras_pc(target_task, basepc, boundspc); }
+#else
+(
+	task_t target_task,
+	vm_address_t basepc,
+	vm_address_t boundspc
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_ras_pc */
+mig_internal novalue _Xtask_set_ras_pc
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t basepc;
+		vm_address_t boundspc;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_set_ras_pc_t __Request;
+	typedef __Reply__task_set_ras_pc_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_set_ras_pc_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_set_ras_pc_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t target_task;
+
+	__DeclareRcvRpc(3427, "task_set_ras_pc")
+	__BeforeRcvRpc(3427, "task_set_ras_pc")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_set_ras_pc_t__defined)
+	check_result = __MIG_check__Request__task_set_ras_pc_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_set_ras_pc_t__defined) */
+
+	target_task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_set_ras_pc(target_task, In0P->basepc, In0P->boundspc);
+	task_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3427, "task_set_ras_pc")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_zone_info_t__defined)
+#define __MIG_check__Request__task_zone_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_zone_info_t(__attribute__((__unused__)) __Request__task_zone_info_t *In0P)
+{
+
+	typedef __Request__task_zone_info_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_zone_info_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_zone_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_zone_info
+#if	defined(LINTLIBRARY)
+    (target_task, names, namesCnt, info, infoCnt)
+	task_t target_task;
+	mach_zone_name_array_t *names;
+	mach_msg_type_number_t *namesCnt;
+	task_zone_info_array_t *info;
+	mach_msg_type_number_t *infoCnt;
+{ return task_zone_info(target_task, names, namesCnt, info, infoCnt); }
+#else
+(
+	task_t target_task,
+	mach_zone_name_array_t *names,
+	mach_msg_type_number_t *namesCnt,
+	task_zone_info_array_t *info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_zone_info */
+mig_internal novalue _Xtask_zone_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_zone_info_t __Request;
+	typedef __Reply__task_zone_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_zone_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_zone_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t namesTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = TRUE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t infoTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = TRUE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t namesTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = TRUE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t infoTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = TRUE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	task_t target_task;
+
+	__DeclareRcvRpc(3428, "task_zone_info")
+	__BeforeRcvRpc(3428, "task_zone_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_zone_info_t__defined)
+	check_result = __MIG_check__Request__task_zone_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_zone_info_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->names = namesTemplate;
+#else	/* UseStaticTemplates */
+	OutP->names.deallocate =  TRUE;
+	OutP->names.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->names.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+#if	UseStaticTemplates
+	OutP->info = infoTemplate;
+#else	/* UseStaticTemplates */
+	OutP->info.deallocate =  TRUE;
+	OutP->info.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->info.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	target_task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->namesCnt = 0;
+
+	OutP->infoCnt = 0;
+
+	RetCode = task_zone_info(target_task, (mach_zone_name_array_t *)&(OutP->names.address), &OutP->namesCnt, (task_zone_info_array_t *)&(OutP->info.address), &OutP->infoCnt);
+	task_deallocate(target_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->names.size = OutP->namesCnt * 80;
+
+	OutP->info.size = OutP->infoCnt * 88;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 2;
+	__AfterRcvRpc(3428, "task_zone_info")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_assign_t__defined)
+#define __MIG_check__Request__task_assign_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_assign_t(__attribute__((__unused__)) __Request__task_assign_t *In0P)
+{
+
+	typedef __Request__task_assign_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->new_set.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->new_set.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_assign_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_assign */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_assign
+#if	defined(LINTLIBRARY)
+    (task, new_set, assign_threads)
+	task_t task;
+	processor_set_t new_set;
+	boolean_t assign_threads;
+{ return task_assign(task, new_set, assign_threads); }
+#else
+(
+	task_t task,
+	processor_set_t new_set,
+	boolean_t assign_threads
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_assign */
+mig_internal novalue _Xtask_assign
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_set;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t assign_threads;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_assign_t __Request;
+	typedef __Reply__task_assign_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_assign_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_assign_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t task;
+	processor_set_t new_set;
+
+	__DeclareRcvRpc(3429, "task_assign")
+	__BeforeRcvRpc(3429, "task_assign")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_assign_t__defined)
+	check_result = __MIG_check__Request__task_assign_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_assign_t__defined) */
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	new_set = convert_port_to_pset(In0P->new_set.name);
+
+	OutP->RetCode = task_assign(task, new_set, In0P->assign_threads);
+	pset_deallocate(new_set);
+	task_deallocate(task);
+#if	__MigKernelSpecificCode
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	if (IP_VALID((ipc_port_t)In0P->new_set.name))
+		ipc_port_release_send((ipc_port_t)In0P->new_set.name);
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3429, "task_assign")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_assign_default_t__defined)
+#define __MIG_check__Request__task_assign_default_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_assign_default_t(__attribute__((__unused__)) __Request__task_assign_default_t *In0P)
+{
+
+	typedef __Request__task_assign_default_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_assign_default_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_assign_default */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_assign_default
+#if	defined(LINTLIBRARY)
+    (task, assign_threads)
+	task_t task;
+	boolean_t assign_threads;
+{ return task_assign_default(task, assign_threads); }
+#else
+(
+	task_t task,
+	boolean_t assign_threads
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_assign_default */
+mig_internal novalue _Xtask_assign_default
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t assign_threads;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_assign_default_t __Request;
+	typedef __Reply__task_assign_default_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_assign_default_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_assign_default_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t task;
+
+	__DeclareRcvRpc(3430, "task_assign_default")
+	__BeforeRcvRpc(3430, "task_assign_default")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_assign_default_t__defined)
+	check_result = __MIG_check__Request__task_assign_default_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_assign_default_t__defined) */
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_assign_default(task, In0P->assign_threads);
+	task_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3430, "task_assign_default")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_get_assignment_t__defined)
+#define __MIG_check__Request__task_get_assignment_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_get_assignment_t(__attribute__((__unused__)) __Request__task_get_assignment_t *In0P)
+{
+
+	typedef __Request__task_get_assignment_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_get_assignment_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_get_assignment */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_assignment
+#if	defined(LINTLIBRARY)
+    (task, assigned_set)
+	task_t task;
+	processor_set_name_t *assigned_set;
+{ return task_get_assignment(task, assigned_set); }
+#else
+(
+	task_t task,
+	processor_set_name_t *assigned_set
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_assignment */
+mig_internal novalue _Xtask_get_assignment
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_get_assignment_t __Request;
+	typedef __Reply__task_get_assignment_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_get_assignment_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_get_assignment_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t assigned_setTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t assigned_setTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	task_t task;
+	processor_set_name_t assigned_set;
+
+	__DeclareRcvRpc(3431, "task_get_assignment")
+	__BeforeRcvRpc(3431, "task_get_assignment")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_get_assignment_t__defined)
+	check_result = __MIG_check__Request__task_get_assignment_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_get_assignment_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->assigned_set = assigned_setTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->assigned_set.disposition = 17;
+#else
+	OutP->assigned_set.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->assigned_set.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	RetCode = task_get_assignment(task, &assigned_set);
+	task_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->assigned_set.name = (mach_port_t)convert_pset_name_to_port(assigned_set);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3431, "task_get_assignment")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_set_policy_t__defined)
+#define __MIG_check__Request__task_set_policy_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_set_policy_t(__attribute__((__unused__)) __Request__task_set_policy_t *In0P, __attribute__((__unused__)) __Request__task_set_policy_t **In1PP, __attribute__((__unused__)) __Request__task_set_policy_t **In2PP)
+{
+
+	typedef __Request__task_set_policy_t __Request;
+	__Request *In1P;
+	__Request *In2P;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	unsigned int msgh_size_delta;
+
+#if	__MigTypeCheck
+	msgh_size = In0P->Head.msgh_size;
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (msgh_size < (sizeof(__Request) - 24)) ||  (msgh_size > (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->pset.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->pset.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+#if defined(__NDR_convert__int_rep__Request__task_set_policy_t__baseCnt__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep)
+		__NDR_convert__int_rep__Request__task_set_policy_t__baseCnt(&In0P->baseCnt, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__task_set_policy_t__baseCnt__defined */
+	msgh_size_delta = _WALIGN_(4 * In0P->baseCnt);
+#if	__MigTypeCheck
+	if ( In0P->baseCnt > 5 )
+		return MIG_BAD_ARGUMENTS;
+	if (((msgh_size - (sizeof(__Request) - 24)) / 4 < In0P->baseCnt) ||
+	    (msgh_size < (sizeof(__Request) - 24) + _WALIGN_(4 * In0P->baseCnt)))
+		return MIG_BAD_ARGUMENTS;
+	msgh_size -= msgh_size_delta;
+#endif	/* __MigTypeCheck */
+
+	*In1PP = In1P = (__Request *) ((pointer_t) In0P + msgh_size_delta - 20);
+
+#if defined(__NDR_convert__int_rep__Request__task_set_policy_t__limitCnt__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep)
+		__NDR_convert__int_rep__Request__task_set_policy_t__limitCnt(&In1P->limitCnt, In1P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__task_set_policy_t__limitCnt__defined */
+	msgh_size_delta = _WALIGN_(4 * In1P->limitCnt);
+#if	__MigTypeCheck
+	if ( In1P->limitCnt > 1 )
+		return MIG_BAD_ARGUMENTS;
+	if (((msgh_size - (sizeof(__Request) - 24)) / 4 < In1P->limitCnt) ||
+	    (msgh_size != (sizeof(__Request) - 24) + _WALIGN_(4 * In1P->limitCnt)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	*In2PP = In2P = (__Request *) ((pointer_t) In1P + msgh_size_delta - 4);
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_set_policy_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_set_policy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_policy
+#if	defined(LINTLIBRARY)
+    (task, pset, policy, base, baseCnt, limit, limitCnt, change)
+	task_t task;
+	processor_set_t pset;
+	policy_t policy;
+	policy_base_t base;
+	mach_msg_type_number_t baseCnt;
+	policy_limit_t limit;
+	mach_msg_type_number_t limitCnt;
+	boolean_t change;
+{ return task_set_policy(task, pset, policy, base, baseCnt, limit, limitCnt, change); }
+#else
+(
+	task_t task,
+	processor_set_t pset,
+	policy_t policy,
+	policy_base_t base,
+	mach_msg_type_number_t baseCnt,
+	policy_limit_t limit,
+	mach_msg_type_number_t limitCnt,
+	boolean_t change
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_policy */
+mig_internal novalue _Xtask_set_policy
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t pset;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		policy_t policy;
+		mach_msg_type_number_t baseCnt;
+		integer_t base[5];
+		mach_msg_type_number_t limitCnt;
+		integer_t limit[1];
+		boolean_t change;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_set_policy_t __Request;
+	typedef __Reply__task_set_policy_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Request *In1P = NULL;
+	Request *In2P = NULL;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_set_policy_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_set_policy_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t task;
+	processor_set_t pset;
+
+	__DeclareRcvRpc(3432, "task_set_policy")
+	__BeforeRcvRpc(3432, "task_set_policy")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_set_policy_t__defined)
+	check_result = __MIG_check__Request__task_set_policy_t((__Request *)In0P, (__Request **)&In1P, (__Request **)&In2P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_set_policy_t__defined) */
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	pset = convert_port_to_pset(In0P->pset.name);
+
+	OutP->RetCode = task_set_policy(task, pset, In0P->policy, In0P->base, In0P->baseCnt, In1P->limit, In1P->limitCnt, In2P->change);
+	pset_deallocate(pset);
+	task_deallocate(task);
+#if	__MigKernelSpecificCode
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	if (IP_VALID((ipc_port_t)In0P->pset.name))
+		ipc_port_release_send((ipc_port_t)In0P->pset.name);
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3432, "task_set_policy")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_get_state_t__defined)
+#define __MIG_check__Request__task_get_state_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_get_state_t(__attribute__((__unused__)) __Request__task_get_state_t *In0P)
+{
+
+	typedef __Request__task_get_state_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_get_state_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_get_state */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_state
+#if	defined(LINTLIBRARY)
+    (task, flavor, old_state, old_stateCnt)
+	task_t task;
+	thread_state_flavor_t flavor;
+	thread_state_t old_state;
+	mach_msg_type_number_t *old_stateCnt;
+{ return task_get_state(task, flavor, old_state, old_stateCnt); }
+#else
+(
+	task_t task,
+	thread_state_flavor_t flavor,
+	thread_state_t old_state,
+	mach_msg_type_number_t *old_stateCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_state */
+mig_internal novalue _Xtask_get_state
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		thread_state_flavor_t flavor;
+		mach_msg_type_number_t old_stateCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_get_state_t __Request;
+	typedef __Reply__task_get_state_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_get_state_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_get_state_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t task;
+
+	__DeclareRcvRpc(3433, "task_get_state")
+	__BeforeRcvRpc(3433, "task_get_state")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_get_state_t__defined)
+	check_result = __MIG_check__Request__task_get_state_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_get_state_t__defined) */
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->old_stateCnt = 32;
+	if (In0P->old_stateCnt < OutP->old_stateCnt)
+		OutP->old_stateCnt = In0P->old_stateCnt;
+
+	OutP->RetCode = task_get_state(task, In0P->flavor, OutP->old_state, &OutP->old_stateCnt);
+	task_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+	OutP->Head.msgh_size = (sizeof(Reply) - 128) + (_WALIGN_((4 * OutP->old_stateCnt)));
+
+	__AfterRcvRpc(3433, "task_get_state")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_set_state_t__defined)
+#define __MIG_check__Request__task_set_state_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_set_state_t(__attribute__((__unused__)) __Request__task_set_state_t *In0P)
+{
+
+	typedef __Request__task_set_state_t __Request;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	msgh_size = In0P->Head.msgh_size;
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (msgh_size < (sizeof(__Request) - 128)) ||  (msgh_size > (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if defined(__NDR_convert__int_rep__Request__task_set_state_t__new_stateCnt__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep)
+		__NDR_convert__int_rep__Request__task_set_state_t__new_stateCnt(&In0P->new_stateCnt, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__task_set_state_t__new_stateCnt__defined */
+#if	__MigTypeCheck
+	if ( In0P->new_stateCnt > 32 )
+		return MIG_BAD_ARGUMENTS;
+	if (((msgh_size - (sizeof(__Request) - 128)) / 4 < In0P->new_stateCnt) ||
+	    (msgh_size != (sizeof(__Request) - 128) + _WALIGN_(4 * In0P->new_stateCnt)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_set_state_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_set_state */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_state
+#if	defined(LINTLIBRARY)
+    (task, flavor, new_state, new_stateCnt)
+	task_t task;
+	thread_state_flavor_t flavor;
+	thread_state_t new_state;
+	mach_msg_type_number_t new_stateCnt;
+{ return task_set_state(task, flavor, new_state, new_stateCnt); }
+#else
+(
+	task_t task,
+	thread_state_flavor_t flavor,
+	thread_state_t new_state,
+	mach_msg_type_number_t new_stateCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_state */
+mig_internal novalue _Xtask_set_state
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		thread_state_flavor_t flavor;
+		mach_msg_type_number_t new_stateCnt;
+		natural_t new_state[32];
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_set_state_t __Request;
+	typedef __Reply__task_set_state_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_set_state_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_set_state_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t task;
+
+	__DeclareRcvRpc(3434, "task_set_state")
+	__BeforeRcvRpc(3434, "task_set_state")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_set_state_t__defined)
+	check_result = __MIG_check__Request__task_set_state_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_set_state_t__defined) */
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_set_state(task, In0P->flavor, In0P->new_state, In0P->new_stateCnt);
+	task_deallocate(task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3434, "task_set_state")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_set_phys_footprint_limit_t__defined)
+#define __MIG_check__Request__task_set_phys_footprint_limit_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_set_phys_footprint_limit_t(__attribute__((__unused__)) __Request__task_set_phys_footprint_limit_t *In0P)
+{
+
+	typedef __Request__task_set_phys_footprint_limit_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_set_phys_footprint_limit_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_set_phys_footprint_limit */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_phys_footprint_limit
+#if	defined(LINTLIBRARY)
+    (task, new_limit, old_limit)
+	task_t task;
+	int new_limit;
+	int *old_limit;
+{ return task_set_phys_footprint_limit(task, new_limit, old_limit); }
+#else
+(
+	task_t task,
+	int new_limit,
+	int *old_limit
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_phys_footprint_limit */
+mig_internal novalue _Xtask_set_phys_footprint_limit
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int new_limit;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_set_phys_footprint_limit_t __Request;
+	typedef __Reply__task_set_phys_footprint_limit_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_set_phys_footprint_limit_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_set_phys_footprint_limit_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t task;
+
+	__DeclareRcvRpc(3435, "task_set_phys_footprint_limit")
+	__BeforeRcvRpc(3435, "task_set_phys_footprint_limit")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_set_phys_footprint_limit_t__defined)
+	check_result = __MIG_check__Request__task_set_phys_footprint_limit_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_set_phys_footprint_limit_t__defined) */
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_set_phys_footprint_limit(task, In0P->new_limit, &OutP->old_limit);
+	task_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3435, "task_set_phys_footprint_limit")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_suspend2_t__defined)
+#define __MIG_check__Request__task_suspend2_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_suspend2_t(__attribute__((__unused__)) __Request__task_suspend2_t *In0P)
+{
+
+	typedef __Request__task_suspend2_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_suspend2_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_suspend2 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_suspend2
+#if	defined(LINTLIBRARY)
+    (target_task, suspend_token)
+	task_t target_task;
+	task_suspension_token_t *suspend_token;
+{ return task_suspend2(target_task, suspend_token); }
+#else
+(
+	task_t target_task,
+	task_suspension_token_t *suspend_token
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_suspend2 */
+mig_internal novalue _Xtask_suspend2
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_suspend2_t __Request;
+	typedef __Reply__task_suspend2_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_suspend2_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_suspend2_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t suspend_tokenTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 18,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t suspend_tokenTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 18,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	task_t target_task;
+	task_suspension_token_t suspend_token;
+
+	__DeclareRcvRpc(3436, "task_suspend2")
+	__BeforeRcvRpc(3436, "task_suspend2")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_suspend2_t__defined)
+	check_result = __MIG_check__Request__task_suspend2_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_suspend2_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->suspend_token = suspend_tokenTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->suspend_token.disposition = 18;
+#else
+	OutP->suspend_token.disposition = 18;
+#endif /* __MigKernelSpecificCode */
+	OutP->suspend_token.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	target_task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	RetCode = task_suspend2(target_task, &suspend_token);
+	task_deallocate(target_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->suspend_token.name = (mach_port_t)convert_task_suspension_token_to_port(suspend_token);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3436, "task_suspend2")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_resume2_t__defined)
+#define __MIG_check__Request__task_resume2_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_resume2_t(__attribute__((__unused__)) __Request__task_resume2_t *In0P)
+{
+
+	typedef __Request__task_resume2_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_resume2_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_resume2 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_resume2
+#if	defined(LINTLIBRARY)
+    (suspend_token)
+	task_suspension_token_t suspend_token;
+{ return task_resume2(suspend_token); }
+#else
+(
+	task_suspension_token_t suspend_token
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_resume2 */
+mig_internal novalue _Xtask_resume2
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_resume2_t __Request;
+	typedef __Reply__task_resume2_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_resume2_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_resume2_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	__DeclareRcvRpc(3437, "task_resume2")
+	__BeforeRcvRpc(3437, "task_resume2")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_resume2_t__defined)
+	check_result = __MIG_check__Request__task_resume2_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_resume2_t__defined) */
+
+	OutP->RetCode = task_resume2(convert_port_to_task_suspension_token(In0P->Head.msgh_request_port));
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3437, "task_resume2")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_purgable_info_t__defined)
+#define __MIG_check__Request__task_purgable_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_purgable_info_t(__attribute__((__unused__)) __Request__task_purgable_info_t *In0P)
+{
+
+	typedef __Request__task_purgable_info_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_purgable_info_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_purgable_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_purgable_info
+#if	defined(LINTLIBRARY)
+    (task, stats)
+	task_t task;
+	task_purgable_info_t *stats;
+{ return task_purgable_info(task, stats); }
+#else
+(
+	task_t task,
+	task_purgable_info_t *stats
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_purgable_info */
+mig_internal novalue _Xtask_purgable_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_purgable_info_t __Request;
+	typedef __Reply__task_purgable_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_purgable_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_purgable_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t task;
+
+	__DeclareRcvRpc(3438, "task_purgable_info")
+	__BeforeRcvRpc(3438, "task_purgable_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_purgable_info_t__defined)
+	check_result = __MIG_check__Request__task_purgable_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_purgable_info_t__defined) */
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_purgable_info(task, &OutP->stats);
+	task_deallocate(task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3438, "task_purgable_info")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_get_mach_voucher_t__defined)
+#define __MIG_check__Request__task_get_mach_voucher_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_get_mach_voucher_t(__attribute__((__unused__)) __Request__task_get_mach_voucher_t *In0P)
+{
+
+	typedef __Request__task_get_mach_voucher_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_get_mach_voucher_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_get_mach_voucher */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_mach_voucher
+#if	defined(LINTLIBRARY)
+    (task, which, voucher)
+	task_t task;
+	mach_voucher_selector_t which;
+	ipc_voucher_t *voucher;
+{ return task_get_mach_voucher(task, which, voucher); }
+#else
+(
+	task_t task,
+	mach_voucher_selector_t which,
+	ipc_voucher_t *voucher
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_mach_voucher */
+mig_internal novalue _Xtask_get_mach_voucher
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_voucher_selector_t which;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_get_mach_voucher_t __Request;
+	typedef __Reply__task_get_mach_voucher_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_get_mach_voucher_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_get_mach_voucher_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t voucherTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t voucherTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	task_t task;
+	ipc_voucher_t voucher;
+
+	__DeclareRcvRpc(3439, "task_get_mach_voucher")
+	__BeforeRcvRpc(3439, "task_get_mach_voucher")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_get_mach_voucher_t__defined)
+	check_result = __MIG_check__Request__task_get_mach_voucher_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_get_mach_voucher_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->voucher = voucherTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->voucher.disposition = 17;
+#else
+	OutP->voucher.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->voucher.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	RetCode = task_get_mach_voucher(task, In0P->which, &voucher);
+	task_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->voucher.name = (mach_port_t)convert_voucher_to_port(voucher);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3439, "task_get_mach_voucher")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_set_mach_voucher_t__defined)
+#define __MIG_check__Request__task_set_mach_voucher_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_set_mach_voucher_t(__attribute__((__unused__)) __Request__task_set_mach_voucher_t *In0P)
+{
+
+	typedef __Request__task_set_mach_voucher_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->voucher.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->voucher.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_set_mach_voucher_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_set_mach_voucher */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_mach_voucher
+#if	defined(LINTLIBRARY)
+    (task, voucher)
+	task_t task;
+	ipc_voucher_t voucher;
+{ return task_set_mach_voucher(task, voucher); }
+#else
+(
+	task_t task,
+	ipc_voucher_t voucher
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_mach_voucher */
+mig_internal novalue _Xtask_set_mach_voucher
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t voucher;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_set_mach_voucher_t __Request;
+	typedef __Reply__task_set_mach_voucher_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_set_mach_voucher_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_set_mach_voucher_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	task_t task;
+	ipc_voucher_t voucher;
+
+	__DeclareRcvRpc(3440, "task_set_mach_voucher")
+	__BeforeRcvRpc(3440, "task_set_mach_voucher")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_set_mach_voucher_t__defined)
+	check_result = __MIG_check__Request__task_set_mach_voucher_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_set_mach_voucher_t__defined) */
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	voucher = convert_port_to_voucher(In0P->voucher.name);
+
+	OutP->RetCode = task_set_mach_voucher(task, voucher);
+	ipc_voucher_release(voucher);
+	task_deallocate(task);
+#if	__MigKernelSpecificCode
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	if (IP_VALID((ipc_port_t)In0P->voucher.name))
+		ipc_port_release_send((ipc_port_t)In0P->voucher.name);
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3440, "task_set_mach_voucher")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__task_subsystem__
+#if !defined(__MIG_check__Request__task_swap_mach_voucher_t__defined)
+#define __MIG_check__Request__task_swap_mach_voucher_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_swap_mach_voucher_t(__attribute__((__unused__)) __Request__task_swap_mach_voucher_t *In0P)
+{
+
+	typedef __Request__task_swap_mach_voucher_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 2) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->new_voucher.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->new_voucher.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->old_voucher.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->old_voucher.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_swap_mach_voucher_t__defined) */
+#endif /* __MIG_check__Request__task_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_swap_mach_voucher */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_swap_mach_voucher
+#if	defined(LINTLIBRARY)
+    (task, new_voucher, old_voucher)
+	task_t task;
+	ipc_voucher_t new_voucher;
+	ipc_voucher_t *old_voucher;
+{ return task_swap_mach_voucher(task, new_voucher, old_voucher); }
+#else
+(
+	task_t task,
+	ipc_voucher_t new_voucher,
+	ipc_voucher_t *old_voucher
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_swap_mach_voucher */
+mig_internal novalue _Xtask_swap_mach_voucher
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_voucher;
+		mach_msg_port_descriptor_t old_voucher;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_swap_mach_voucher_t __Request;
+	typedef __Reply__task_swap_mach_voucher_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_swap_mach_voucher_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_swap_mach_voucher_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t old_voucherTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t old_voucherTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 19,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	task_t task;
+	ipc_voucher_t new_voucher;
+	ipc_voucher_t old_voucher;
+
+	__DeclareRcvRpc(3441, "task_swap_mach_voucher")
+	__BeforeRcvRpc(3441, "task_swap_mach_voucher")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_swap_mach_voucher_t__defined)
+	check_result = __MIG_check__Request__task_swap_mach_voucher_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_swap_mach_voucher_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->old_voucher = old_voucherTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->old_voucher.disposition = 17;
+#else
+	OutP->old_voucher.disposition = 19;
+#endif /* __MigKernelSpecificCode */
+	OutP->old_voucher.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	task = convert_port_to_task(In0P->Head.msgh_request_port);
+
+	new_voucher = convert_port_to_voucher(In0P->new_voucher.name);
+
+	old_voucher = convert_port_to_voucher(In0P->old_voucher.name);
+
+	RetCode = task_swap_mach_voucher(task, new_voucher, &old_voucher);
+	ipc_voucher_release(new_voucher);
+	task_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+
+	if (IP_VALID((ipc_port_t)In0P->old_voucher.name))
+		ipc_port_release_send((ipc_port_t)In0P->old_voucher.name);
+
+	if (IP_VALID((ipc_port_t)In0P->new_voucher.name))
+		ipc_port_release_send((ipc_port_t)In0P->new_voucher.name);
+#endif /* __MigKernelSpecificCode */
+	OutP->old_voucher.name = (mach_port_t)convert_voucher_to_port(old_voucher);
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3441, "task_swap_mach_voucher")
+}
+
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+boolean_t task_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+mig_routine_t task_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+extern const struct task_subsystem task_subsystem;
+const struct task_subsystem {
+	mig_server_routine_t 	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[42];
+} task_subsystem = {
+	task_server_routine,
+	3400,
+	3442,
+	(mach_msg_size_t)sizeof(union __ReplyUnion__task_subsystem),
+	(vm_address_t)0,
+	{
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_create, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_create_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_terminate, 1, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_terminate_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_threads, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_threads_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_ports_register, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_ports_register_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_ports_lookup, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_ports_lookup_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_info, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_info_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_set_info, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_set_info_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_suspend, 1, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_suspend_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_resume, 1, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_resume_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_get_special_port, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_get_special_port_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_set_special_port, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_set_special_port_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xthread_create_from_user, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__thread_create_from_user_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xthread_create_running_from_user, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__thread_create_running_from_user_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_set_exception_ports, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_set_exception_ports_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_get_exception_ports, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_get_exception_ports_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_swap_exception_ports, 10, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_swap_exception_ports_t) },
+		{0, 0, 0, 0, 0, 0},
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xsemaphore_create, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__semaphore_create_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xsemaphore_destroy, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__semaphore_destroy_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_policy_set, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_policy_set_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_policy_get, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_policy_get_t) },
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_policy, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_policy_t) },
+		{0, 0, 0, 0, 0, 0},
+		{0, 0, 0, 0, 0, 0},
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_set_ras_pc, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_set_ras_pc_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_zone_info, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_zone_info_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_assign, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_assign_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_assign_default, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_assign_default_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_get_assignment, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_get_assignment_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_set_policy, 8, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_set_policy_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_get_state, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_get_state_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_set_state, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_set_state_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_set_phys_footprint_limit, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_set_phys_footprint_limit_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_suspend2, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_suspend2_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_resume2, 1, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_resume2_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_purgable_info, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_purgable_info_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_get_mach_voucher, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_get_mach_voucher_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_set_mach_voucher, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_set_mach_voucher_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_swap_mach_voucher, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_swap_mach_voucher_t) },
+	}
+};
+
+mig_external boolean_t task_server
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	register mig_routine_t routine;
+
+	OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0);
+	OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port;
+	/* Minimal size: routine() will update it if different */
+	OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t);
+	OutHeadP->msgh_local_port = MACH_PORT_NULL;
+	OutHeadP->msgh_id = InHeadP->msgh_id + 100;
+
+	if ((InHeadP->msgh_id > 3441) || (InHeadP->msgh_id < 3400) ||
+	    ((routine = task_subsystem.routine[InHeadP->msgh_id - 3400].stub_routine) == 0)) {
+		((mig_reply_error_t *)OutHeadP)->NDR = NDR_record;
+		((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID;
+		return FALSE;
+	}
+	(*routine) (InHeadP, OutHeadP);
+	return TRUE;
+}
+
+mig_external mig_routine_t task_server_routine
+	(mach_msg_header_t *InHeadP)
+{
+	register int msgh_id;
+
+	msgh_id = InHeadP->msgh_id - 3400;
+
+	if ((msgh_id > 41) || (msgh_id < 0))
+		return 0;
+
+	return task_subsystem.routine[msgh_id].stub_routine;
+}


Property changes on: trunk/sys/compat/mach/task_server.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/compat/mach/vm_map_server.c
===================================================================
--- trunk/sys/compat/mach/vm_map_server.c	                        (rev 0)
+++ trunk/sys/compat/mach/vm_map_server.c	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,4444 @@
+/*
+ * IDENTIFICATION:
+ * stub generated Thu Jun 11 18:17:45 2015
+ * with a MiG generated Thu Jun 11 16:16:11 PDT 2015 by kmacy at serenity
+ * OPTIONS: 
+ *	KernelServer
+ */
+
+/* Module vm_map */
+
+#define	__MIG_check__Request__vm_map_subsystem__ 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#ifdef _KERNEL
+#include <sys/mach/ndr.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#else /* !_KERNEL */
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#endif /*_KERNEL */
+
+#include <sys/mach/std_types.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc_mig.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach_debug/mach_debug_types.h>
+#include <sys/mach/vm_types.h>
+
+#ifndef	mig_internal
+#define	mig_internal	static __inline__
+#endif	/* mig_internal */
+
+#ifndef	mig_external
+#define mig_external
+#endif	/* mig_external */
+
+#if	!defined(__MigTypeCheck) && defined(TypeCheck)
+#define	__MigTypeCheck		TypeCheck	/* Legacy setting */
+#endif	/* !defined(__MigTypeCheck) */
+
+#if	!defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
+#define	__MigKernelSpecificCode	_MIG_KERNEL_SPECIFIC_CODE_	/* Legacy setting */
+#endif	/* !defined(__MigKernelSpecificCode) */
+
+#ifndef	LimitCheck
+#define	LimitCheck 0
+#endif	/* LimitCheck */
+
+#ifndef	min
+#define	min(a,b)  ( ((a) < (b))? (a): (b) )
+#endif	/* min */
+
+#if !defined(_WALIGN_)
+#define _WALIGN_(x) (((x) + 7) & ~7)
+#endif /* !defined(_WALIGN_) */
+
+#if !defined(_WALIGNSZ_)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#endif /* !defined(_WALIGNSZ_) */
+
+#ifndef	UseStaticTemplates
+#define	UseStaticTemplates	1
+#endif	/* UseStaticTemplates */
+
+#define _WALIGN_(x) (((x) + 7) & ~7)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#ifndef	__DeclareRcvRpc
+#define	__DeclareRcvRpc(_NUM_, _NAME_)
+#endif	/* __DeclareRcvRpc */
+
+#ifndef	__BeforeRcvRpc
+#define	__BeforeRcvRpc(_NUM_, _NAME_)
+#endif	/* __BeforeRcvRpc */
+
+#ifndef	__AfterRcvRpc
+#define	__AfterRcvRpc(_NUM_, _NAME_)
+#endif	/* __AfterRcvRpc */
+
+#ifndef	__DeclareRcvSimple
+#define	__DeclareRcvSimple(_NUM_, _NAME_)
+#endif	/* __DeclareRcvSimple */
+
+#ifndef	__BeforeRcvSimple
+#define	__BeforeRcvSimple(_NUM_, _NAME_)
+#endif	/* __BeforeRcvSimple */
+
+#ifndef	__AfterRcvSimple
+#define	__AfterRcvSimple(_NUM_, _NAME_)
+#endif	/* __AfterRcvSimple */
+
+#define novalue void
+#if	__MigKernelSpecificCode
+#define msgh_request_port	msgh_remote_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_REMOTE(bits)
+#define msgh_reply_port		msgh_local_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#else
+#define msgh_request_port	msgh_local_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#define msgh_reply_port		msgh_remote_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_REMOTE(bits)
+#endif /* __MigKernelSpecificCode */
+
+#define MIG_RETURN_ERROR(X, code)	{\
+				((mig_reply_error_t *)X)->RetCode = code;\
+				((mig_reply_error_t *)X)->NDR = NDR_record;\
+				return;\
+				}
+
+/* typedefs for all requests */
+
+#ifndef __Request__vm_map_subsystem__defined
+#define __Request__vm_map_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_region_flavor_t flavor;
+		mach_msg_type_number_t infoCnt;
+	} __Request__vm_region_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		int flags;
+	} __Request__vm_allocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+	} __Request__vm_deallocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		boolean_t set_maximum;
+		vm_prot_t new_protection;
+	} __Request__vm_protect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_inherit_t new_inheritance;
+	} __Request__vm_inherit_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+	} __Request__vm_read_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_read_entry_t data_list;
+		natural_t count;
+	} __Request__vm_read_list_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		mach_msg_type_number_t dataCnt;
+	} __Request__vm_write_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t source_address;
+		vm_size_t size;
+		vm_address_t dest_address;
+	} __Request__vm_copy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_address_t data;
+	} __Request__vm_read_overwrite_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_sync_t sync_flags;
+	} __Request__vm_msync_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_behavior_t new_behavior;
+	} __Request__vm_behavior_set_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_machine_attribute_t attribute;
+		vm_machine_attribute_val_t value;
+	} __Request__vm_machine_attribute_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t src_task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t target_address;
+		vm_size_t size;
+		vm_address_t mask;
+		int flags;
+		vm_address_t src_address;
+		boolean_t copy;
+		vm_inherit_t inheritance;
+	} __Request__vm_remap_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t must_wire;
+	} __Request__task_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t parent_entry;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_size_t size;
+		vm_offset_t offset;
+		vm_prot_t permission;
+	} __Request__mach_make_memory_entry_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_offset_t offset;
+	} __Request__vm_map_page_query_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+	} __Request__mach_vm_region_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__vm_mapped_pages_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+	} __Request__vm_region_recurse_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+	} __Request__vm_region_recurse_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+	} __Request__mach_vm_region_info_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_region_flavor_t flavor;
+		mach_msg_type_number_t infoCnt;
+	} __Request__vm_region_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t parent_entry;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		memory_object_size_t size;
+		memory_object_offset_t offset;
+		vm_prot_t permission;
+	} __Request__mach_make_memory_entry_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_purgable_t control;
+		int state;
+	} __Request__vm_purgable_control_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__vm_map_subsystem__defined */
+
+/* typedefs for all replies */
+
+#ifndef __Reply__vm_map_subsystem__defined
+#define __Reply__vm_map_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t object_name;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		mach_msg_type_number_t infoCnt;
+		int info[10];
+	} __Reply__vm_region_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_address_t address;
+	} __Reply__vm_allocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_deallocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_protect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_inherit_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t dataCnt;
+	} __Reply__vm_read_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_read_entry_t data_list;
+	} __Reply__vm_read_list_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_write_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_copy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_size_t outsize;
+	} __Reply__vm_read_overwrite_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_msync_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_behavior_set_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_machine_attribute_val_t value;
+	} __Reply__vm_machine_attribute_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_address_t target_address;
+		vm_prot_t cur_protection;
+		vm_prot_t max_protection;
+	} __Reply__vm_remap_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t object_handle;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_size_t size;
+	} __Reply__mach_make_memory_entry_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		integer_t disposition;
+		integer_t ref_count;
+	} __Reply__vm_map_page_query_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t objects;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_info_region_t region;
+		mach_msg_type_number_t objectsCnt;
+	} __Reply__mach_vm_region_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t pages;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t pagesCnt;
+	} __Reply__vm_mapped_pages_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_address_t address;
+		vm_size_t size;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+		int info[19];
+	} __Reply__vm_region_recurse_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_address_t address;
+		vm_size_t size;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+		int info[19];
+	} __Reply__vm_region_recurse_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t objects;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_info_region_64_t region;
+		mach_msg_type_number_t objectsCnt;
+	} __Reply__mach_vm_region_info_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t object_name;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		mach_msg_type_number_t infoCnt;
+		int info[10];
+	} __Reply__vm_region_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t object_handle;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		memory_object_size_t size;
+	} __Reply__mach_make_memory_entry_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int state;
+	} __Reply__vm_purgable_control_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__vm_map_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__vm_map_subsystem__defined
+#define __ReplyUnion__vm_map_subsystem__defined
+union __ReplyUnion__vm_map_subsystem {
+	__Reply__vm_region_t Reply_vm_region;
+	__Reply__vm_allocate_t Reply_vm_allocate;
+	__Reply__vm_deallocate_t Reply_vm_deallocate;
+	__Reply__vm_protect_t Reply_vm_protect;
+	__Reply__vm_inherit_t Reply_vm_inherit;
+	__Reply__vm_read_t Reply_vm_read;
+	__Reply__vm_read_list_t Reply_vm_read_list;
+	__Reply__vm_write_t Reply_vm_write;
+	__Reply__vm_copy_t Reply_vm_copy;
+	__Reply__vm_read_overwrite_t Reply_vm_read_overwrite;
+	__Reply__vm_msync_t Reply_vm_msync;
+	__Reply__vm_behavior_set_t Reply_vm_behavior_set;
+	__Reply__vm_machine_attribute_t Reply_vm_machine_attribute;
+	__Reply__vm_remap_t Reply_vm_remap;
+	__Reply__task_wire_t Reply_task_wire;
+	__Reply__mach_make_memory_entry_t Reply_mach_make_memory_entry;
+	__Reply__vm_map_page_query_t Reply_vm_map_page_query;
+	__Reply__mach_vm_region_info_t Reply_mach_vm_region_info;
+	__Reply__vm_mapped_pages_info_t Reply_vm_mapped_pages_info;
+	__Reply__vm_region_recurse_t Reply_vm_region_recurse;
+	__Reply__vm_region_recurse_64_t Reply_vm_region_recurse_64;
+	__Reply__mach_vm_region_info_64_t Reply_mach_vm_region_info_64;
+	__Reply__vm_region_64_t Reply_vm_region_64;
+	__Reply__mach_make_memory_entry_64_t Reply_mach_make_memory_entry_64;
+	__Reply__vm_purgable_control_t Reply_vm_purgable_control;
+};
+#endif /* __RequestUnion__vm_map_subsystem__defined */
+/* Forward Declarations */
+
+
+mig_internal novalue _Xvm_region
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_allocate
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_deallocate
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_protect
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_inherit
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_read
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_read_list
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_write
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_copy
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_read_overwrite
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_msync
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_behavior_set
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_machine_attribute
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_remap
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xtask_wire
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_make_memory_entry
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_map_page_query
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_region_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_mapped_pages_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_region_recurse
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_region_recurse_64
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_vm_region_info_64
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_region_64
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xmach_make_memory_entry_64
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xvm_purgable_control
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_region_t__defined)
+#define __MIG_check__Request__vm_region_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_region_t(__attribute__((__unused__)) __Request__vm_region_t *In0P)
+{
+
+	typedef __Request__vm_region_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_region_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_region */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_region
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, flavor, info, infoCnt, object_name)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t *size;
+	vm_region_flavor_t flavor;
+	vm_region_info_t info;
+	mach_msg_type_number_t *infoCnt;
+	mach_port_t *object_name;
+{ return vm_region(target_task, address, size, flavor, info, infoCnt, object_name); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t *size,
+	vm_region_flavor_t flavor,
+	vm_region_info_t info,
+	mach_msg_type_number_t *infoCnt,
+	mach_port_t *object_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_region */
+mig_internal novalue _Xvm_region
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_region_flavor_t flavor;
+		mach_msg_type_number_t infoCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_region_t __Request;
+	typedef __Reply__vm_region_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_region_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_region_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t object_nameTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t object_nameTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3800, "vm_region")
+	__BeforeRcvRpc(3800, "vm_region")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_region_t__defined)
+	check_result = __MIG_check__Request__vm_region_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_region_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->object_name = object_nameTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->object_name.disposition = 17;
+#else
+	OutP->object_name.disposition = 17;
+#endif /* __MigKernelSpecificCode */
+	OutP->object_name.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->infoCnt = 10;
+	if (In0P->infoCnt < OutP->infoCnt)
+		OutP->infoCnt = In0P->infoCnt;
+
+	RetCode = vm_region(target_task, &In0P->address, &OutP->size, In0P->flavor, OutP->info, &OutP->infoCnt, &OutP->object_name.name);
+	vm_map_deallocate(target_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->address = In0P->address;
+	OutP->Head.msgh_size = (sizeof(Reply) - 40) + (_WALIGN_((4 * OutP->infoCnt)));
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3800, "vm_region")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_allocate_t__defined)
+#define __MIG_check__Request__vm_allocate_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_allocate_t(__attribute__((__unused__)) __Request__vm_allocate_t *In0P)
+{
+
+	typedef __Request__vm_allocate_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_allocate_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_allocate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_allocate
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, flags)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t size;
+	int flags;
+{ return vm_allocate(target_task, address, size, flags); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t size,
+	int flags
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_allocate */
+mig_internal novalue _Xvm_allocate
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		int flags;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_allocate_t __Request;
+	typedef __Reply__vm_allocate_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_allocate_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_allocate_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3801, "vm_allocate")
+	__BeforeRcvRpc(3801, "vm_allocate")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_allocate_t__defined)
+	check_result = __MIG_check__Request__vm_allocate_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_allocate_t__defined) */
+
+	target_task = convert_port_entry_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = vm_allocate(target_task, &In0P->address, In0P->size, In0P->flags);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->address = In0P->address;
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3801, "vm_allocate")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_deallocate_t__defined)
+#define __MIG_check__Request__vm_deallocate_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_deallocate_t(__attribute__((__unused__)) __Request__vm_deallocate_t *In0P)
+{
+
+	typedef __Request__vm_deallocate_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_deallocate_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_deallocate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_deallocate
+#if	defined(LINTLIBRARY)
+    (target_task, address, size)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+{ return vm_deallocate(target_task, address, size); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_deallocate */
+mig_internal novalue _Xvm_deallocate
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_deallocate_t __Request;
+	typedef __Reply__vm_deallocate_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_deallocate_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_deallocate_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3802, "vm_deallocate")
+	__BeforeRcvRpc(3802, "vm_deallocate")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_deallocate_t__defined)
+	check_result = __MIG_check__Request__vm_deallocate_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_deallocate_t__defined) */
+
+	target_task = convert_port_entry_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = vm_deallocate(target_task, In0P->address, In0P->size);
+	vm_map_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3802, "vm_deallocate")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_protect_t__defined)
+#define __MIG_check__Request__vm_protect_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_protect_t(__attribute__((__unused__)) __Request__vm_protect_t *In0P)
+{
+
+	typedef __Request__vm_protect_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_protect_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_protect */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_protect
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, set_maximum, new_protection)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	boolean_t set_maximum;
+	vm_prot_t new_protection;
+{ return vm_protect(target_task, address, size, set_maximum, new_protection); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	boolean_t set_maximum,
+	vm_prot_t new_protection
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_protect */
+mig_internal novalue _Xvm_protect
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		boolean_t set_maximum;
+		vm_prot_t new_protection;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_protect_t __Request;
+	typedef __Reply__vm_protect_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_protect_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_protect_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3803, "vm_protect")
+	__BeforeRcvRpc(3803, "vm_protect")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_protect_t__defined)
+	check_result = __MIG_check__Request__vm_protect_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_protect_t__defined) */
+
+	target_task = convert_port_entry_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = vm_protect(target_task, In0P->address, In0P->size, In0P->set_maximum, In0P->new_protection);
+	vm_map_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3803, "vm_protect")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_inherit_t__defined)
+#define __MIG_check__Request__vm_inherit_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_inherit_t(__attribute__((__unused__)) __Request__vm_inherit_t *In0P)
+{
+
+	typedef __Request__vm_inherit_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_inherit_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_inherit */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_inherit
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, new_inheritance)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_inherit_t new_inheritance;
+{ return vm_inherit(target_task, address, size, new_inheritance); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_inherit_t new_inheritance
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_inherit */
+mig_internal novalue _Xvm_inherit
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_inherit_t new_inheritance;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_inherit_t __Request;
+	typedef __Reply__vm_inherit_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_inherit_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_inherit_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3804, "vm_inherit")
+	__BeforeRcvRpc(3804, "vm_inherit")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_inherit_t__defined)
+	check_result = __MIG_check__Request__vm_inherit_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_inherit_t__defined) */
+
+	target_task = convert_port_entry_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = vm_inherit(target_task, In0P->address, In0P->size, In0P->new_inheritance);
+	vm_map_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3804, "vm_inherit")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_read_t__defined)
+#define __MIG_check__Request__vm_read_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_read_t(__attribute__((__unused__)) __Request__vm_read_t *In0P)
+{
+
+	typedef __Request__vm_read_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_read_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_read */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_read
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, data, dataCnt)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_offset_t *data;
+	mach_msg_type_number_t *dataCnt;
+{ return vm_read(target_task, address, size, data, dataCnt); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_offset_t *data,
+	mach_msg_type_number_t *dataCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_read */
+mig_internal novalue _Xvm_read
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_read_t __Request;
+	typedef __Reply__vm_read_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_read_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_read_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t dataTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t dataTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3805, "vm_read")
+	__BeforeRcvRpc(3805, "vm_read")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_read_t__defined)
+	check_result = __MIG_check__Request__vm_read_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_read_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->data = dataTemplate;
+#else	/* UseStaticTemplates */
+	OutP->data.deallocate =  FALSE;
+	OutP->data.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->data.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	RetCode = vm_read(target_task, In0P->address, In0P->size, (vm_offset_t *)&(OutP->data.address), &OutP->dataCnt);
+	vm_map_deallocate(target_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->data.size = OutP->dataCnt;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3805, "vm_read")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_read_list_t__defined)
+#define __MIG_check__Request__vm_read_list_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_read_list_t(__attribute__((__unused__)) __Request__vm_read_list_t *In0P)
+{
+
+	typedef __Request__vm_read_list_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_read_list_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_read_list */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_read_list
+#if	defined(LINTLIBRARY)
+    (target_task, data_list, count)
+	vm_map_t target_task;
+	vm_read_entry_t data_list;
+	natural_t count;
+{ return vm_read_list(target_task, data_list, count); }
+#else
+(
+	vm_map_t target_task,
+	vm_read_entry_t data_list,
+	natural_t count
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_read_list */
+mig_internal novalue _Xvm_read_list
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_read_entry_t data_list;
+		natural_t count;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_read_list_t __Request;
+	typedef __Reply__vm_read_list_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_read_list_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_read_list_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3806, "vm_read_list")
+	__BeforeRcvRpc(3806, "vm_read_list")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_read_list_t__defined)
+	check_result = __MIG_check__Request__vm_read_list_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_read_list_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = vm_read_list(target_task, In0P->data_list, In0P->count);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	{   typedef struct { char data[4096]; } *sp;
+	    * (sp) OutP->data_list = * (sp) In0P->data_list;
+	}
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3806, "vm_read_list")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_write_t__defined)
+#define __MIG_check__Request__vm_write_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_write_t(__attribute__((__unused__)) __Request__vm_write_t *In0P)
+{
+
+	typedef __Request__vm_write_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->data.type != MACH_MSG_OOL_DESCRIPTOR)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+#if __MigTypeCheck
+	if (In0P->data.size != In0P->dataCnt)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_write_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_write */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_write
+#if	defined(LINTLIBRARY)
+    (target_task, address, data, dataCnt)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_offset_t data;
+	mach_msg_type_number_t dataCnt;
+{ return vm_write(target_task, address, data, dataCnt); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_offset_t data,
+	mach_msg_type_number_t dataCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_write */
+mig_internal novalue _Xvm_write
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		mach_msg_type_number_t dataCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_write_t __Request;
+	typedef __Reply__vm_write_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_write_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_write_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3807, "vm_write")
+	__BeforeRcvRpc(3807, "vm_write")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_write_t__defined)
+	check_result = __MIG_check__Request__vm_write_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_write_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = vm_write(target_task, In0P->address, (vm_offset_t)(In0P->data.address), In0P->dataCnt);
+	vm_map_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3807, "vm_write")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_copy_t__defined)
+#define __MIG_check__Request__vm_copy_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_copy_t(__attribute__((__unused__)) __Request__vm_copy_t *In0P)
+{
+
+	typedef __Request__vm_copy_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_copy_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_copy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_copy
+#if	defined(LINTLIBRARY)
+    (target_task, source_address, size, dest_address)
+	vm_map_t target_task;
+	vm_address_t source_address;
+	vm_size_t size;
+	vm_address_t dest_address;
+{ return vm_copy(target_task, source_address, size, dest_address); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t source_address,
+	vm_size_t size,
+	vm_address_t dest_address
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_copy */
+mig_internal novalue _Xvm_copy
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t source_address;
+		vm_size_t size;
+		vm_address_t dest_address;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_copy_t __Request;
+	typedef __Reply__vm_copy_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_copy_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_copy_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3808, "vm_copy")
+	__BeforeRcvRpc(3808, "vm_copy")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_copy_t__defined)
+	check_result = __MIG_check__Request__vm_copy_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_copy_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = vm_copy(target_task, In0P->source_address, In0P->size, In0P->dest_address);
+	vm_map_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3808, "vm_copy")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_read_overwrite_t__defined)
+#define __MIG_check__Request__vm_read_overwrite_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_read_overwrite_t(__attribute__((__unused__)) __Request__vm_read_overwrite_t *In0P)
+{
+
+	typedef __Request__vm_read_overwrite_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_read_overwrite_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_read_overwrite */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_read_overwrite
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, data, outsize)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_address_t data;
+	vm_size_t *outsize;
+{ return vm_read_overwrite(target_task, address, size, data, outsize); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_address_t data,
+	vm_size_t *outsize
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_read_overwrite */
+mig_internal novalue _Xvm_read_overwrite
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_address_t data;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_read_overwrite_t __Request;
+	typedef __Reply__vm_read_overwrite_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_read_overwrite_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_read_overwrite_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3809, "vm_read_overwrite")
+	__BeforeRcvRpc(3809, "vm_read_overwrite")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_read_overwrite_t__defined)
+	check_result = __MIG_check__Request__vm_read_overwrite_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_read_overwrite_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = vm_read_overwrite(target_task, In0P->address, In0P->size, In0P->data, &OutP->outsize);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3809, "vm_read_overwrite")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_msync_t__defined)
+#define __MIG_check__Request__vm_msync_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_msync_t(__attribute__((__unused__)) __Request__vm_msync_t *In0P)
+{
+
+	typedef __Request__vm_msync_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_msync_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_msync */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_msync
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, sync_flags)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_sync_t sync_flags;
+{ return vm_msync(target_task, address, size, sync_flags); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_sync_t sync_flags
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_msync */
+mig_internal novalue _Xvm_msync
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_sync_t sync_flags;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_msync_t __Request;
+	typedef __Reply__vm_msync_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_msync_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_msync_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3810, "vm_msync")
+	__BeforeRcvRpc(3810, "vm_msync")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_msync_t__defined)
+	check_result = __MIG_check__Request__vm_msync_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_msync_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = vm_msync(target_task, In0P->address, In0P->size, In0P->sync_flags);
+	vm_map_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3810, "vm_msync")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_behavior_set_t__defined)
+#define __MIG_check__Request__vm_behavior_set_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_behavior_set_t(__attribute__((__unused__)) __Request__vm_behavior_set_t *In0P)
+{
+
+	typedef __Request__vm_behavior_set_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_behavior_set_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_behavior_set */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_behavior_set
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, new_behavior)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_behavior_t new_behavior;
+{ return vm_behavior_set(target_task, address, size, new_behavior); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_behavior_t new_behavior
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_behavior_set */
+mig_internal novalue _Xvm_behavior_set
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_behavior_t new_behavior;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_behavior_set_t __Request;
+	typedef __Reply__vm_behavior_set_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_behavior_set_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_behavior_set_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3811, "vm_behavior_set")
+	__BeforeRcvRpc(3811, "vm_behavior_set")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_behavior_set_t__defined)
+	check_result = __MIG_check__Request__vm_behavior_set_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_behavior_set_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = vm_behavior_set(target_task, In0P->address, In0P->size, In0P->new_behavior);
+	vm_map_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3811, "vm_behavior_set")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_machine_attribute_t__defined)
+#define __MIG_check__Request__vm_machine_attribute_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_machine_attribute_t(__attribute__((__unused__)) __Request__vm_machine_attribute_t *In0P)
+{
+
+	typedef __Request__vm_machine_attribute_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_machine_attribute_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_machine_attribute */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_machine_attribute
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, attribute, value)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_machine_attribute_t attribute;
+	vm_machine_attribute_val_t *value;
+{ return vm_machine_attribute(target_task, address, size, attribute, value); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_machine_attribute_t attribute,
+	vm_machine_attribute_val_t *value
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_machine_attribute */
+mig_internal novalue _Xvm_machine_attribute
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_machine_attribute_t attribute;
+		vm_machine_attribute_val_t value;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_machine_attribute_t __Request;
+	typedef __Reply__vm_machine_attribute_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_machine_attribute_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_machine_attribute_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3813, "vm_machine_attribute")
+	__BeforeRcvRpc(3813, "vm_machine_attribute")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_machine_attribute_t__defined)
+	check_result = __MIG_check__Request__vm_machine_attribute_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_machine_attribute_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = vm_machine_attribute(target_task, In0P->address, In0P->size, In0P->attribute, &In0P->value);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->value = In0P->value;
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3813, "vm_machine_attribute")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_remap_t__defined)
+#define __MIG_check__Request__vm_remap_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_remap_t(__attribute__((__unused__)) __Request__vm_remap_t *In0P)
+{
+
+	typedef __Request__vm_remap_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->src_task.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->src_task.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_remap_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_remap */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_remap
+#if	defined(LINTLIBRARY)
+    (target_task, target_address, size, mask, flags, src_task, src_address, copy, cur_protection, max_protection, inheritance)
+	vm_map_t target_task;
+	vm_address_t *target_address;
+	vm_size_t size;
+	vm_address_t mask;
+	int flags;
+	vm_map_t src_task;
+	vm_address_t src_address;
+	boolean_t copy;
+	vm_prot_t *cur_protection;
+	vm_prot_t *max_protection;
+	vm_inherit_t inheritance;
+{ return vm_remap(target_task, target_address, size, mask, flags, src_task, src_address, copy, cur_protection, max_protection, inheritance); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *target_address,
+	vm_size_t size,
+	vm_address_t mask,
+	int flags,
+	vm_map_t src_task,
+	vm_address_t src_address,
+	boolean_t copy,
+	vm_prot_t *cur_protection,
+	vm_prot_t *max_protection,
+	vm_inherit_t inheritance
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_remap */
+mig_internal novalue _Xvm_remap
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t src_task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t target_address;
+		vm_size_t size;
+		vm_address_t mask;
+		int flags;
+		vm_address_t src_address;
+		boolean_t copy;
+		vm_inherit_t inheritance;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_remap_t __Request;
+	typedef __Reply__vm_remap_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_remap_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_remap_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+	vm_map_t src_task;
+
+	__DeclareRcvRpc(3814, "vm_remap")
+	__BeforeRcvRpc(3814, "vm_remap")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_remap_t__defined)
+	check_result = __MIG_check__Request__vm_remap_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_remap_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	src_task = convert_port_to_map(In0P->src_task.name);
+
+	OutP->RetCode = vm_remap(target_task, &In0P->target_address, In0P->size, In0P->mask, In0P->flags, src_task, In0P->src_address, In0P->copy, &OutP->cur_protection, &OutP->max_protection, In0P->inheritance);
+	vm_map_deallocate(src_task);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+
+	if (IP_VALID((ipc_port_t)In0P->src_task.name))
+		ipc_port_release_send((ipc_port_t)In0P->src_task.name);
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->target_address = In0P->target_address;
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3814, "vm_remap")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__task_wire_t__defined)
+#define __MIG_check__Request__task_wire_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__task_wire_t(__attribute__((__unused__)) __Request__task_wire_t *In0P)
+{
+
+	typedef __Request__task_wire_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__task_wire_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine task_wire */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_wire
+#if	defined(LINTLIBRARY)
+    (target_task, must_wire)
+	vm_map_t target_task;
+	boolean_t must_wire;
+{ return task_wire(target_task, must_wire); }
+#else
+(
+	vm_map_t target_task,
+	boolean_t must_wire
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_wire */
+mig_internal novalue _Xtask_wire
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t must_wire;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__task_wire_t __Request;
+	typedef __Reply__task_wire_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__task_wire_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__task_wire_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3815, "task_wire")
+	__BeforeRcvRpc(3815, "task_wire")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__task_wire_t__defined)
+	check_result = __MIG_check__Request__task_wire_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__task_wire_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = task_wire(target_task, In0P->must_wire);
+	vm_map_deallocate(target_task);
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	__AfterRcvRpc(3815, "task_wire")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__mach_make_memory_entry_t__defined)
+#define __MIG_check__Request__mach_make_memory_entry_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_make_memory_entry_t(__attribute__((__unused__)) __Request__mach_make_memory_entry_t *In0P)
+{
+
+	typedef __Request__mach_make_memory_entry_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->parent_entry.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->parent_entry.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_make_memory_entry_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_make_memory_entry */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_make_memory_entry
+#if	defined(LINTLIBRARY)
+    (target_task, size, offset, permission, object_handle, parent_entry)
+	vm_map_t target_task;
+	vm_size_t *size;
+	vm_offset_t offset;
+	vm_prot_t permission;
+	mem_entry_name_port_t *object_handle;
+	mem_entry_name_port_t parent_entry;
+{ return mach_make_memory_entry(target_task, size, offset, permission, object_handle, parent_entry); }
+#else
+(
+	vm_map_t target_task,
+	vm_size_t *size,
+	vm_offset_t offset,
+	vm_prot_t permission,
+	mem_entry_name_port_t *object_handle,
+	mem_entry_name_port_t parent_entry
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_make_memory_entry */
+mig_internal novalue _Xmach_make_memory_entry
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t parent_entry;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_size_t size;
+		vm_offset_t offset;
+		vm_prot_t permission;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_make_memory_entry_t __Request;
+	typedef __Reply__mach_make_memory_entry_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_make_memory_entry_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_make_memory_entry_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t object_handleTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t object_handleTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	vm_map_t target_task;
+	mem_entry_name_port_t object_handle;
+
+	__DeclareRcvRpc(3816, "mach_make_memory_entry")
+	__BeforeRcvRpc(3816, "mach_make_memory_entry")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_make_memory_entry_t__defined)
+	check_result = __MIG_check__Request__mach_make_memory_entry_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_make_memory_entry_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->object_handle = object_handleTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->object_handle.disposition = 17;
+#else
+	OutP->object_handle.disposition = 17;
+#endif /* __MigKernelSpecificCode */
+	OutP->object_handle.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	RetCode = mach_make_memory_entry(target_task, &In0P->size, In0P->offset, In0P->permission, &object_handle, null_conversion(In0P->parent_entry.name));
+	vm_map_deallocate(target_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+
+	if (IP_VALID((ipc_port_t)In0P->parent_entry.name))
+		ipc_port_release_send((ipc_port_t)In0P->parent_entry.name);
+#endif /* __MigKernelSpecificCode */
+	OutP->object_handle.name = (mach_port_t)null_conversion(object_handle);
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->size = In0P->size;
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3816, "mach_make_memory_entry")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_map_page_query_t__defined)
+#define __MIG_check__Request__vm_map_page_query_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_map_page_query_t(__attribute__((__unused__)) __Request__vm_map_page_query_t *In0P)
+{
+
+	typedef __Request__vm_map_page_query_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_map_page_query_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_map_page_query */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_map_page_query
+#if	defined(LINTLIBRARY)
+    (target_map, offset, disposition, ref_count)
+	vm_map_t target_map;
+	vm_offset_t offset;
+	integer_t *disposition;
+	integer_t *ref_count;
+{ return vm_map_page_query(target_map, offset, disposition, ref_count); }
+#else
+(
+	vm_map_t target_map,
+	vm_offset_t offset,
+	integer_t *disposition,
+	integer_t *ref_count
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_map_page_query */
+mig_internal novalue _Xvm_map_page_query
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_offset_t offset;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_map_page_query_t __Request;
+	typedef __Reply__vm_map_page_query_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_map_page_query_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_map_page_query_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_map;
+
+	__DeclareRcvRpc(3817, "vm_map_page_query")
+	__BeforeRcvRpc(3817, "vm_map_page_query")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_map_page_query_t__defined)
+	check_result = __MIG_check__Request__vm_map_page_query_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_map_page_query_t__defined) */
+
+	target_map = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = vm_map_page_query(target_map, In0P->offset, &OutP->disposition, &OutP->ref_count);
+	vm_map_deallocate(target_map);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3817, "vm_map_page_query")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_region_info_t__defined)
+#define __MIG_check__Request__mach_vm_region_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_region_info_t(__attribute__((__unused__)) __Request__mach_vm_region_info_t *In0P)
+{
+
+	typedef __Request__mach_vm_region_info_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_region_info_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_region_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_region_info
+#if	defined(LINTLIBRARY)
+    (task, address, region, objects, objectsCnt)
+	vm_map_t task;
+	vm_address_t address;
+	vm_info_region_t *region;
+	vm_info_object_array_t *objects;
+	mach_msg_type_number_t *objectsCnt;
+{ return mach_vm_region_info(task, address, region, objects, objectsCnt); }
+#else
+(
+	vm_map_t task,
+	vm_address_t address,
+	vm_info_region_t *region,
+	vm_info_object_array_t *objects,
+	mach_msg_type_number_t *objectsCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_region_info */
+mig_internal novalue _Xmach_vm_region_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_region_info_t __Request;
+	typedef __Reply__mach_vm_region_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_region_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_region_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t objectsTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t objectsTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	vm_map_t task;
+
+	__DeclareRcvRpc(3818, "mach_vm_region_info")
+	__BeforeRcvRpc(3818, "mach_vm_region_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_region_info_t__defined)
+	check_result = __MIG_check__Request__mach_vm_region_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_region_info_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->objects = objectsTemplate;
+#else	/* UseStaticTemplates */
+	OutP->objects.deallocate =  FALSE;
+	OutP->objects.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->objects.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	RetCode = mach_vm_region_info(task, In0P->address, &OutP->region, (vm_info_object_array_t *)&(OutP->objects.address), &OutP->objectsCnt);
+	vm_map_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->objects.size = OutP->objectsCnt * 84;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3818, "mach_vm_region_info")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_mapped_pages_info_t__defined)
+#define __MIG_check__Request__vm_mapped_pages_info_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_mapped_pages_info_t(__attribute__((__unused__)) __Request__vm_mapped_pages_info_t *In0P)
+{
+
+	typedef __Request__vm_mapped_pages_info_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_mapped_pages_info_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_mapped_pages_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_mapped_pages_info
+#if	defined(LINTLIBRARY)
+    (task, pages, pagesCnt)
+	vm_map_t task;
+	page_address_array_t *pages;
+	mach_msg_type_number_t *pagesCnt;
+{ return vm_mapped_pages_info(task, pages, pagesCnt); }
+#else
+(
+	vm_map_t task,
+	page_address_array_t *pages,
+	mach_msg_type_number_t *pagesCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_mapped_pages_info */
+mig_internal novalue _Xvm_mapped_pages_info
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_mapped_pages_info_t __Request;
+	typedef __Reply__vm_mapped_pages_info_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_mapped_pages_info_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_mapped_pages_info_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t pagesTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t pagesTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	vm_map_t task;
+
+	__DeclareRcvRpc(3819, "vm_mapped_pages_info")
+	__BeforeRcvRpc(3819, "vm_mapped_pages_info")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_mapped_pages_info_t__defined)
+	check_result = __MIG_check__Request__vm_mapped_pages_info_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_mapped_pages_info_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->pages = pagesTemplate;
+#else	/* UseStaticTemplates */
+	OutP->pages.deallocate =  FALSE;
+	OutP->pages.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->pages.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	RetCode = vm_mapped_pages_info(task, (page_address_array_t *)&(OutP->pages.address), &OutP->pagesCnt);
+	vm_map_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->pages.size = OutP->pagesCnt * 4;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3819, "vm_mapped_pages_info")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_region_recurse_t__defined)
+#define __MIG_check__Request__vm_region_recurse_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_region_recurse_t(__attribute__((__unused__)) __Request__vm_region_recurse_t *In0P)
+{
+
+	typedef __Request__vm_region_recurse_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_region_recurse_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_region_recurse */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_region_recurse
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, nesting_depth, info, infoCnt)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t *size;
+	natural_t *nesting_depth;
+	vm_region_recurse_info_t info;
+	mach_msg_type_number_t *infoCnt;
+{ return vm_region_recurse(target_task, address, size, nesting_depth, info, infoCnt); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t *size,
+	natural_t *nesting_depth,
+	vm_region_recurse_info_t info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_region_recurse */
+mig_internal novalue _Xvm_region_recurse
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_region_recurse_t __Request;
+	typedef __Reply__vm_region_recurse_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_region_recurse_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_region_recurse_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3821, "vm_region_recurse")
+	__BeforeRcvRpc(3821, "vm_region_recurse")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_region_recurse_t__defined)
+	check_result = __MIG_check__Request__vm_region_recurse_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_region_recurse_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->infoCnt = 19;
+	if (In0P->infoCnt < OutP->infoCnt)
+		OutP->infoCnt = In0P->infoCnt;
+
+	OutP->RetCode = vm_region_recurse(target_task, &In0P->address, &OutP->size, &In0P->nesting_depth, OutP->info, &OutP->infoCnt);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->address = In0P->address;
+
+	OutP->nesting_depth = In0P->nesting_depth;
+	OutP->Head.msgh_size = (sizeof(Reply) - 76) + (_WALIGN_((4 * OutP->infoCnt)));
+
+	__AfterRcvRpc(3821, "vm_region_recurse")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_region_recurse_64_t__defined)
+#define __MIG_check__Request__vm_region_recurse_64_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_region_recurse_64_t(__attribute__((__unused__)) __Request__vm_region_recurse_64_t *In0P)
+{
+
+	typedef __Request__vm_region_recurse_64_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_region_recurse_64_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_region_recurse_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_region_recurse_64
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, nesting_depth, info, infoCnt)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t *size;
+	natural_t *nesting_depth;
+	vm_region_recurse_info_t info;
+	mach_msg_type_number_t *infoCnt;
+{ return vm_region_recurse_64(target_task, address, size, nesting_depth, info, infoCnt); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t *size,
+	natural_t *nesting_depth,
+	vm_region_recurse_info_t info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_region_recurse_64 */
+mig_internal novalue _Xvm_region_recurse_64
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_region_recurse_64_t __Request;
+	typedef __Reply__vm_region_recurse_64_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_region_recurse_64_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_region_recurse_64_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3822, "vm_region_recurse_64")
+	__BeforeRcvRpc(3822, "vm_region_recurse_64")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_region_recurse_64_t__defined)
+	check_result = __MIG_check__Request__vm_region_recurse_64_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_region_recurse_64_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->infoCnt = 19;
+	if (In0P->infoCnt < OutP->infoCnt)
+		OutP->infoCnt = In0P->infoCnt;
+
+	OutP->RetCode = vm_region_recurse_64(target_task, &In0P->address, &OutP->size, &In0P->nesting_depth, OutP->info, &OutP->infoCnt);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->address = In0P->address;
+
+	OutP->nesting_depth = In0P->nesting_depth;
+	OutP->Head.msgh_size = (sizeof(Reply) - 76) + (_WALIGN_((4 * OutP->infoCnt)));
+
+	__AfterRcvRpc(3822, "vm_region_recurse_64")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__mach_vm_region_info_64_t__defined)
+#define __MIG_check__Request__mach_vm_region_info_64_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_vm_region_info_64_t(__attribute__((__unused__)) __Request__mach_vm_region_info_64_t *In0P)
+{
+
+	typedef __Request__mach_vm_region_info_64_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_vm_region_info_64_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_vm_region_info_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_region_info_64
+#if	defined(LINTLIBRARY)
+    (task, address, region, objects, objectsCnt)
+	vm_map_t task;
+	vm_address_t address;
+	vm_info_region_64_t *region;
+	vm_info_object_array_t *objects;
+	mach_msg_type_number_t *objectsCnt;
+{ return mach_vm_region_info_64(task, address, region, objects, objectsCnt); }
+#else
+(
+	vm_map_t task,
+	vm_address_t address,
+	vm_info_region_64_t *region,
+	vm_info_object_array_t *objects,
+	mach_msg_type_number_t *objectsCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_region_info_64 */
+mig_internal novalue _Xmach_vm_region_info_64
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_vm_region_info_64_t __Request;
+	typedef __Reply__mach_vm_region_info_64_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_vm_region_info_64_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_vm_region_info_64_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t objectsTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_ool_descriptor_t objectsTemplate = {
+		.address = (void *)0,
+		.size = 0,
+		.deallocate = FALSE,
+		.copy = MACH_MSG_VIRTUAL_COPY,
+		.type = MACH_MSG_OOL_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	vm_map_t task;
+
+	__DeclareRcvRpc(3823, "mach_vm_region_info_64")
+	__BeforeRcvRpc(3823, "mach_vm_region_info_64")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_vm_region_info_64_t__defined)
+	check_result = __MIG_check__Request__mach_vm_region_info_64_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_vm_region_info_64_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->objects = objectsTemplate;
+#else	/* UseStaticTemplates */
+	OutP->objects.deallocate =  FALSE;
+	OutP->objects.copy = MACH_MSG_VIRTUAL_COPY;
+	OutP->objects.type = MACH_MSG_OOL_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	RetCode = mach_vm_region_info_64(task, In0P->address, &OutP->region, (vm_info_object_array_t *)&(OutP->objects.address), &OutP->objectsCnt);
+	vm_map_deallocate(task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+	OutP->objects.size = OutP->objectsCnt * 84;
+
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3823, "mach_vm_region_info_64")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_region_64_t__defined)
+#define __MIG_check__Request__vm_region_64_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_region_64_t(__attribute__((__unused__)) __Request__vm_region_64_t *In0P)
+{
+
+	typedef __Request__vm_region_64_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_region_64_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_region_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_region_64
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, flavor, info, infoCnt, object_name)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t *size;
+	vm_region_flavor_t flavor;
+	vm_region_info_t info;
+	mach_msg_type_number_t *infoCnt;
+	mach_port_t *object_name;
+{ return vm_region_64(target_task, address, size, flavor, info, infoCnt, object_name); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t *size,
+	vm_region_flavor_t flavor,
+	vm_region_info_t info,
+	mach_msg_type_number_t *infoCnt,
+	mach_port_t *object_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_region_64 */
+mig_internal novalue _Xvm_region_64
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_region_flavor_t flavor;
+		mach_msg_type_number_t infoCnt;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_region_64_t __Request;
+	typedef __Reply__vm_region_64_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_region_64_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_region_64_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t object_nameTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t object_nameTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3824, "vm_region_64")
+	__BeforeRcvRpc(3824, "vm_region_64")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_region_64_t__defined)
+	check_result = __MIG_check__Request__vm_region_64_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_region_64_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->object_name = object_nameTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->object_name.disposition = 17;
+#else
+	OutP->object_name.disposition = 17;
+#endif /* __MigKernelSpecificCode */
+	OutP->object_name.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->infoCnt = 10;
+	if (In0P->infoCnt < OutP->infoCnt)
+		OutP->infoCnt = In0P->infoCnt;
+
+	RetCode = vm_region_64(target_task, &In0P->address, &OutP->size, In0P->flavor, OutP->info, &OutP->infoCnt, &OutP->object_name.name);
+	vm_map_deallocate(target_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->address = In0P->address;
+	OutP->Head.msgh_size = (sizeof(Reply) - 40) + (_WALIGN_((4 * OutP->infoCnt)));
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3824, "vm_region_64")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__mach_make_memory_entry_64_t__defined)
+#define __MIG_check__Request__mach_make_memory_entry_64_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__mach_make_memory_entry_64_t(__attribute__((__unused__)) __Request__mach_make_memory_entry_64_t *In0P)
+{
+
+	typedef __Request__mach_make_memory_entry_64_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 1) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	__MigTypeCheck
+	if (In0P->parent_entry.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    In0P->parent_entry.disposition != 17)
+		return MIG_TYPE_ERROR;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__mach_make_memory_entry_64_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine mach_make_memory_entry_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_make_memory_entry_64
+#if	defined(LINTLIBRARY)
+    (target_task, size, offset, permission, object_handle, parent_entry)
+	vm_map_t target_task;
+	memory_object_size_t *size;
+	memory_object_offset_t offset;
+	vm_prot_t permission;
+	mach_port_t *object_handle;
+	mem_entry_name_port_t parent_entry;
+{ return mach_make_memory_entry_64(target_task, size, offset, permission, object_handle, parent_entry); }
+#else
+(
+	vm_map_t target_task,
+	memory_object_size_t *size,
+	memory_object_offset_t offset,
+	vm_prot_t permission,
+	mach_port_t *object_handle,
+	mem_entry_name_port_t parent_entry
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_make_memory_entry_64 */
+mig_internal novalue _Xmach_make_memory_entry_64
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t parent_entry;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		memory_object_size_t size;
+		memory_object_offset_t offset;
+		vm_prot_t permission;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__mach_make_memory_entry_64_t __Request;
+	typedef __Reply__mach_make_memory_entry_64_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__mach_make_memory_entry_64_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__mach_make_memory_entry_64_t__defined */
+
+#if	__MigKernelSpecificCode
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t object_handleTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#else
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t object_handleTemplate = {
+		.name = MACH_PORT_NULL,
+		.disposition = 17,
+		.type = MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+#endif /* __MigKernelSpecificCode */
+	kern_return_t RetCode;
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3825, "mach_make_memory_entry_64")
+	__BeforeRcvRpc(3825, "mach_make_memory_entry_64")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__mach_make_memory_entry_64_t__defined)
+	check_result = __MIG_check__Request__mach_make_memory_entry_64_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__mach_make_memory_entry_64_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->object_handle = object_handleTemplate;
+#else	/* UseStaticTemplates */
+#if __MigKernelSpecificCode
+	OutP->object_handle.disposition = 17;
+#else
+	OutP->object_handle.disposition = 17;
+#endif /* __MigKernelSpecificCode */
+	OutP->object_handle.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	RetCode = mach_make_memory_entry_64(target_task, &In0P->size, In0P->offset, In0P->permission, &OutP->object_handle.name, null_conversion(In0P->parent_entry.name));
+	vm_map_deallocate(target_task);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+#if	__MigKernelSpecificCode
+
+	if (IP_VALID((ipc_port_t)In0P->parent_entry.name))
+		ipc_port_release_send((ipc_port_t)In0P->parent_entry.name);
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->size = In0P->size;
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(3825, "mach_make_memory_entry_64")
+}
+
+#if ( __MigTypeCheck )
+#if __MIG_check__Request__vm_map_subsystem__
+#if !defined(__MIG_check__Request__vm_purgable_control_t__defined)
+#define __MIG_check__Request__vm_purgable_control_t__defined
+
+mig_internal kern_return_t __MIG_check__Request__vm_purgable_control_t(__attribute__((__unused__)) __Request__vm_purgable_control_t *In0P)
+{
+
+	typedef __Request__vm_purgable_control_t __Request;
+#if	__MigTypeCheck
+	if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->msgh_body.msgh_descriptor_count != 0) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__vm_purgable_control_t__defined) */
+#endif /* __MIG_check__Request__vm_map_subsystem__ */
+#endif /* ( __MigTypeCheck ) */
+
+
+/* Routine vm_purgable_control */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_purgable_control
+#if	defined(LINTLIBRARY)
+    (target_task, address, control, state)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_purgable_t control;
+	int *state;
+{ return vm_purgable_control(target_task, address, control, state); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_purgable_t control,
+	int *state
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_purgable_control */
+mig_internal novalue _Xvm_purgable_control
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_purgable_t control;
+		int state;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__vm_purgable_control_t __Request;
+	typedef __Reply__vm_purgable_control_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__vm_purgable_control_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__vm_purgable_control_t__defined */
+
+#if	__MigKernelSpecificCode
+#else
+#endif /* __MigKernelSpecificCode */
+	vm_map_t target_task;
+
+	__DeclareRcvRpc(3830, "vm_purgable_control")
+	__BeforeRcvRpc(3830, "vm_purgable_control")
+/* RetCArg=0x0 rtSimpleRequest=0 */
+
+#if	defined(__MIG_check__Request__vm_purgable_control_t__defined)
+	check_result = __MIG_check__Request__vm_purgable_control_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__vm_purgable_control_t__defined) */
+
+	target_task = convert_port_to_map(In0P->Head.msgh_request_port);
+
+	OutP->RetCode = vm_purgable_control(target_task, In0P->address, In0P->control, &In0P->state);
+	vm_map_deallocate(target_task);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+#if	__MigKernelSpecificCode
+#endif /* __MigKernelSpecificCode */
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->state = In0P->state;
+
+	OutP->Head.msgh_size = (sizeof(Reply));
+	__AfterRcvRpc(3830, "vm_purgable_control")
+}
+
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+boolean_t vm_map_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+mig_routine_t vm_map_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+extern const struct vm_map_subsystem vm_map_subsystem;
+const struct vm_map_subsystem {
+	mig_server_routine_t 	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[31];
+} vm_map_subsystem = {
+	vm_map_server_routine,
+	3800,
+	3831,
+	(mach_msg_size_t)sizeof(union __ReplyUnion__vm_map_subsystem),
+	(vm_address_t)0,
+	{
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_region, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_region_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_allocate, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_allocate_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_deallocate, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_deallocate_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_protect, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_protect_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_inherit, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_inherit_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_read, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_read_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_read_list, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_read_list_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_write, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_write_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_copy, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_copy_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_read_overwrite, 8, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_read_overwrite_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_msync, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_msync_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_behavior_set, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_behavior_set_t) },
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_machine_attribute, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_machine_attribute_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_remap, 14, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_remap_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xtask_wire, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__task_wire_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_make_memory_entry, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_make_memory_entry_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_map_page_query, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_map_page_query_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_region_info, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_region_info_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_mapped_pages_info, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_mapped_pages_info_t) },
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_region_recurse, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_region_recurse_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_region_recurse_64, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_region_recurse_64_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_vm_region_info_64, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_vm_region_info_64_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_region_64, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_region_64_t) },
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xmach_make_memory_entry_64, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_make_memory_entry_64_t) },
+		{0, 0, 0, 0, 0, 0},
+		{0, 0, 0, 0, 0, 0},
+		{0, 0, 0, 0, 0, 0},
+		{0, 0, 0, 0, 0, 0},
+          { (mig_impl_routine_t) 0,
+            (mig_stub_routine_t) _Xvm_purgable_control, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__vm_purgable_control_t) },
+	}
+};
+
+mig_external boolean_t vm_map_server
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	register mig_routine_t routine;
+
+	OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0);
+	OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port;
+	/* Minimal size: routine() will update it if different */
+	OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t);
+	OutHeadP->msgh_local_port = MACH_PORT_NULL;
+	OutHeadP->msgh_id = InHeadP->msgh_id + 100;
+
+	if ((InHeadP->msgh_id > 3830) || (InHeadP->msgh_id < 3800) ||
+	    ((routine = vm_map_subsystem.routine[InHeadP->msgh_id - 3800].stub_routine) == 0)) {
+		((mig_reply_error_t *)OutHeadP)->NDR = NDR_record;
+		((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID;
+		return FALSE;
+	}
+	(*routine) (InHeadP, OutHeadP);
+	return TRUE;
+}
+
+mig_external mig_routine_t vm_map_server_routine
+	(mach_msg_header_t *InHeadP)
+{
+	register int msgh_id;
+
+	msgh_id = InHeadP->msgh_id - 3800;
+
+	if ((msgh_id > 30) || (msgh_id < 0))
+		return 0;
+
+	return vm_map_subsystem.routine[msgh_id].stub_routine;
+}


Property changes on: trunk/sys/compat/mach/vm_map_server.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/clock_server.h
===================================================================
--- trunk/sys/sys/mach/clock_server.h	                        (rev 0)
+++ trunk/sys/sys/mach/clock_server.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,352 @@
+#ifndef	_clock_server_
+#define	_clock_server_
+
+/* Module clock */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#ifdef _KERNEL
+#include <sys/mach/ndr.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#else /* !_KERNEL */
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#endif /*_KERNEL */
+
+#ifdef AUTOTEST
+#ifndef FUNCTION_PTR_T
+#define FUNCTION_PTR_T
+typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
+typedef struct {
+        char            *name;
+        function_ptr_t  function;
+} function_table_entry;
+typedef function_table_entry   *function_table_t;
+#endif /* FUNCTION_PTR_T */
+#endif /* AUTOTEST */
+
+#ifndef	clock_MSG_COUNT
+#define	clock_MSG_COUNT	3
+#endif	/* clock_MSG_COUNT */
+
+#include <sys/mach/std_types.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc_mig.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/mach_types.h>
+
+#ifdef __BeforeMigServerHeader
+__BeforeMigServerHeader
+#endif /* __BeforeMigServerHeader */
+
+
+/* Routine clock_get_time */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t clock_get_time
+#if	defined(LINTLIBRARY)
+    (clock_serv, cur_time)
+	clock_serv_t clock_serv;
+	mach_timespec_t *cur_time;
+{ return clock_get_time(clock_serv, cur_time); }
+#else
+(
+	clock_serv_t clock_serv,
+	mach_timespec_t *cur_time
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine clock_get_attributes */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t clock_get_attributes
+#if	defined(LINTLIBRARY)
+    (clock_serv, flavor, clock_attr, clock_attrCnt)
+	clock_serv_t clock_serv;
+	clock_flavor_t flavor;
+	clock_attr_t clock_attr;
+	mach_msg_type_number_t *clock_attrCnt;
+{ return clock_get_attributes(clock_serv, flavor, clock_attr, clock_attrCnt); }
+#else
+(
+	clock_serv_t clock_serv,
+	clock_flavor_t flavor,
+	clock_attr_t clock_attr,
+	mach_msg_type_number_t *clock_attrCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine clock_alarm */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t clock_alarm
+#if	defined(LINTLIBRARY)
+    (clock_serv, alarm_type, alarm_time, alarm_port, alarm_portPoly)
+	clock_serv_t clock_serv;
+	alarm_type_t alarm_type;
+	mach_timespec_t alarm_time;
+	clock_reply_t alarm_port;
+	mach_msg_type_name_t alarm_portPoly;
+{ return clock_alarm(clock_serv, alarm_type, alarm_time, alarm_port, alarm_portPoly); }
+#else
+(
+	clock_serv_t clock_serv,
+	alarm_type_t alarm_type,
+	mach_timespec_t alarm_time,
+	clock_reply_t alarm_port,
+	mach_msg_type_name_t alarm_portPoly
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine clock_get_time */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t clock_get_time
+#if	defined(LINTLIBRARY)
+    (clock_serv, cur_time)
+	clock_serv_t clock_serv;
+	mach_timespec_t *cur_time;
+{ return clock_get_time(clock_serv, cur_time); }
+#else
+(
+	clock_serv_t clock_serv,
+	mach_timespec_t *cur_time
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine clock_get_attributes */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t clock_get_attributes
+#if	defined(LINTLIBRARY)
+    (clock_serv, flavor, clock_attr, clock_attrCnt)
+	clock_serv_t clock_serv;
+	clock_flavor_t flavor;
+	clock_attr_t clock_attr;
+	mach_msg_type_number_t *clock_attrCnt;
+{ return clock_get_attributes(clock_serv, flavor, clock_attr, clock_attrCnt); }
+#else
+(
+	clock_serv_t clock_serv,
+	clock_flavor_t flavor,
+	clock_attr_t clock_attr,
+	mach_msg_type_number_t *clock_attrCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine clock_alarm */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t clock_alarm
+#if	defined(LINTLIBRARY)
+    (clock_serv, alarm_type, alarm_time, alarm_port, alarm_portPoly)
+	clock_serv_t clock_serv;
+	alarm_type_t alarm_type;
+	mach_timespec_t alarm_time;
+	clock_reply_t alarm_port;
+	mach_msg_type_name_t alarm_portPoly;
+{ return clock_alarm(clock_serv, alarm_type, alarm_time, alarm_port, alarm_portPoly); }
+#else
+(
+	clock_serv_t clock_serv,
+	alarm_type_t alarm_type,
+	mach_timespec_t alarm_time,
+	clock_reply_t alarm_port,
+	mach_msg_type_name_t alarm_portPoly
+);
+#endif	/* defined(LINTLIBRARY) */
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+boolean_t clock_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+mig_routine_t clock_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+extern const struct clock_subsystem {
+	mig_server_routine_t	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[3];
+} clock_subsystem;
+
+/* typedefs for all requests */
+
+#ifndef __Request__clock_subsystem__defined
+#define __Request__clock_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__clock_get_time_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		clock_flavor_t flavor;
+		mach_msg_type_number_t clock_attrCnt;
+	} __Request__clock_get_attributes_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t alarm_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		alarm_type_t alarm_type;
+		mach_timespec_t alarm_time;
+	} __Request__clock_alarm_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__clock_subsystem__defined */
+
+
+/* union of all requests */
+
+#ifndef __RequestUnion__clock_subsystem__defined
+#define __RequestUnion__clock_subsystem__defined
+union __RequestUnion__clock_subsystem {
+	__Request__clock_get_time_t Request_clock_get_time;
+	__Request__clock_get_attributes_t Request_clock_get_attributes;
+	__Request__clock_alarm_t Request_clock_alarm;
+};
+#endif /* __RequestUnion__clock_subsystem__defined */
+/* typedefs for all replies */
+
+#ifndef __Reply__clock_subsystem__defined
+#define __Reply__clock_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_timespec_t cur_time;
+	} __Reply__clock_get_time_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t clock_attrCnt;
+		int clock_attr[1];
+	} __Reply__clock_get_attributes_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__clock_alarm_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__clock_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__clock_subsystem__defined
+#define __ReplyUnion__clock_subsystem__defined
+union __ReplyUnion__clock_subsystem {
+	__Reply__clock_get_time_t Reply_clock_get_time;
+	__Reply__clock_get_attributes_t Reply_clock_get_attributes;
+	__Reply__clock_alarm_t Reply_clock_alarm;
+};
+#endif /* __RequestUnion__clock_subsystem__defined */
+
+#ifndef subsystem_to_name_map_clock
+#define subsystem_to_name_map_clock \
+    { "clock_get_time", 1000 },\
+    { "clock_get_attributes", 1001 },\
+    { "clock_alarm", 1002 }
+#endif
+
+#ifdef __AfterMigServerHeader
+__AfterMigServerHeader
+#endif /* __AfterMigServerHeader */
+
+#endif	 /* _clock_server_ */


Property changes on: trunk/sys/sys/mach/clock_server.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/clock_types.defs
===================================================================
--- trunk/sys/sys/mach/clock_types.defs	                        (rev 0)
+++ trunk/sys/sys/mach/clock_types.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/*
+ *	File:		clock_types.defs
+ *	Purpose:
+ *		Clock kernel interface type declarations
+ */
+
+#ifndef	_MACH_CLOCK_TYPES_DEFS_
+#define _MACH_CLOCK_TYPES_DEFS_
+
+#include <sys/mach/std_types.defs>
+
+type clock_serv_t = mach_port_t
+		cusertype: clock_serv_t
+#if	KERNEL_SERVER
+		intran: clock_serv_t convert_port_to_clock(mach_port_t)
+		outtran: mach_port_t convert_clock_to_port(clock_serv_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type clock_ctrl_t = mach_port_t
+		cusertype: clock_ctrl_t
+#if	KERNEL_SERVER
+		intran: clock_ctrl_t convert_port_to_clock_ctrl(mach_port_t)
+		outtran: mach_port_t convert_clock_ctrl_to_port(clock_ctrl_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type clock_reply_t = polymorphic|MACH_MSG_TYPE_MAKE_SEND_ONCE;
+
+type clock_flavor_t = int;
+type clock_attr_t = array[*:1] of int;
+type mach_timespec_t	= struct[2] of int;
+type time_t = int;
+type sleep_type_t = int;
+type alarm_type_t = int;
+type clock_res_t = int;
+type clock_id_t = int;
+
+import <sys/mach/mach_types.h>;
+
+#endif	/* _MACH_CLOCK_TYPES_DEFS_ */
+
+/* vim: set ft=c : */

Added: trunk/sys/sys/mach/clock_types.h
===================================================================
--- trunk/sys/sys/mach/clock_types.h	                        (rev 0)
+++ trunk/sys/sys/mach/clock_types.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,163 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+
+/*
+ *	File:		clock_types.h
+ *	Purpose:	Clock facility header definitions. These
+ *			definitons are needed by both kernel and
+ *			user-level software.
+ */
+
+#ifndef	_MACH_CLOCK_TYPES_H_
+#define	_MACH_CLOCK_TYPES_H_
+
+/*
+ * Reserved clock id values for default clocks.
+ */
+#define	REALTIME_CLOCK	0		/* required for all systems */
+#define BATTERY_CLOCK	1		/* optional */
+#define HIGHRES_CLOCK	2		/* optional */
+
+/* Any number of distributed clocks may be defined. */
+#define DIST_CLOCK_0	3		/* optional */
+#define DIST_CLOCK_1	4		/* optional */
+
+/*
+ * Type definitions.
+ */
+typedef	int	alarm_type_t;		/* alarm time type */
+typedef int	sleep_type_t;		/* sleep time type */
+typedef	int	clock_id_t;		/* clock identification type */
+typedef int	clock_flavor_t;		/* clock flavor type */
+typedef int	*clock_attr_t;		/* clock attribute type */
+typedef int	clock_res_t;		/* clock resolution type */
+
+
+/*
+ * Attribute names.
+ */
+#define	CLOCK_GET_TIME_RES	1	/* get_time call resolution */
+#define	CLOCK_MAP_TIME_RES	2	/* map_time call resolution */
+#define CLOCK_ALARM_CURRES	3	/* current alarm resolution */
+#define CLOCK_ALARM_MINRES	4	/* minimum alarm resolution */
+#define CLOCK_ALARM_MAXRES	5	/* maximum alarm resolution */
+#define CLOCK_BASE_FREQ		6	/* base counter frequency */
+/* Attribute names specific to DISTRIBUTED_CLOCK */
+#define DCLOCK_STATE			7
+#define DCLOCK_PARAM_BOUND		8
+#define DCLOCK_PARAM_DRIFT_CONST 	9
+#define DCLOCK_OPARAM_REFCLOCK		10	
+
+/* DISTRIBUTED_CLOCK states (accessible via attribute DCLOCK_STATE) */
+#define DCLOCK_STATE_UNINITIALIZED		0
+#define DCLOCK_STATE_MANAGED			1
+#define DCLOCK_STATE_INITIALIZED		2
+#define	DCLOCK_STATE_RUNNING			3
+#define	DCLOCK_STATE_FAILED			4
+
+/*
+ * Normal time specification used by the kernel clock facility.
+ */
+struct tvalspec {
+	unsigned int	tv_sec;			/* seconds */
+	clock_res_t	tv_nsec;		/* nanoseconds */
+};
+typedef struct tvalspec	tvalspec_t;
+typedef struct tvalspec mach_timespec_t;
+
+
+#ifdef NSEC_PER_SEC
+#undef NSEC_PER_SEC
+#endif
+#ifdef USEC_PER_SEC
+#undef USEC_PER_SEC
+#endif
+#ifdef NSEC_PER_USEC
+#undef NSEC_PER_USEC
+#endif
+#define NSEC_PER_USEC	1000ll		/* nanoseconds per microsecond */
+#define USEC_PER_SEC	1000000ll	/* microseconds per second */
+#define NSEC_PER_SEC	1000000000ll /* nanoseconds per second */
+#define BAD_TVALSPEC(t)							\
+	((t)->tv_nsec < 0 || (t)->tv_nsec >= NSEC_PER_SEC)
+
+/* t1 <=> t2 */
+#define CMP_TVALSPEC(t1, t2)						\
+	((t1)->tv_sec > (t2)->tv_sec ? +1 :				\
+	((t1)->tv_sec < (t2)->tv_sec ? -1 : (t1)->tv_nsec - (t2)->tv_nsec))
+
+/* t1  += t2 */
+#define ADD_TVALSPEC(t1, t2)						\
+{									\
+	if (((t1)->tv_nsec += (t2)->tv_nsec) >= NSEC_PER_SEC) {		\
+		(t1)->tv_nsec -= NSEC_PER_SEC;				\
+		(t1)->tv_sec  += 1;					\
+	}								\
+	(t1)->tv_sec += (t2)->tv_sec;					\
+}
+
+/* t1  -= t2 */
+#define SUB_TVALSPEC(t1, t2)						\
+{									\
+	if (((t1)->tv_nsec -= (t2)->tv_nsec) < 0) {			\
+		(t1)->tv_nsec += NSEC_PER_SEC;				\
+		(t1)->tv_sec  -= 1;					\
+	}								\
+	(t1)->tv_sec -= (t2)->tv_sec;					\
+}
+
+/*
+ * Mapped time specification used by the kernel clock facility.
+ */
+struct	mapped_tvalspec {
+	tvalspec_t	mtv_time;
+#define	mtv_sec		mtv_time.tv_sec		/* seconds */
+#define mtv_nsec	mtv_time.tv_nsec	/* nanoseconds */
+	unsigned int	mtv_csec;		/* check seconds */
+};
+typedef struct mapped_tvalspec	mapped_tvalspec_t;
+
+/*
+ * Macro for reading a consistant tvalspec_t value "ts"
+ * from a mapped time specification "mts". (On a multi
+ * processor, it is assumed that processors see writes
+ * in the "correct" order since the kernel updates the
+ * mapped time in the inverse order it is read here.)
+ */
+#define MTS_TO_TS(mts, ts)				\
+	do {						\
+		(ts)->tv_sec  = (mts)->mtv_sec;		\
+		(ts)->tv_nsec = (mts)->mtv_nsec;	\
+	} while ((ts)->tv_sec != (mts)->mtv_csec);
+
+/*
+ * Alarm parameter defines.
+ */
+#define ALRMTYPE	0xff		/* type (8-bit field)	*/
+#define   TIME_ABSOLUTE	0x0		/* absolute time */
+#define	  TIME_RELATIVE	0x1		/* relative time */
+#define BAD_ALRMTYPE(t)	\
+	(((t) & 0xfe) != 0)
+
+#endif /* _MACH_CLOCK_TYPES_H_ */


Property changes on: trunk/sys/sys/mach/clock_types.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/.cvsignore
===================================================================
--- trunk/sys/sys/mach/device/.cvsignore	                        (rev 0)
+++ trunk/sys/sys/mach/device/.cvsignore	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,3 @@
+device_reply.h
+device.h
+device_request.h

Added: trunk/sys/sys/mach/device/buf.h
===================================================================
--- trunk/sys/sys/mach/device/buf.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/buf.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,149 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/14  15:38:51  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:07:51  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:26:11  mrt]
+ * 
+ * Revision 2.2  90/05/03  15:19:05  dbg
+ * 	Add B_MD1.
+ * 	[90/03/14            dbg]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	3/90
+ *
+ * 	Definitions to make new IO structures look like old ones
+ */
+
+/*
+ * io_req and fields
+ */
+#include <device/io_req.h>
+
+#define	buf	io_req
+
+/*
+ * Redefine fields for drivers using old names
+ */
+#define	b_flags		io_op
+#define	b_bcount	io_count
+#define	b_error		io_error
+#define	b_dev		io_unit
+#define	b_blkno		io_recnum
+#define	b_resid		io_residual
+#define	b_un		io_un
+#define	b_addr		data
+#define	av_forw		io_next
+#define	av_back		io_prev
+
+/*
+ * Redefine fields for driver request list heads, using old names.
+ */
+#define	b_actf		io_next
+#define	b_actl		io_prev
+#define	b_forw		io_link
+#define	b_back		io_rlink
+#define	b_active	io_count
+#define	b_errcnt	io_residual
+#define	b_bufsize	io_alloc_size
+
+/*
+ * Redefine flags
+ */
+#define	B_WRITE		IO_WRITE
+#define	B_READ		IO_READ
+#define	B_OPEN		IO_OPEN
+#define	B_DONE		IO_DONE
+#define	B_ERROR		IO_ERROR
+#define	B_BUSY		IO_BUSY
+#define	B_WANTED	IO_WANTED
+#define	B_BAD		IO_BAD
+#define	B_CALL		IO_CALL
+
+#define	B_MD1		IO_SPARE_START
+
+/*
+ * Redefine uio structure
+ */
+#define	uio	io_req
+
+/*
+ * Redefine physio routine
+ */
+#define	physio(strat, xbuf, dev, ops, minphys, ior) \
+		block_io(strat, minphys, ior)
+
+/*
+ * Export standard routines.
+ */
+extern void		minphys(
+				io_req_t	ior);
+extern io_return_t	block_io(
+				void		(*strat)(
+							io_req_t),
+				void		(*max_count)(
+							io_req_t),
+				io_req_t	ior);
+extern void		brelse(
+				struct buf	* bp);
+
+/*
+ * Alternate name for iodone
+ */
+#define	biodone	iodone
+#define biowait iowait


Property changes on: trunk/sys/sys/mach/device/buf.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/cdli.h
===================================================================
--- trunk/sys/sys/mach/device/cdli.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/cdli.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,160 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/*
+ *   (C) COPYRIGHT International Business Machines Corp. 1988,1993
+ *   All Rights Reserved
+ *   Licensed Materials - Property of IBM
+ *   US Government Users Restricted Rights - Use, duplication or
+ *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
+ */
+
+#ifndef _SYS_CDLI_H
+#define _SYS_CDLI_H
+
+#include <mach/mach_types.h>
+#include <types.h>
+#include <kern/spl.h>
+#include <kern/misc_protos.h>
+#include <kern/kalloc.h>
+#include <device/cdli_err.h>
+#include <device/mbuf.h>
+#include <device/ndd.h>
+
+struct cdli_inits
+{
+	int	(*init_rtn)(void);
+};
+extern struct cdli_inits cdli_inits[];
+
+struct ns_user {
+	void			(*isr)(struct ndd *,
+				       struct mbuf *,
+				       caddr_t, caddr_t); /* protocol input function */
+	caddr_t			isr_data;/* arg to isr			*/
+        struct ifqueue 		*protoq; /* input queue, may be NULL	*/
+	u_long			pkt_format; /* specifies hdr presentation */
+	u_long			netisr;	 /* isr number for schednetisr	*/
+	struct ifnet		*ifp;    /* ifnet ptr for socket users	*/
+};
+typedef struct ns_user ns_user_t;
+
+/* values for pkt_format */
+#define	NS_PROTO		0x0001
+#define NS_PROTO_SNAP		0x0002
+#define	NS_INCLUDE_LLC		0x0004
+#define	NS_INCLUDE_MAC		0x0008
+#define	NS_HANDLE_NON_UI	0x0100
+
+struct nd_dmxstats {
+	u_long		nd_nofilter;	/* packets dropped due to no user */
+	u_long		nd_nobufs;	/* packets dropped due to no buffers */
+	u_long		nd_bcast;	/* # of broadcast packets received */
+	u_long		nd_mcast;	/* # of multicast packets received */
+};
+typedef struct nd_dmxstats nd_dmxstats_t;
+
+struct ns_statuser {
+	void		(*isr)(caddr_t, caddr_t); /* status input function	*/
+	caddr_t		isr_data;	/* arg to isr			*/
+};
+typedef struct ns_statuser ns_statuser_t;
+
+struct ns_demuxer {
+	struct ns_demuxer *nd_next;/* link em together			   */
+	u_short	nd_inuse;	   /* any users?			   */
+	u_short	nd_use_nsdmx;	   /* boolean- true => common dmx services */
+	int	(*nd_add_filter)(struct ndd *,
+				 caddr_t,
+				 int,
+				 struct ns_user *); /* add func for receive filter (ie sap) */
+	int	(*nd_del_filter)(struct ndd *,
+				 caddr_t,
+				 int); /* delete func for removing filter */
+	int	(*nd_add_status)(struct ndd *,
+				 caddr_t,
+				 int,
+				 struct ns_statuser *);	/* add func for receive filter (ie sap) */
+	int	(*nd_del_status)(struct ndd *,
+				 caddr_t,
+				 int);	/* delete func for removing filter	   */
+	void	(*nd_receive)(struct ndd *, struct mbuf *); /* parser/demuxer for input packets     */
+	void	(*nd_status)(struct ndd *, int); /* asynchronous status handler          */
+	void	(*nd_response)(struct ndd *, struct mbuf *, int); /* XID and TEST response function       */
+	struct nd_dmxstats nd_dmxstats;	/* common demuxer statistics       */
+	u_int	nd_speclen;	   /* length of demuxer specific stats     */
+	caddr_t	nd_specstats;	   /* ptr to demuxer spcecific stats       */
+	u_long	nd_type;	   /* NDD type of this demuxer		   */
+};
+typedef struct ns_demuxer ns_demuxer_t;
+
+
+#define	NS_8022_LLC_DSAP	(0x00000001)	/* filter on DSAP only 	*/
+#define	NS_8022_LLC_DSAP_SNAP	(0x00000002)	/* filter on DSAP & SNAP*/
+#define	NS_TAP			(0x00000003)	/* network tap		*/
+#define	NS_ETHERTYPE		(0x00000004)	/* ethertype only 	*/
+
+struct ns_8022 {
+	u_int		filtertype;
+	u_char		dsap;		/* DSAP				*/
+	u_char		orgcode[3];	/* SNAP organization code	*/
+	u_short		ethertype;	/* SNAP ethertype		*/
+};
+typedef struct ns_8022 ns_8022_t;
+
+#define	NS_STATUS_MASK		(0x00000001)	/* status mask filtering*/
+
+struct ns_com_status {
+	u_int		filtertype;	/* type of filter		*/
+	u_int 		mask;		/* status code mask value 	*/
+	struct com_status_user	*sid;	/* returned user status id	*/
+};
+typedef struct ns_com_status ns_com_status_t;
+
+#define ND_CONFIG_VERSION_1	0x01
+
+typedef struct nd_config {
+	int	version;
+	int	errcode;
+	int	ndd_type;	/* type of demuxer. see sys/ndd.h */
+} nd_config_t;
+
+#define CFG_INIT	1
+#define CFG_TERM	2
+
+#include <device/cdli_proto.h>	/* Placement for ns_* and nd_* structs */
+
+#if CPUS > 1
+#define CDLI_LOCK_INIT(x)	simple_lock_init(x, ETAP_IO_CDLI)
+#define CDLI_LOCK(x)		simple_lock(x)
+#define CDLI_UNLOCK(x)		simple_unlock(x)
+#define CDLI_IS_LOCKED(l)	((l).lock_data)
+#else
+#define CDLI_LOCK_INIT(x)
+#define CDLI_LOCK(x)
+#define CDLI_UNLOCK(x)
+#define CDLI_IS_LOCKED(l)	1
+#endif
+
+#define	IF_DEQUEUE_M(q, m)	if_dequeue_m((q), &(m))
+#endif /* _SYS_CDLI_H */


Property changes on: trunk/sys/sys/mach/device/cdli.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/cdli_err.h
===================================================================
--- trunk/sys/sys/mach/device/cdli_err.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/cdli_err.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+#include <mach/error.h>
+
+#ifndef _CDLI_ERROR_H_
+#define _CDLI_ERROR_H_
+
+#define CDLI_ERR_BITS (err_kern|err_sub(2))
+
+#define CDLI_ERR_DEMUX_EXISTS		(CDLI_ERR_BITS | 1)
+#define CDLI_ERR_DEMUX_DOESNT_EXIST	(CDLI_ERR_BITS | 2)
+#define CDLI_ERR_DEMUX_IN_USE		(CDLI_ERR_BITS | 3)
+#define CDLI_ERR_NS_EXISTS		(CDLI_ERR_BITS | 4)
+#define CDLI_ERR_NS_DOESNT_EXIST	(CDLI_ERR_BITS | 5)
+#define CDLI_ERR_NDD_DOESNT_EXIST	(CDLI_ERR_BITS | 6)
+
+#define CDLI_ERR_BAD_ETH_CONFIG_CMD	(CDLI_ERR_BITS | 7)
+#define CDLI_ERR_ISR_MISSING		(CDLI_ERR_BITS | 8)
+#define CDLI_ERR_PROTOQ_MISSING		(CDLI_ERR_BITS | 9)
+#define CDLI_ERR_BAD_LEN		(CDLI_ERR_BITS | 10)
+#define CDLI_ERR_BAD_FILTERTYPE		(CDLI_ERR_BITS | 11)
+#define CDLI_ERR_NOMEM			(CDLI_ERR_BITS | 12)
+#define CDLI_ERR_FILTER_EXISTS		(CDLI_ERR_BITS | 13)
+#define CDLI_ERR_FILTER_DOESNT_EXIST	(CDLI_ERR_BITS | 14)
+#define CDLI_ERR_ISR_EXISTS		(CDLI_ERR_BITS | 15)
+#define CDLI_ERR_ISR_DOESNT_EXIST	(CDLI_ERR_BITS | 16)
+#define CDLI_ERR_PROTO_EXISTS		(CDLI_ERR_BITS | 17)
+#define CDLI_ERR_AF_OUT_OF_RANGE	(CDLI_ERR_BITS | 17)
+
+#endif


Property changes on: trunk/sys/sys/mach/device/cdli_err.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/cdli_proto.h
===================================================================
--- trunk/sys/sys/mach/device/cdli_proto.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/cdli_proto.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,93 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+#ifndef _KERN_CDLI_PROTO_H_
+#define _KERN_CDLI_PROTO_H_
+
+#include <device/if_ether.h>
+#include <device/mbuf.h>
+#include <device/ndd.h>
+#include <device/nd_lan.h>
+#include <device/cdli_err.h>
+
+/* Prototypes */
+
+/* From cdli.c */
+int ns_init(void);
+struct ns_demuxer *ns_get_demuxer(u_short);
+int ns_add_demux(u_long, struct ns_demuxer *);
+int ns_del_demux(u_int);
+int ns_add_filter(struct ndd *, caddr_t, int, struct ns_user *);
+int ns_del_filter(struct ndd *, caddr_t, int);
+int ns_add_status(struct ndd *, caddr_t, int, struct ns_statuser *);
+int ns_del_status(struct ndd *, caddr_t, int);
+int ns_attach(struct ndd *);
+int ns_detach(struct ndd *);
+struct ndd *ns_locate_wo_lock(char *);
+struct ndd *ns_locate(char *);
+int ns_alloc(char *, struct ndd **);
+void ns_free(struct ndd *);
+void ether_input(struct ifnet *, struct ether_header *, struct mbuf *);
+void if_dequeue_m(struct ifqueue *, struct mbuf **);
+
+/* From eth_demux.c */
+int nd_eth_config(char *, int);
+int eth_config(int, struct nd_config);
+int eth_add_filter(struct ndd *, struct ns_8022 *, int,
+	       struct ns_user *);
+int eth_del_filter(struct ndd *, struct ns_8022 *, int);
+int eth_add_status(struct ndd *, struct ns_com_status *,
+		   int, struct ns_statuser *);
+int eth_del_status(struct ndd *, struct ns_com_status *, int);
+struct eth_user	*eth_get_user(u_short, struct ndd *);
+int eth_add_ethertype(struct ndd *, struct ns_8022 *, struct ns_user *);
+int eth_del_ethertype(struct ndd *, struct ns_8022 *);
+int eth_add_tap(struct ndd *, struct ns_user *);
+int eth_del_tap(struct ndd *);
+void eth_receive(struct ndd *, caddr_t);
+int eth_std_receive(struct ndd *, caddr_t, struct ether_header *);
+void eth_response(struct ndd *, caddr_t, int);
+int eth_dmx_init(struct ndd *);
+int eth_add_demuxer(int);
+
+/* From nd_lan.c */
+int dmx_init(struct ndd *);
+void dmx_term(struct ndd *);
+void dmx_8022_receive(struct ndd *, struct mbuf *, int);
+void dmx_non_ui(struct ndd *, struct mbuf *, int);
+int dmx_8022_add_filter(struct ndd *, struct ns_8022 *, struct ns_user *);
+int dmx_8022_del_filter(struct ndd *, struct ns_8022 *);
+int dmx_add_status(struct ndd *, struct ns_com_status *, struct ns_statuser *);
+int dmx_del_status(struct ndd *, struct ns_com_status *);
+void dmx_status(struct ndd *, struct ndd_statblk *);
+struct ns_8022_user *dmx_8022_get_user(struct ns_8022 *, struct ndd *);
+int dmx_init(struct ndd *);
+void dmx_term(struct ndd *);
+int nd_config_proto(u_short, struct config_proto *);
+int nd_config_sap(u_short, u_short, struct config_proto *, u_short *);
+int nd_find_af(u_short, u_short);
+
+/* From devices files */
+int cdli_ns8390init(void);
+
+#endif


Property changes on: trunk/sys/sys/mach/device/cdli_proto.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/cdrom_status.h
===================================================================
--- trunk/sys/sys/mach/device/cdrom_status.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/cdrom_status.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,156 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ * 
+ */
+/*
+ * MkLinux
+ */
+
+/*
+ * codes and structures for audio cd commands.
+ */
+
+typedef struct {
+        unsigned char   cdmsf_min0;	/* start minute */
+        unsigned char   cdmsf_sec0;	/* start second */
+        unsigned char   cdmsf_frame0;	/* start frame */
+        unsigned char   cdmsf_min1;	/* end minute */
+        unsigned char   cdmsf_sec1;	/* end second */
+        unsigned char   cdmsf_frame1;	/* end frame */
+} cd_msf_t;
+
+typedef struct {
+        unsigned char   cdti_track0;	/* start track */
+        unsigned char   cdti_index0;	/* start index */
+        unsigned char   cdti_track1;	/* end track */
+        unsigned char   cdti_index1;	/* end index */
+} cd_ti_t;
+
+
+typedef struct {
+	unsigned int	len;
+	unsigned char	first_track;
+	unsigned char	last_track;
+} cd_toc_header_t;
+
+typedef union {
+	  struct {
+	    unsigned char	minute;
+	    unsigned char	second;
+	    unsigned char	frame;
+	  } msf;
+	  int lba;
+} cd_addr_t;
+
+typedef struct {
+	unsigned char	cdt_track;
+	unsigned int	cdt_adr		:4;
+	unsigned int	cdt_ctrl	:4;
+	unsigned char	cdt_type;
+	cd_addr_t	cdt_addr;
+	unsigned char	cdt_datamode;
+} cd_toc_t;
+
+typedef struct {
+	unsigned char	cdsc_format;
+	unsigned char	cdsc_track;
+	unsigned char	cdsc_index;
+	unsigned char	cdsc_audiostatus;
+	unsigned int	cdsc_adr	:4;
+	unsigned int	cdsc_ctrl	:4;
+	unsigned char	cdsc_type;
+	cd_addr_t	cdsc_absolute_addr;
+	cd_addr_t	cdsc_relative_addr;
+} cd_subchnl_t;
+
+typedef struct {
+        u_char  channel0;
+        u_char  channel1;
+        u_char  channel2;
+        u_char  channel3;
+} cd_volctrl_t;
+
+
+/*
+ * CD-ROM address types (cdrom_tocentry.cdte_format)
+ */
+#define MACH_CDROM_LBA 0x01 /* "logical block": first frame is #0 */
+#define MACH_CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */
+
+/*
+ * bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl)
+ */
+#define MACH_CDROM_DATA_TRACK        0x04
+
+/*
+ * The leadout track is always 0xAA, regardless of # of tracks on disc
+ */
+#define MACH_CDROM_LEADOUT   0xAA
+
+/*
+ * CD-ROM IOCTL commands
+ * For IOCTL calls, we will commandeer byte 0x53, or 'S'.
+ */
+
+#define MACH_CDROMPAUSE              0x5301
+#define MACH_CDROMRESUME             0x5302
+#define MACH_CDROMPLAYMSF            0x5303  /* (struct cdrom_msf) */
+#define MACH_CDROMPLAYTRKIND         0x5304  /* (struct cdrom_ti) */
+
+#define MACH_CDROMSTOP               0x5307  /* stop the drive motor */
+#define MACH_CDROMSTART              0x5308  /* turn the motor on */
+
+#define MACH_CDROMEJECT              0x5309  /* eject CD-ROM media */
+
+#define MACH_CDROMVOLCTRL            0x530a  /* (struct cdrom_volctrl) */
+#define MACH_CDROMVOLREAD	     0x5313  /* read current volume */
+
+
+#define MACH_SCMD_READ_TOC_MSF		0x5320	/* Toc in msf format */
+#define MACH_SCMD_READ_TOC_LBA		0x5321	/* Toc in lba format */
+
+#define MACH_SCMD_READ_SUBCHNL_MSF	0x5322	/* SC info in msf format */
+#define MACH_SCMD_READ_SUBCHNL_LBA	0x5323	/* SC info in lba format */
+
+/*
+ * CD-ROM-specific SCSI command opcodes
+ */
+
+/*
+ * Group 2 (10-byte).  All of these are called 'optional' by SCSI-II.
+ */
+#define MACH_SCMD_READ_TOC           0x43    /* read table of contents */
+#define MACH_SCMD_PLAYAUDIO_MSF      0x47    /* play data at time offset */
+#define MACH_SCMD_PLAYAUDIO_TI       0x48    /* play data at track/index */
+#define MACH_SCMD_PAUSE_RESUME       0x4B    /* pause/resume audio */
+#define MACH_SCMD_READ_SUBCHANNEL    0x42    /* read SC info on playing disc */
+#define MACH_SCMD_PLAYAUDIO10        0x45    /* play data at logical block */
+#define MACH_SCMD_READ_HEADER        0x44    /* read TOC header */
+
+/*
+ * audio states (from SCSI-2, but seen with other drives, too)
+ */
+#define MACH_CDROM_AUDIO_INVALID     0x00    /* audio status not supported */
+#define MACH_CDROM_AUDIO_PLAY        0x11    /* audio play operation in progress */
+#define MACH_CDROM_AUDIO_PAUSED      0x12    /* audio play operation paused */
+#define MACH_CDROM_AUDIO_COMPLETED   0x13    /* audio play successfully completed */
+#define MACH_CDROM_AUDIO_ERROR       0x14    /* audio play stopped due to error */
+#define MACH_CDROM_AUDIO_NO_STATUS   0x15    /* no current audio status to return */
+


Property changes on: trunk/sys/sys/mach/device/cdrom_status.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/cirbuf.h
===================================================================
--- trunk/sys/sys/mach/device/cirbuf.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/cirbuf.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,133 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4.3.1  92/03/28  10:04:31  jeffreyh
+ * 	04-Mar-92  emcmanus at gr.osf.org
+ * 		Declare new cb_space() function.
+ * 	[92/03/10  07:56:04  bernadat]
+ * 
+ * Revision 2.4  91/05/14  15:39:43  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:08:06  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:26:40  mrt]
+ * 
+ * Revision 2.2  90/08/27  21:54:39  dbg
+ * 	Created.
+ * 	[90/07/09            dbg]
+ * 
+ */
+/* CMU_ENDHIST */
+
+/*
+ *(C)UNIX System Laboratories, Inc. all or some portions of this file are
+ *derived from material licensed to the University of California by
+ *American Telephone and Telegraph Co. or UNIX System Laboratories,
+ *Inc. and are reproduced herein with the permission of UNIX System
+ *Laboratories, Inc.
+ */
+
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	7/90
+ */
+
+#ifndef	_DEVICE_CIRBUF_H_
+#define	_DEVICE_CIRBUF_H_
+
+/*
+ * Circular buffers for TTY
+ */
+
+struct cirbuf {
+	char *	c_start;	/* start of buffer */
+	char *	c_end;		/* end of buffer + 1*/
+	char *	c_cf;		/* read pointer */
+	char *	c_cl;		/* write pointer */
+	short	c_cc;		/* current number of characters
+				   (compatibility) */
+	short	c_hog;		/* max ever */
+};
+
+/*
+ * Exported routines
+ */
+
+extern int	putc(
+			char			ch,
+			struct cirbuf 		* cb);
+extern int	getc(
+			struct cirbuf		* cb);
+extern int	q_to_b(
+			struct cirbuf		* cb,
+			char			* cp,
+			int			count);
+extern int	b_to_q(
+			char			* cp,
+			int			count,
+			struct cirbuf		* cb);
+extern void	ndflush(
+			struct cirbuf		* cb,
+			int			count);
+extern void	cb_alloc(
+			struct cirbuf		* cb,
+			int			buf_size);
+extern void	cb_free(
+			struct cirbuf		* cb);
+extern int	cb_space(
+			struct cirbuf		* cb);
+extern int	ndqb(
+			struct cirbuf		*cb,
+			int			mask);
+
+#endif	/* _DEVICE_CIRBUF_H_ */


Property changes on: trunk/sys/sys/mach/device/cirbuf.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/conf.h
===================================================================
--- trunk/sys/sys/mach/device/conf.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/conf.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,205 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/08/28  11:11:12  jsb
+ * 	Change block size entry to general device info entry.
+ * 	[91/08/12  17:24:37  dlb]
+ * 
+ * 	Add block size entry.  Only needed for block_io devices.
+ * 	[91/08/05  17:28:42  dlb]
+ * 
+ * Revision 2.3  91/05/14  15:39:57  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.2  91/02/05  17:08:10  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:26:55  mrt]
+ * 
+ * Revision 2.1  89/08/03  15:26:07  rwd
+ * Created.
+ * 
+ * 12-May-89  David Golub (dbg) at Carnegie-Mellon University
+ *	Added indirect devices.
+ *
+ * 12-Apr-89  David Golub (dbg) at Carnegie-Mellon University
+ *	Added port_death routine.
+ *
+ * 24-Aug-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	8/88
+ */
+
+#ifndef	_CONF_
+#define	_CONF_
+
+#include <device/device_types.h>
+#include <device/net_status.h>
+#include <device/device_typedefs.h>
+
+/*
+ * Operations list for major device types.
+ */
+struct dev_ops {
+	char *    	d_name;		/* name for major device */
+	io_return_t	(*d_open)(	/* open device */
+				dev_t		dev,
+				dev_mode_t	flag,
+				io_req_t	ior);
+	void		(*d_close)(	/* close device */
+				dev_t		dev);
+	io_return_t	(*d_read)(	/* read */
+				dev_t		dev,
+				io_req_t	ior);
+	io_return_t	(*d_write)(	/* write */
+				dev_t		dev,
+				io_req_t	ior);
+	io_return_t	(*d_getstat)(	/* get status/control */
+				dev_t			dev,
+				dev_flavor_t		flavor,
+				dev_status_t		data,
+				mach_msg_type_number_t	* count);
+	io_return_t	(*d_setstat)(	/* set status/control */
+				dev_t			dev,
+				dev_flavor_t		flavor,
+				dev_status_t		data,
+				mach_msg_type_number_t	count);
+	vm_offset_t	(*d_mmap)(	/* map memory */
+				dev_t		dev,
+				vm_offset_t	off,
+				vm_prot_t	prot);
+	io_return_t	(*d_async_in)(	/* asynchronous input setup */
+				dev_t			dev,
+				ipc_port_t		rcv_port,
+				int			pri,
+				filter_t		*filter,
+				mach_msg_type_number_t	fcount,
+				mach_device_t		device);
+	void		(*d_reset)(	/* reset device */
+				dev_t		dev);
+	boolean_t	(*d_port_death)(/* clean up reply ports */
+				dev_t		dev,
+				ipc_port_t	port);
+					
+	int		d_subdev;	/* number of sub-devices per
+					   unit */
+	io_return_t	(*d_dev_info)(	/* driver info for kernel */
+				dev_t		dev,
+				dev_flavor_t	flavor,
+				char		* info);
+};
+
+#define	NULL_OPEN	(io_return_t (*)(dev_t, dev_mode_t, io_req_t))nulldev
+#define	NULL_CLOSE	(void (*)(dev_t))nulldev
+#define	NULL_READ	(io_return_t (*)(dev_t, io_req_t))nulldev
+#define	NULL_WRITE	(io_return_t (*)(dev_t, io_req_t))nulldev
+#define	NULL_GETS	(io_return_t (*)(dev_t, dev_flavor_t, dev_status_t, mach_msg_type_number_t *))nulldev
+#define	NULL_SETS	(io_return_t (*)(dev_t, dev_flavor_t, dev_status_t, mach_msg_type_number_t))nulldev
+#define	NULL_MMAP	(vm_offset_t (*)(dev_t, vm_offset_t, vm_prot_t))nulldev
+#define	NULL_ASYNC	(io_return_t (*)(dev_t, ipc_port_t, int, filter_t *, mach_msg_type_number_t, mach_device_t))nulldev
+#define	NULL_RESET	(void (*)(dev_t))nulldev
+#define	NULL_DEATH	(boolean_t (*)(dev_t, ipc_port_t))nulldev
+#define	NULL_DINFO	(io_return_t (*)(dev_t, dev_flavor_t, char *))nodev
+
+#define	NO_OPEN		(io_return_t (*)(dev_t, dev_mode_t, io_req_t))nodev
+#define	NO_CLOSE	(void (*)(dev_t))nodev
+#define	NO_READ		(io_return_t (*)(dev_t, io_req_t))nodev
+#define	NO_WRITE	(io_return_t (*)(dev_t, io_req_t))nodev
+#define	NO_GETS		(io_return_t (*)(dev_t, dev_flavor_t, dev_status_t, mach_msg_type_number_t *))nodev
+#define	NO_SETS		(io_return_t (*)(dev_t, dev_flavor_t, dev_status_t, mach_msg_type_number_t))nodev
+#define	NO_MMAP		(vm_offset_t (*)(dev_t, vm_offset_t, vm_prot_t))nodev
+#define	NO_ASYNC	(io_return_t (*)(dev_t, ipc_port_t, int, filter_t *, mach_msg_type_number_t, mach_device_t))nodev
+#define	NO_RESET	(void (*)(dev_t))nodev
+#define	NO_DEATH	(boolean_t (*)(dev_t, ipc_port_t))nodev
+#define	NO_DINFO	(io_return_t (*)(dev_t, dev_flavor_t, char *))nodev
+
+
+/*
+ * Routines for null entries.
+ */
+extern int	nulldev(void);		/* no operation - OK */
+extern int	nodev(void);		/* no operation - error */
+
+/*
+ * Flavor constants for d_dev_info routine
+ */
+#define D_INFO_BLOCK_SIZE	1
+#define D_INFO_SGLIST_IO	2
+#define D_INFO_CLONE_OPEN	3
+
+/*
+ * Head of list of attached devices
+ */
+extern struct dev_ops	dev_name_list[];
+extern int		dev_name_count;
+
+/*
+ * Indirection vectors for certain devices.
+ */
+struct dev_indirect {
+	char *		d_name;		/* name for device */
+	struct dev_ops	*d_ops;		/* operations (major device) */
+	int		d_unit;		/* and unit number */
+};
+typedef struct dev_indirect	*dev_indirect_t;
+
+/*
+ * List of indirect devices.
+ */
+extern struct dev_indirect	dev_indirect_list[];
+extern int			dev_indirect_count;
+
+#endif	/* _CONF_ */


Property changes on: trunk/sys/sys/mach/device/conf.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/data_device.h
===================================================================
--- trunk/sys/sys/mach/device/data_device.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/data_device.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,81 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+
+#include <types.h>
+#include <kern/macro_help.h>
+#include <kern/queue.h>
+#include <device/dev_hdr.h>
+#include <device/device_types.h>
+#include <device/io_req.h>
+
+#ifndef _DEVICE_DATA_DEVICE_H_
+#define	_DEVICE_DATA_DEVICE_H_
+
+/*
+ * Request sent to the bootstrap task
+ */
+#define	DATADEV_NAME	"data_device"		      /* Device generic name */
+
+typedef struct datadev {
+    queue_chain_t	  dd_chain;		      /* data request chain */
+    const char		 *dd_name;		      /* name */
+    unsigned		  dd_size;		      /* name size */
+    dev_t		  dd_dev;		      /* data device */
+    void		(*dd_close)(void *);	      /* close function */
+    void		(*dd_write)(void *, io_req_t);/* write function */
+    void		 *dd_arg;		      /* functions argument */
+} *datadev_t;
+
+#define	DATADEV_INIT(_ddev, _name, _close, _write, _arg)	\
+MACRO_BEGIN							\
+    const char *_p = (_ddev)->dd_name  = (const char *)(_name);	\
+    (_ddev)->dd_size = 1;					\
+    while (*_p++ != '\0')					\
+	(_ddev)->dd_size++;					\
+    (_ddev)->dd_close = (void (*)(void *))(_close);		\
+    (_ddev)->dd_write = (void (*)(void *, io_req_t))(_write);	\
+    (_ddev)->dd_arg   = (_arg);					\
+MACRO_END
+
+extern void		datadev_init(void);
+
+extern void		datadev_request(datadev_t);
+
+extern io_return_t	datadev_open(dev_t,
+				     dev_mode_t,
+				     io_req_t);
+
+extern void		datadev_close(dev_t);
+
+extern io_return_t	datadev_read(dev_t,
+				     io_req_t);
+
+extern io_return_t	datadev_write(dev_t,
+				      io_req_t);
+
+extern io_return_t	datadev_dinfo(dev_t,
+				      dev_flavor_t,
+				      char *);
+
+#endif /* _DEVICE_DATA_DEVICE_H_ */


Property changes on: trunk/sys/sys/mach/device/data_device.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/dev_forward.defs
===================================================================
--- trunk/sys/sys/mach/device/dev_forward.defs	                        (rev 0)
+++ trunk/sys/sys/mach/device/dev_forward.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,84 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/14  15:40:10  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:08:17  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:27:05  mrt]
+ * 
+ * Revision 2.2  90/12/14  10:59:32  jsb
+ * 	First checkin.
+ * 	[90/12/13  21:12:45  jsb]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: Joseph S. Barrera, Carnegie Mellon University
+ *	Date: 	12/90
+ */
+
+subsystem KernelUser dev_forward 2800;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+#include <device/device_types.defs>
+
+type reply_port_t = MACH_MSG_TYPE_MOVE_SEND_ONCE | polymorphic
+	ctype: mach_port_t;
+
+simpleroutine forward_device_open_send(
+		master_port	: mach_port_t;
+	ureplyport reply_port	: reply_port_t;
+		mode		: dev_mode_t;
+		name		: dev_name_t);

Added: trunk/sys/sys/mach/device/dev_hdr.h
===================================================================
--- trunk/sys/sys/mach/device/dev_hdr.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/dev_hdr.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,253 @@
+/*
+ * Device emulation code ported from gnumach to OSF Mach
+ *   Elgin Lee, 1998
+ */
+/*
+ * Mach device definitions (i386at version).
+ *
+ * Copyright (c) 1996 The University of Utah and
+ * the Computer Systems Laboratory at the University of Utah (CSL).
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the
+ * Computer Systems Laboratory at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist at cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ *      Author: Shantanu Goel, University of Utah CSL
+ */
+
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.7  91/05/14  15:40:30  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.6  91/02/05  17:08:20  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:27:12  mrt]
+ * 
+ * Revision 2.5  90/09/09  14:31:08  rpd
+ * 	Use decl_simple_lock_data.
+ * 	[90/08/30            rpd]
+ * 
+ * Revision 2.4  90/08/27  21:54:45  dbg
+ * 	Fix type definitions.
+ * 	[90/07/16            dbg]
+ * 
+ * Revision 2.3  90/06/02  14:47:10  rpd
+ * 	Updated for new IPC.
+ * 	[90/03/26  21:43:28  rpd]
+ * 
+ * Revision 2.2  89/09/08  11:23:07  dbg
+ * 	Rename to 'struct device' and 'device_t'.  Added open-
+ * 	state.  Removed most of old flags.
+ * 	[89/08/01            dbg]
+ * 
+ * 12-Apr-89  David Golub (dbg) at Carnegie-Mellon University
+ *	Added routine to call a function on each device.
+ *
+ *  3-Mar-89  David Golub (dbg) at Carnegie-Mellon University
+ *	Created.
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	3/89
+ */
+
+#ifndef	_DEVICE_DEV_HDR_H_
+#define	_DEVICE_DEV_HDR_H_
+
+#include <types.h>
+#include <mach/port.h>
+#include <kern/lock.h>
+#include <kern/queue.h>
+#include <device/device_types.h>
+#include <device/device_typedefs.h>
+
+struct device_emulation_ops;
+
+/* This structure is associated with each open device port.
+   The port representing the device points to this structure.  */
+struct device
+{
+  struct device_emulation_ops *emul_ops;
+  void *emul_data;
+};
+
+#define	DEVICE_NULL	((device_t)0)
+
+/*
+ * Generic device header for Mach-native devices.  May be allocated with
+ * the device, or built when the device is opened.
+ */
+struct mach_device {
+	decl_mutex_data(,ref_lock)	/* lock for reference count */
+	int		ref_count;	/* reference count */
+	decl_mutex_data(,iop_lock)
+	decl_mutex_data(,lock)		/* lock for rest of state */
+	short		state;		/* state: */
+#define	DEV_STATE_INIT		0	/* not open  */
+#define	DEV_STATE_OPENING	1	/* being opened */
+#define	DEV_STATE_OPEN		2	/* open */
+#define	DEV_STATE_CLOSING	3	/* being closed */
+	short		flag;		/* random flags: */
+#define	D_EXCL_OPEN		0x0001	/* open only once */
+#define	D_CLONED		0x0002	/* device cloned on open */
+	short		open_count;	/* number of times open */
+	unsigned char	io_in_progress;	/* number of IOs in progress */
+	unsigned char	io_in_progress_limit;	/* Limit on number of IOs */
+#define IO_IN_PROGRESS_MAX 255
+#define IO_IN_PROGRESS_DEFAULT 10
+	boolean_t	io_wait;	/* someone waiting for IO to finish */
+	boolean_t	iop_wait;	/* someone waiting for IO to finish */
+
+	struct ipc_port *port;		/* open port */
+	queue_chain_t	number_chain;	/* chain for lookup by number */
+	dev_t		dev_number;	/* device number */
+	struct dev_ops	*dev_ops;	/* and operations vector */
+
+	struct device   dev;            /* the device structure for the port */
+};
+
+typedef	struct mach_device	*mach_device_t;
+#define	MACH_DEVICE_NULL	((mach_device_t)0)
+
+/*
+ * I/O completion queue kernel object.
+ */
+struct io_done_queue {
+	decl_simple_lock_data(,ref_lock) /* lock for reference count */
+	decl_simple_lock_data(,lock)	/* lock for other fields */
+	int		ref_count;	/* reference count */
+	struct ipc_port *port;		/* associated kernel port */
+	queue_head_t	io_done_list;	/* list of completed I/O requests */
+	int		io_in_progress;	/* pending I/O requests */
+	int		waiters;	/* threads doing io_done_queue_wait()
+					   less queued I/O requests */
+	int		handoffs;	/* I/O reqs given to io_done_thread */
+};
+
+#define	IO_DONE_QUEUE_NULL	((io_done_queue_t)0)
+
+/*
+ * To find and remove device entries
+ */
+extern kern_return_t	device_lookup_mode(
+					char		*name,
+					dev_mode_t	mode,
+					mach_device_t	*dev);
+extern mach_device_t	device_lookup(	/* by name */
+					char		* name);
+extern void		mach_device_reference(
+					void		*device);
+extern void		mach_device_deallocate(
+					void		*device);
+extern void		device_reference(
+					device_t	device);
+extern void		device_deallocate(
+					device_t	device);
+
+/*
+ * To find and remove port-to-device mappings
+ */
+extern device_t		dev_port_lookup(
+					ipc_port_t	port);
+extern void		dev_port_enter(
+					mach_device_t	device);
+extern void		dev_port_remove(
+					mach_device_t	device);
+
+/*
+ * To call a routine on each device
+ */
+extern boolean_t	dev_map(
+					boolean_t	(*routine)(
+						mach_device_t, ipc_port_t),
+					ipc_port_t	port);
+
+/*
+ * To find port-to-io_done_queue mappings
+ */
+extern io_done_queue_t	io_done_queue_port_lookup(
+					ipc_port_t	port);
+extern void		io_done_queue_reference(
+					io_done_queue_t	queue);
+
+
+extern void		dev_name_init(void);
+extern void		dev_lookup_init(void);
+
+/*
+ * To lock and unlock device state and open-count
+ */
+#define	device_lock(device)	mutex_lock(&(device)->lock)
+#define	device_unlock(device)	mutex_unlock(&(device)->lock)
+
+/*
+ * To lock and unlock I/O completion queue
+ */
+#define	io_done_queue_lock(queue)	simple_lock(&(queue)->lock)
+#define	io_done_queue_unlock(queue)	simple_unlock(&(queue)->lock)
+
+#endif	/* _DEVICE_DEV_HDR_H_ */


Property changes on: trunk/sys/sys/mach/device/dev_hdr.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/dev_master.h
===================================================================
--- trunk/sys/sys/mach/device/dev_master.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/dev_master.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,113 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6  91/05/14  15:41:00  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.5  91/02/05  17:08:30  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:27:25  mrt]
+ * 
+ * Revision 2.4  91/01/08  15:09:30  rpd
+ * 	Added continuation argument to thread_block.
+ * 	[90/12/08            rpd]
+ * 
+ * Revision 2.3  90/10/12  18:07:25  rpd
+ * 	Fixed calls to thread_bind in io_grab_master and io_release_master.
+ * 	[90/10/10            rpd]
+ * 
+ * Revision 2.2  90/01/11  11:41:48  dbg
+ * 	Created.
+ * 	[89/11/27            dbg]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	11/89
+ *
+ * 	Bind an IO operation to the master CPU.
+ */
+
+#include <cpus.h>
+
+#if	NCPUS > 1
+
+#include <kern/macro_help.h>
+#include <kern/cpu_number.h>
+#include <kern/sched_prim.h>
+#include <kern/thread.h>
+#include <kern/processor.h>
+
+#define	io_grab_master() \
+	MACRO_BEGIN \
+	thread_bind(current_thread(), master_processor); \
+	mp_disable_preemption(); \
+	if (current_processor() != master_processor) { \
+	    mp_enable_preemption(); \
+	    thread_block(); \
+	} else { \
+	    mp_enable_preemption(); \
+	} \
+	MACRO_END
+
+#define	io_release_master() \
+	MACRO_BEGIN \
+	thread_bind(current_thread(), PROCESSOR_NULL); \
+	MACRO_END
+
+#else	/* NCPUS > 1 */
+
+#define	io_grab_master()
+#define	io_release_master()
+
+#endif	/* NCPUS > 1 */


Property changes on: trunk/sys/sys/mach/device/dev_master.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/device.defs
===================================================================
--- trunk/sys/sys/mach/device/device.defs	                        (rev 0)
+++ trunk/sys/sys/mach/device/device.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,198 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.7.3.1  92/03/03  16:13:45  jeffreyh
+ * 	Pick up changes from TRUNK
+ * 	[92/02/26  11:00:51  jeffreyh]
+ * 
+ * Revision 2.8  92/01/03  20:03:29  dbg
+ * 	Add 'CountInOut' tag to routines returning variable-length
+ * 	inline arrays.  Remove 'IsLong' tag from routines passing or
+ * 	returning variable-length arrays.  Old routines left under
+ * 	'xxx_' names.  REMOVE THESE SOON!
+ * 	[91/11/26            dbg]
+ * 
+ * Revision 2.7  91/05/14  15:41:53  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.6  91/02/05  17:08:50  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:27:50  mrt]
+ * 
+ * Revision 2.5  90/06/02  14:47:25  rpd
+ * 	Changes for new IPC.
+ * 	[90/05/03  00:13:46  rpd]
+ * 
+ * 29-Jun-88  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Moved data type declarations to "mach_types.defs".
+ *
+ * 10-Feb-88  Douglas Orr (dorr) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ * File:	device/device.defs
+ * Author:	Douglas Orr
+ *		Feb 10, 1988
+ * Abstract:
+ *	Mach device support.  Mach devices are accessed through
+ *	block and character device interfaces to the kernel.
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+		       device 2800;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+#include <device/device_types.defs>
+
+serverprefix	ds_;
+
+type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic
+	ctype: mach_port_t;
+
+skip;	/* nmk15: device_open */
+
+routine device_close(
+		device		: device_t
+	);
+
+routine device_write(
+		device		: device_t;
+	sreplyport reply_port	: reply_port_t;
+	in	mode		: dev_mode_t;
+	in	recnum		: recnum_t;
+	in	data		: io_buf_ptr_t, const;
+	out	bytes_written	: io_buf_len_t
+	);
+
+routine device_write_inband(
+		device		: device_t;
+	sreplyport reply_port	: reply_port_t;
+	in	mode		: dev_mode_t;
+	in	recnum		: recnum_t;
+	in	data		: io_buf_ptr_inband_t, const;
+	out	bytes_written	: io_buf_len_t
+	);
+
+routine	device_read(
+		device		: device_t;
+	sreplyport reply_port	: reply_port_t;
+	in	mode		: dev_mode_t;
+	in	recnum		: recnum_t;
+	in	bytes_wanted	: io_buf_len_t;
+	out	data		: io_buf_ptr_t
+	);
+
+routine	device_read_inband(
+		device		: device_t;
+	sreplyport reply_port	: reply_port_t;
+	in	mode		: dev_mode_t;
+	in	recnum		: recnum_t;
+	in	bytes_wanted	: io_buf_len_t;
+	out	data		: io_buf_ptr_inband_t
+	);
+
+skip;	/* obsolete: xxx_device_set_status */
+skip;   /* obsolete: xxx_device_get_status */
+skip;	/* obsolete: xxx_device_set_filter */
+
+routine device_map(
+		device		: device_t;
+	in	prot		: vm_prot_t;
+	in	offset		: vm_offset_t;
+	in	size		: vm_size_t;
+	out	pager		: memory_object_t;
+	in	unmap		: boolean_t
+	);
+
+routine	device_set_status(
+		device		: device_t;
+	in	flavor		: dev_flavor_t;
+	in	status		: dev_status_t
+	);
+
+routine	device_get_status(
+		device		: device_t;
+	in	flavor		: dev_flavor_t;
+	out	status		: dev_status_t, CountInOut
+	);
+
+routine device_set_filter(
+		device		: device_t;
+	in	receive_port	: mach_port_send_t;
+	in	priority	: int;
+	in	filter		: filter_array_t
+	);
+
+skip;	/* device_read_reply_overwrite */
+
+routine device_open(
+		master_port	: mach_port_t;
+	sreplyport reply_port	: reply_port_t;
+	in	ledger		: ledger_port_t;
+	in	mode		: dev_mode_t;
+	in	sec_token	: security_token_t;
+	in	name		: dev_name_t;
+	out	device		: device_t
+	);
+
+routine io_done_queue_create(
+		host		: host_t;
+	out	queue		: io_done_queue_t
+	);
+
+routine io_done_queue_terminate(
+		queue		: io_done_queue_t
+	);

Added: trunk/sys/sys/mach/device/device_emul.h
===================================================================
--- trunk/sys/sys/mach/device/device_emul.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/device_emul.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,70 @@
+/*
+ * Mach device emulation definitions (i386at version).
+ *
+ * Copyright (c) 1996 The University of Utah and
+ * the Computer Systems Laboratory at the University of Utah (CSL).
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the
+ * Computer Systems Laboratory at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist at cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ *      Author: Shantanu Goel, University of Utah CSL
+ */
+
+#ifndef _DEVICE_DEVICE_EMUL_H_
+#define _DEVICE_DEVICE_EMUL_H_
+
+#include <kern/ledger.h>
+#include <mach/notify.h>
+#include <device/net_status.h>
+
+/* Each emulation layer provides these operations.  */
+struct device_emulation_ops
+{
+  void (*reference) (void *);
+  void (*dealloc) (void *);
+  ipc_port_t (*dev_to_port) (void *);
+  io_return_t (*open) (ipc_port_t, mach_msg_type_name_t, ledger_t,
+		       dev_mode_t, security_token_t, char *, device_t *);
+  io_return_t (*close) (void *);
+  io_return_t (*write) (void *, ipc_port_t, mach_msg_type_name_t,
+			dev_mode_t, recnum_t, io_buf_ptr_t, mach_msg_type_number_t, io_buf_len_t *);
+  io_return_t (*write_inband) (void *, ipc_port_t, mach_msg_type_name_t,
+			       dev_mode_t, recnum_t, io_buf_ptr_inband_t,
+			       mach_msg_type_number_t, io_buf_len_t *);
+  io_return_t (*write_common) (void *, ipc_port_t, mach_msg_type_name_t,
+			       dev_mode_t, recnum_t, io_buf_ptr_t,
+			       mach_msg_type_number_t, int, io_buf_len_t *);
+  io_return_t (*read) (void *, ipc_port_t, mach_msg_type_name_t,
+		       dev_mode_t, recnum_t, io_buf_len_t, io_buf_ptr_t *,
+		       mach_msg_type_number_t *);
+  io_return_t (*read_inband) (void *, ipc_port_t, mach_msg_type_name_t,
+			      dev_mode_t, recnum_t, io_buf_len_t,
+			      io_buf_ptr_inband_t, mach_msg_type_number_t *);
+  io_return_t (*read_common) (void *, ipc_port_t, mach_msg_type_name_t,
+			      dev_mode_t, recnum_t, io_buf_len_t, int,
+			      io_buf_ptr_t *, mach_msg_type_number_t *);
+  io_return_t (*set_status) (void *, dev_flavor_t, dev_status_t,
+			     mach_msg_type_number_t);
+  io_return_t (*get_status) (void *, dev_flavor_t, dev_status_t,
+			     mach_msg_type_number_t *);
+  io_return_t (*set_filter) (void *, ipc_port_t, int, filter_t [],
+			     mach_msg_type_number_t);
+  io_return_t (*map) (void *, vm_prot_t, vm_offset_t,
+		      vm_size_t, ipc_port_t *, boolean_t);
+  void (*no_senders) (mach_no_senders_notification_t *);
+};
+
+#endif /* _DEVICE_DEVICE_EMUL_H_ */


Property changes on: trunk/sys/sys/mach/device/device_emul.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/device_port.h
===================================================================
--- trunk/sys/sys/mach/device/device_port.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/device_port.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5  91/05/14  15:42:21  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:08:57  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:28:06  mrt]
+ * 
+ * Revision 2.3  90/06/02  14:47:34  rpd
+ * 	Converted to new IPC.
+ * 	[90/03/26  21:51:28  rpd]
+ * 
+ * Revision 2.2  89/09/08  11:23:37  dbg
+ * 	Created.
+ * 	[89/08/23            dbg]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	8/89
+ */
+
+#ifndef	_DEVICE_DEVICE_PORT_H_
+#define	_DEVICE_DEVICE_PORT_H_
+
+#include <ipc/ipc_port.h>
+
+/*
+ *	Master privileged port for this host's device service
+ */
+extern ipc_port_t	master_device_port;
+
+#endif	/* _DEVICE_DEVICE_PORT_H_ */


Property changes on: trunk/sys/sys/mach/device/device_port.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/device_reply.defs
===================================================================
--- trunk/sys/sys/mach/device/device_reply.defs	                        (rev 0)
+++ trunk/sys/sys/mach/device/device_reply.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,179 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.7  91/05/14  15:42:37  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.6  91/02/05  17:09:01  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:28:12  mrt]
+ * 
+ * Revision 2.5  90/06/02  14:47:40  rpd
+ * 	Converted to new IPC.
+ * 	[90/03/26  21:52:00  rpd]
+ * 
+ * Revision 2.4  89/09/08  11:23:41  dbg
+ * 	Define KERNEL_SERVER.
+ * 	[89/08/23            dbg]
+ * 
+ * Revision 2.3  89/08/31  16:18:39  rwd
+ * 	Added device_read_reply_inband
+ * 	[89/08/15            rwd]
+ * 
+ * Revision 2.2  89/08/05  16:05:58  rwd
+ * 	Added device_write_reply_inband
+ * 	[89/08/04            rwd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	8/89
+ *
+ * 	Reply-only side of device interface.
+ */
+
+subsystem
+#if	KERNEL_USER
+	  KernelUser
+#endif	/* KERNEL_USER */
+		     device_reply 2900;
+				/* to match reply numbers for device.defs */
+
+/*
+ * Device_write_reply (only user of this data type) deallocates
+ * the data.
+ */
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+#include <device/device_types.defs>
+
+#ifdef	SEQNOS
+serverprefix seqnos_;
+serverdemux seqnos_device_reply_server;
+#else	/* SEQNOS */
+userprefix	ds_;
+#endif	/* SEQNOS */
+
+type reply_port_t = polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE
+	ctype: mach_port_t;
+
+skip;	/* nmk15: device_open */
+
+skip;	/* device_close */
+
+simpleroutine	device_write_reply(
+	    reply_port		: reply_port_t;
+#ifdef	SEQNOS
+	msgseqno seqno		: mach_port_seqno_t;
+#endif	/* SEQNOS */
+	in  return_code		: kern_return_t;
+	in  bytes_written	: io_buf_len_t
+	);
+
+simpleroutine	device_write_reply_inband(
+	    reply_port		: reply_port_t;
+#ifdef	SEQNOS
+	msgseqno seqno		: mach_port_seqno_t;
+#endif	/* SEQNOS */
+	in  return_code		: kern_return_t;
+	in  bytes_written	: io_buf_len_t
+	);
+
+simpleroutine	device_read_reply(
+	    reply_port		: reply_port_t;
+#ifdef	SEQNOS
+	msgseqno seqno		: mach_port_seqno_t;
+#endif	/* SEQNOS */
+	in  return_code		: kern_return_t, RetCode;
+	in  data		: io_buf_ptr_t, dealloc
+	);
+
+simpleroutine	device_read_reply_inband(
+	    reply_port		: reply_port_t;
+#ifdef	SEQNOS
+	msgseqno seqno		: mach_port_seqno_t;
+#endif	/* SEQNOS */
+	in  return_code		: kern_return_t;
+	in  data		: io_buf_ptr_inband_t
+	);
+
+skip;	/*    xxx_device_set_status */
+
+skip;	/*    xxx_device_get_status */
+
+skip;	/*    xxx_device_set_filter */
+
+skip;	/*    device_map */
+
+skip;	/*    device_set_status */
+
+skip;	/*    device_get_status */
+
+skip;	/*    device_set_filter */
+
+simpleroutine	device_read_reply_overwrite(
+	    reply_port		: reply_port_t;
+#ifdef	SEQNOS
+	msgseqno seqno		: mach_port_seqno_t;
+#endif	/* SEQNOS */
+	in  return_code		: kern_return_t;
+	in  bytes_read		: io_buf_len_t
+	);
+
+simpleroutine	device_open_reply(
+	    reply_port		: reply_port_t;
+#ifdef	SEQNOS
+	msgseqno seqno		: mach_port_seqno_t;
+#endif	/* SEQNOS */
+	in  return_code		: kern_return_t, RetCode;
+	in  device_port		: mach_port_make_send_t
+	);

Added: trunk/sys/sys/mach/device/device_request.defs
===================================================================
--- trunk/sys/sys/mach/device/device_request.defs	                        (rev 0)
+++ trunk/sys/sys/mach/device/device_request.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,149 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.7  91/05/14  15:42:50  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.6  91/02/05  17:09:06  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:28:20  mrt]
+ * 
+ * Revision 2.5  90/06/02  14:47:44  rpd
+ * 	Converted to new IPC.
+ * 	[90/03/26  21:52:44  rpd]
+ * 
+ * Revision 2.4  89/09/08  11:23:48  dbg
+ * 	Use device_t.
+ * 	[89/08/24            dbg]
+ * 
+ * Revision 2.3  89/08/31  16:18:42  rwd
+ * 	Added device_read_request_inband
+ * 	[89/08/15            rwd]
+ * 
+ * Revision 2.2  89/08/05  16:06:05  rwd
+ * 	Added device_write_request_inband
+ * 	[89/08/04            rwd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	8/89
+ *
+ *	 Request-only side of device interface.
+ */
+
+subsystem device_request 2800;	/* to match device.defs */
+
+#include <mach/mach_types.defs>
+#include <device/device_types.defs>
+
+serverprefix	ds_;
+
+type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE
+	ctype: mach_port_t;
+
+skip;	/* nmk15: device_open */
+
+skip;	/*    device_close */
+
+simpleroutine device_write_request(
+	    device		: device_t;
+  ureplyport reply_port		: reply_port_t;
+	in  mode		: dev_mode_t;
+	in  recnum		: recnum_t;
+	in  data		: io_buf_ptr_t
+	);
+
+simpleroutine device_write_request_inband(
+	    device		: device_t;
+  ureplyport reply_port		: reply_port_t;
+	in  mode		: dev_mode_t;
+	in  recnum		: recnum_t;
+	in  data		: io_buf_ptr_inband_t
+	);
+
+simpleroutine device_read_request(
+	    device		: device_t;
+  ureplyport reply_port		: reply_port_t;
+	in  mode		: dev_mode_t;
+	in  recnum		: recnum_t;
+	in  bytes_wanted	: io_buf_len_t
+	);
+
+simpleroutine device_read_request_inband(
+	    device		: device_t;
+  ureplyport reply_port		: reply_port_t;
+	in  mode		: dev_mode_t;
+	in  recnum		: recnum_t;
+	in  bytes_wanted	: io_buf_len_t
+	);
+
+skip;	/* obsolete: xxx_device_set_status */
+skip;   /* obsolete: xxx_device_get_status */
+skip;	/* obsolete: xxx_device_set_filter */
+
+skip;	/* device_map */
+skip;	/* device_set_status */
+skip;	/* device_get_status */
+skip;	/* device_set_filter */
+
+skip;   /* device_read_reply_overwrite */
+
+simpleroutine device_open_request(
+	    device_server_port	: mach_port_t;
+  ureplyport reply_port		: reply_port_t;
+	in  ledger		: ledger_port_t;
+	in  mode		: dev_mode_t;
+	in  sec_token		: security_token_t;
+	in  name		: dev_name_t
+	);

Added: trunk/sys/sys/mach/device/device_typedefs.h
===================================================================
--- trunk/sys/sys/mach/device/device_typedefs.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/device_typedefs.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+
+#ifndef	DEVICE_TYPEDEFS_H
+#define	DEVICE_TYPEDEFS_H
+
+typedef struct dev_ops		*dev_ops_t;
+typedef struct io_req 		*io_req_t;
+typedef	struct device		*device_t;
+typedef	struct io_done_queue	*io_done_queue_t;
+
+#endif	/* DEVICE_TYPEDEFS_H */


Property changes on: trunk/sys/sys/mach/device/device_typedefs.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/device_types.defs
===================================================================
--- trunk/sys/sys/mach/device/device_types.defs	                        (rev 0)
+++ trunk/sys/sys/mach/device/device_types.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,133 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.8  91/06/25  10:26:40  rpd
+ * 	Changed the port-based type declarations
+ * 	to use mach_port_t as the C type name.
+ * 	[91/05/23            rpd]
+ * 
+ * Revision 2.7  91/05/14  15:43:07  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.6  91/03/16  14:42:54  rpd
+ * 	Added filter_t.
+ * 	[91/02/12            rpd]
+ * 
+ * Revision 2.5  91/02/05  17:09:10  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:28:27  mrt]
+ * 
+ * Revision 2.4  90/06/02  14:47:48  rpd
+ * 	Converted to new IPC.
+ * 	[90/03/26  21:53:33  rpd]
+ * 
+ * Revision 2.3  89/09/08  11:23:52  dbg
+ * 	Add device_t and translation functions.
+ * 	[89/08/01            dbg]
+ * 
+ * Revision 2.2  89/08/05  16:06:27  rwd
+ * 	Added io_buf_ptr_inband_t
+ * 	[89/08/04            rwd]
+ * 
+ * 	Created.
+ * 	[89/03/03            dbg]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	3/89
+ *	
+ *	Common definitions for device interface types.
+ */
+
+#ifndef	_DEVICE_DEVICE_TYPES_DEFS_
+#define	_DEVICE_DEVICE_TYPES_DEFS_
+
+/*
+ *	Basic types
+ */
+
+#include <mach/std_types.defs>
+
+type recnum_t		= unsigned32;
+type dev_mode_t		= unsigned32;
+type dev_flavor_t	= unsigned32;
+type dev_name_t         = c_string[*:128];
+type dev_status_t	= array[*:1024] of int;
+type io_buf_len_t	= integer_t;
+type io_buf_ptr_t	= ^array[] of MACH_MSG_TYPE_INTEGER_8;
+type io_buf_ptr_inband_t= array[*:128] of char;
+type filter_t		= short;
+type filter_array_t	= array[*:64] of filter_t;
+
+type device_t = mach_port_t
+		ctype: mach_port_t
+#if	KERNEL_SERVER
+		intran: device_t dev_port_lookup(mach_port_t)
+		outtran: mach_port_t convert_device_to_port(device_t)
+		destructor: device_deallocate(device_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type io_done_queue_t	= mach_port_t
+		ctype: mach_port_t
+#if	KERNEL_SERVER
+		intran: io_done_queue_t io_done_queue_port_lookup(mach_port_t)
+		outtran: mach_port_t convert_io_done_queue_to_port(io_done_queue_t)
+#endif	KERNEL_SERVER
+		;
+
+import <device/device_types.h>;
+import <device/net_status.h>;
+
+#endif	/* _DEVICE_DEVICE_TYPES_DEFS_ */

Added: trunk/sys/sys/mach/device/device_types.h
===================================================================
--- trunk/sys/sys/mach/device/device_types.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/device_types.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,237 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.8.3.1  92/03/28  10:04:36  jeffreyh
+ * 	04-Mar-92  emcmanus at gr.osf.org
+ * 		New D_OUT_OF_BAND return possible from device_read.
+ * 	[92/03/10  07:56:07  bernadat]
+ * 	Changes from TRUNK
+ * 	[92/03/10  14:10:45  jeffreyh]
+ * 
+ * Revision 2.9  92/02/23  22:42:53  elf
+ * 	Added mandatory DEV_GET_SIZE getstatus operation.
+ * 	Must be implemented by all devices.
+ * 	[92/02/22  19:59:27  af]
+ * 
+ * Revision 2.8  91/07/31  17:33:54  dbg
+ * 	Fix dev_name_t to match definition in
+ * 	device/device_types.defs.
+ * 	[91/07/30  16:47:13  dbg]
+ * 
+ * Revision 2.7  91/05/14  15:43:20  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.6  91/05/13  06:02:18  af
+ * 	Added D_READ_ONLY.
+ * 	[91/05/12  15:47:28  af]
+ * 
+ * Revision 2.5  91/02/05  17:09:13  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:28:40  mrt]
+ * 
+ * Revision 2.4  90/06/02  14:47:52  rpd
+ * 	Converted to new IPC.
+ * 	[90/03/26  21:53:55  rpd]
+ * 
+ * Revision 2.3  89/09/08  11:23:58  dbg
+ * 	Add device_t, and separate in-kernel and out-of-kernel
+ * 	definitions.
+ * 	[89/08/01            dbg]
+ * 
+ * Revision 2.2  89/08/05  16:06:33  rwd
+ * 	Added code for inband writing
+ * 	[89/08/04            rwd]
+ * 
+ *  3-Mar-89  David Golub (dbg) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	3/89
+ */
+
+#ifndef	DEVICE_TYPES_H
+#define	DEVICE_TYPES_H
+
+/*
+ * Types for device interface.
+ */
+#include <sys/mach/std_types.h>
+
+/*
+ * I/O completion queues
+ */
+
+/*
+ * Device name string
+ */
+typedef	char	dev_name_t[128];	/* must match device_types.defs */
+
+/*
+ * Mode for open/read/write
+ */
+typedef	uint32_t		dev_mode_t;
+#define	D_READ		0x1		/* read */
+#define	D_WRITE		0x2		/* write */
+#define	D_NODELAY	0x4		/* no delay on open */
+#define	D_NOWAIT	0x8		/* do not wait if data not available */
+#define	D_CLONE		0x10		/* clone device on open */
+
+/*
+ * IO buffer - out-of-line array of characters.
+ */
+typedef char *	io_buf_ptr_t;
+
+/*
+ * IO buffer - in-line array of characters.
+ */
+#define IO_INBAND_MAX (128)		/* must match device_types.defs */
+typedef char 	io_buf_ptr_inband_t[IO_INBAND_MAX];
+
+/*
+ * Buffer length data counts.
+ */
+typedef integer_t	io_buf_len_t;
+
+/*
+ * Record number for random-access devices
+ */
+typedef	uint32_t		recnum_t;
+
+/*
+ * Flavors of set/get statuses
+ */
+typedef uint32_t		dev_flavor_t;
+
+/*
+ * Generic array for get/set status
+ */
+typedef int		*dev_status_t;	/* Variable-length array of integers */
+#define	DEV_STATUS_MAX	(1024)		/* Maximum array size */
+
+typedef int		dev_status_data_t[DEV_STATUS_MAX];
+
+/*
+ * Mandatory get/set status operations
+ */
+
+/* size a device: op code and indexes for returned values */
+#define	DEV_GET_SIZE			0
+#	define	DEV_GET_SIZE_DEVICE_SIZE	0	/* 0 if unknown */
+#	define	DEV_GET_SIZE_RECORD_SIZE	1	/* 1 if sequential */
+#define	DEV_GET_SIZE_COUNT		2
+
+/*
+ * Device error codes
+ */
+typedef	int		io_return_t;
+
+#define	D_IO_QUEUED		(-1)	/* IO queued - do not return result */
+#define	D_SUCCESS		0
+
+#define	D_IO_ERROR		2500	/* hardware IO error */
+#define	D_WOULD_BLOCK		2501	/* would block, but D_NOWAIT set */
+#define	D_NO_SUCH_DEVICE	2502	/* no such device */
+#define	D_ALREADY_OPEN		2503	/* exclusive-use device already open */
+#define	D_DEVICE_DOWN		2504	/* device has been shut down */
+#define	D_INVALID_OPERATION	2505	/* bad operation for device */
+#define	D_INVALID_RECNUM	2506	/* invalid record (block) number */
+#define	D_INVALID_SIZE		2507	/* invalid IO size */
+#define D_NO_MEMORY		2508	/* memory allocation failure */
+#define D_READ_ONLY		2509	/* device cannot be written to */
+#define D_OUT_OF_BAND		2510	/* out-of-band condition on device */
+#define D_NOT_CLONED		2511	/* device cannot be cloned */
+
+/*
+ * Values for r_type field
+ */
+#define	IO_DONE_READ		1
+#define	IO_DONE_WRITE		2
+#define	IO_DONE_OVERWRITE	3
+
+typedef struct io_done_result {
+	struct control_info {
+	    int			qd_type;	/* type of I/O operation */
+	    mach_port_t		qd_reqid;	/* request id */
+	    kern_return_t	qd_code;	/* return code */
+	    io_buf_ptr_t	qd_data;	/* buffer pointer */
+	    int			qd_count;	/* number of bytes */
+	} qd_control;
+	io_buf_ptr_inband_t	qd_inline;	/* inline data */
+} io_done_result_t;
+
+#define qd_type		qd_control.qd_type
+#define qd_reqid	qd_control.qd_reqid
+#define qd_code		qd_control.qd_code
+#define qd_data		qd_control.qd_data
+#define qd_count	qd_control.qd_count
+
+#if 0
+#ifdef	MACH_KERNEL
+/*
+ * Get kernel-only type definitions.
+ */
+#include <device/device_types_kernel.h>
+
+#else	/* MACH_KERNEL */
+/*
+ * Device handle.
+ */
+typedef	mach_port_t	device_t;
+
+#endif	/* MACH_KERNEL */
+#endif
+
+#endif	/* DEVICE_TYPES_H */
+


Property changes on: trunk/sys/sys/mach/device/device_types.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/device_types_kernel.h
===================================================================
--- trunk/sys/sys/mach/device/device_types_kernel.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/device_types_kernel.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6  91/06/25  10:26:46  rpd
+ * 	Changed the convert_foo_to_bar functions
+ * 	to use ipc_port_t instead of mach_port_t.
+ * 	[91/05/27            rpd]
+ * 
+ * Revision 2.5  91/05/14  15:43:37  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:09:18  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:28:48  mrt]
+ * 
+ * Revision 2.3  90/06/02  14:47:56  rpd
+ * 	Converted to new IPC.
+ * 	[90/03/26  21:54:19  rpd]
+ * 
+ * Revision 2.2  89/09/08  11:24:03  dbg
+ * 	Created.
+ * 	[89/08/01            dbg]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	8/89
+ */
+
+#ifndef	_DEVICE_DEVICE_TYPES_KERNEL_H_
+#define	_DEVICE_DEVICE_TYPES_KERNEL_H_
+
+/*
+ * Kernel-only type definitions for device server.
+ */
+
+#include <mach/port.h>
+#include <device/dev_hdr.h>
+
+extern device_t		dev_port_lookup(
+					ipc_port_t	port);
+extern struct ipc_port	*convert_device_to_port(
+					device_t	dev);
+extern struct ipc_port	*mach_convert_device_to_port(
+					void		*dev);
+extern io_done_queue_t	io_done_queue_port_lookup(
+					ipc_port_t	port);
+extern struct ipc_port	*convert_io_done_queue_to_port(
+					io_done_queue_t	queue);
+
+#endif	/* _DEVICE_DEVICE_TYPES_KERNEL_H_ */


Property changes on: trunk/sys/sys/mach/device/device_types_kernel.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/disk_status.h
===================================================================
--- trunk/sys/sys/mach/device/disk_status.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/disk_status.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,474 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.3.4.2  92/04/30  11:49:19  bernadat
+ * 	Changes from TRUNK:
+ * 	We add one more partition so that we can point to the "whole"
+ * 	  	disk.  It is at slot MAXPARTITIONS.
+ * 	  	[92/04/01            rvb]
+ * 
+ * Revision 2.3.4.1  92/02/18  18:39:17  jeffreyh
+ * 	Increase number of disk partitions to 16 to be compatible with 2.5
+ * 	[92/02/08            bernadat]
+ * 
+ * Revision 2.3  91/05/14  15:43:50  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.2  91/05/13  06:02:21  af
+ * 	Created, starting from Reno's disklabel.h (copyright included).
+ * 	[91/05/03            af]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ * Copyright (c) 1987, 1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ *	@(#)disklabel.h	7.10 (Berkeley) 6/27/88
+ */
+
+#ifndef	_DISK_STATUS_H_
+#define	_DISK_STATUS_H_
+
+#include <device/ds_status.h>
+
+/*
+ * Each disk has a label which includes information about the hardware
+ * disk geometry, filesystem partitions, and drive specific information.
+ * The label is in block 0 or 1, possibly offset from the beginning
+ * to leave room for a bootstrap, etc.
+ */
+
+#ifdef hp_pa
+
+#ifndef LABELSECTOR
+#define LABELSECTOR	2       /* sector containing label */
+#endif
+#define LABELOFFSET	0	/* offset of label in sector */
+
+#else /* hp_pa */
+
+#define LABELSECTOR	0	/* sector containing label */
+#define LABELOFFSET	64	/* offset of label in sector */
+
+#endif /* hp_pa */
+
+#define DISKMAGIC	((uint32) 0x82564557U)	/* The disk magic number */
+
+#ifndef MAXPARTITIONS
+#ifdef hp_pa
+#define	MAXPARTITIONS	8
+#else
+#define	MAXPARTITIONS	16
+#define PARTITIONS	(MAXPARTITIONS + 1)
+#endif
+#endif
+
+#ifndef PARTITIONS
+#define PARTITIONS	MAXPARTITIONS
+#endif
+
+#ifndef LOCORE
+struct disklabel {
+	uint32	d_magic;		/* the magic number */
+	short	d_type;			/* drive type */
+	short	d_subtype;		/* controller/d_type specific */
+	char	d_typename[16];		/* type name, e.g. "eagle" */
+	/* 
+	 * d_packname contains the pack identifier and is returned when
+	 * the disklabel is read off the disk or in-core copy.
+	 * d_boot0 and d_boot1 are the (optional) names of the
+	 * primary (block 0) and secondary (block 1-15) bootstraps
+	 * as found in /usr/mdec.  These are returned when using
+	 * getdiskbyname(3) to retrieve the values from /etc/disktab.
+	 */
+#if defined(MACH_KERNEL) || defined(STANDALONE)
+	char	d_packname[16];			/* pack identifier */ 
+#else
+	union {
+		char	un_d_packname[16];	/* pack identifier */ 
+		struct {
+			char *un_d_boot0;	/* primary bootstrap name */
+			char *un_d_boot1;	/* secondary bootstrap name */
+		} un_b; 
+	} d_un; 
+#define d_packname	d_un.un_d_packname
+#define d_boot0		d_un.un_b.un_d_boot0
+#define d_boot1		d_un.un_b.un_d_boot1
+#endif	/* ! MACH_KERNEL or STANDALONE */
+			/* disk geometry: */
+	uint32	d_secsize;		/* # of bytes per sector */
+	uint32	d_nsectors;		/* # of data sectors per track */
+	uint32	d_ntracks;		/* # of tracks per cylinder */
+	uint32	d_ncylinders;		/* # of data cylinders per unit */
+	uint32	d_secpercyl;		/* # of data sectors per cylinder */
+	uint32	d_secperunit;		/* # of data sectors per unit */
+	/*
+	 * Spares (bad sector replacements) below
+	 * are not counted in d_nsectors or d_secpercyl.
+	 * Spare sectors are assumed to be physical sectors
+	 * which occupy space at the end of each track and/or cylinder.
+	 */
+	unsigned short	d_sparespertrack;	/* # of spare sectors per track */
+	unsigned short	d_sparespercyl;		/* # of spare sectors per cylinder */
+	/*
+	 * Alternate cylinders include maintenance, replacement,
+	 * configuration description areas, etc.
+	 */
+	uint32	d_acylinders;		/* # of alt. cylinders per unit */
+
+			/* hardware characteristics: */
+	/*
+	 * d_interleave, d_trackskew and d_cylskew describe perturbations
+	 * in the media format used to compensate for a slow controller.
+	 * Interleave is physical sector interleave, set up by the formatter
+	 * or controller when formatting.  When interleaving is in use,
+	 * logically adjacent sectors are not physically contiguous,
+	 * but instead are separated by some number of sectors.
+	 * It is specified as the ratio of physical sectors traversed
+	 * per logical sector.  Thus an interleave of 1:1 implies contiguous
+	 * layout, while 2:1 implies that logical sector 0 is separated
+	 * by one sector from logical sector 1.
+	 * d_trackskew is the offset of sector 0 on track N
+	 * relative to sector 0 on track N-1 on the same cylinder.
+	 * Finally, d_cylskew is the offset of sector 0 on cylinder N
+	 * relative to sector 0 on cylinder N-1.
+	 */
+	unsigned short	d_rpm;			/* rotational speed */
+	unsigned short	d_interleave;		/* hardware sector interleave */
+	unsigned short	d_trackskew;		/* sector 0 skew, per track */
+	unsigned short	d_cylskew;		/* sector 0 skew, per cylinder */
+	uint32	d_headswitch;		/* head switch time, usec */
+	uint32	d_trkseek;		/* track-to-track seek, usec */
+	uint32	d_flags;		/* generic flags */
+#define NDDATA 5
+	uint32	d_drivedata[NDDATA];	/* drive-type specific information */
+#define NSPARE 5
+	uint32	d_spare[NSPARE];	/* reserved for future use */
+	uint32	d_magic2;		/* the magic number (again) */
+	unsigned short	d_checksum;		/* xor of data incl. partitions */
+
+			/* filesystem and partition information: */
+	unsigned short	d_npartitions;		/* number of partitions in following */
+	uint32	d_bbsize;		/* size of boot area at sn0, bytes */
+	uint32	d_sbsize;		/* max size of fs superblock, bytes */
+	struct	label_partition {		/* the partition table */
+		uint32	p_size;		/* number of sectors in partition */
+		uint32	p_offset;	/* starting sector */
+		uint32	p_fsize;	/* filesystem basic fragment size */
+		unsigned char	p_fstype;	/* filesystem type, see below */
+		unsigned char	p_frag;		/* filesystem fragments per block */
+		unsigned short	p_cpg;		/* filesystem cylinders per group */
+	} d_partitions[PARTITIONS];	/* actually may be more */
+
+#if	defined(__alpha) && defined(MACH_KERNEL)
+	/*
+	 * Disgusting hack. If this structure contains a pointer,
+	 * as it does for non-kernel, then the compiler rounds
+	 * the size to make it pointer-sized properly (arrays of..).
+	 * But if I define the pointer for the kernel then instances
+	 * of this structure better be aligned otherwise picking
+	 * up a short might be done by too-smart compilers (GCC) with
+	 * a load-long instruction expecting the short to be aligned.
+	 */
+	int32	bugfix;
+#endif
+};
+#else /* LOCORE */
+	/*
+	 * offsets for asm boot files.
+	 */
+	.set	d_secsize,40
+	.set	d_nsectors,44
+	.set	d_ntracks,48
+	.set	d_ncylinders,52
+	.set	d_secpercyl,56
+	.set	d_secperunit,60
+	.set	d_end_,276		/* size of disk label */
+#endif /* LOCORE */
+
+/* d_type values: */
+#define	DTYPE_SMD		1		/* SMD, XSMD; VAX hp/up */
+#define	DTYPE_MSCP		2		/* MSCP */
+#define	DTYPE_DEC		3		/* other DEC (rk, rl) */
+#define	DTYPE_SCSI		4		/* SCSI */
+#define	DTYPE_ESDI		5		/* ESDI interface */
+#define	DTYPE_ST506		6		/* ST506 etc. */
+#define	DTYPE_IPI		7		/* IPI */
+#define	DTYPE_FLOPPY		10		/* floppy */
+
+#ifdef DKTYPENAMES
+static char *dktypenames[] = {
+	"unknown",
+	"SMD",
+	"MSCP",
+	"old DEC",
+	"SCSI",
+	"ESDI",
+	"type 6",
+	"IPI",
+	"type 8",
+	"type 9",
+	"floppy",
+	0
+};
+#define DKMAXTYPES	(sizeof(dktypenames) / sizeof(dktypenames[0]) - 1)
+#endif
+
+/*
+ * Filesystem type and version.
+ * Used to interpret other filesystem-specific
+ * per-partition information.
+ */
+#define	FS_UNUSED	0		/* unused */
+#define	FS_SWAP		1		/* swap */
+#define	FS_V6		2		/* Sixth Edition */
+#define	FS_V7		3		/* Seventh Edition */
+#define	FS_SYSV		4		/* System V */
+#define	FS_V71K		5		/* V7 with 1K blocks (4.1, 2.9) */
+#define	FS_V8		6		/* Eighth Edition, 4K blocks */
+#define	FS_BSDFFS	7		/* 4.2BSD fast file system */
+#define	FS_LVM		8		/* Partition in use by LVM */
+
+#define	FS_VENDOR1	16		/* Reserved for vendor use */
+#define	FS_VENDOR2	17		/* Reserved for vendor use */
+#define	FS_VENDOR3	18		/* Reserved for vendor use */
+#define	FS_VENDOR4	19		/* Reserved for vendor use */
+#define	FS_VENDOR5	20		/* Reserved for vendor use */
+#define	FS_VENDOR6	21		/* Reserved for vendor use */
+#define	FS_VENDOR7	22		/* Reserved for vendor use */
+#define	FS_VENDOR8	23		/* Reserved for vendor use */
+#define	FS_VENDOR9	24		/* Reserved for vendor use */
+#define	FS_VENDOR10	25		/* Reserved for vendor use */
+#define	FS_VENDOR11	26		/* Reserved for vendor use */
+#define	FS_VENDOR12	27		/* Reserved for vendor use */
+#define	FS_VENDOR13	28		/* Reserved for vendor use */
+#define	FS_VENDOR14	29		/* Reserved for vendor use */
+#define	FS_VENDOR15	30		/* Reserved for vendor use */
+#define	FS_VENDOR16	31		/* Reserved for vendor use */
+
+#ifdef	DKTYPENAMES
+static char *fstypenames[] = {
+	"unused",
+	"swap",
+	"Version 6",
+	"Version 7",
+	"System V",
+	"4.1BSD",
+	"Eighth Edition",
+	"4.2BSD",
+	"LVM",
+	"???",
+	"???",
+	"???",
+	"???",
+	"???",
+	"???",
+	"???",
+	"vendor 1",
+	"vendor 2",
+	"vendor 3",
+	"vendor 4",
+	"vendor 5",
+	"vendor 6",
+	"vendor 7",
+	"vendor 8",
+	"vendor 9",
+	"vendor 10",
+	"vendor 11",
+	"vendor 12",
+	"vendor 13",
+	"vendor 14",
+	"vendor 15",
+	"vendor 16",
+	0
+};
+#define FSMAXTYPES	(sizeof(fstypenames) / sizeof(fstypenames[0]) - 1)
+#endif
+
+/*
+ * flags shared by various drives:
+ */
+#define		D_REMOVABLE	0x01		/* removable media */
+#define		D_ECC		0x02		/* supports ECC */
+#define		D_BADSECT	0x04		/* supports bad sector forw. */
+#define		D_RAMDISK	0x08		/* disk emulator */
+#define		D_CHAIN		0x10		/* can do back-back transfers */
+
+/*
+ * Drive data for SMD.
+ */
+#define	d_smdflags	d_drivedata[0]
+#define		D_SSE		0x1		/* supports skip sectoring */
+#define	d_mindist	d_drivedata[1]
+#define	d_maxdist	d_drivedata[2]
+#define	d_sdist		d_drivedata[3]
+
+/*
+ * Drive data for ST506.
+ */
+#define d_precompcyl	d_drivedata[0]
+#define d_gap3		d_drivedata[1]		/* used only when formatting */
+
+/*
+ * IBM controller info (d_precompcyl used, too)
+ */
+#define	d_step		d_drivedata[2]
+
+#ifndef LOCORE
+/*
+ * Structure used to perform a format
+ * or other raw operation, returning data
+ * and/or register values.
+ * Register identification and format
+ * are device- and driver-dependent.
+ */
+struct format_op {
+	char	*df_buf;
+	int	df_count;		/* value-result */
+	daddr_t	df_startblk;
+	int	df_reg[8];		/* result */
+};
+
+/*
+ * Structure used internally to retrieve
+ * information about a partition on a disk.
+ */
+struct partinfo {
+	struct disklabel *disklab;
+	struct label_partition *part;
+};
+
+/*
+ * Disk-specific ioctls.
+ */
+		/* get and set disklabel; DIOCGPART used internally */
+#define DIOCGDINFO	_IOR('d', 101, struct disklabel)/* get */
+#define DIOCSDINFO	_IOW('d', 102, struct disklabel)/* set */
+#define DIOCWDINFO	_IOW('d', 103, struct disklabel)/* set, update disk */
+#define DIOCGPART	_IOW('d', 104, struct partinfo)	/* get partition */
+
+/* do format operation, read or write */
+#define DIOCRFORMAT	_IOWR('d', 105, struct format_op)
+#define DIOCWFORMAT	_IOWR('d', 106, struct format_op)
+
+#define DIOCSSTEP	_IOW('d', 107, int)	/* set step rate */
+#define DIOCSRETRIES	_IOW('d', 108, int)	/* set # of retries */
+#define DIOCWLABEL	_IOW('d', 109, int)	/* write en/disable label */
+
+#define DIOCSBAD	_IOW('d', 110, struct dkbad)	/* set kernel dkbad */
+
+/*
+ * These are really generic SCSI ioctls and structures
+ * but will probably be used with disks most often
+ */
+/*
+ * Structure used to perform SCSI pass-through commands
+ */
+struct scsi_io {
+#define SCSI_CDB_LENGTH 12
+	unsigned char	cdb[SCSI_CDB_LENGTH];
+	unsigned long	cmd_count;
+#define SCSI_NONE	(0 << 0)
+#define MEM_TO_SCSI	(1 << 0)
+#define SCSI_TO_MEM	(1 << 1)
+	unsigned long	direction;
+#define SCSI_GOOD			0x00
+#define SCSI_CHECK_CONDITION		0x01
+#define SCSI_CONDITION_MET		0x02
+#define SCSI_BUSY			0x03
+#define SCSI_INTERMEDIATE		0x04
+#define SCSI_INTERMEDIATE_CONDITION_MET	0x05
+#define SCSI_RESERVATION_CONFLICT	0x06
+#define SCSI_COMMAND_TERMINATED		0x07
+#define SCSI_QUEUE_FULL			0x08
+	unsigned long	status;
+	unsigned long	buf_len;
+#define SCSI_BUF_MAX	(2 * 1024)
+	unsigned char	scsi_buff[SCSI_BUF_MAX];
+};
+
+/* SCSI pass-through command */
+#define DIOCSCSI	_IOWR('d', 111, struct scsi_io)
+
+/*
+ * Structure used to get SCSI device physical information
+ */
+struct scsi_phys {
+	unsigned long	slot;
+	unsigned char	controller;
+	unsigned char	target_id;
+	unsigned char	lun;
+};
+
+/* Get SCSI device physical information */
+#define DIOCGPHYS	_IOR('d', 112, struct scsi_phys)
+/* Just get partition information.  Used interally in unix server. */
+#define DIOCGPINFO	_IOR('d', 113, struct label_partition)
+/* Get the mach record size. */
+#define DIOMRINFO	_IOR('d', 114, int)
+
+#endif	/* LOCORE */
+
+#endif	/* _DISK_STATUS_H_ */


Property changes on: trunk/sys/sys/mach/device/disk_status.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/dk.h
===================================================================
--- trunk/sys/sys/mach/device/dk.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/dk.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,56 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ *
+ */
+/* CMU_ENDHIST */
+/*
+ */
+/*
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *	@(#)dk.h	7.1 (Berkeley) 6/4/86
+ */
+
+/*
+ * Instrumentation for disk IO
+ */
+#define	DK_NDRIVE	4
+
+#ifdef MACH_KERNEL
+int	dk_ndrive;
+int	dk_busy;
+long	dk_time[DK_NDRIVE];
+long	dk_seek[DK_NDRIVE];
+long	dk_xfer[DK_NDRIVE];
+long	dk_wds[DK_NDRIVE];
+float	dk_mspw[DK_NDRIVE];
+int	dkn;
+
+long	tk_nin;
+long	tk_nout;
+#endif


Property changes on: trunk/sys/sys/mach/device/dk.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/driver_lock.h
===================================================================
--- trunk/sys/sys/mach/device/driver_lock.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/driver_lock.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,130 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+
+#ifndef _DEVICE_DRIVER_LOCK_H_
+#define	_DEVICE_DRIVER_LOCK_H_
+
+#include <cpus.h>
+#include <mach_ldebug.h>
+
+#include <mach/boolean.h>
+#include <kern/etap_options.h>
+#include <kern/lock.h>
+#include <kern/processor.h>
+
+#if NCPUS > 1 || MACH_LDEBUG || ETAP_LOCK_TRACE
+
+#include <kern/thread.h>
+
+#define	DRIVER_OP_START	0 /* Wants to register a pending start */
+#define	DRIVER_OP_INTR	1 /* Wants to register a pending interrupt */
+#define	DRIVER_OP_TIMEO	2 /* Wants to register a pending timeout */
+#define DRIVER_OP_CALLB	3 /* Wants to register a pending callback */
+#define	DRIVER_OP_LAST	4 /* Last pending operation */
+
+#define	DRIVER_OP_WAIT	DRIVER_OP_LAST
+				  /* Wait for exclusive use of the driver */
+
+#define DRIVER_LOCK_NOFUNC	((void (*)(int)) 0)
+
+typedef struct driver_lock {
+	decl_simple_lock_data(, dl_lock)	/* Structure protection */
+	unsigned int		dl_pending;	/* Pending driver ops */
+	void			(*dl_op[DRIVER_OP_LAST])(int);	
+						/* Driver op routines */
+	int			dl_unit;	/* Driver op argument */
+	thread_t		dl_thread;	/* Thread holding the lock */
+	unsigned int		dl_count;	/* Recursive lock count */
+} driver_lock_t;
+
+#define	driver_lock_decl(attr, name)	attr driver_lock_t name;
+
+extern void		driver_lock_init(driver_lock_t *, 
+					 int,
+					 void (*)(int),
+					 void (*)(int),
+					 void (*)(int),
+					 void (*)(int));
+
+extern boolean_t	driver_lock(driver_lock_t *, 
+				    unsigned int,
+				    boolean_t);
+
+extern void		driver_unlock(driver_lock_t *);
+
+struct funnel {
+	decl_simple_lock_data(, funnel_lock)
+	processor_t	funnel_bound_processor;
+	unsigned int	funnel_count;	/* # of times we entered the funnel */
+	int		funnel_cpu;	/* cpu currently in funnel */
+#if	MACH_LDEBUG
+        decl_simple_lock_data(, funnel_debug_lock)
+#endif	/* MACH_LDEBUG */
+};
+	     
+extern void		funnel_init(struct funnel *f,
+				    processor_t bound_processor);
+extern void		funnel_enter(struct funnel *f,
+				     processor_t *saved_processor);
+extern void		funnel_exit(struct funnel *f,
+				    processor_t saved_processor);
+extern int		funnel_escape(struct funnel *f);
+extern void		funnel_reenter(struct funnel *f,
+				       int count);
+extern boolean_t	funnel_in_use(struct funnel *f);
+
+#define DECL_FUNNEL(class,f) 		class struct funnel f;
+#define DECL_FUNNEL_VARS		processor_t funnel_saved_processor;
+#define FUNNEL_INIT(f,p)		funnel_init(f,p)
+#define FUNNEL_ENTER(f)			funnel_enter(f,&funnel_saved_processor)
+#define FUNNEL_EXIT(f)			funnel_exit(f,funnel_saved_processor)
+#define FUNNEL_ESCAPE(f)		(funnel_escape(f))
+#define FUNNEL_REENTER(f,count)		funnel_reenter(f,count)
+#define FUNNEL_IN_USE(f)		funnel_in_use(f)
+
+#else /* NCPUS > 1 || MACH_LDEBUG || ETAP_LOCK_TRACE */
+
+#define	driver_lock_decl(attr, name)				\
+					decl_simple_lock_data(attr, name)
+#define	driver_lock_init(addr, unit, start, intr, timeo, callb)	\
+					simple_lock_init((addr), ETAP_IO_DEVINS)
+#define	driver_lock(lock, op, try)				\
+					simple_lock_try(lock)
+#define	driver_unlock(lock)					\
+					simple_unlock(lock)
+
+#define DECL_FUNNEL(class,f)
+#define DECL_FUNNEL_VARS
+#define FUNNEL_INIT(f,p)
+#define FUNNEL_ENTER(f)
+#define FUNNEL_EXIT(f)
+#define FUNNEL_ESCAPE(f)		(1)
+#define FUNNEL_REENTER(f,count)
+#define FUNNEL_IN_USE(f)		(TRUE)
+
+#endif /* NCPUS > 1 || MACH_LDEBUG || ETAP_LOCK_TRACE */
+
+#define	driver_lock_state()
+
+#endif /* _DEVICE_DRIVER_LOCK_H_ */


Property changes on: trunk/sys/sys/mach/device/driver_lock.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/ds_routines.h
===================================================================
--- trunk/sys/sys/mach/device/ds_routines.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/ds_routines.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,245 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5  91/08/28  11:11:22  jsb
+ * 	Page list support: device_write_dealloc returns a boolean.
+ * 	[91/08/05  17:32:28  dlb]
+ * 
+ * Revision 2.4  91/05/14  15:47:56  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:09:33  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:29:15  mrt]
+ * 
+ * Revision 2.2  89/09/08  11:24:24  dbg
+ * 	Created.
+ * 	[89/08/04            dbg]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	8/89
+ *
+ *	Device service utility routines.
+ */
+
+#ifndef	DS_ROUTINES_H
+#define	DS_ROUTINES_H
+
+#include <norma_device.h>
+#include <vm/vm_map.h>
+#include <mach/machine/vm_types.h>
+#include <mach/vm_sync.h>
+#include <kern/host.h>
+#include <device/device_types.h>
+
+/*
+ * Map for device IO memory.
+ */
+vm_map_t	device_io_map;
+
+#define iodone(ior)	io_completed(ior, FALSE)
+
+extern void		io_completed(
+				io_req_t	ior,
+				boolean_t	can_block);
+extern void		io_done_thread(void);
+extern void		iowait(
+				io_req_t	ior);
+extern kern_return_t	device_read_alloc_sg(
+				io_req_t	ior,
+				vm_size_t	size);
+extern kern_return_t	device_read_alloc(
+				io_req_t	ior,
+				vm_size_t	size);
+extern kern_return_t	device_write_get(
+				io_req_t	ior,
+				boolean_t	* wait);
+extern boolean_t	device_write_dealloc(
+				io_req_t	ior);
+extern boolean_t	dev_name_lookup(
+				char		* name,
+				dev_ops_t	* ops,
+				int		* unit);
+extern void		dev_set_indirection(
+				char		* name,
+				dev_ops_t	ops,
+				int		unit);
+extern boolean_t	dev_change_indirect(
+				char		* iname,
+				char		* dname,
+				int		unit);
+extern boolean_t	 dev_find_indirect(
+				dev_ops_t 	devops,
+				int		unit,
+				char		*realname);
+
+extern kern_return_t	device_pager_setup(
+				mach_device_t	device,
+				vm_prot_t	prot,
+				vm_offset_t	offset,
+				vm_size_t	size,
+				ipc_port_t	* port);
+extern void		device_pager_init(void);
+extern kern_return_t	device_pager_data_request(
+			        ipc_port_t	pager,
+			        ipc_port_t      pager_request,
+			        vm_offset_t     offset,
+			        vm_size_t       length,
+			        vm_prot_t       protection_required);
+extern kern_return_t	device_pager_synchronize(
+				ipc_port_t	memory_object,
+				ipc_port_t	memory_control,
+				vm_offset_t	offset,
+				vm_offset_t	length,
+				vm_sync_t	sync_flags);
+extern kern_return_t	device_pager_data_return(
+				ipc_port_t		pager,
+				ipc_port_t		pager_req,
+				vm_offset_t		offset,
+				pointer_t		addr,
+				mach_msg_type_number_t	data_cnt,
+				boolean_t		dirty,
+				boolean_t		kernel_copy);
+extern kern_return_t	device_pager_change_completed(
+				ipc_port_t	pager,
+				ipc_port_t	pager_req,
+				memory_object_flavor_t	flavor);
+extern kern_return_t	device_pager_init_pager(
+				ipc_port_t	pager,
+				ipc_port_t	pager_req,
+				vm_size_t	pager_page_size);
+extern kern_return_t	device_pager_terminate(
+				ipc_port_t	pager,
+				ipc_port_t	pager_req);
+extern kern_return_t	device_pager_data_unlock(
+				ipc_port_t	memory_obj,
+				ipc_port_t	control_port,
+				vm_offset_t	offset,
+				vm_size_t	length,
+				vm_prot_t	access);
+extern kern_return_t	device_pager_lock_completed(
+				ipc_port_t	memory_obj,
+				ipc_port_t	pager_req,
+				vm_offset_t	offset,
+				vm_size_t	length);
+extern kern_return_t	device_pager_supply_completed(
+				ipc_port_t	pager,
+				ipc_port_t	pager_request,
+				vm_offset_t	offset,
+				vm_size_t	length,
+				kern_return_t	result,
+				vm_offset_t	error_offset);
+extern void		device_service_create(void);
+extern kern_return_t	device_write_get_sg(
+				io_req_t	ior,
+				boolean_t	* wait);
+extern kern_return_t	device_write_get(
+				io_req_t	ior,
+				boolean_t	* wait);
+extern boolean_t	device_write_dealloc(
+				io_req_t	ior);
+extern void		ds_init(void);
+extern boolean_t	ds_notify(
+				mach_msg_header_t
+						* msg);
+extern boolean_t	ds_master_notify(
+				mach_msg_header_t
+						* msg);
+extern boolean_t	ds_open_done(
+				io_req_t	ior);
+extern boolean_t	ds_read_done(
+				io_req_t	ior);
+extern boolean_t	ds_write_done(
+				io_req_t	ior);
+extern io_return_t	ds_io_done_queue_wait(
+				io_done_queue_t		queue,
+				io_done_result_t	*result,
+				io_done_result_t	*ures);
+extern void		io_done_queue_deallocate(
+				io_done_queue_t		queue);
+extern io_return_t	ds_device_write_common(
+				device_t		device,
+				ipc_port_t		reply_port,
+				mach_msg_type_name_t	reply_port_type,
+				dev_mode_t		mode,
+				recnum_t		recnum,
+				io_buf_ptr_t		data,
+				mach_msg_type_number_t	count,
+				int			op,
+				io_buf_len_t		*written);
+extern io_return_t	ds_device_read_common(
+				device_t		device,
+				ipc_port_t		reply_port,
+				mach_msg_type_name_t	reply_port_type,
+				dev_mode_t		mode,
+				recnum_t		recnum,
+				io_buf_len_t		bytes_wanted,
+				int			op,
+				io_buf_ptr_t		*data,
+				mach_msg_type_number_t	*data_count);
+
+#if	NORMA_DEVICE
+extern char		*dev_forward_name(
+				char		*name,
+				char		*namebuf,
+				int		namelen);
+#endif	/* NORMA_DEVICE */
+
+#if	MACH_KDB
+extern void		db_show_ior(
+				io_req_t	ior);
+#endif	/* MACH_KDB */
+
+#endif	/* DS_ROUTINES_H */


Property changes on: trunk/sys/sys/mach/device/ds_routines.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/ds_status.h
===================================================================
--- trunk/sys/sys/mach/device/ds_status.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/ds_status.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,31 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ * 
+ */
+/*
+ * MkLinux
+ */
+#ifndef	_DEVICE_DS_STATUS_H_
+#define	_DEVICE_DS_STATUS_H_
+
+#define	MDIOCGETL	_IOR('M', 1, int)
+#define	MDIOCSETL	_IOW('M', 2, int)
+
+#endif	/* _DEVICE_DS_STATUS_H_ */


Property changes on: trunk/sys/sys/mach/device/ds_status.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/errno.h
===================================================================
--- trunk/sys/sys/mach/device/errno.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/errno.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,82 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.3  91/05/14  15:48:09  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.2  91/02/05  17:09:37  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:29:22  mrt]
+ * 
+ */
+/* CMU_ENDHIST */
+/*
+ * Mach Operating System
+ * Copyright (c) 1991 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the  rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	8/89
+ *
+ *	Old names for new error codes, for compatibility.
+ */
+
+#ifndef	_ERRNO_
+#define	_ERRNO_
+
+#include <device/device_types.h>	/* the real error names */
+
+#define	EIO		D_IO_ERROR
+#define	ENXIO		D_NO_SUCH_DEVICE
+#define	EINVAL		D_INVALID_SIZE	/* XXX */
+#define	EBUSY		D_ALREADY_OPEN
+#define	ENOTTY		D_INVALID_OPERATION
+#define ENOMEM		D_NO_MEMORY
+#define ENOSPC		D_NO_SPACE
+
+#endif	/* _ERRNO_ */


Property changes on: trunk/sys/sys/mach/device/errno.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/io_req.h
===================================================================
--- trunk/sys/sys/mach/device/io_req.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/io_req.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,347 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.12.4.1  92/03/03  16:13:59  jeffreyh
+ * 	Pick up changes from TRUNK.
+ * 	[92/02/26  11:01:36  jeffreyh]
+ * 
+ * Revision 2.13  92/01/03  20:03:43  dbg
+ * 	Rename io_lock to io_req_lock to avoid conflict with io_lock
+ * 	macro for ipc_objects.
+ * 	[91/10/21            dbg]
+ * 
+ * Revision 2.12  91/08/28  11:11:24  jsb
+ * 	Removed semicolon after decl_simple_lock_data in io_req declaration.
+ * 	[91/08/16  15:31:22  jsb]
+ * 
+ * 	Add lock and associated macros to io_req structure.
+ * 	[91/08/12  17:28:46  dlb]
+ * 
+ * 	Add io_total for use by writes - io_count is for each driver
+ * 	operation, io_total is for the entire device_write.
+ * 	[91/08/05  17:34:49  dlb]
+ * 
+ * 	Add io_copy field to remember vm_map_copy_t that must be discarded
+ * 	when a mapped (not inline) device_write completes.
+ * 	[91/07/31  14:43:07  dlb]
+ * 
+ * Revision 2.11  91/08/03  18:17:39  jsb
+ * 	Added IO_LOANED flag, initially for norma_ipc support.
+ * 	Loaned ior's are returned directly at interrupt level;
+ * 	see iodone() for details.
+ * 	[91/07/27  22:28:29  jsb]
+ * 
+ * Revision 2.10  91/05/14  15:58:41  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.9  91/05/13  06:02:25  af
+ * 	Added IO_INTERNAL, for use when an io_request packet is used
+ * 	just for synchronization purposes.
+ * 	[91/03/11            af]
+ * 
+ * Revision 2.8  91/02/05  17:09:49  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:29:53  mrt]
+ * 
+ * Revision 2.7  90/06/02  14:48:08  rpd
+ * 	Converted to new IPC.  Removed io_dev_port.
+ * 	[90/03/26  21:56:39  rpd]
+ * 
+ * Revision 2.6  90/05/03  15:19:09  dbg
+ * 	Add spare flags definition for device-dependent uses.
+ * 	[90/03/14            dbg]
+ * 
+ * Revision 2.5  90/01/11  11:42:13  dbg
+ * 	De-lint.
+ * 	[89/12/06            dbg]
+ * 
+ * Revision 2.4  89/09/08  11:24:30  dbg
+ * 	Allocate io_req elements from kalloc pool, to allow a
+ * 	variable-length vm_page_t array at the end of the io_req_t.
+ * 	[89/08/14            dbg]
+ * 
+ * 	Changed 'dev_hdr_t' to 'device_t'.
+ * 	[89/08/01            dbg]
+ * 
+ * Revision 2.3  89/08/31  16:18:51  rwd
+ * 	Added io_inband_zone
+ * 	[89/08/15            rwd]
+ * 
+ * Revision 2.2  89/08/05  16:06:50  rwd
+ * 	Added IO_INBAND.
+ * 	[89/08/04            rwd]
+ * 
+ * 10-Oct-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	10/88
+ */
+
+#ifndef	_IO_REQ_
+#define	_IO_REQ_
+
+#include <mach_kdb.h>
+#include <chained_ios.h>
+
+#include <mach/boolean.h>
+#include <mach/port.h>
+#include <mach/message.h>
+#include <mach/vm_param.h>
+#include <kern/kalloc.h>
+#include <kern/lock.h>
+#include <vm/vm_page.h>
+#include <device/device_types.h>
+#include <device/device_typedefs.h>
+#include <device/io_scatter.h>
+
+#include <kern/macro_help.h>
+
+/*
+ * IO request scatter/gather list
+ */
+struct io_sg_entry {            /* sg list entry */
+	vm_offset_t     iosge_phys;     /* physical address */
+	vm_size_t       iosge_length;   /* length in bytes */
+};
+
+struct io_sglist_hdr {          /* sg list header */
+	vm_size_t       length;         /* total bytes covered by list */
+	int             nentries;       /* number of entries */
+};
+
+typedef struct io_sglist {      /* sg list structure */
+	struct io_sglist_hdr iosg_hdr;	/* list header */
+	struct io_sg_entry   iosg_list[1];   /* variable sized list */
+} *io_sglist_t;
+
+/*
+ * Size of an sglist with n entries
+ */
+#define IO_SGLIST_SIZE(n) \
+  (sizeof(struct io_sglist_hdr) + (n)*sizeof(struct io_sg_entry))
+
+/*
+ * IO request element, queued on device for delayed replies.
+ */
+struct io_req {
+	struct io_req *	io_next;	/* next, ... */
+	struct io_req *	io_prev;	/* prev pointers: link in done,
+					   defered, or in-progress list */
+	mach_device_t	io_device;	/* pointer to open-device structure */
+	char *		io_dev_ptr;	/* pointer to driver structure -
+					   filled in by driver if necessary */
+	int		io_unit;	/* unit number ('minor') of device */
+	int		io_op;		/* IO operation */
+	dev_mode_t	io_mode;	/* operation mode (wait, truncate) */
+	recnum_t	io_recnum;	/* starting record number for
+					   random-access devices */
+
+	union io_un {
+	    io_buf_ptr_t    data;	/* data, for IO requests */
+	} io_un;
+#define	io_data		io_un.data
+
+	union io_seg {
+		io_sglist_t	sgp;	        /* sglist, for IO requests */
+		unsigned	seg_count;	/* Chained IOs seg count */
+	} io_seg;
+#define	io_sgp		io_seg.sgp
+#define	io_seg_count	io_seg.seg_count
+
+	vm_address_t    io_uaddr;	/* user buf for overwrite requests */
+	vm_map_t	io_map;		/* target map for overwrite requests */
+	io_buf_len_t	io_count;	/* amount requested */
+	io_buf_len_t	io_alloc_size;	/* amount allocated */
+	io_buf_len_t	io_residual;	/* amount NOT done */
+	io_return_t	io_error;	/* error code */
+	boolean_t	(*io_done)(	/* call when done - returns TRUE
+					   if IO really finished */
+					io_req_t	ior);
+	struct ipc_port	*io_reply_port;	/* reply port/queue, for asynchronous
+					   messages */
+	mach_msg_type_name_t io_reply_port_type;
+					/* send or send-once right? */
+	struct io_req *	io_link;	/* forward link (for driver header) */
+	struct io_req *	io_rlink;	/* reverse link (for driver header) */
+	vm_map_copy_t	io_copy;	/* vm_map_copy obj. for this op. */
+					/* Lock for this structure */
+#if	MACH_KDB
+	int		io_ioip;
+#endif
+	io_buf_len_t	io_total;	/* total op size, for write */
+	int		io_save;	/* Saved IO operation */
+	decl_simple_lock_data(,io_req_lock) /* Lock for this structure */
+};
+
+
+/*
+ * LOCKING NOTE: Operations on io_req's are in general single threaded by
+ * the invoking code, obviating the need for a lock.  The usual IO_CALL
+ * path through the code is: Initiating thread hands io_req to device driver,
+ * driver passes it to io_done thread, io_done thread sends reply message.  No
+ * locking is needed in this sequence.  Unfortunately, a synchronous wait
+ * for a buffer requires a lock to avoid problems if the wait and interrupt
+ * happen simultaneously on different processors.
+ */
+
+#define ior_lock(ior)	simple_lock(&(ior)->io_req_lock)
+#define ior_unlock(ior)	simple_unlock(&(ior)->io_req_lock)
+
+/*
+ * Flags and operations
+ */
+
+#define	IO_WRITE	0x00000000	/* operation is write */
+#define	IO_READ		0x00000001	/* operation is read */
+#define	IO_OPEN		0x00000002	/* operation is open */
+#define	IO_DONE		0x00000100	/* operation complete */
+#define	IO_ERROR	0x00000200	/* error on operation */
+#define	IO_BUSY		0x00000400	/* operation in progress */
+#define	IO_WANTED	0x00000800	/* wakeup when no longer BUSY */
+#define	IO_BAD		0x00001000	/* bad disk block */
+#define	IO_CALL		0x00002000	/* call io_done_thread when done */
+#define IO_INBAND	0x00004000	/* mig call was inband */
+#define IO_INTERNAL	0x00008000	/* internal, device-driver specific */
+#define	IO_LOANED	0x00010000	/* ior loaned by another module */
+#define IO_SYNC		0x00020000	/* caller is synchronous */
+#define IO_OVERWRITE	0x00040000	/* overwrite request */
+#define IO_KERNEL_BUF	0x00080000	/* buffer address is in kernel */
+#define	IO_QUEUE	0x00100000	/* use completion queue when done */
+#define IO_SGLIST	0x00200000	/* data points to scatter/gather list*/
+#define	IO_TRANSPORT	0x00400000	/* Special IOR from transport */
+#define	IO_PASSIVE	0x00800000	/* Post target mode request */
+#define	IO_SCATTER	0x01000000	/* io_data points to io_scatter */
+#define	IO_PAD		0x02000000	/* This is a padded IO and we
+					   don't care as much about residual */
+#define IO_HANDOFF	0x04000000	/* ior moved from user io_done_queue to
+					   io_done_thread_queue */
+#define IO_FREE		0x08000000	/* ior can be freed now */
+#define IO_WCLONED	0x10000000	/* caller recycled written data */
+#define	IO_SPARE_START	0x20000000	/* start of spare flags */
+#define IO_CHAINED	0x40000000	/* Chained io. This means that several
+					   IO requests are chained with this 
+					   one. A single I/O operation will
+					   performed for the complete chain.
+					   It is mostly used to gather disk
+					   IOs on contiguous disk blocks. 
+					   Not te be mixed up with IO_SGLIST */
+
+extern io_return_t	block_io(
+				void		(*strat)(io_req_t ior),
+				void		(*max_count)(io_req_t ior),
+				io_req_t	ior);
+extern void		disksort(
+				io_req_t	head,
+				io_req_t	ior);
+extern vm_offset_t	block_io_mmap(dev_t, vm_offset_t, vm_prot_t);
+
+zone_t	io_req_zone;
+
+/*
+ * Macros to allocate and free IORs
+ */
+#if	MACH_KDB
+#define	io_req_alloc(ior)					\
+	MACRO_BEGIN						\
+	(ior) = (io_req_t)zalloc(io_req_zone);			\
+	simple_lock_init(&(ior)->io_req_lock, ETAP_IO_REQ);	\
+	ior->io_ioip = 0;\
+	MACRO_END
+
+#define	io_req_free(ior)					\
+	MACRO_BEGIN						\
+	assert(!ior->io_ioip);					\
+	zfree(io_req_zone, (vm_offset_t)(ior));			\
+	MACRO_END
+
+#else
+#define	io_req_alloc(ior)					\
+	MACRO_BEGIN						\
+	(ior) = (io_req_t)zalloc(io_req_zone);			\
+	simple_lock_init(&(ior)->io_req_lock, ETAP_IO_REQ);	\
+	MACRO_END
+
+#define	io_req_free(ior)					\
+	MACRO_BEGIN						\
+	zfree(io_req_zone, (vm_offset_t)(ior));			\
+	MACRO_END
+#endif
+
+#define	io_sglist_alloc(sglist, nentries)			\
+	MACRO_BEGIN						\
+	(sglist) = (io_sglist_t)kalloc(IO_SGLIST_SIZE(nentries));\
+	(sglist)->iosg_hdr.nentries = (nentries);		\
+	MACRO_END
+
+#define	io_sglist_free(sglist)					\
+	(kfree((vm_offset_t)(sglist),				\
+	       IO_SGLIST_SIZE((sglist)->iosg_hdr.nentries)))
+
+zone_t	io_inband_zone; /* for inband reads */
+
+#if CHAINED_IOS
+
+extern void 	chain_io_reqs(io_req_t		ior1,
+			      io_req_t		ior2,
+			      io_req_t	 	head);
+
+extern	void	chained_iodone(io_req_t         ior);
+
+extern	void	split_io_reqs(io_req_t		ior);
+
+#endif	/* CHAINED_IOS */
+
+#endif	/* _IO_REQ_ */


Property changes on: trunk/sys/sys/mach/device/io_req.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/io_scatter.h
===================================================================
--- trunk/sys/sys/mach/device/io_scatter.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/io_scatter.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ * 
+ */
+/*
+ * MkLinux
+ */
+
+#ifndef	_DEVICE_IO_SCATTER_H_
+#define	_DEVICE_IO_SCATTER_H_
+
+typedef struct io_scatter {
+	vm_offset_t	ios_address;
+	vm_size_t	ios_length;
+} *io_scatter_t;
+
+
+void ios_copy(io_scatter_t from, io_scatter_t to, vm_offset_t size);
+
+void ios_copy_from(io_scatter_t from, char *to, vm_offset_t size);
+
+void ios_copy_to(char *from, io_scatter_t to, vm_offset_t size);
+#endif	/*_DEVICE_IO_SCATTER_H_*/


Property changes on: trunk/sys/sys/mach/device/io_scatter.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/misc_protos.h
===================================================================
--- trunk/sys/sys/mach/device/misc_protos.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/misc_protos.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+
+#include <types.h> /* for u_char */
+
+extern void		sleep(
+				event_t		channel,
+				int		pri);
+extern void		wakeup(
+				event_t		channel);
+extern struct io_req *	geteblk(
+				io_buf_len_t	size);
+extern int              atoi(
+                                u_char                  * cp);
+extern int              atoi_term(
+                                char                    * p,
+                                char                    ** t);


Property changes on: trunk/sys/sys/mach/device/misc_protos.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/ndd.h
===================================================================
--- trunk/sys/sys/mach/device/ndd.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/ndd.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,268 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/*
+ *   (C) COPYRIGHT International Business Machines Corp. 1988,1993
+ *   All Rights Reserved
+ *   Licensed Materials - Property of IBM
+ *   US Government Users Restricted Rights - Use, duplication or
+ *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
+ */
+
+#ifndef	_NDD_H_
+#define	_NDD_H_
+
+#include <types.h>
+#include <device/conf.h>
+
+#define	NDD_MAXNAMELEN	(16)
+
+/*
+ * Structure for generic statistics
+ */
+struct ndd_genstats
+{
+	u_long	ndd_ipackets_msw;	/* packets received on interface(msw) */
+	u_long	ndd_ipackets_lsw;	/* packets received on interface(lsw) */
+	u_long	ndd_ibytes_msw;		/* total # of octets received(msw) */
+	u_long	ndd_ibytes_lsw;		/* total # of octets received(lsw) */
+	u_long	ndd_recvintr_msw;	/* number of receive interrupts(msw) */
+	u_long	ndd_recvintr_lsw;	/* number of receive interrupts(lsw) */
+	u_long	ndd_ierrors;		/* input errors on interface */
+	u_long	ndd_opackets_msw;	/* packets sent on interface(msw) */
+	u_long	ndd_opackets_lsw;	/* packets sent on interface(lsw) */
+	u_long	ndd_obytes_msw;		/* total number of octets sent(msw) */
+	u_long	ndd_obytes_lsw;		/* total number of octets sent(lsw) */
+	u_long	ndd_xmitintr_msw;	/* number of transmit interrupts(msw) */
+	u_long	ndd_xmitintr_lsw;	/* number of transmit interrupts(lsw) */
+	u_long	ndd_oerrors;		/* output errors on interface */
+	u_long	ndd_nobufs;		/* no buffers available */
+	u_long	ndd_xmitque_max;	/* max transmits ever queued */
+	u_long	ndd_xmitque_ovf;	/* number of transmit queue overflows */
+	u_long	ndd_ipackets_drop;	/* number of packets not passed up */
+};
+typedef	struct ndd_genstats ndd_genstats_t;
+
+/*
+ * Structure defining a network device driver interface.
+ */
+struct ndd {
+	struct	ndd *ndd_next;		/* next ndd in chain */
+	u_long	ndd_refcnt;		/* number of allocs outstanding */
+	char	*ndd_name;		/* name, e.g. ``en'' or ``tr'' */
+	int	ndd_unit;		/* unit number */
+	u_long	ndd_flags;		/* up/down, broadcast, etc. */
+	caddr_t	ndd_correlator;		/* correlator for NDD use */
+/* procedure handles */
+	int	(*ndd_open)(struct ndd *); /* init function */
+	int	(*ndd_close)(struct ndd *); /* close function */
+	int	(*ndd_output)(struct ndd *, caddr_t); /* output function */
+	int	(*ndd_ctl)(struct ndd *, int, caddr_t, int);	/* control function */
+/* user receive and status functions */
+	void	(*nd_receive)(struct ndd *, caddr_t); /* demuxer receive function */
+	void	(*nd_status)(struct ndd *, int); /* status notification */
+	struct dev_ops d_ops;	/* dev_ops table for server-mk interface */
+/* driver description */
+	u_long	ndd_mtu;		/* maximum transmission unit */
+	u_long	ndd_mintu;		/* minimum transmission unit */
+	u_long	ndd_type;		/* ethernet, etc (see interface types */
+	u_long	ndd_addrlen;		/* media address length */
+	u_long	ndd_hdrlen;		/* media header length */
+	caddr_t	ndd_physaddr; 		/* medias physical address */
+/* stats */
+	struct	ndd_genstats ndd_genstats;	/* generic network stats */
+	caddr_t	ndd_specstats;		/* pointer to device specific stats */
+	u_long	ndd_speclen;		/* length of device specific stats */
+/* demuxer linkage */
+	struct	ns_demuxer *ndd_demuxer;/* back pointer to associated demuxer */
+	struct  ns_dmx_ctl *ndd_nsdemux;/* ptr to common demux control */
+	caddr_t	ndd_specdemux;		/* ptr to demuxer specific control */
+	int	ndd_demuxsource;	/* 0 if system dmx, 1 if NDD provided */
+/* packet tracing */
+	void	(*ndd_trace)(struct ndd *, caddr_t, caddr_t, caddr_t); /* packet trace function */
+	caddr_t	ndd_trace_arg;		/* argument to trace function */
+	u_long	ndd_reserved[16];	/* reserved */
+	decl_simple_lock_data(,ndd_lock_data)
+};
+typedef	struct ndd	ndd_t;
+
+typedef	struct ndd	* nddp_t;
+
+
+/* flag values */
+#define	NDD_UP		(0x00000001)	/* NDD is opened */
+#define	NDD_BROADCAST	(0x00000002)	/* broadcast address valid */
+#define	NDD_DEBUG	(0x00000004)	/* operating in debug mode */
+#define	NDD_RUNNING	(0x00000008)	/* NDD is operational */
+#define	NDD_SIMPLEX	(0x00000010)	/* can't hear own transmissions */
+#define	NDD_DEAD	(0x00000020)	/* device is not operational */
+#define	NDD_LIMBO	(0x00000040)	/* in network recovery mode */
+#define	NDD_PROMISC	(0x00000080)	/* in promiscuous mode */
+#define	NDD_ALTADDRS	(0x00000100)	/* receiving additional addresses */
+#define	NDD_MULTICAST	(0x00000200)	/* receiving all multicasts */
+
+#define	NDD_PSEUDO_NDD	(0x00001000)	/* temporary */
+
+#define	NDD_SPECFLAGS	(0x00100000)	/* min value of device specific flags */
+
+/* interface types for benefit of parsing media address headers (ndd_type) */
+#define NDD_OTHER	0x1		/* none of the following */
+#define NDD_1822	0x2		/* old-style arpanet imp */
+#define NDD_HDH1822	0x3		/* HDH arpanet imp */
+#define NDD_X25DDN	0x4		/* x25 to imp */
+#define NDD_X25		0x5		/* PDN X25 interface */
+#define	NDD_ETHER	0x6		/* Ethernet I or II */
+#define	NDD_ISO88023	0x7		/* Ethernet 802.3 */
+#define	NDD_ISO88024	0x8		/* Token Bus */
+#define	NDD_ISO88025	0x9		/* Token Ring */
+#define	NDD_ISO88026	0xa		/* MAN */
+#define	NDD_STARLAN	0xb
+#define	NDD_P10		0xc		/* Proteon 10MBit ring */
+#define	NDD_P80		0xd		/* Proteon 10MBit ring */
+#define NDD_HY		0xe		/* Hyperchannel */
+#define NDD_FDDI	0xf
+#define NDD_LAPB	0x10
+#define NDD_SDLC	0x11
+#define NDD_T1		0x12
+#define NDD_CEPT	0x13
+#define NDD_ISDNBASIC	0x14
+#define NDD_ISDNPRIMARY	0x15
+#define NDD_PTPSERIAL	0x16
+#define	NDD_LOOP	0x18		/* loopback */
+#define NDD_EON		0x19		/* ISO over IP */
+#define	NDD_XETHER	0x1a		/* obsolete 3MB experimental ethernet */
+#define	NDD_NSIP	0x1b		/* XNS over IP */
+#define	NDD_SLIP	0x1c		/* IP over generic TTY */
+
+#define	NDD_SCB		0x127		/* SCB device driver */
+#define	NDD_FCS		0x128		/* FCS device driver */
+#define	NDD_SCSI	0x129		/* SCSI device driver */
+
+/* 
+ * The following primitives define common NDD control operations
+ */
+#define	NDD_GET_STATS		(0x00000001)
+#define	NDD_ENABLE_MULTICAST	(0x00000002)
+#define	NDD_DISABLE_MULTICAST	(0x00000003)
+#define	NDD_PROMISCUOUS_ON	(0x00000004)
+#define	NDD_PROMISCUOUS_OFF	(0x00000005)
+#define	NDD_ADD_FILTER		(0x00000006)
+#define	NDD_DEL_FILTER		(0x00000007)
+#define	NDD_MIB_QUERY		(0x00000008)
+#define	NDD_MIB_GET		(0x00000009)
+#define	NDD_MIB_SET		(0x0000000A)
+#define	NDD_ADD_STATUS		(0x0000000B)
+#define	NDD_DEL_STATUS		(0x0000000C)
+#define	NDD_ENABLE_ADDRESS	(0x0000000D)
+#define	NDD_DISABLE_ADDRESS	(0x0000000E)
+
+#define	NDD_DUMP_ADDR		(0x00000100)
+#define	NDD_PRIORITY_ADDR	(0x00000101)
+
+#define	NDD_DEVICE_SPECIFIC	(0x00010000)
+
+/*
+ * Flag values for NDD_MIB_QUERY
+ */
+#define	MIB_NOT_SUPPORTED	(0x00)	/* MIB variable not supported by NDD */
+#define	MIB_READ_ONLY		(0x01)	/* MIB variable is read only */
+#define	MIB_READ_WRITE		(0x02)	/* MIB variable can be read or set */
+#define	MIB_WRITE_ONLY		(0x03)	/* MIB variable can only be set */
+
+struct ndd_mib_query {
+	u_int 		mib_get[1];	/* MAC specific MIB structure */
+};
+typedef	struct ndd_mib_query ndd_mib_query_t;
+
+struct ndd_mib_get {
+	u_int 		mib_get[1];	/* MAC specific MIB structure */
+};
+typedef	struct ndd_mib_get ndd_mib_get_t;
+
+/*
+ * status codes for NDD_MIB_SET operations 
+ */
+#define	MIB_OK			0	/* operation was successful */
+#define	MIB_NOT_SETTABLE	1	/* MIB variable is not settable */
+#define	MIB_WRONG_STATE		2	/* variable is settable but not now */
+#define	MIB_FAILED		3	/* NDD was unable to set variable */
+#define	MIB_BAD_VALUE		4	/* incorrect value for variable */
+
+typedef	u_int	mib_t;
+
+struct ndd_mib_set {
+	u_int		count;		/* number of MIB variables to set */
+	struct {			/* repeated count times	*/
+		mib_t	mib;	    	/* a MIB variable to set */
+		u_int	mib_len;    	/* length of the MIB variable value */
+		u_int	status;	    	/* return status from set operation */
+		u_int 	mib_value[1];   /* value to set, length is mib_len */
+	} mib;
+};
+typedef	struct ndd_mib_set ndd_mib_set_t;
+
+struct ndd_statblk {
+	u_int		code;		/* status block code		*/
+	u_int		option[10];	/* additional information 	*/
+};
+typedef struct ndd_statblk ndd_statblk_t;
+
+/* 
+ * Status block codes for ndd_statblk
+ */
+#define	NDD_HARD_FAIL	(0x00000001)	/* A hardware failure has occurred */
+#define	NDD_LIMBO_ENTER	(0x00000002)	/* Entered Network Recovery Mode */
+#define	NDD_LIMBO_EXIT	(0x00000003)	/* Exited Network Recovery Mode */
+#define	NDD_CONNECTED	(0x00000004)	/* Device open successful */
+#define	NDD_STATUS	(0x00000005)	/* Various status and event info */
+#define	NDD_BAD_PKTS	(0x00000006)	/* A bad packet was received */
+
+/* 
+ * Reason codes for ndd_statblk
+ */
+#define	NDD_ADAP_CHECK	(0x00000001)	/* Adapter checkstop condition */
+#define	NDD_BUS_ERROR	(0x00000002)	/* Bus error */
+#define	NDD_CMD_FAIL	(0x00000003)	/* A device command has failed */
+#define	NDD_PIO_FAIL	(0x00000004)	/* A PIO operation has failed */
+#define	NDD_UCODE_FAIL	(0x00000005)	/* Failure of device microcode */
+#define	NDD_TX_ERROR	(0x00000006)	/* A transmission error has occurred */
+#define	NDD_TX_TIMEOUT	(0x00000007)	/* Transmission timeout error */
+#define	NDD_RCV_ERROR	(0x00000008)	/* A receive error has occured */
+#define	NDD_AUTO_RMV	(0x00000009)	/* Auto-remove error detected */
+
+
+struct ndd_config {
+	int	seq_number;
+	caddr_t	dds;
+	int	l_vpd;
+	caddr_t	p_vpd;
+	caddr_t	ucode;
+};
+typedef struct ndd_config	ndd_config_t;
+
+
+#ifdef _KERNEL
+extern struct ndd *ndd;
+#endif /* _KERNEL */
+
+#endif	/* _NDD_H_ */


Property changes on: trunk/sys/sys/mach/device/ndd.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/param.h
===================================================================
--- trunk/sys/sys/mach/device/param.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/param.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,110 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6  91/05/14  16:00:44  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.5  91/02/05  17:10:13  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:30:33  mrt]
+ * 
+ * Revision 2.4  90/12/05  23:27:45  af
+ * 
+ * 
+ * Revision 2.3  90/12/05  20:42:08  af
+ * 	Fixed missing parenthesis.
+ * 	[90/11/29            af]
+ * 
+ * Revision 2.2  90/08/27  21:55:37  dbg
+ * 	Re-wrote from scratch.
+ * 	[90/07/16            dbg]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	7/90
+ */
+
+#ifndef	_DEVICE_PARAM_H_
+#define	_DEVICE_PARAM_H_
+
+/****************************************************************************
+*                                                                           * 
+*   This file used to contain such traditional Unix defines as DEV_BSIZE.   *
+*   They have been removed leaving nothing.  This file remains because it   *
+*   is possible that there may in future be defines which legitimately      *
+*   belong here and also to warn those who might, out of ignorance,         *
+*   re-establish the former state affairs.                                  *
+*                                                                           *
+*   Anyone who is tempted to put a define for DEV_BSIZE into this file      *
+*   should stop for a moment to consider what it means.  If, in the Unix    *
+*   commenting tradition, the unhelpful simple noun phrase "device block    *
+*   size" is offerred, we should ask "Of what device?"  If any particular   *
+*   device is cited, it should be obvious that the appropriate define       *
+*   belongs in a file specific to that device.  If it is asserted that it   *
+*   applies to all devices, we must ask the justification for such a re-    *
+*   diculous restriction.                                                   *
+*                                                                           *
+*   Another kind of answer to the question of what it means is of the type  *
+*   "512, which I need to get this Unix driver to compile."  If you are     *
+*   too timid to fix the driver to reflect the environment in which it      *
+*   operating and have resort to this kind of kludge, please put it in      *
+*   that specific driver and don't impose it on the rest of the system.     *
+*                                                                           *
+*   If none of the above stays your hand, there is nothing a I can do to    *
+*   prevent you from going ahead.  This note will, however, ensure that     *
+*   you are unable to plead ignorance before your peers.                    *
+*                                                                           *
+****************************************************************************/
+
+#endif	/* _DEVICE_PARAM_H_ */


Property changes on: trunk/sys/sys/mach/device/param.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/subrs.h
===================================================================
--- trunk/sys/sys/mach/device/subrs.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/subrs.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+
+#include <device/buf.h>
+
+extern void		harderr(
+				struct buf	* bp,
+				char		* cp);
+
+extern char             * itoa(
+                                int		num,
+                                char		* str);
+
+/* Structure for driver shutdown routine callback */
+struct drvr_shut {
+	struct drvr_shut	*next;
+	void			(*callback)(caddr_t);	/* callback routine */
+	caddr_t			param;
+};
+	
+#define	DRVR_REGISTER	0x00000001	/* register a callback routine */
+#define	DRVR_UNREGISTER	0x00000002	/* de-register a callback routine */
+
+void
+drvr_register_shutdown(void (*callback)(caddr_t), caddr_t param, int flags);
+void drvr_shutdown(void);


Property changes on: trunk/sys/sys/mach/device/subrs.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/template.mk
===================================================================
--- trunk/sys/sys/mach/device/template.mk	                        (rev 0)
+++ trunk/sys/sys/mach/device/template.mk	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,86 @@
+#
+# Copyright 1991-1998 by Open Software Foundation, Inc. 
+#              All Rights Reserved 
+#  
+# Permission to use, copy, modify, and distribute this software and 
+# its documentation for any purpose and without fee is hereby granted, 
+# provided that the above copyright notice appears in all copies and 
+# that both the copyright notice and this permission notice appear in 
+# supporting documentation. 
+#  
+# OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+# FOR A PARTICULAR PURPOSE. 
+#  
+# IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+# NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+#
+#
+# MkLinux
+
+VPATH		= ..:../..
+
+MIGFLAGS	= -MD ${IDENT}
+MIGKSFLAGS	= -DKERNEL_SERVER
+MIGKUFLAGS	= -DKERNEL_USER
+
+DEVICE_FILES	= device_server.h device_server.c
+DEVICE_REPLY_FILES = device_reply.h device_reply_user.c
+DEVICE_PAGER_FILES = device_pager_server.h device_pager_server.c
+NORMA_DEVICE_FILES = dev_forward.h dev_forward.c
+
+
+OTHERS		= ${DEVICE_FILES} ${DEVICE_REPLY_FILES} ${DEVICE_PAGER_FILES} \
+		  ${NORMA_DEVICE_FILES}
+
+INCFLAGS	= -I.. -I../..
+MDINCFLAGS	= -I.. -I../..
+
+DEPENDENCIES	=
+
+.include <${RULES_MK}>
+
+.ORDER: ${DEVICE_FILES}
+
+${DEVICE_FILES}: device/device.defs
+	${_MIG_} ${_MIGFLAGS_} ${MIGKSFLAGS}		\
+		-header /dev/null			\
+		-user /dev/null				\
+		-sheader device_server.h		\
+		-server device_server.c			\
+                ${device/device.defs:P}
+
+.ORDER: ${DEVICE_REPLY_FILES}
+
+${DEVICE_REPLY_FILES}: device/device_reply.defs
+	${_MIG_} ${_MIGFLAGS_} ${MIGKUFLAGS}		\
+		-header device_reply.h			\
+		-user device_reply_user.c		\
+		-server /dev/null			\
+		${device/device_reply.defs:P}
+
+.ORDER: ${DEVICE_PAGER_FILES}
+
+${DEVICE_PAGER_FILES}: mach/memory_object.defs
+	${_MIG_} ${_MIGFLAGS_} ${MIGKSFLAGS}		\
+		-header /dev/null			\
+		-user /dev/null				\
+		-sheader device_pager_server.h		\
+		-server device_pager_server.c		\
+		${mach/memory_object.defs:P}
+
+.ORDER: ${NORMA_DEVICE_FILES}
+
+${NORMA_DEVICE_FILES}: device/dev_forward.defs
+	${_MIG_} ${_MIGFLAGS_} ${MIGKUFLAGS}		\
+		-header dev_forward.h			\
+		-user dev_forward.c			\
+		-server /dev/null			\
+                ${device/dev_forward.defs:P}
+
+.if exists(depend.mk)
+.include "depend.mk"
+.endif


Property changes on: trunk/sys/sys/mach/device/template.mk
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/test_device_entries.h
===================================================================
--- trunk/sys/sys/mach/device/test_device_entries.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/test_device_entries.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,69 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+
+extern void		testdev_generate_replies(void);
+extern void		testdev_generate_packets(void);
+
+extern io_return_t	testdev_open(
+				dev_t		dev,
+				dev_mode_t	flag,
+				io_req_t	ior);
+extern void		testdev_close(
+				dev_t		dev);
+extern io_return_t	testdev_read(
+				dev_t		dev,
+				io_req_t	ior);
+extern io_return_t	testdev_write(
+				dev_t		dev,
+				io_req_t	ior);
+extern io_return_t	testdev_getstat(
+				dev_t		dev,
+				dev_flavor_t	flavor,
+				dev_status_t	data,
+				mach_msg_type_number_t * count);
+extern io_return_t	testdev_setstat(
+				dev_t		dev,
+				dev_flavor_t	flavor,
+				dev_status_t	data,
+				mach_msg_type_number_t	count);
+extern vm_offset_t	testdev_mmap(
+				dev_t		dev,
+				vm_offset_t	off,
+				vm_prot_t	prot);
+extern io_return_t	testdev_async_in(
+				dev_t		dev,
+				ipc_port_t	rcv_port,
+				int		pri,
+				filter_t	*filter,
+				mach_msg_type_number_t fcount,
+				mach_device_t	device);
+extern void		testdev_reset(
+				dev_t		dev);
+extern boolean_t	testdev_port_death(
+				dev_t		dev,
+				ipc_port_t	port);
+extern io_return_t	testdev_dev_info(
+				dev_t		dev,
+				dev_flavor_t	flavor,
+				char		* info);


Property changes on: trunk/sys/sys/mach/device/test_device_entries.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/test_device_status.h
===================================================================
--- trunk/sys/sys/mach/device/test_device_status.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/test_device_status.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+
+#ifndef _DEVICE_TEST_DEVICE_STATUS_H_
+#define _DEVICE_TEST_DEVICE_STATUS_H_
+
+#include <device/device_types.h>
+
+struct test_device_status {
+	mach_port_t	reply_port;
+	int		reply_type;
+#define	DEVICE_TEST_READ_REPLY			1
+#define DEVICE_TEST_READ_INBAND_REPLY		2
+#define DEVICE_TEST_READ_OVERWRITE_REPLY	3
+#define DEVICE_TEST_WRITE_REPLY			4
+#define DEVICE_TEST_WRITE_INBAND_REPLY		5
+#define DEVICE_TEST_FILTERED_PACKET		6
+	mach_port_t	reply_thread;
+	vm_address_t	reply_uaddr;
+	int		reply_count;
+	int		reply_size;
+	boolean_t	reply_synchronous;
+};
+typedef struct test_device_status	test_device_status_t;
+#define TEST_DEVICE_STATUS_COUNT (sizeof (test_device_status_t) / sizeof (int))
+
+#define TEST_DEVICE_STATUS			1
+#define TEST_DEVICE_GENERATE_REPLIES		2
+
+#endif	/* _DEVICE_TEST_DEVICE_STATUS_H_ */


Property changes on: trunk/sys/sys/mach/device/test_device_status.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/tty.h
===================================================================
--- trunk/sys/sys/mach/device/tty.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/tty.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,347 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6.3.2  92/04/30  11:49:25  bernadat
+ * 	16-Apr-92  emcmanusat gr.osf.org
+ * 	Define TQ_FLUSHED.
+ * 	[92/04/22  09:59:57  bernadat]
+ * 
+ * Revision 2.6.3.1  92/03/28  10:05:02  jeffreyh
+ * 	04-Mar-92  emcmanus at gr.osf.org
+ * 		Support for out-of-band events: definitions for character quoting
+ * 		in the input queue, new tty fields to store events.
+ * 	[92/03/10  07:56:12  bernadat]
+ * 
+ * Revision 2.6  91/07/09  23:16:12  danner
+ * 	   Added omron tty specific flags; conditionalized under luna88k.
+ * 	[91/05/25            danner]
+ * 
+ * Revision 2.5  91/05/14  16:02:00  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:10:26  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:30:52  mrt]
+ * 
+ * Revision 2.3  90/08/27  21:55:44  dbg
+ * 	Re-created to avoid ownership problems.
+ * 	[90/07/09            dbg]
+ * 
+ */
+/* CMU_ENDHIST */
+
+/*
+ *(C)UNIX System Laboratories, Inc. all or some portions of this file are
+ *derived from material licensed to the University of California by
+ *American Telephone and Telegraph Co. or UNIX System Laboratories,
+ *Inc. and are reproduced herein with the permission of UNIX System
+ *Laboratories, Inc.
+ */
+
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	7/90
+ *
+ * 	Compatibility TTY structure for existing TTY device drivers.
+ */
+
+#ifndef	_DEVICE_TTY_H_
+#define	_DEVICE_TTY_H_
+
+#include <kern/lock.h>
+#include <kern/queue.h>
+#include <mach/port.h>
+
+#include <device/io_req.h>
+#include <device/device_types.h>
+#ifdef luna88k
+#include <luna88k/jtermio.h>
+#endif
+#include <device/tty_status.h>
+#include <device/cirbuf.h>
+#include <device/buf.h>
+
+struct tty {
+	decl_simple_lock_data(,t_lock)
+	struct cirbuf	t_inq;		/* input buffer */
+	struct cirbuf	t_outq;		/* output buffer */
+	char *		t_addr;		/* device pointer */
+	int		t_dev;		/* device number */
+	void		(*t_start)(	/* routine to start output */
+				struct tty	* tp);
+#define	t_oproc	t_start
+	void		(*t_stop)(	/* routine to stop output */
+				struct tty	* tp,
+				int		flags);
+	int		(*t_mctl)(	/* (optional) routine to control
+					   modem signals */
+				struct tty	* tp,
+				int		bits,
+				int		how);
+	int		t_ispeed;	/* input speed */
+	int		t_ospeed;	/* output speed */
+	char		t_breakc;	/* character to deliver when 'break'
+					   condition received */
+	int		t_flags;	/* mode flags */
+	int		t_state;	/* current state */
+	int		t_line;		/* fake line discipline number,
+					   for old drivers - always 0 */
+	int		t_outofband;	/* current out-of-band events */
+	int		t_outofbandarg;	/* arg to first out-of-band event */
+	int		t_nquoted;	/* number of quoted chars in inq */
+	int		t_hiwater;	/* baud-rate limited high water mark */
+	int		t_lowater;	/* baud-rate limited low water mark */
+	queue_head_t	t_delayed_read;	/* pending read requests */
+	queue_head_t	t_delayed_write;/* pending write requests */
+	queue_head_t	t_delayed_open;	/* pending open requests */
+
+	io_return_t	(*t_getstat)(	/* routine to get status */
+				dev_t		dev,
+				dev_flavor_t	flavor,
+				dev_status_t	data,
+				natural_t	* count);
+#ifdef luna
+      struct jterm    t_jt;
+      short           t_jstate;
+      char            t_term;         /* terminal type */
+      char            t_tmflag;       /* t_tmflag */
+      unsigned short  t_omron;        /* OMRON extended flags */
+      int             *t_kfptr;
+#endif /* luna */
+	io_return_t	(*t_setstat)(	/* routine to set status */
+				dev_t		dev,
+				dev_flavor_t	flavor,
+				dev_status_t	data,
+				natural_t	count);
+	dev_ops_t	t_tops;		/* another device to possibly
+					   push through */
+};
+typedef struct tty	*tty_t;
+
+/*
+ * Common TTY service routines
+ */
+extern io_return_t	char_open(
+				dev_t		dev,
+				struct tty	* tp,
+				dev_mode_t	mode,
+				io_req_t	ior);
+extern io_return_t	char_read(
+				struct tty	* tp,
+				io_req_t	ior);
+extern io_return_t	char_write(
+				struct tty	* tp,
+				io_req_t	ior);
+extern void		tty_queue_completion(
+				queue_t		qh);
+extern boolean_t	tty_queueempty(
+				struct tty	* tp,
+				int		queue);
+
+#define	tt_open_wakeup(tp) \
+	(tty_queue_completion(&(tp)->t_delayed_open))
+#define	tt_write_wakeup(tp) \
+	(tty_queue_completion(&(tp)->t_delayed_write))
+
+/*
+ * Structure used to store baud rate specific information
+ */
+struct baud_rate_info {
+	int br_rate;
+	int br_info;
+};
+typedef struct baud_rate_info *baud_rate_info_t;
+
+extern int baud_rate_get_info(int, baud_rate_info_t);
+
+#define	OBUFSIZ	100
+#define	TTMINBUF	90
+
+/* internal state bits */
+#define	TS_INIT		0x00000001	/* tty structure initialized */
+#define	TS_TIMEOUT	0x00000002	/* delay timeout in progress */
+#define	TS_WOPEN	0x00000004	/* waiting for open to complete */
+#define	TS_ISOPEN	0x00000008	/* device is open */
+#define	TS_FLUSH	0x00000010	/* outq has been flushed during DMA */
+#define	TS_CARR_ON	0x00000020	/* software copy of carrier-present */
+#define	TS_BUSY		0x00000040	/* output in progress */
+#define	TS_ASLEEP	0x00000080	/* wakeup when output done */
+
+#define	TS_TTSTOP	0x00000100	/* output stopped by ctl-s */
+#define	TS_HUPCLS	0x00000200	/* hang up upon last close */
+#define	TS_TBLOCK	0x00000400	/* tandem queue blocked */
+
+#define	TS_NBIO		0x00001000	/* tty in non-blocking mode */
+#define	TS_ONDELAY	0x00002000	/* device is open; software copy of 
+ 					 * carrier is not present */
+#define	TS_MIN		0x00004000	/* buffer input chars, if possible */
+#define	TS_MIN_TO	0x00008000	/* timeout for the above is active */
+
+#define TS_OUT          0x00010000	/* tty in use for dialout only */
+#define TS_RTS_DOWN     0x00020000	/* modem pls stop */
+
+#define TS_TRANSLATE	0x00100000	/* translation device enabled */
+#define TS_KDB		0x00200000	/* should enter kdb on ALT */
+
+/* flags - old names defined in terms of new ones */
+
+#define	TANDEM		TF_TANDEM
+#define	ODDP		TF_ODDP
+#define	EVENP		TF_EVENP
+#define	ANYP		(ODDP|EVENP)
+#define	MDMBUF		TF_MDMBUF
+#define	LITOUT		TF_LITOUT
+#define	NOHANG		TF_NOHANG
+
+#define	ECHO		TF_ECHO
+#define	CRMOD		TF_CRMOD
+#define	XTABS		TF_XTABS
+#define	CRTSCTS		TF_CRTSCTS
+
+/* these are here only to let old code compile - they are never set */
+#define	RAW		LITOUT
+#define	PASS8		LITOUT
+
+/*
+ * Hardware bits.
+ * SHOULD NOT BE HERE.
+ */
+#define	DONE	0200
+#define	IENABLE	0100
+
+/*
+ * Modem control commands.
+ */
+#define	DMSET		0
+#define	DMBIS		1
+#define	DMBIC		2
+#define	DMGET		3
+
+/*
+ * Fake 'line discipline' switch, for the benefit of old code
+ * that wants to call through it.
+ */
+struct ldisc_switch {
+	int	(*l_read)(	/* read */
+			struct tty		* tp,
+			struct uio		* uio);
+	int	(*l_write)(	/* write */
+			struct tty		* tp,
+			struct uio		* uio);
+	void	(*l_rint)(	/* single character input */
+			unsigned int		ch,
+			struct tty		* tp);
+	int	(*l_modem)(	/* modem change */
+			struct tty		* tp,
+			int			flag);
+	void	(*l_start)(void);/* start output */
+};
+
+extern struct ldisc_switch	linesw[];
+
+/*
+ * Character quoting, so we can sneak out-of-band events like break into
+ * the input queue.
+ */
+#define TTY_QUOTEC ((char)0377)
+enum {TQ_QUOTEC, TQ_BREAK, TQ_BAD_PARITY, TQ_FLUSHED};
+/* Things that follow TTY_QUOTEC. */
+
+extern void		ttychars(
+				struct tty		* tp);
+extern void		ttydrain(
+				struct tty		* tp);
+extern void		ttyclose(
+				struct tty		* tp);
+extern boolean_t	tty_portdeath(
+				struct tty		* tp,
+				ipc_port_t		port);
+extern io_return_t	tty_get_status(
+				struct tty		* tp,
+				dev_flavor_t		flavor,
+				dev_status_t		data,
+				mach_msg_type_number_t	* count);
+extern io_return_t	tty_set_status(
+				struct tty		* tp,
+				dev_flavor_t		flavor,
+				dev_status_t		data,
+				mach_msg_type_number_t	count);
+extern boolean_t	ttymodem(
+				struct tty		* tp,
+				int			flag);
+extern void		ttyoutput(
+				unsigned		c,
+				struct tty		* tp);
+extern void		ttyinput(
+				unsigned int		ch,
+				struct tty		* tp);
+extern void		ttybreak(
+				int			ch,
+				struct tty		* tp);
+extern void		ttyinputbadparity(
+				int			ch,
+				struct tty		* tp);
+extern void		ttrstrt(
+				struct tty		* tp);
+extern void		ttstart(
+				struct tty		* tp);
+extern void		ttyflush(
+				struct tty		* tp,
+				int			rw);
+extern int		TTLOWAT(
+				struct tty		* tp);
+extern void		tty_cts(
+				struct tty		* tp,
+				boolean_t		cts_up);
+
+#endif	/* _DEVICE_TTY_H_ */
+


Property changes on: trunk/sys/sys/mach/device/tty.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/device/tty_status.h
===================================================================
--- trunk/sys/sys/mach/device/tty_status.h	                        (rev 0)
+++ trunk/sys/sys/mach/device/tty_status.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,191 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5.3.2  92/04/30  11:49:34  bernadat
+ * 	16-Apr-92  emcmanus at gr.osf.org
+ * 	Define TOOB_FLUSHED.
+ * 	[92/04/22  10:00:03  bernadat]
+ * 
+ * Revision 2.5.3.1  92/03/28  10:05:07  jeffreyh
+ * 	04-Mar-92  emcmanus at gr.osf.org
+ * 		New tt_flags bits in TTY_STATUS request: TF_OUT_OF_BAND, TF_INPCK.
+ * 		New device_set/get_status requests: TTY_OUT_OF_BAND, TTY_DRAIN,
+ * 		and corresponding support definitions.
+ * 	[92/03/10  07:56:17  bernadat]
+ * 
+ * Revision 2.5  91/05/14  16:02:15  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:10:33  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/01/31  17:31:01  mrt]
+ * 
+ * Revision 2.3  90/12/05  23:28:49  af
+ * 	Merge problems.
+ * 
+ * Revision 2.2  90/12/05  20:42:12  af
+ * 	Created by dbg, I believe.  Added a couple of modem switches.
+ * 	[90/11/13            af]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Author: David B. Golub, Carnegie Mellon University
+ *	Date: 	ll/90
+ *
+ * 	Status information for tty.
+ */
+
+#include <device/ds_status.h>
+
+struct tty_status {
+	int	tt_ispeed;		/* input speed */
+	int	tt_ospeed;		/* output speed */
+	int	tt_breakc;		/* character to deliver when break
+					   detected on line */
+	int	tt_flags;		/* mode flags */
+};
+#define	TTY_STATUS_COUNT	(sizeof(struct tty_status)/sizeof(int))
+#define	TTY_STATUS_COMPAT	(dev_flavor_t)(('t'<<16) + 1)
+#define	TTY_STATUS		(dev_flavor_t)(('t'<<16) + 1)
+#define	TTY_STATUS_NEW		(dev_flavor_t)(('t'<<16) + 11)
+
+/*
+ * Flags
+ */
+#define	TF_TANDEM	0x00000001	/* send stop character when input
+					   queue full */
+#define	TF_ODDP		0x00000002	/* get/send odd parity */
+#define	TF_EVENP	0x00000004	/* get/send even parity */
+#define	TF_ANYP		(TF_ODDP|TF_EVENP)
+					/* get any parity/send none */
+#define	TF_LITOUT	0x00000008	/* output all 8 bits
+					   otherwise, characters >= 0x80
+					   are time delays	XXX */
+#define	TF_MDMBUF	0x00000010	/* start/stop output on carrier
+					   interrupt
+					   otherwise, dropping carrier
+					   hangs up line */
+#define	TF_NOHANG	0x00000020	/* no hangup signal on carrier drop */
+#define	TF_HUPCLS	0x00000040	/* hang up (outgoing) on last close */
+
+/*
+ * Read-only flags - information about device
+ */
+#define	TF_ECHO		0x00000080	/* device wants user to echo input */
+#define	TF_CRMOD	0x00000100	/* device wants \r\n, not \n */
+#define	TF_XTABS	0x00000200	/* device does not understand tabs */
+
+#define TF_OUT_OF_BAND	0x00000400	/* enable out-of-band notification */
+#define TF_INPCK	0x00000800	/* check parity of incoming chars */
+
+#define TF_CRTSCTS	0x00001000	/* do RTS/CTS hardware flow control  */
+#define TF_8BIT		0x00002000	/* 8 bit? If not, then 7-bit */
+#define TF_READ		0x00004000	/* Enable receiver? */
+
+/*
+ * Modem control
+ */
+#define	TTY_MODEM_COUNT		(1)	/* one integer */
+#define	TTY_MODEM		(dev_flavor_t)(('t'<<16) + 2)
+
+#define	TM_LE		0x0001		/* line enable */
+#define	TM_DTR		0x0002		/* data terminal ready */
+#define	TM_RTS		0x0004		/* request to send */
+#define	TM_ST		0x0008		/* secondary transmit */
+#define	TM_SR		0x0010		/* secondary receive */
+#define	TM_CTS		0x0020		/* clear to send */
+#define	TM_CAR		0x0040		/* carrier detect */
+#define	TM_RNG		0x0080		/* ring */
+#define	TM_DSR		0x0100		/* data set ready */
+
+#define	TM_BRK		0x0200		/* set line break (internal) */
+#define	TM_HUP		0x0000		/* close line (internal) */
+
+/*
+ * Other controls
+ */
+#define	TTY_FLUSH_COUNT		(1)	/* one integer - D_READ|D_WRITE */
+#define	TTY_FLUSH		(dev_flavor_t)(('t'<<16) + 3)
+					/* flush input or output */
+#define	TTY_STOP		(dev_flavor_t)(('t'<<16) + 4)
+					/* stop output */
+#define	TTY_START		(dev_flavor_t)(('t'<<16) + 5)
+					/* start output */
+#define	TTY_SET_BREAK		(dev_flavor_t)(('t'<<16) + 6)
+					/* set break condition */
+#define	TTY_CLEAR_BREAK		(dev_flavor_t)(('t'<<16) + 7)
+					/* clear break condition */
+#define TTY_SET_TRANSLATION	(dev_flavor_t)(('t'<<16) + 8)
+					/* set translation table */
+#define TTY_NMODEM		(('t'<<16) + 9)
+					/* set/clr soft carrier */
+
+struct tty_out_of_band {
+	int toob_event;		/* event bitmask */
+	int toob_arg;		/* argument for first event */
+};
+#define TTY_OUT_OF_BAND_COUNT	(sizeof(struct tty_out_of_band)/sizeof(int))
+#define TTY_OUT_OF_BAND		(('t'<<16) + 9)
+					/* get out of band events */
+#define TOOB_NO_EVENT		0
+#define TOOB_BREAK		1
+#define TOOB_BAD_PARITY		2
+#define TOOB_FLUSHED		3
+#define TOOB_CARRIER		4
+
+#define TTY_DRAIN		(('t'<<16) + 10)
+					/* wait for output to drain */
+
+/*
+ * WARNING - TTY_STATUS is (('t'<<16) + 11) due to i/f changes...
+ */


Property changes on: trunk/sys/sys/mach/device/tty_status.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/error.h
===================================================================
--- trunk/sys/sys/mach/error.h	                        (rev 0)
+++ trunk/sys/sys/mach/error.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,152 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/14  16:51:24  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:31:48  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:16:50  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:57:47  rpd
+ * 	Added err_mach_ipc for new IPC.
+ * 	[90/03/26  22:28:42  rpd]
+ * 
+ * Revision 2.1  89/08/03  16:02:07  rwd
+ * Created.
+ * 
+ * Revision 2.4  89/02/25  18:13:18  gm0w
+ * 	Changes for cleanup.
+ * 
+ * Revision 2.3  89/02/07  00:51:57  mwyoung
+ * Relocated from sys/error.h
+ * 
+ * Revision 2.2  88/10/18  00:37:31  mwyoung
+ * 	Added {system,sub and code}_emask 
+ * 	[88/10/17  17:06:58  mrt]
+ * 
+ *	Added {system,sub and code}_emask 
+ *
+ *  12-May-88 Mary Thompson (mrt) at Carnegie Mellon
+ *	Changed mach_error_t from unsigned int to kern_return_t
+ *	which is a 32 bit integer regardless of machine type.
+ *      insigned int was incompatible with old usages of mach_error.
+ *
+ *  10-May-88 Douglas Orr (dorr) at Carnegie-Mellon University
+ *	Missing endif replaced
+ *
+ *   5-May-88 Mary Thompson (mrt) at Carnegie Mellon
+ *	Changed typedef of mach_error_t from long to unsigned int
+ *	to keep our Camelot users happy. Also moved the nonkernel
+ *	function declarations from here to mach_error.h.
+ *
+ *  10-Feb-88 Douglas Orr (dorr) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ * File:	mach/error.h
+ * Purpose:
+ *	error module definitions
+ *
+ */
+
+#ifndef	ERROR_H_
+#define ERROR_H_
+#include <mach/kern_return.h>
+
+/*
+ *	error number layout as follows:
+ *
+ *	hi		 		       lo
+ *	| system(6) | subsystem(12) | code(14) |
+ */
+
+
+#define	err_none		(mach_error_t)0
+#define ERR_SUCCESS		(mach_error_t)0
+#define	ERR_ROUTINE_NIL		(mach_error_fn_t)0
+
+
+#define	err_system(x)		(((x)&0x3f)<<26)
+#define err_sub(x)		(((x)&0xfff)<<14)
+
+#define err_get_system(err)	(((err)>>26)&0x3f)
+#define err_get_sub(err)	(((err)>>14)&0xfff)
+#define err_get_code(err)	((err)&0x3fff)
+
+#define system_emask		(err_system(0x3f))
+#define sub_emask		(err_sub(0xfff))
+#define code_emask		(0x3fff)
+
+
+/*	major error systems	*/
+#define	err_kern		err_system(0x0)		/* kernel */
+#define	err_us			err_system(0x1)		/* user space library */
+#define	err_server		err_system(0x2)		/* user space servers */
+#define	err_ipc			err_system(0x3)		/* old ipc errors */
+#define err_mach_ipc		err_system(0x4)		/* mach-ipc errors */
+#define	err_dipc		err_system(0x7)		/* distributed ipc */
+#define err_local		err_system(0x3e)	/* user defined errors */
+#define	err_ipc_compat		err_system(0x3f)	/* (compatibility) mach-ipc errors */
+
+#define	err_max_system		0x3f
+
+
+/*	unix errors get lumped into one subsystem  */
+#define	unix_err(errno)		(err_kern|err_sub(3)|errno)
+
+typedef	kern_return_t	mach_error_t;
+typedef mach_error_t	(* mach_error_fn_t)( void );
+
+#endif	/* ERROR_H_ */


Property changes on: trunk/sys/sys/mach/error.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/etap_macros.h
===================================================================
--- trunk/sys/sys/mach/etap_macros.h	                        (rev 0)
+++ trunk/sys/sys/mach/etap_macros.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,457 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ * 
+ */
+/*
+ * MkLinux
+ */
+/*
+ *	The Event Trace Analysis Package
+ *	================================
+ *
+ *	Function:	Traces micro-kernel events.
+ *
+ *	Macro Notes:	Several macros are added throughout the lock code.
+ *			These macros allow for convenient configuration
+ *			and code readability.
+ *
+ *			The macro prefixes determine a specific trace
+ *			configuration operation:
+ *
+ *			CUM	-  Cumulative trace specific operation.
+ *			MON	-  Monitored  trace specific operation.
+ *			ETAP	-  Both a cumulative and monitored trace
+ *				   operation.
+ */
+
+
+#ifndef _KERN_ETAP_MACROS_H_
+#define _KERN_ETAP_MACROS_H_
+#if 0
+#include <kern/etap_options.h>
+#include <kern/lock.h>
+#include <mach/etap.h>
+#include <mach/etap_events.h>
+#include <kern/etap_pool.h>
+#endif
+
+#define ETAP 0
+#define ETAP_MONITOR 0
+#define ETAP_LOCK_MONITOR 0
+#define ETAP_LOCK_ACCUMULATE 0
+#define ETAP_EVENT_MONITOR 0
+#define ETAP_LOCK_TRACE 0
+#define MACH_COUNTER 0
+#define MACH_IPC_TEST 0
+#if	ETAP
+
+#include <kern/macro_help.h>
+#include <mach/vm_param.h>
+#include <ipc/ipc_types.h>
+#include <mach/message.h>
+#include <machine/rtclock_entries.h>
+
+extern void etap_init_phase1(void);
+extern void etap_init_phase2(void);
+extern void etap_event_table_assign(struct event_table_chain *, etap_event_t);
+extern unsigned int  etap_get_pc(void);
+extern event_table_t event_table;
+extern subs_table_t subs_table;
+
+/*
+ *  Time Macros
+ */
+
+#define ETAP_TIMESTAMP(t)		rtc_gettime_interrupts_disabled(&t)
+#define ETAP_TIME_SUM(t,sum_me)		t += sum_me
+#define ETAP_TIME_SUB(t,stop,start)	MACRO_BEGIN \
+						(t) = (stop); \
+						SUB_TVALSPEC(&(t), &(start)); \
+					MACRO_END
+#define ETAP_TIME_SQR(t,sqr_me)		t += sqr_me*sqr_me
+#define ETAP_TIME_DIV(r,n,d)		r = (u_short) n/d
+#define ETAP_TIME_IS_ZERO(t)		((t).tv_sec == 0)
+#define ETAP_TIME_CLEAR(t)		((t).tv_sec = 0)
+#define ETAP_TIME_GREATER(t1,t2)	((t1) > (t2))
+
+#else	/* ETAP */
+
+#define etap_init_phase1()
+#define etap_init_phase2()
+#define etap_event_table_assign(event)
+#define ETAP_TIMESTAMP(t)
+#define ETAP_TIME_SUB(t,start,stop)
+#define ETAP_TIME_CLEAR(t)
+
+#endif	/* ETAP */
+
+
+/*
+ *  ===================================================
+ *  ETAP: cumulative trace specific macros
+ *  ===================================================
+ */
+
+#if	ETAP_LOCK_ACCUMULATE
+
+extern cbuff_entry_t	etap_cbuff_reserve(event_table_t);
+extern simple_lock_t	cbuff_locks;
+extern int		cbuff_width;
+
+/*
+ *  If cumulative hold tracing is enabled for the event (i.e., acquired lock),
+ *  the CUM_HOLD_ACCUMULATE macro will update the appropriate cumulative buffer
+ *  entry with the newly collected hold data.
+ */
+
+#define CUM_HOLD_ACCUMULATE(cp,total_time,dynamic,trace)		      \
+MACRO_BEGIN								      \
+    u_short	_bucket;						      \
+    if ((cp) != CBUFF_ENTRY_NULL && ((trace) & CUM_DURATION)) {		      \
+       if (dynamic)							      \
+	   simple_lock_no_trace(&cbuff_locks[dynamic-1]);		      \
+       (cp)->hold.triggered++;						      \
+       ETAP_TIME_SUM((cp)->hold.time,(total_time));			      \
+       ETAP_TIME_SQR((cp)->hold.time_sq,(total_time));			      \
+       if (ETAP_TIME_IS_ZERO((cp)->hold.min_time) ||			      \
+	   ETAP_TIME_GREATER((cp)->hold.min_time,(total_time)))		      \
+	       (cp)->hold.min_time = (total_time);			      \
+       if (ETAP_TIME_GREATER((total_time),(cp)->hold.max_time))		      \
+	       (cp)->hold.max_time = (total_time);			      \
+       ETAP_TIME_DIV(_bucket,(total_time),cbuff_width);			      \
+       if (_bucket >= ETAP_CBUFF_IBUCKETS)				      \
+	   (cp)->hold_interval[ETAP_CBUFF_IBUCKETS-1]++;		      \
+       else								      \
+	   (cp)->hold_interval[_bucket]++;				      \
+       if (dynamic)							      \
+	   simple_unlock_no_trace(&cbuff_locks[dynamic-1]);		      \
+    }									      \
+MACRO_END
+
+/*
+ *  If cumulative wait tracing is enabled for the event (i.e., acquired lock),
+ *  the CUM_WAIT_ACCUMULATE macro will update the appropriate cumulative
+ *  buffer entry with the newly collected wait data.
+ */
+
+#define CUM_WAIT_ACCUMULATE(cp,total_time,dynamic,trace)		      \
+MACRO_BEGIN								      \
+    u_short    _bucket;							      \
+    if ((cp) != CBUFF_ENTRY_NULL && ((trace) & CUM_CONTENTION)) {	      \
+       if (dynamic)							      \
+	   simple_lock_no_trace(&cbuff_locks[dynamic-1]);		      \
+       (cp)->wait.triggered++;						      \
+       ETAP_TIME_SUM((cp)->wait.time,(total_time));			      \
+       ETAP_TIME_SQR((cp)->wait.time_sq,(total_time));			      \
+       if (ETAP_TIME_IS_ZERO((cp)->wait.min_time) ||			      \
+	   ETAP_TIME_GREATER((cp)->wait.min_time,(total_time)))		      \
+	       (cp)->wait.min_time = (total_time);			      \
+       if (ETAP_TIME_GREATER((total_time),(cp)->wait.max_time))		      \
+	       (cp)->wait.max_time = (total_time);			      \
+       ETAP_TIME_DIV(_bucket,(total_time),cbuff_width);			      \
+       if (_bucket >= ETAP_CBUFF_IBUCKETS)				      \
+	   (cp)->wait_interval[ETAP_CBUFF_IBUCKETS-1]++;		      \
+       else								      \
+	   (cp)->wait_interval[_bucket]++;				      \
+       if (dynamic)							      \
+	   simple_unlock_no_trace(&cbuff_locks[dynamic-1]);		      \
+     }									      \
+MACRO_END
+
+/*
+ *  Initially a lock's cbuff_read pointer is set to CBUFF_ENTRY_NULL. This
+ *  saves space in the cumulative buffer in the event that a read lock is
+ *  not acquired.  In the case that a read lock is acquired, the
+ *  CUM_READ_ENTRY_RESERVE macro is called.  Here a cumulative
+ *  record is reserved and initialized.
+ */
+
+#define CUM_READ_ENTRY_RESERVE(l,cp,trace)				      \
+MACRO_BEGIN								      \
+    if ((cp) == CBUFF_ENTRY_NULL && (trace) & ETAP_CUMULATIVE) {	      \
+       (cp) = etap_cbuff_reserve(lock_event_table(l));			      \
+       if ((cp) != CBUFF_ENTRY_NULL) {					      \
+	  (cp)->event = lock_event_table(l)->event;			      \
+	  (cp)->instance = (u_int) l;					      \
+	  (cp)->kind = READ_LOCK;					      \
+       }								      \
+    }									      \
+MACRO_END
+
+#else  /* ETAP_LOCK_ACCUMULATE */
+#define etap_cbuff_reserve(et)
+#define CUM_HOLD_ACCUMULATE(cp,t,d,tr)
+#define CUM_WAIT_ACCUMULATE(cp,t,d,tr)
+#define CUM_READ_ENTRY_RESERVE(l,rep,tr)
+#endif /* ETAP_LOCK_ACCUMULATE */
+
+/*
+ *  ===============================================
+ *  ETAP: monitor trace specific macros
+ *  ===============================================
+ */
+
+#if	ETAP_MONITOR
+extern int			mbuff_entries;
+extern monitor_buffer_t		mbuff[];
+#endif	/* ETAP_MONITOR */
+
+
+#if	ETAP_LOCK_MONITOR
+
+/*
+ *  If monitor tracing is enabled for the lock, the
+ *  MON_DATA_COLLECT macro will write collected lock data to
+ *  the next slot in a cpu specific monitor buffer.  Circular
+ *  buffer maintenance is also performed here.
+ */
+
+#define MON_DATA_COLLECT(l,e,total_time,type,op,trace)			     \
+MACRO_BEGIN								     \
+	mbuff_entry_t _mp;						     \
+	int _cpu, _ent, _s;						     \
+	if ((trace) & op) {						     \
+	   mp_disable_preemption();					     \
+	   _cpu = cpu_number();						     \
+	   _s	= sploff();						     \
+	   _ent = mbuff[_cpu]->free;					     \
+	   _mp	= &mbuff[_cpu]->entry[_ent];				     \
+	   _mp->event	     = lock_event_table(l)->event;		     \
+	   _mp->flags	     = ((op) | (type));				     \
+	   _mp->instance     = (u_int) (l);				     \
+	   _mp->time	     = (total_time);				     \
+	   _mp->data[0]	     = (e)->start_pc;				     \
+	   _mp->data[1]	     = (e)->end_pc;				     \
+	   mbuff[_cpu]->free = (_ent+1) % mbuff_entries;		     \
+	   if (mbuff[_cpu]->free == 0)					     \
+		mbuff[_cpu]->timestamp++;				     \
+	   splon(_s);							     \
+	   mp_enable_preemption();					     \
+	}								     \
+MACRO_END
+
+#define MON_CLEAR_PCS(l)						     \
+MACRO_BEGIN								     \
+	(l)->start_pc = 0;						     \
+	(l)->end_pc   = 0;						     \
+MACRO_END
+
+#define MON_ASSIGN_PC(target,source,trace)				     \
+	if ((trace) & ETAP_MONITORED) target = source
+
+#else  /* ETAP_LOCK_MONITOR */
+#define MON_DATA_COLLECT(l,le,tt,t,o,tr)
+#define MON_GET_PC(pc,tr)
+#define MON_CLEAR_PCS(l)
+#define MON_ASSIGN_PC(t,s,tr)
+#endif /* ETAP_LOCK_MONITOR */
+
+
+#if	ETAP_EVENT_MONITOR
+
+#define ETAP_PROBE(_event, _flags, _thread)				     \
+MACRO_BEGIN								     \
+	mbuff_entry_t _mp;						     \
+	int _cpu, _ent, _s;						     \
+	if (event_table[_event].status) {				     \
+	   mp_disable_preemption();					     \
+	   _cpu	 = cpu_number();					     \
+	   _s	 = sploff();						     \
+	   _ent	 = mbuff[_cpu]->free;					     \
+	   _mp = &mbuff[_cpu]->entry[_ent];				     \
+	   ETAP_TIMESTAMP(_mp->time);					     \
+	   _mp->event = _event;						     \
+	   _mp->flags = KERNEL_EVENT | _flags;				     \
+	   _mp->instance  = (u_int) _thread;				     \
+	   mbuff[_cpu]->free = (_ent+1) % mbuff_entries;		     \
+	   if (mbuff[_cpu]->free == 0)					     \
+		mbuff[_cpu]->timestamp++;				     \
+	   splon(_s);							     \
+	   mp_enable_preemption();					     \
+	}								     \
+MACRO_END
+
+#define ETAP_PROBE_DATA(_event, _flags, _thread, _data, _size)		     \
+MACRO_BEGIN								     \
+	mbuff_entry_t _mp;						     \
+	int _cpu, _ent, _s;						     \
+	if (event_table[_event].status && _thread->etap_trace) {	     \
+	   mp_disable_preemption();					     \
+	   _cpu	 = cpu_number();					     \
+	   _s	 = sploff();						     \
+	   _ent	 = mbuff[_cpu]->free;					     \
+	   _mp = &mbuff[_cpu]->entry[_ent];				     \
+	   ETAP_TIMESTAMP(_mp->time);					     \
+	   _mp->pc	  = etap_get_pc();				     \
+	   _mp->event	  = _event;					     \
+	   _mp->flags	  = KERNEL_EVENT | _flags;			     \
+	   _mp->instance  = (u_int) _thread;				     \
+	   bcopy((char *) _data, (char *) _mp->data, _size);		     \
+	   mbuff[_cpu]->free = (_ent+1) % mbuff_entries;		     \
+	   if (mbuff[_cpu]->free == 0)					     \
+		mbuff[_cpu]->timestamp++;				     \
+	   splon(_s);							     \
+	   mp_enable_preemption();					     \
+	}								     \
+MACRO_END
+
+#define ETAP_DATA_LOAD(ed, x)		((ed) = (u_int) (x))
+#define ETAP_SET_REASON(_th, _reason)	((_th)->etap_reason = (_reason))
+
+#else	/* ETAP_EVENT_MONITOR */
+#define ETAP_PROBE(e,f,th)
+#define ETAP_PROBE_DATA(e,f,th,d,s)
+#define ETAP_DATA_LOAD(d,x);
+#define ETAP_SET_REASON(t,r)
+#endif	/* ETAP_EVENT_MONITOR */
+
+/*
+ *  =================================
+ *  ETAP: general lock macros
+ *  =================================
+ */
+
+#if	ETAP_LOCK_TRACE
+
+#define ETAP_TOTAL_TIME(t,stop,start)	\
+	ETAP_TIME_SUB((t),(stop),(start))
+
+#define ETAP_DURATION_TIMESTAMP(e,trace)				\
+MACRO_BEGIN								\
+	if ((trace) & ETAP_DURATION)					\
+	     ETAP_TIMESTAMP((e)->start_hold_time);			\
+MACRO_END
+
+#define ETAP_COPY_START_HOLD_TIME(entry,time,trace)			\
+MACRO_BEGIN								\
+	if ((trace) & ETAP_DURATION)					\
+	     (entry)->start_hold_time = time;				\
+MACRO_END
+
+#define ETAP_CONTENTION_TIMESTAMP(e,trace)				\
+MACRO_BEGIN								\
+	if ((trace) & ETAP_CONTENTION)					\
+	     ETAP_TIMESTAMP((e)->start_wait_time);			\
+MACRO_END
+
+#define ETAP_STAMP(event_table,trace,dynamic)				\
+MACRO_BEGIN								\
+	if ((event_table) != EVENT_TABLE_NULL) {			\
+	    (dynamic) = (event_table)->dynamic;				\
+	    (trace)   = (event_table)->status;				\
+	}								\
+MACRO_END
+
+#define ETAP_WHOLE_OP(l)	\
+	(!(ETAP_TIME_IS_ZERO((l)->u.s.start_hold_time)))
+#define ETAP_DURATION_ENABLED(trace)	((trace) & ETAP_DURATION)
+#define ETAP_CONTENTION_ENABLED(trace)	((trace) & ETAP_CONTENTION)
+
+/*
+ *  The ETAP_CLEAR_TRACE_DATA macro sets the etap specific fields
+ *  of the simple_lock_t structure to zero.
+ *
+ *  This is always done just before a simple lock is released.
+ */
+
+#define ETAP_CLEAR_TRACE_DATA(l)		\
+MACRO_BEGIN					\
+	ETAP_TIME_CLEAR((l)->u.s.start_hold_time);	\
+	MON_CLEAR_PCS((l));			\
+MACRO_END
+
+
+/* ==================================================
+ *  The ETAP_XXX_ENTRY macros manipulate the locks
+ *  start_list (a linked list of start data).
+ * ==================================================
+ */
+
+#define ETAP_CREATE_ENTRY(entry,trace)					   \
+MACRO_BEGIN								   \
+	if ((trace) & ETAP_TRACE_ON)					   \
+	    (entry) = get_start_data_node();				   \
+MACRO_END
+
+#define ETAP_LINK_ENTRY(l,entry,trace)					   \
+MACRO_BEGIN								   \
+	if ((trace) & ETAP_TRACE_ON) {					   \
+		(entry)->next = (l)->u.s.start_list;			   \
+		(l)->u.s.start_list = (entry);				   \
+		(entry)->thread_id = (u_int) current_thread();		   \
+		ETAP_TIME_CLEAR((entry)->start_wait_time);		   \
+	}								   \
+MACRO_END
+
+#define ETAP_FIND_ENTRY(l,entry,trace)					   \
+MACRO_BEGIN								   \
+	u_int _ct;							   \
+	_ct = (u_int) current_thread();					   \
+	(entry) = (l)->u.s.start_list;					   \
+	while ((entry) != SD_ENTRY_NULL && (entry)->thread_id != _ct)	   \
+	      (entry) = (entry)->next;					   \
+	if ((entry) == SD_ENTRY_NULL)					   \
+	      (trace) = 0;						   \
+MACRO_END
+
+#define ETAP_UNLINK_ENTRY(l,entry)					   \
+MACRO_BEGIN								   \
+	boolean_t	  _first = TRUE;				   \
+	start_data_node_t _prev;					   \
+	u_int		  _ct;						   \
+	_ct = (u_int) current_thread();					   \
+	(entry) = (l)->u.s.start_list;					   \
+	while ((entry) != SD_ENTRY_NULL && (entry)->thread_id != _ct){	   \
+	    _prev = (entry);						   \
+	    (entry) = (entry)->next;					   \
+	    _first = FALSE;						   \
+	}								   \
+	if (entry != SD_ENTRY_NULL) {					   \
+	    if (_first)							   \
+		(l)->u.s.start_list = (entry)->next;			   \
+	    else							   \
+		_prev->next = (entry)->next;				   \
+	    (entry)->next = SD_ENTRY_NULL;				   \
+	}								   \
+MACRO_END
+
+#define ETAP_DESTROY_ENTRY(entry)					   \
+MACRO_BEGIN								   \
+	if ((entry) != SD_ENTRY_NULL)					   \
+	   free_start_data_node ((entry));				   \
+MACRO_END
+
+#else	/* ETAP_LOCK_TRACE */
+#define ETAP_TOTAL_TIME(t,stop,start)
+#define ETAP_DURATION_TIMESTAMP(le,tr)
+#define ETAP_CONTENTION_TIMESTAMP(le,tr)
+#define ETAP_COPY_START_HOLD_TIME(le,t,tr)
+#define ETAP_STAMP(tt,tr,d)
+#define ETAP_DURATION_ENABLED(tr)     (0)  /* always fails */
+#define ETAP_CONTENTION_ENABLED(tr)   (0)  /* always fails */
+#define ETAP_CLEAR_TRACE_DATA(l)
+#define ETAP_CREATE_ENTRY(e,tr)
+#define ETAP_LINK_ENTRY(l,e,tr)
+#define ETAP_FIND_ENTRY(l,e,tr)
+#define ETAP_UNLINK_ENTRY(l,e)
+#define ETAP_DESTROY_ENTRY(e)
+#endif	/* ETAP_LOCK_TRACE */
+
+#endif	/* _KERN_ETAP_MACROS_H_ */


Property changes on: trunk/sys/sys/mach/etap_macros.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/exception.h
===================================================================
--- trunk/sys/sys/mach/exception.h	                        (rev 0)
+++ trunk/sys/sys/mach/exception.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1 @@
+#include <sys/mach/exception_types.h>


Property changes on: trunk/sys/sys/mach/exception.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/exception_types.h
===================================================================
--- trunk/sys/sys/mach/exception_types.h	                        (rev 0)
+++ trunk/sys/sys/mach/exception_types.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,122 @@
+#ifndef _MACH_EXCEPTION_TYPES_H_
+#define _MACH_EXCEPTION_TYPES_H_
+
+#if defined(__i386__) || defined(__amd64__)
+#define EXC_TYPES_COUNT 13
+#else
+#define EXC_TYPES_COUNT 2
+#endif
+
+#define	EXC_MASK_MACHINE	0
+
+/*
+ *      Machine-independent exception definitions.
+ */
+
+#define EXC_BAD_ACCESS          1       /* Could not access memory */
+                /* Code contains kern_return_t describing error. */
+                /* Subcode contains bad memory address. */
+
+#define EXC_BAD_INSTRUCTION     2       /* Instruction failed */
+                /* Illegal or undefined instruction or operand */
+
+#define EXC_ARITHMETIC          3       /* Arithmetic exception */
+                /* Exact nature of exception is in code field */
+
+#define EXC_EMULATION           4       /* Emulation instruction */
+                /* Emulation support instruction encountered */
+                /* Details in code and subcode fields   */
+
+#define EXC_SOFTWARE            5       /* Software generated exception */
+                /* Exact exception is in code field. */
+                /* Codes 0 - 0xFFFF reserved to hardware */
+                /* Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix) */
+
+#define EXC_BREAKPOINT          6       /* Trace, breakpoint, etc. */
+                /* Details in code field. */
+
+#define EXC_SYSCALL             7       /* System calls. */
+
+#define EXC_MACH_SYSCALL        8       /* Mach system calls. */
+
+#define EXC_RPC_ALERT           9       /* RPC alert */
+ 
+#define EXC_CRASH               10      /* Abnormal process exit */
+
+#define EXC_RESOURCE            11      /* Hit resource consumption limit */
+                /* Exact resource is in code field. */
+
+#define EXC_GUARD               12      /* Violated guarded resource protections */
+
+#define EXC_MAX EXC_GUARD
+
+#define EXC_MASK_BAD_ACCESS             (1 << EXC_BAD_ACCESS)
+#define EXC_MASK_BAD_INSTRUCTION        (1 << EXC_BAD_INSTRUCTION)
+#define EXC_MASK_ARITHMETIC             (1 << EXC_ARITHMETIC)
+#define EXC_MASK_EMULATION              (1 << EXC_EMULATION)
+#define EXC_MASK_SOFTWARE               (1 << EXC_SOFTWARE)
+#define EXC_MASK_BREAKPOINT             (1 << EXC_BREAKPOINT)
+#define EXC_MASK_SYSCALL                (1 << EXC_SYSCALL)
+#define EXC_MASK_MACH_SYSCALL           (1 << EXC_MACH_SYSCALL)
+#define EXC_MASK_RPC_ALERT              (1 << EXC_RPC_ALERT)
+#define EXC_MASK_CRASH                  (1 << EXC_CRASH)
+#define EXC_MASK_RESOURCE               (1 << EXC_RESOURCE)
+#define EXC_MASK_GUARD                  (1 << EXC_GUARD)
+
+#define EXC_MASK_ALL    (EXC_MASK_BAD_ACCESS |                  \
+                         EXC_MASK_BAD_INSTRUCTION |             \
+                         EXC_MASK_ARITHMETIC |                  \
+                         EXC_MASK_EMULATION |                   \
+                         EXC_MASK_SOFTWARE |                    \
+                         EXC_MASK_BREAKPOINT |                  \
+                         EXC_MASK_SYSCALL |                     \
+                         EXC_MASK_MACH_SYSCALL |                \
+                         EXC_MASK_RPC_ALERT |                   \
+                         EXC_MASK_RESOURCE |                    \
+                         EXC_MASK_GUARD |                       \
+                         EXC_MASK_MACHINE)
+
+
+
+
+#define EXCEPTION_DEFAULT			1
+#define EXCEPTION_STATE				2
+#define EXCEPTION_STATE_IDENTITY	3
+
+#define MACH_EXCEPTION_CODES            0x80000000
+/*      Send 64-bit code and subcode in the exception header */
+
+#define FIRST_EXCEPTION		1	/* ZERO is illegal */
+
+
+
+#include <sys/mach/port.h>
+#include <sys/mach/thread_status.h>
+#include <sys/mach/vm_types.h>
+/*
+ * Exported types
+ */
+
+typedef int                             exception_type_t;
+typedef int		                        exception_data_type_t;
+typedef int64_t                         mach_exception_data_type_t;
+typedef int                             exception_behavior_t;
+typedef exception_data_type_t           *exception_data_t;
+typedef mach_exception_data_type_t      *mach_exception_data_t;
+typedef unsigned int                    exception_mask_t;
+typedef exception_mask_t                *exception_mask_array_t;
+typedef exception_behavior_t            *exception_behavior_array_t;
+typedef thread_state_flavor_t           *exception_flavor_array_t;
+typedef mach_port_t                     *exception_port_array_t;
+typedef mach_exception_data_type_t      mach_exception_code_t;
+typedef mach_exception_data_type_t      mach_exception_subcode_t;
+
+
+
+struct exception_action{
+	struct ipc_port		*port;		/* exception port */
+	thread_state_flavor_t	flavor;		/* state flavor to send */
+	exception_behavior_t	behavior;	/* exception type to raise */
+};
+
+#endif


Property changes on: trunk/sys/sys/mach/exception_types.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/host.h
===================================================================
--- trunk/sys/sys/mach/host.h	                        (rev 0)
+++ trunk/sys/sys/mach/host.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,113 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4.2.1  92/06/24  18:05:04  jeffreyh
+ * 	Added host_paging_self field to host structure
+ * 	[92/06/17            jeffreyh]
+ * 
+ * Revision 2.4  91/05/14  16:41:25  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:26:20  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  16:12:24  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:53:53  rpd
+ * 	Created for new host/processor technology.
+ * 	[90/03/26  23:50:40  rpd]
+ * 
+ * 	Cleanup changes.
+ * 	[89/08/02            dlb]
+ * 	extern realhost declaration.
+ * 	[89/02/03            dlb]
+ * 
+ * Revision 2.3  89/10/15  02:04:17  rpd
+ * 	Minor cleanups.
+ * 
+ * Revision 2.2  89/10/11  14:05:08  dlb
+ * 	Cleanup.
+ * 	[89/08/02            dlb]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ *	kern/host.h
+ *
+ *	Definitions for host data structures.
+ *
+ */
+
+#ifndef	_KERN_HOST_H_
+#define _KERN_HOST_H_
+#include <sys/mach/host_special_ports.h>
+
+struct	host {
+	struct mtx lock;
+	ipc_port_t special[HOST_MAX_SPECIAL_PORT + 1];
+	struct exception_action exc_actions[EXC_TYPES_COUNT];
+	struct ipc_port *host_self;
+	struct ipc_port *host_priv_self;
+	struct ipc_port *host_security_self;
+};
+
+#define host_lock(host)		mtx_lock(&(host)->lock)
+#define host_unlock(host)	mtx_unlock(&(host)->lock)
+
+
+typedef struct host	host_data_t;
+
+#define HOST_NULL	((host_t)0)
+
+extern host_data_t	realhost;
+
+#endif	/* _KERN_HOST_H_ */


Property changes on: trunk/sys/sys/mach/host.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/host_info.h
===================================================================
--- trunk/sys/sys/mach/host_info.h	                        (rev 0)
+++ trunk/sys/sys/mach/host_info.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,253 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4.2.1  92/01/09  18:44:17  jsb
+ * 	From durriya at ri.osf.org: defined kernel_boot_info_t.
+ * 	[92/01/08  15:01:53  jsb]
+ * 
+ * Revision 2.4  91/05/14  16:51:48  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:31:58  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:17:13  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:57:58  rpd
+ * 	Added HOST_LOAD_INFO and related definitions.
+ * 	[90/04/27            rpd]
+ * 	Created for new host/processor technology.
+ * 	[90/03/26  23:50:51  rpd]
+ * 
+ * 	Cleanup changes.
+ * 	[89/08/02            dlb]
+ * 	Add sched_info flavor to return minimum times for use by
+ * 	external schedulers.
+ * 	[89/06/08            dlb]
+ * 	Added kernel_version type definitions.
+ * 	[88/12/02            dlb]
+ * 
+ * Revision 2.4  89/10/15  02:05:31  rpd
+ * 	Minor cleanups.
+ * 
+ * Revision 2.3  89/10/11  17:32:15  dlb
+ * 	Include mach/machine/vm_types.h instead of mach/vm_param.h
+ * 	[89/10/11            dlb]
+ * 
+ * Revision 2.2  89/10/11  14:36:55  dlb
+ * 	Add sched_info flavor to return minimum times for use by
+ * 	external schedulers.
+ * 	[89/06/08            dlb]
+ * 
+ * 	Added kernel_version type definitions.
+ * 	[88/12/02            dlb]
+ * 
+ * 30-Nov-88  David Black (dlb) at Carnegie-Mellon University
+ *	Created.  2 flavors so far: basic info,  slot numbers.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ *	File:	mach/host_info.h
+ *
+ *	Definitions for host_info call.
+ */
+
+#ifndef	_MACH_HOST_INFO_H_
+#define	_MACH_HOST_INFO_H_
+
+#include <sys/mach/vm_statistics.h>
+#include <sys/mach/machine.h>
+
+#include <sys/mach/time_value.h>
+
+/*
+ *	Generic information structure to allow for expansion.
+ */
+typedef integer_t        *host_info64_t;         /* varying array of int. */
+typedef integer_t	*host_info_t;		/* varying array of int. */
+
+#define	HOST_INFO_MAX	(1024)		/* max array size */
+typedef integer_t	host_info_data_t[HOST_INFO_MAX];
+
+#define KERNEL_VERSION_MAX (512)
+typedef char	kernel_version_t[KERNEL_VERSION_MAX];
+
+#define KERNEL_BOOT_INFO_MAX (4096)
+typedef char	kernel_boot_info_t[KERNEL_BOOT_INFO_MAX];
+
+#define	KERNEL_BOOTMAGIC_MAX	(8192)
+
+/*
+ *	Currently defined information.
+ */
+/* host_info() */
+typedef	integer_t	host_flavor_t;
+#define HOST_BASIC_INFO		1	/* basic info */
+#define HOST_SCHED_INFO		3	/* scheduling info */
+#define HOST_RESOURCE_SIZES	4	/* kernel struct sizes */
+#define HOST_PRIORITY_INFO	5	/* priority information */
+#define HOST_PAGING_INFO	6	/* VM/paging info */
+
+struct host_basic_info {
+	integer_t	max_cpus;	/* max number of cpus possible */
+	integer_t	avail_cpus;	/* number of cpus now available */
+	vm_size_t	memory_size;	/* size of memory in bytes */
+	cpu_type_t	cpu_type;	/* cpu type */
+	cpu_subtype_t	cpu_subtype;	/* cpu subtype */
+};
+
+typedef	struct host_basic_info	host_basic_info_data_t;
+typedef struct host_basic_info	*host_basic_info_t;
+#define HOST_BASIC_INFO_COUNT \
+		(sizeof(host_basic_info_data_t)/sizeof(integer_t))
+
+struct host_sched_info {
+	integer_t	min_timeout;	/* minimum timeout in milliseconds */
+	integer_t	min_quantum;	/* minimum quantum in milliseconds */
+};
+
+typedef	struct host_sched_info	host_sched_info_data_t;
+typedef struct host_sched_info	*host_sched_info_t;
+#define HOST_SCHED_INFO_COUNT \
+		(sizeof(host_sched_info_data_t)/sizeof(integer_t))
+
+struct kernel_resource_sizes {
+	vm_size_t	task;
+        vm_size_t	thread;
+        vm_size_t	port;
+        vm_size_t	memory_region;
+        vm_size_t	memory_object;
+};
+
+typedef struct kernel_resource_sizes	kernel_resource_sizes_data_t;
+typedef struct kernel_resource_sizes	*kernel_resource_sizes_t;
+#define HOST_RESOURCE_SIZES_COUNT \
+		(sizeof(kernel_resource_sizes_data_t)/sizeof(integer_t))
+
+struct host_priority_info {
+    	integer_t	kernel_priority;
+    	integer_t	system_priority;
+    	integer_t	server_priority;
+    	integer_t	user_priority;
+    	integer_t	depress_priority;
+    	integer_t	idle_priority;
+    	integer_t	minimum_priority;
+	integer_t	maximum_priority;
+};
+
+typedef struct host_priority_info	host_priority_info_data_t;
+typedef struct host_priority_info	*host_priority_info_t;
+#define HOST_PRIORITY_INFO_COUNT \
+		(sizeof(host_priority_info_data_t)/sizeof(integer_t))
+
+/* host_statistics() */
+#define	HOST_LOAD_INFO		1	/* System loading stats */
+#define HOST_VM_INFO		2	/* Virtual memory stats */
+#define HOST_CPU_LOAD_INFO	3	/* CPU load stats */
+
+struct host_load_info {
+	integer_t	avenrun[3];	/* scaled by LOAD_SCALE */
+	integer_t	mach_factor[3];	/* scaled by LOAD_SCALE */
+};
+
+typedef struct host_load_info	host_load_info_data_t;
+typedef struct host_load_info	*host_load_info_t;
+#define	HOST_LOAD_INFO_COUNT \
+		(sizeof(host_load_info_data_t)/sizeof(integer_t))
+
+/* in <mach/vm_statistics.h> */
+#define	HOST_VM_INFO_COUNT \
+		(sizeof(vm_statistics_data_t)/sizeof(integer_t))
+
+struct host_cpu_load_info {		/* number of ticks while running... */
+	unsigned long	cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */
+};
+typedef struct host_cpu_load_info	host_cpu_load_info_data_t;
+typedef struct host_cpu_load_info	*host_cpu_load_info_t;
+#define HOST_CPU_LOAD_INFO_COUNT \
+		(sizeof (host_cpu_load_info_data_t) / sizeof (integer_t))
+
+struct host_paging_info {
+	time_value_t	sample_time;	/* (TOD) time sample taken */
+	time_value_t	reset_time;	/* (TOD) time at last reset */
+
+			/* Information about page queues */
+	long	pagesize;		/* page size in bytes */
+	long	free_count;		/* # of pages free */
+	long	active_count;		/* # of pages active */
+	long	inactive_count;		/* # of pages inactive */
+	long	wire_count;		/* # of pages wired down */
+
+			/* Information about page faults */
+	long	faults;			/* # of faults */
+	long	zero_fill_count;	/* # of zero fill pages */
+	long	pageins;		/* # of faults resulting in pageins */
+	long	pages_pagedin;		/* # of pages paged in */
+	long	cow_faults;		/* # of copy-on-write faults */
+	long	reactivations;		/* # of pages reactivated */
+
+			/* Information about object cache performance */
+	long	lookups;		/* object cache lookups */
+	long	hits;			/* object cache hits */
+
+			/* Information about page replacement algorithm */
+	long	pageouts;		/* # of pageout operations (clusters) */
+	long	pages_pagedout;		/* # of pages paged out */
+};
+
+typedef struct host_paging_info	host_paging_info_data_t;
+typedef struct host_paging_info	*host_paging_info_t;
+#define HOST_PAGING_INFO_COUNT \
+		(sizeof(host_paging_info_data_t)/sizeof(int))
+
+#endif	/* _MACH_HOST_INFO_H_ */


Property changes on: trunk/sys/sys/mach/host_info.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/host_notify.h
===================================================================
--- trunk/sys/sys/mach/host_notify.h	                        (rev 0)
+++ trunk/sys/sys/mach/host_notify.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,9 @@
+#ifndef _MACH_HOST_NOTIFY_H_
+#define _MACH_HOST_NOTIFY_H_
+
+#define HOST_NOTIFY_CALENDAR_CHANGE             0
+#define HOST_NOTIFY_TYPE_MAX                    0
+
+#define HOST_CALENDAR_CHANGED_REPLYID   950
+
+#endif /* _MACH_HOST_NOTIFY_H_ */


Property changes on: trunk/sys/sys/mach/host_notify.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/host_priv_server.h
===================================================================
--- trunk/sys/sys/mach/host_priv_server.h	                        (rev 0)
+++ trunk/sys/sys/mach/host_priv_server.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,1849 @@
+#ifndef	_host_priv_server_
+#define	_host_priv_server_
+
+/* Module host_priv */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#ifdef _KERNEL
+#include <sys/mach/ndr.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#else /* !_KERNEL */
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#endif /*_KERNEL */
+
+#ifdef AUTOTEST
+#ifndef FUNCTION_PTR_T
+#define FUNCTION_PTR_T
+typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
+typedef struct {
+        char            *name;
+        function_ptr_t  function;
+} function_table_entry;
+typedef function_table_entry   *function_table_t;
+#endif /* FUNCTION_PTR_T */
+#endif /* AUTOTEST */
+
+#ifndef	host_priv_MSG_COUNT
+#define	host_priv_MSG_COUNT	26
+#endif	/* host_priv_MSG_COUNT */
+
+#include <sys/mach/std_types.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc_mig.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach_debug/mach_debug_types.h>
+
+#ifdef __BeforeMigServerHeader
+__BeforeMigServerHeader
+#endif /* __BeforeMigServerHeader */
+
+
+/* Routine host_get_boot_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_boot_info
+#if	defined(LINTLIBRARY)
+    (host_priv, boot_info)
+	host_priv_t host_priv;
+	kernel_boot_info_t boot_info;
+{ return host_get_boot_info(host_priv, boot_info); }
+#else
+(
+	host_priv_t host_priv,
+	kernel_boot_info_t boot_info
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_reboot */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_reboot
+#if	defined(LINTLIBRARY)
+    (host_priv, options)
+	host_priv_t host_priv;
+	int options;
+{ return host_reboot(host_priv, options); }
+#else
+(
+	host_priv_t host_priv,
+	int options
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_priv_statistics */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_priv_statistics
+#if	defined(LINTLIBRARY)
+    (host_priv, flavor, host_info_out, host_info_outCnt)
+	host_priv_t host_priv;
+	host_flavor_t flavor;
+	host_info_t host_info_out;
+	mach_msg_type_number_t *host_info_outCnt;
+{ return host_priv_statistics(host_priv, flavor, host_info_out, host_info_outCnt); }
+#else
+(
+	host_priv_t host_priv,
+	host_flavor_t flavor,
+	host_info_t host_info_out,
+	mach_msg_type_number_t *host_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_default_memory_manager */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_default_memory_manager
+#if	defined(LINTLIBRARY)
+    (host_priv, default_manager, cluster_size)
+	host_priv_t host_priv;
+	memory_object_default_t *default_manager;
+	memory_object_cluster_size_t cluster_size;
+{ return host_default_memory_manager(host_priv, default_manager, cluster_size); }
+#else
+(
+	host_priv_t host_priv,
+	memory_object_default_t *default_manager,
+	memory_object_cluster_size_t cluster_size
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_wire */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_wire
+#if	defined(LINTLIBRARY)
+    (host_priv, task, address, size, desired_access)
+	host_priv_t host_priv;
+	vm_map_t task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_prot_t desired_access;
+{ return vm_wire(host_priv, task, address, size, desired_access); }
+#else
+(
+	host_priv_t host_priv,
+	vm_map_t task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_prot_t desired_access
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine thread_wire */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t thread_wire
+#if	defined(LINTLIBRARY)
+    (host_priv, thread, wired)
+	host_priv_t host_priv;
+	thread_act_t thread;
+	boolean_t wired;
+{ return thread_wire(host_priv, thread, wired); }
+#else
+(
+	host_priv_t host_priv,
+	thread_act_t thread,
+	boolean_t wired
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_allocate_cpm */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_allocate_cpm
+#if	defined(LINTLIBRARY)
+    (host_priv, task, address, size, flags)
+	host_priv_t host_priv;
+	vm_map_t task;
+	vm_address_t *address;
+	vm_size_t size;
+	int flags;
+{ return vm_allocate_cpm(host_priv, task, address, size, flags); }
+#else
+(
+	host_priv_t host_priv,
+	vm_map_t task,
+	vm_address_t *address,
+	vm_size_t size,
+	int flags
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_processors */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_processors
+#if	defined(LINTLIBRARY)
+    (host_priv, out_processor_list, out_processor_listCnt)
+	host_priv_t host_priv;
+	processor_array_t *out_processor_list;
+	mach_msg_type_number_t *out_processor_listCnt;
+{ return host_processors(host_priv, out_processor_list, out_processor_listCnt); }
+#else
+(
+	host_priv_t host_priv,
+	processor_array_t *out_processor_list,
+	mach_msg_type_number_t *out_processor_listCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_clock_control */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_clock_control
+#if	defined(LINTLIBRARY)
+    (host_priv, clock_id, clock_ctrl)
+	host_priv_t host_priv;
+	clock_id_t clock_id;
+	clock_ctrl_t *clock_ctrl;
+{ return host_get_clock_control(host_priv, clock_id, clock_ctrl); }
+#else
+(
+	host_priv_t host_priv,
+	clock_id_t clock_id,
+	clock_ctrl_t *clock_ctrl
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_special_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_special_port
+#if	defined(LINTLIBRARY)
+    (host_priv, node, which, port)
+	host_priv_t host_priv;
+	int node;
+	int which;
+	mach_port_t *port;
+{ return host_get_special_port(host_priv, node, which, port); }
+#else
+(
+	host_priv_t host_priv,
+	int node,
+	int which,
+	mach_port_t *port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_set_special_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_set_special_port
+#if	defined(LINTLIBRARY)
+    (host_priv, which, port)
+	host_priv_t host_priv;
+	int which;
+	mach_port_t port;
+{ return host_set_special_port(host_priv, which, port); }
+#else
+(
+	host_priv_t host_priv,
+	int which,
+	mach_port_t port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_set_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_set_exception_ports
+#if	defined(LINTLIBRARY)
+    (host_priv, exception_mask, new_port, behavior, new_flavor)
+	host_priv_t host_priv;
+	exception_mask_t exception_mask;
+	mach_port_t new_port;
+	exception_behavior_t behavior;
+	thread_state_flavor_t new_flavor;
+{ return host_set_exception_ports(host_priv, exception_mask, new_port, behavior, new_flavor); }
+#else
+(
+	host_priv_t host_priv,
+	exception_mask_t exception_mask,
+	mach_port_t new_port,
+	exception_behavior_t behavior,
+	thread_state_flavor_t new_flavor
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_exception_ports
+#if	defined(LINTLIBRARY)
+    (host_priv, exception_mask, masks, masksCnt, old_handlers, old_behaviors, old_flavors)
+	host_priv_t host_priv;
+	exception_mask_t exception_mask;
+	exception_mask_array_t masks;
+	mach_msg_type_number_t *masksCnt;
+	exception_handler_array_t old_handlers;
+	exception_behavior_array_t old_behaviors;
+	exception_flavor_array_t old_flavors;
+{ return host_get_exception_ports(host_priv, exception_mask, masks, masksCnt, old_handlers, old_behaviors, old_flavors); }
+#else
+(
+	host_priv_t host_priv,
+	exception_mask_t exception_mask,
+	exception_mask_array_t masks,
+	mach_msg_type_number_t *masksCnt,
+	exception_handler_array_t old_handlers,
+	exception_behavior_array_t old_behaviors,
+	exception_flavor_array_t old_flavors
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_swap_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_swap_exception_ports
+#if	defined(LINTLIBRARY)
+    (host_priv, exception_mask, new_port, behavior, new_flavor, masks, masksCnt, old_handlerss, old_behaviors, old_flavors)
+	host_priv_t host_priv;
+	exception_mask_t exception_mask;
+	mach_port_t new_port;
+	exception_behavior_t behavior;
+	thread_state_flavor_t new_flavor;
+	exception_mask_array_t masks;
+	mach_msg_type_number_t *masksCnt;
+	exception_handler_array_t old_handlerss;
+	exception_behavior_array_t old_behaviors;
+	exception_flavor_array_t old_flavors;
+{ return host_swap_exception_ports(host_priv, exception_mask, new_port, behavior, new_flavor, masks, masksCnt, old_handlerss, old_behaviors, old_flavors); }
+#else
+(
+	host_priv_t host_priv,
+	exception_mask_t exception_mask,
+	mach_port_t new_port,
+	exception_behavior_t behavior,
+	thread_state_flavor_t new_flavor,
+	exception_mask_array_t masks,
+	mach_msg_type_number_t *masksCnt,
+	exception_handler_array_t old_handlerss,
+	exception_behavior_array_t old_behaviors,
+	exception_flavor_array_t old_flavors
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_wire */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_wire
+#if	defined(LINTLIBRARY)
+    (host_priv, task, address, size, desired_access)
+	host_priv_t host_priv;
+	vm_map_t task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_prot_t desired_access;
+{ return mach_vm_wire(host_priv, task, address, size, desired_access); }
+#else
+(
+	host_priv_t host_priv,
+	vm_map_t task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_prot_t desired_access
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_processor_sets */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_processor_sets
+#if	defined(LINTLIBRARY)
+    (host_priv, processor_sets, processor_setsCnt)
+	host_priv_t host_priv;
+	processor_set_name_array_t *processor_sets;
+	mach_msg_type_number_t *processor_setsCnt;
+{ return host_processor_sets(host_priv, processor_sets, processor_setsCnt); }
+#else
+(
+	host_priv_t host_priv,
+	processor_set_name_array_t *processor_sets,
+	mach_msg_type_number_t *processor_setsCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_processor_set_priv */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_processor_set_priv
+#if	defined(LINTLIBRARY)
+    (host_priv, set_name, set)
+	host_priv_t host_priv;
+	processor_set_name_t set_name;
+	processor_set_t *set;
+{ return host_processor_set_priv(host_priv, set_name, set); }
+#else
+(
+	host_priv_t host_priv,
+	processor_set_name_t set_name,
+	processor_set_t *set
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine set_dp_control_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t set_dp_control_port
+#if	defined(LINTLIBRARY)
+    (host, control_port)
+	host_priv_t host;
+	mach_port_t control_port;
+{ return set_dp_control_port(host, control_port); }
+#else
+(
+	host_priv_t host,
+	mach_port_t control_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine get_dp_control_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t get_dp_control_port
+#if	defined(LINTLIBRARY)
+    (host, contorl_port)
+	host_priv_t host;
+	mach_port_t *contorl_port;
+{ return get_dp_control_port(host, contorl_port); }
+#else
+(
+	host_priv_t host,
+	mach_port_t *contorl_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_set_UNDServer */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_set_UNDServer
+#if	defined(LINTLIBRARY)
+    (host, server)
+	host_priv_t host;
+	UNDServerRef server;
+{ return host_set_UNDServer(host, server); }
+#else
+(
+	host_priv_t host,
+	UNDServerRef server
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_UNDServer */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_UNDServer
+#if	defined(LINTLIBRARY)
+    (host, server)
+	host_priv_t host;
+	UNDServerRef *server;
+{ return host_get_UNDServer(host, server); }
+#else
+(
+	host_priv_t host,
+	UNDServerRef *server
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine kext_request */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t kext_request
+#if	defined(LINTLIBRARY)
+    (host_priv, user_log_flags, request_data, request_dataCnt, response_data, response_dataCnt, log_data, log_dataCnt, op_result)
+	host_priv_t host_priv;
+	uint32_t user_log_flags;
+	vm_offset_t request_data;
+	mach_msg_type_number_t request_dataCnt;
+	vm_offset_t *response_data;
+	mach_msg_type_number_t *response_dataCnt;
+	vm_offset_t *log_data;
+	mach_msg_type_number_t *log_dataCnt;
+	kern_return_t *op_result;
+{ return kext_request(host_priv, user_log_flags, request_data, request_dataCnt, response_data, response_dataCnt, log_data, log_dataCnt, op_result); }
+#else
+(
+	host_priv_t host_priv,
+	uint32_t user_log_flags,
+	vm_offset_t request_data,
+	mach_msg_type_number_t request_dataCnt,
+	vm_offset_t *response_data,
+	mach_msg_type_number_t *response_dataCnt,
+	vm_offset_t *log_data,
+	mach_msg_type_number_t *log_dataCnt,
+	kern_return_t *op_result
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_boot_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_boot_info
+#if	defined(LINTLIBRARY)
+    (host_priv, boot_info)
+	host_priv_t host_priv;
+	kernel_boot_info_t boot_info;
+{ return host_get_boot_info(host_priv, boot_info); }
+#else
+(
+	host_priv_t host_priv,
+	kernel_boot_info_t boot_info
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_reboot */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_reboot
+#if	defined(LINTLIBRARY)
+    (host_priv, options)
+	host_priv_t host_priv;
+	int options;
+{ return host_reboot(host_priv, options); }
+#else
+(
+	host_priv_t host_priv,
+	int options
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_priv_statistics */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_priv_statistics
+#if	defined(LINTLIBRARY)
+    (host_priv, flavor, host_info_out, host_info_outCnt)
+	host_priv_t host_priv;
+	host_flavor_t flavor;
+	host_info_t host_info_out;
+	mach_msg_type_number_t *host_info_outCnt;
+{ return host_priv_statistics(host_priv, flavor, host_info_out, host_info_outCnt); }
+#else
+(
+	host_priv_t host_priv,
+	host_flavor_t flavor,
+	host_info_t host_info_out,
+	mach_msg_type_number_t *host_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_default_memory_manager */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_default_memory_manager
+#if	defined(LINTLIBRARY)
+    (host_priv, default_manager, cluster_size)
+	host_priv_t host_priv;
+	memory_object_default_t *default_manager;
+	memory_object_cluster_size_t cluster_size;
+{ return host_default_memory_manager(host_priv, default_manager, cluster_size); }
+#else
+(
+	host_priv_t host_priv,
+	memory_object_default_t *default_manager,
+	memory_object_cluster_size_t cluster_size
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_wire */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_wire
+#if	defined(LINTLIBRARY)
+    (host_priv, task, address, size, desired_access)
+	host_priv_t host_priv;
+	vm_map_t task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_prot_t desired_access;
+{ return vm_wire(host_priv, task, address, size, desired_access); }
+#else
+(
+	host_priv_t host_priv,
+	vm_map_t task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_prot_t desired_access
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine thread_wire */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t thread_wire
+#if	defined(LINTLIBRARY)
+    (host_priv, thread, wired)
+	host_priv_t host_priv;
+	thread_act_t thread;
+	boolean_t wired;
+{ return thread_wire(host_priv, thread, wired); }
+#else
+(
+	host_priv_t host_priv,
+	thread_act_t thread,
+	boolean_t wired
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_allocate_cpm */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_allocate_cpm
+#if	defined(LINTLIBRARY)
+    (host_priv, task, address, size, flags)
+	host_priv_t host_priv;
+	vm_map_t task;
+	vm_address_t *address;
+	vm_size_t size;
+	int flags;
+{ return vm_allocate_cpm(host_priv, task, address, size, flags); }
+#else
+(
+	host_priv_t host_priv,
+	vm_map_t task,
+	vm_address_t *address,
+	vm_size_t size,
+	int flags
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_processors */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_processors
+#if	defined(LINTLIBRARY)
+    (host_priv, out_processor_list, out_processor_listCnt)
+	host_priv_t host_priv;
+	processor_array_t *out_processor_list;
+	mach_msg_type_number_t *out_processor_listCnt;
+{ return host_processors(host_priv, out_processor_list, out_processor_listCnt); }
+#else
+(
+	host_priv_t host_priv,
+	processor_array_t *out_processor_list,
+	mach_msg_type_number_t *out_processor_listCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_clock_control */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_clock_control
+#if	defined(LINTLIBRARY)
+    (host_priv, clock_id, clock_ctrl)
+	host_priv_t host_priv;
+	clock_id_t clock_id;
+	clock_ctrl_t *clock_ctrl;
+{ return host_get_clock_control(host_priv, clock_id, clock_ctrl); }
+#else
+(
+	host_priv_t host_priv,
+	clock_id_t clock_id,
+	clock_ctrl_t *clock_ctrl
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_special_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_special_port
+#if	defined(LINTLIBRARY)
+    (host_priv, node, which, port)
+	host_priv_t host_priv;
+	int node;
+	int which;
+	mach_port_t *port;
+{ return host_get_special_port(host_priv, node, which, port); }
+#else
+(
+	host_priv_t host_priv,
+	int node,
+	int which,
+	mach_port_t *port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_set_special_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_set_special_port
+#if	defined(LINTLIBRARY)
+    (host_priv, which, port)
+	host_priv_t host_priv;
+	int which;
+	mach_port_t port;
+{ return host_set_special_port(host_priv, which, port); }
+#else
+(
+	host_priv_t host_priv,
+	int which,
+	mach_port_t port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_set_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_set_exception_ports
+#if	defined(LINTLIBRARY)
+    (host_priv, exception_mask, new_port, behavior, new_flavor)
+	host_priv_t host_priv;
+	exception_mask_t exception_mask;
+	mach_port_t new_port;
+	exception_behavior_t behavior;
+	thread_state_flavor_t new_flavor;
+{ return host_set_exception_ports(host_priv, exception_mask, new_port, behavior, new_flavor); }
+#else
+(
+	host_priv_t host_priv,
+	exception_mask_t exception_mask,
+	mach_port_t new_port,
+	exception_behavior_t behavior,
+	thread_state_flavor_t new_flavor
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_exception_ports
+#if	defined(LINTLIBRARY)
+    (host_priv, exception_mask, masks, masksCnt, old_handlers, old_behaviors, old_flavors)
+	host_priv_t host_priv;
+	exception_mask_t exception_mask;
+	exception_mask_array_t masks;
+	mach_msg_type_number_t *masksCnt;
+	exception_handler_array_t old_handlers;
+	exception_behavior_array_t old_behaviors;
+	exception_flavor_array_t old_flavors;
+{ return host_get_exception_ports(host_priv, exception_mask, masks, masksCnt, old_handlers, old_behaviors, old_flavors); }
+#else
+(
+	host_priv_t host_priv,
+	exception_mask_t exception_mask,
+	exception_mask_array_t masks,
+	mach_msg_type_number_t *masksCnt,
+	exception_handler_array_t old_handlers,
+	exception_behavior_array_t old_behaviors,
+	exception_flavor_array_t old_flavors
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_swap_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_swap_exception_ports
+#if	defined(LINTLIBRARY)
+    (host_priv, exception_mask, new_port, behavior, new_flavor, masks, masksCnt, old_handlerss, old_behaviors, old_flavors)
+	host_priv_t host_priv;
+	exception_mask_t exception_mask;
+	mach_port_t new_port;
+	exception_behavior_t behavior;
+	thread_state_flavor_t new_flavor;
+	exception_mask_array_t masks;
+	mach_msg_type_number_t *masksCnt;
+	exception_handler_array_t old_handlerss;
+	exception_behavior_array_t old_behaviors;
+	exception_flavor_array_t old_flavors;
+{ return host_swap_exception_ports(host_priv, exception_mask, new_port, behavior, new_flavor, masks, masksCnt, old_handlerss, old_behaviors, old_flavors); }
+#else
+(
+	host_priv_t host_priv,
+	exception_mask_t exception_mask,
+	mach_port_t new_port,
+	exception_behavior_t behavior,
+	thread_state_flavor_t new_flavor,
+	exception_mask_array_t masks,
+	mach_msg_type_number_t *masksCnt,
+	exception_handler_array_t old_handlerss,
+	exception_behavior_array_t old_behaviors,
+	exception_flavor_array_t old_flavors
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_wire */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_wire
+#if	defined(LINTLIBRARY)
+    (host_priv, task, address, size, desired_access)
+	host_priv_t host_priv;
+	vm_map_t task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_prot_t desired_access;
+{ return mach_vm_wire(host_priv, task, address, size, desired_access); }
+#else
+(
+	host_priv_t host_priv,
+	vm_map_t task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_prot_t desired_access
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_processor_sets */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_processor_sets
+#if	defined(LINTLIBRARY)
+    (host_priv, processor_sets, processor_setsCnt)
+	host_priv_t host_priv;
+	processor_set_name_array_t *processor_sets;
+	mach_msg_type_number_t *processor_setsCnt;
+{ return host_processor_sets(host_priv, processor_sets, processor_setsCnt); }
+#else
+(
+	host_priv_t host_priv,
+	processor_set_name_array_t *processor_sets,
+	mach_msg_type_number_t *processor_setsCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_processor_set_priv */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_processor_set_priv
+#if	defined(LINTLIBRARY)
+    (host_priv, set_name, set)
+	host_priv_t host_priv;
+	processor_set_name_t set_name;
+	processor_set_t *set;
+{ return host_processor_set_priv(host_priv, set_name, set); }
+#else
+(
+	host_priv_t host_priv,
+	processor_set_name_t set_name,
+	processor_set_t *set
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine set_dp_control_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t set_dp_control_port
+#if	defined(LINTLIBRARY)
+    (host, control_port)
+	host_priv_t host;
+	mach_port_t control_port;
+{ return set_dp_control_port(host, control_port); }
+#else
+(
+	host_priv_t host,
+	mach_port_t control_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine get_dp_control_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t get_dp_control_port
+#if	defined(LINTLIBRARY)
+    (host, contorl_port)
+	host_priv_t host;
+	mach_port_t *contorl_port;
+{ return get_dp_control_port(host, contorl_port); }
+#else
+(
+	host_priv_t host,
+	mach_port_t *contorl_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_set_UNDServer */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_set_UNDServer
+#if	defined(LINTLIBRARY)
+    (host, server)
+	host_priv_t host;
+	UNDServerRef server;
+{ return host_set_UNDServer(host, server); }
+#else
+(
+	host_priv_t host,
+	UNDServerRef server
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_UNDServer */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_UNDServer
+#if	defined(LINTLIBRARY)
+    (host, server)
+	host_priv_t host;
+	UNDServerRef *server;
+{ return host_get_UNDServer(host, server); }
+#else
+(
+	host_priv_t host,
+	UNDServerRef *server
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine kext_request */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t kext_request
+#if	defined(LINTLIBRARY)
+    (host_priv, user_log_flags, request_data, request_dataCnt, response_data, response_dataCnt, log_data, log_dataCnt, op_result)
+	host_priv_t host_priv;
+	uint32_t user_log_flags;
+	vm_offset_t request_data;
+	mach_msg_type_number_t request_dataCnt;
+	vm_offset_t *response_data;
+	mach_msg_type_number_t *response_dataCnt;
+	vm_offset_t *log_data;
+	mach_msg_type_number_t *log_dataCnt;
+	kern_return_t *op_result;
+{ return kext_request(host_priv, user_log_flags, request_data, request_dataCnt, response_data, response_dataCnt, log_data, log_dataCnt, op_result); }
+#else
+(
+	host_priv_t host_priv,
+	uint32_t user_log_flags,
+	vm_offset_t request_data,
+	mach_msg_type_number_t request_dataCnt,
+	vm_offset_t *response_data,
+	mach_msg_type_number_t *response_dataCnt,
+	vm_offset_t *log_data,
+	mach_msg_type_number_t *log_dataCnt,
+	kern_return_t *op_result
+);
+#endif	/* defined(LINTLIBRARY) */
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+boolean_t host_priv_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+mig_routine_t host_priv_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+extern const struct host_priv_subsystem {
+	mig_server_routine_t	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[26];
+} host_priv_subsystem;
+
+/* typedefs for all requests */
+
+#ifndef __Request__host_priv_subsystem__defined
+#define __Request__host_priv_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__host_get_boot_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int options;
+	} __Request__host_reboot_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t flavor;
+		mach_msg_type_number_t host_info_outCnt;
+	} __Request__host_priv_statistics_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t default_manager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		memory_object_cluster_size_t cluster_size;
+	} __Request__host_default_memory_manager_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_prot_t desired_access;
+	} __Request__vm_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t thread;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t wired;
+	} __Request__thread_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		int flags;
+	} __Request__vm_allocate_cpm_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__host_processors_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		clock_id_t clock_id;
+	} __Request__host_get_clock_control_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int node;
+		int which;
+	} __Request__host_get_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int which;
+	} __Request__host_set_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+		exception_behavior_t behavior;
+		thread_state_flavor_t new_flavor;
+	} __Request__host_set_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+	} __Request__host_get_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+		exception_behavior_t behavior;
+		thread_state_flavor_t new_flavor;
+	} __Request__host_swap_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_prot_t desired_access;
+	} __Request__mach_vm_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__host_processor_sets_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t set_name;
+		/* end of the kernel processed data */
+	} __Request__host_processor_set_priv_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t control_port;
+		/* end of the kernel processed data */
+	} __Request__set_dp_control_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__get_dp_control_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t server;
+		/* end of the kernel processed data */
+	} __Request__host_set_UNDServer_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__host_get_UNDServer_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t request_data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		uint32_t user_log_flags;
+		mach_msg_type_number_t request_dataCnt;
+	} __Request__kext_request_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__host_priv_subsystem__defined */
+
+
+/* union of all requests */
+
+#ifndef __RequestUnion__host_priv_subsystem__defined
+#define __RequestUnion__host_priv_subsystem__defined
+union __RequestUnion__host_priv_subsystem {
+	__Request__host_get_boot_info_t Request_host_get_boot_info;
+	__Request__host_reboot_t Request_host_reboot;
+	__Request__host_priv_statistics_t Request_host_priv_statistics;
+	__Request__host_default_memory_manager_t Request_host_default_memory_manager;
+	__Request__vm_wire_t Request_vm_wire;
+	__Request__thread_wire_t Request_thread_wire;
+	__Request__vm_allocate_cpm_t Request_vm_allocate_cpm;
+	__Request__host_processors_t Request_host_processors;
+	__Request__host_get_clock_control_t Request_host_get_clock_control;
+	__Request__host_get_special_port_t Request_host_get_special_port;
+	__Request__host_set_special_port_t Request_host_set_special_port;
+	__Request__host_set_exception_ports_t Request_host_set_exception_ports;
+	__Request__host_get_exception_ports_t Request_host_get_exception_ports;
+	__Request__host_swap_exception_ports_t Request_host_swap_exception_ports;
+	__Request__mach_vm_wire_t Request_mach_vm_wire;
+	__Request__host_processor_sets_t Request_host_processor_sets;
+	__Request__host_processor_set_priv_t Request_host_processor_set_priv;
+	__Request__set_dp_control_port_t Request_set_dp_control_port;
+	__Request__get_dp_control_port_t Request_get_dp_control_port;
+	__Request__host_set_UNDServer_t Request_host_set_UNDServer;
+	__Request__host_get_UNDServer_t Request_host_get_UNDServer;
+	__Request__kext_request_t Request_kext_request;
+};
+#endif /* __RequestUnion__host_priv_subsystem__defined */
+/* typedefs for all replies */
+
+#ifndef __Reply__host_priv_subsystem__defined
+#define __Reply__host_priv_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t boot_infoOffset; /* MiG doesn't use it */
+		mach_msg_type_number_t boot_infoCnt;
+		char boot_info[4096];
+	} __Reply__host_get_boot_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__host_reboot_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t host_info_outCnt;
+		integer_t host_info_out[68];
+	} __Reply__host_priv_statistics_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t default_manager;
+		/* end of the kernel processed data */
+	} __Reply__host_default_memory_manager_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__thread_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_address_t address;
+	} __Reply__vm_allocate_cpm_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_ports_descriptor_t out_processor_list;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t out_processor_listCnt;
+	} __Reply__host_processors_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t clock_ctrl;
+		/* end of the kernel processed data */
+	} __Reply__host_get_clock_control_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t port;
+		/* end of the kernel processed data */
+	} __Reply__host_get_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__host_set_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__host_set_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t old_handlers[32];
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t masksCnt;
+		exception_mask_t masks[32];
+		exception_behavior_t old_behaviors[32];
+		thread_state_flavor_t old_flavors[32];
+	} __Reply__host_get_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t old_handlerss[32];
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t masksCnt;
+		exception_mask_t masks[32];
+		exception_behavior_t old_behaviors[32];
+		thread_state_flavor_t old_flavors[32];
+	} __Reply__host_swap_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_vm_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_ports_descriptor_t processor_sets;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t processor_setsCnt;
+	} __Reply__host_processor_sets_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t set;
+		/* end of the kernel processed data */
+	} __Reply__host_processor_set_priv_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__set_dp_control_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t contorl_port;
+		/* end of the kernel processed data */
+	} __Reply__get_dp_control_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__host_set_UNDServer_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t server;
+		/* end of the kernel processed data */
+	} __Reply__host_get_UNDServer_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t response_data;
+		mach_msg_ool_descriptor_t log_data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t response_dataCnt;
+		mach_msg_type_number_t log_dataCnt;
+		kern_return_t op_result;
+	} __Reply__kext_request_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__host_priv_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__host_priv_subsystem__defined
+#define __ReplyUnion__host_priv_subsystem__defined
+union __ReplyUnion__host_priv_subsystem {
+	__Reply__host_get_boot_info_t Reply_host_get_boot_info;
+	__Reply__host_reboot_t Reply_host_reboot;
+	__Reply__host_priv_statistics_t Reply_host_priv_statistics;
+	__Reply__host_default_memory_manager_t Reply_host_default_memory_manager;
+	__Reply__vm_wire_t Reply_vm_wire;
+	__Reply__thread_wire_t Reply_thread_wire;
+	__Reply__vm_allocate_cpm_t Reply_vm_allocate_cpm;
+	__Reply__host_processors_t Reply_host_processors;
+	__Reply__host_get_clock_control_t Reply_host_get_clock_control;
+	__Reply__host_get_special_port_t Reply_host_get_special_port;
+	__Reply__host_set_special_port_t Reply_host_set_special_port;
+	__Reply__host_set_exception_ports_t Reply_host_set_exception_ports;
+	__Reply__host_get_exception_ports_t Reply_host_get_exception_ports;
+	__Reply__host_swap_exception_ports_t Reply_host_swap_exception_ports;
+	__Reply__mach_vm_wire_t Reply_mach_vm_wire;
+	__Reply__host_processor_sets_t Reply_host_processor_sets;
+	__Reply__host_processor_set_priv_t Reply_host_processor_set_priv;
+	__Reply__set_dp_control_port_t Reply_set_dp_control_port;
+	__Reply__get_dp_control_port_t Reply_get_dp_control_port;
+	__Reply__host_set_UNDServer_t Reply_host_set_UNDServer;
+	__Reply__host_get_UNDServer_t Reply_host_get_UNDServer;
+	__Reply__kext_request_t Reply_kext_request;
+};
+#endif /* __RequestUnion__host_priv_subsystem__defined */
+
+#ifndef subsystem_to_name_map_host_priv
+#define subsystem_to_name_map_host_priv \
+    { "host_get_boot_info", 400 },\
+    { "host_reboot", 401 },\
+    { "host_priv_statistics", 402 },\
+    { "host_default_memory_manager", 403 },\
+    { "vm_wire", 404 },\
+    { "thread_wire", 405 },\
+    { "vm_allocate_cpm", 406 },\
+    { "host_processors", 407 },\
+    { "host_get_clock_control", 408 },\
+    { "host_get_special_port", 412 },\
+    { "host_set_special_port", 413 },\
+    { "host_set_exception_ports", 414 },\
+    { "host_get_exception_ports", 415 },\
+    { "host_swap_exception_ports", 416 },\
+    { "mach_vm_wire", 418 },\
+    { "host_processor_sets", 419 },\
+    { "host_processor_set_priv", 420 },\
+    { "set_dp_control_port", 421 },\
+    { "get_dp_control_port", 422 },\
+    { "host_set_UNDServer", 423 },\
+    { "host_get_UNDServer", 424 },\
+    { "kext_request", 425 }
+#endif
+
+#ifdef __AfterMigServerHeader
+__AfterMigServerHeader
+#endif /* __AfterMigServerHeader */
+
+#endif	 /* _host_priv_server_ */


Property changes on: trunk/sys/sys/mach/host_priv_server.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/host_special_ports.h
===================================================================
--- trunk/sys/sys/mach/host_special_ports.h	                        (rev 0)
+++ trunk/sys/sys/mach/host_special_ports.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,55 @@
+#ifndef HOST_SPECIAL_PORTS_H_
+#define HOST_SPECIAL_PORTS_H_
+
+/*
+ * Always provided by kernel (cannot be set from user-space).
+ */
+#define HOST_PORT                        1
+#define HOST_PRIV_PORT                   2
+#define HOST_IO_MASTER_PORT              3
+#define HOST_MAX_SPECIAL_KERNEL_PORT     7 /* room to grow */
+
+/*
+ * Not provided by kernel
+ */
+#define HOST_DYNAMIC_PAGER_PORT         (1 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_AUDIT_CONTROL_PORT         (2 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_USER_NOTIFICATION_PORT     (3 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_AUTOMOUNTD_PORT            (4 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_LOCKD_PORT                 (5 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_SEATBELT_PORT              (7 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_KEXTD_PORT                 (8 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_CHUD_PORT                  (9 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_UNFREED_PORT               (10 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_AMFID_PORT                 (11 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_GSSD_PORT                  (12 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_TELEMETRY_PORT             (13 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_ATM_NOTIFICATION_PORT      (14 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_COALITION_PORT             (15 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_MAX_SPECIAL_PORT           (16 + HOST_MAX_SPECIAL_KERNEL_PORT)
+                                        /* room to grow here as well */
+
+
+
+/*
+ * Definitions for ease of use.
+ *
+ * In the get call, the host parameter can be any host, but will generally
+ * be the local node host port. In the set call, the host must the per-node
+ * host port for the node being affected.
+ */
+#define host_get_host_port(host, port)	\
+	(host_get_special_port((host), 	\
+	HOST_LOCAL_NODE, HOST_PORT, (port)))
+#define host_set_host_port(host, port) (KERN_INVALID_ARGUMENT)
+
+#define host_get_host_priv_port(host, port)	\
+	(host_get_special_port((host), 		\
+	HOST_LOCAL_NODE, HOST_PRIV_PORT, (port)))
+#define host_set_host_priv_port(host, port) (KERN_INVALID_ARGUMENT)
+
+/*
+ * Special node identifier to always represent the local node.
+ */
+#define HOST_LOCAL_NODE                  -1
+#endif


Property changes on: trunk/sys/sys/mach/host_special_ports.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_entry.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_entry.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_entry.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,250 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5  91/05/14  16:31:54  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:21:24  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:44:29  mrt]
+ * 
+ * Revision 2.3  91/01/08  15:13:06  rpd
+ * 	Removed MACH_IPC_GENNOS, IE_BITS_UNUSEDC, IE_BITS_UNUSEDG.
+ * 	[90/11/08            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:49:41  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  20:54:40  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_entry.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Definitions for translation entries, which represent
+ *	tasks' capabilities for ports and port sets.
+ */
+
+#ifndef	_IPC_IPC_ENTRY_H_
+#define _IPC_IPC_ENTRY_H_
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/port.h>
+#include <sys/mach/kern_return.h>
+#include <vm/uma.h>
+#include <sys/mach/port.h>
+#include <sys/mach/ipc/ipc_table.h>
+#include <sys/mach/ipc/ipc_types.h>
+#include <sys/mach/ipc/ipc_object.h>
+
+/*
+ *	Spaces hold capabilities for ipc_object_t's (ports and port sets).
+ *	Each ipc_entry_t records a capability.  Most capabilities have
+ *	small names, and the entries are elements of a table.
+ *	Capabilities can have large names, and a splay tree holds
+ *	those entries.  The cutoff point between the table and the tree
+ *	is adjusted dynamically to minimize memory consumption.
+ *
+ *	The ie_index field of entries in the table implements
+ *	a ordered hash table with open addressing and linear probing.
+ *	This hash table converts (space, object) -> name.
+ *	It is used independently of the other fields.
+ *
+ *	Free (unallocated) entries in the table have null ie_object
+ *	fields.  The ie_bits field is zero except for IE_BITS_GEN.
+ *	The ie_next (ie_request) field links free entries into a free list.
+ *
+ *	The first entry in the table (index 0) is always free.
+ *	It is used as the head of the free list.
+ */
+
+typedef natural_t ipc_entry_bits_t;
+typedef ipc_table_elems_t ipc_entry_num_t;	/* number of entries */
+
+typedef struct ipc_entry {
+	ipc_entry_bits_t ie_bits;
+	mach_port_name_t ie_name;
+	struct ipc_space *ie_space;
+	struct file		*ie_fp;
+	struct ipc_object *ie_object;
+	struct ipc_entry *ie_link;
+	LIST_ENTRY(ipc_entry) ie_space_link;
+	union {
+		mach_port_index_t next;
+		ipc_table_index_t /* XXX ipc_port_request_index_t */ request;
+	} index;
+	union {
+		mach_port_index_t table;
+		struct ipc_tree_entry *tree;
+	} hash;
+} *ipc_entry_t;
+
+#define	IE_NULL		((ipc_entry_t) 0)
+
+#define	ie_request	index.request
+#define	ie_next		index.next
+#define	ie_index	hash.table
+
+#define	IE_BITS_UREFS_MASK	0x0000ffff	/* 16 bits of user-reference */
+#define	IE_BITS_UREFS(bits)	((bits) & IE_BITS_UREFS_MASK)
+
+#define	IE_BITS_TYPE_MASK	0x001f0000	/* 5 bits of capability type */
+#define	IE_BITS_TYPE(bits)	((bits) & IE_BITS_TYPE_MASK)
+
+#define	IE_BITS_COLLISION	0x00800000	/* 1 bit for collisions */
+
+
+#ifndef NO_PORT_GEN
+#define	IE_BITS_GEN_MASK	0xff000000	/* 8 bits for generation */
+#define	IE_BITS_GEN(bits)	((bits) & IE_BITS_GEN_MASK)
+#define	IE_BITS_GEN_ONE		0x04000000	/* low bit of generation */
+#define IE_BITS_NEW_GEN(old)	(((old) + IE_BITS_GEN_ONE) & IE_BITS_GEN_MASK)
+#else
+#define	IE_BITS_GEN_MASK	0
+#define	IE_BITS_GEN(bits)	0
+#define	IE_BITS_GEN_ONE		0
+#define IE_BITS_NEW_GEN(old)	(old)
+#endif	/* !USE_PORT_GEN */
+
+
+#define	IE_BITS_RIGHT_MASK	0x007fffff	/* relevant to the right */
+
+
+typedef struct ipc_tree_entry {
+	struct ipc_entry ite_entry;
+	mach_port_name_t ite_name;
+	struct ipc_space *ite_space;
+	struct ipc_tree_entry *ite_lchild;
+	struct ipc_tree_entry *ite_rchild;
+} *ipc_tree_entry_t;
+
+#define	ITE_NULL	((ipc_tree_entry_t) 0)
+
+#define	ite_bits	ite_entry.ie_bits
+#define	ite_object	ite_entry.ie_object
+#define	ite_request	ite_entry.ie_request
+#define	ite_next	ite_entry.hash.tree
+
+extern uma_zone_t ipc_tree_entry_zone;
+
+#define ite_alloc()	((ipc_tree_entry_t) uma_zalloc(ipc_tree_entry_zone, M_WAITOK))
+#define	ite_free(ite)	uma_zfree(ipc_tree_entry_zone, (ite))
+
+/*
+ * Exported interfaces
+ */
+
+/* Search for entry in a space by name */
+extern ipc_entry_t ipc_entry_lookup(
+	ipc_space_t	space,
+	mach_port_name_t	name);
+
+/* release a reference to an entry */
+void ipc_entry_release(
+	ipc_entry_t entry);
+
+/* Allocate an entry in a space */
+extern kern_return_t ipc_entry_get(
+	ipc_space_t	space,
+	boolean_t	is_send_once,
+	mach_port_name_t	*namep,
+	ipc_entry_t	*entryp);
+
+/* Allocate an entry in a space, growing the space if necessary */
+extern kern_return_t ipc_entry_alloc(
+	ipc_space_t	space,
+	boolean_t	is_send_once,
+	mach_port_name_t	*namep,
+	ipc_entry_t	*entryp);
+
+/* Allocate/find an entry in a space with a specific name */
+extern kern_return_t ipc_entry_alloc_name(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	*entryp);
+
+/* Deallocate an entry from a space */
+extern void ipc_entry_dealloc(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	entry);
+
+extern int ipc_entry_refs(
+	ipc_entry_t entry);
+
+extern void ipc_entry_add_refs(
+	ipc_entry_t entry, int delta);
+
+extern void ipc_entry_hold(
+	ipc_entry_t entry);
+
+extern void ipc_entry_release(
+	ipc_entry_t entry);
+
+kern_return_t ipc_entry_file_to_port(
+	ipc_space_t space,
+	mach_port_name_t name,
+	ipc_object_t *objectp);
+
+kern_return_t ipc_entry_port_to_file(
+	ipc_space_t space,
+	mach_port_name_t *namep,
+	ipc_object_t object);
+
+void ipc_entry_close(
+	ipc_space_t space __unused,
+	mach_port_name_t name);
+
+
+#endif	/* _IPC_IPC_ENTRY_H_ */


Property changes on: trunk/sys/sys/mach/ipc/ipc_entry.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_hash.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_hash.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_hash.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,132 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5.3.1  92/03/03  16:18:24  jeffreyh
+ * 	Changes from TRUNK
+ * 	[92/02/26  11:41:07  jeffreyh]
+ * 
+ * Revision 2.6  92/01/14  16:44:18  rpd
+ * 	Changed ipc_hash_info for CountInOut.
+ * 	[92/01/14            rpd]
+ * 
+ * Revision 2.5  91/05/14  16:32:23  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:21:34  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:44:52  mrt]
+ * 
+ * Revision 2.3  91/01/08  15:13:35  rpd
+ * 	Changed ipc_info_bucket_t to hash_info_bucket_t.
+ * 	[91/01/02            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:49:51  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  20:55:01  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_hash.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Declarations of entry hash table operations.
+ */
+
+#ifndef	_IPC_IPC_HASH_H_
+#define _IPC_IPC_HASH_H_
+
+#include <sys/mach/kern_return.h>
+#if 0
+#include <mach/boolean.h>
+#include <mach_debug/hash_info.h>
+#endif
+/*
+ * Exported interfaces
+ */
+
+/* Lookup (space, obj) in the appropriate reverse hash table */
+extern boolean_t ipc_hash_lookup(
+	ipc_space_t		space,
+	ipc_object_t		obj,
+	mach_port_name_t		*namep,
+	ipc_entry_t		*entryp);
+
+/* Insert an entry into the appropriate reverse hash table */
+extern void ipc_hash_insert(
+	ipc_space_t		space,
+	ipc_object_t		obj,
+	mach_port_name_t		name,
+	ipc_entry_t		entry);
+
+/* Delete an entry from the appropriate reverse hash table */
+extern void ipc_hash_delete(
+	ipc_space_t		space,
+	ipc_object_t		obj,
+	mach_port_name_t		name,
+	ipc_entry_t		entry);
+
+/* Initialize the reverse hash table implementation */
+extern void ipc_hash_init(void);
+
+
+#if	MACH_IPC_DEBUG
+#include <mach_ipc_debug.h>
+
+extern natural_t ipc_hash_info(
+	hash_info_bucket_t	*info,
+	mach_msg_type_number_t count);
+
+#endif	/* MACH_IPC_DEBUG */
+
+#endif	/* _IPC_IPC_HASH_H_ */


Property changes on: trunk/sys/sys/mach/ipc/ipc_hash.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_init.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_init.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_init.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,91 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/14  16:32:45  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:21:42  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:45:16  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:49:59  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  20:55:26  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_init.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Declarations of functions to initialize the IPC system.
+ */
+
+#ifndef	_IPC_IPC_INIT_H_
+#define _IPC_IPC_INIT_H_
+
+extern int ipc_space_max;
+extern int ipc_port_max;
+extern int ipc_pset_max;
+
+/*
+ * Exported interfaces
+ */
+
+/* IPC initialization needed before creation of kernel task */
+extern void ipc_bootstrap(void);
+
+/* Remaining IPC initialization */
+extern void ipc_init(void);
+
+#endif	/* _IPC_IPC_INIT_H_ */


Property changes on: trunk/sys/sys/mach/ipc/ipc_init.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_kmsg.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_kmsg.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_kmsg.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,421 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.11.2.4  92/05/28  18:14:33  jeffreyh
+ * 	Add ikm_has_dest_right boolean.  Put in union with ikm_norma_acked.
+ * 	[92/05/28            dlb]
+ * 
+ * Revision 2.11.2.3  92/05/26  18:53:43  jeffreyh
+ * 	Add ikm_norma_acked field for norma message processing.
+ * 	[92/05/05            dlb]
+ * 
+ * Revision 2.11.2.2  92/04/08  15:44:33  jeffreyh
+ * 	Temporary debugging logic.
+ * 	[92/04/06            dlb]
+ * 
+ * Revision 2.11.2.1  92/01/03  16:35:19  jsb
+ * 	Added ikm_source_node to support norma_ipc_receive_rright.
+ * 	[91/12/28  08:38:53  jsb]
+ * 
+ * Revision 2.11  91/12/14  14:26:54  jsb
+ * 	NORMA_IPC: added ikm_copy to struct kmsg.
+ * 
+ * Revision 2.10  91/08/28  11:13:31  jsb
+ * 	Renamed IKM_SIZE_CLPORT to IKM_SIZE_NORMA.
+ * 	[91/08/15  08:12:02  jsb]
+ * 
+ * Revision 2.9  91/08/03  18:18:24  jsb
+ * 	NORMA_IPC: added ikm_page field to struct ipc_kmsg.
+ * 	[91/07/17  14:01:38  jsb]
+ * 
+ * Revision 2.8  91/06/17  15:46:15  jsb
+ * 	Renamed NORMA conditionals.
+ * 	[91/06/17  10:46:12  jsb]
+ * 
+ * Revision 2.7  91/05/14  16:33:21  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.6  91/03/16  14:48:10  rpd
+ * 	Replaced ith_saved with ipc_kmsg_cache.
+ * 	[91/02/16            rpd]
+ * 
+ * Revision 2.5  91/02/05  17:22:08  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:45:52  mrt]
+ * 
+ * Revision 2.4  91/01/08  15:14:04  rpd
+ * 	Added ipc_kmsg_free.  Generalized the notion of special message sizes.
+ * 	[91/01/05            rpd]
+ * 	Added declarations of ipc_kmsg_copyout_object, ipc_kmsg_copyout_body.
+ * 	[90/12/21            rpd]
+ * 
+ * Revision 2.3  90/09/28  16:54:48  jsb
+ * 	Added NORMA_IPC support (hack in ikm_free).
+ * 	[90/09/28  14:03:06  jsb]
+ * 
+ * Revision 2.2  90/06/02  14:50:24  rpd
+ * 	Increased IKM_SAVED_KMSG_SIZE from 128 to 256.
+ * 	[90/04/23            rpd]
+ * 	Created for new IPC.
+ * 	[90/03/26  20:56:16  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_kmsg.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Definitions for kernel messages.
+ */
+
+#ifndef	_IPC_IPC_KMSG_H_
+#define _IPC_IPC_KMSG_H_
+
+#include <sys/mach/vm_types.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+
+#include <sys/mach/ipc/ipc_object.h>
+
+/*
+ *	This structure is only the header for a kmsg buffer;
+ *	the actual buffer is normally larger.  The rest of the buffer
+ *	holds the body of the message.
+ *
+ *	In a kmsg, the port fields hold pointers to ports instead
+ *	of port names.  These pointers hold references.
+ *
+ *	The ikm_header.msgh_remote_port field is the destination
+ *	of the message.
+ */
+
+typedef struct ipc_kmsg {
+	mach_msg_size_t			ikm_size;
+	struct ipc_kmsg *ikm_next, *ikm_prev;
+	mach_msg_header_t		*ikm_header;
+	ipc_port_t			ikm_prealloc;
+} *ipc_kmsg_t;
+
+#define	IKM_NULL		((ipc_kmsg_t) 0)
+
+#define	IKM_OVERHEAD   (sizeof(struct ipc_kmsg))
+
+#define	ikm_plus_overhead(size)	((mach_msg_size_t)((size) + IKM_OVERHEAD))
+#define	ikm_less_overhead(size)	((mach_msg_size_t)((size) - IKM_OVERHEAD))
+
+/*
+ * XXX	For debugging.
+ */
+#define IKM_BOGUS		((ipc_kmsg_t) 0xffffff10)
+
+/*
+ *	The size of the kernel message buffers that will be cached.
+ *	IKM_SAVED_KMSG_SIZE includes overhead; IKM_SAVED_MSG_SIZE doesn't.
+ */
+
+#define	IKM_SAVED_KMSG_SIZE	256
+#define	IKM_SAVED_MSG_SIZE	ikm_less_overhead(IKM_SAVED_KMSG_SIZE)
+
+#define	ikm_alloc(size)	ipc_kmsg_alloc(size);
+
+#define	ikm_init(kmsg, size)						\
+MACRO_BEGIN								\
+	ikm_init_special((kmsg), ikm_plus_overhead(size));		\
+MACRO_END
+
+#define	ikm_init_special(kmsg, size)					\
+MACRO_BEGIN								\
+	(kmsg)->ikm_size = (size);					\
+	(kmsg)->ikm_prev = NULL;						\
+	(kmsg)->ikm_next = NULL;						\
+MACRO_END
+
+#define	ikm_check_initialized(kmsg, size)				\
+MACRO_BEGIN								\
+	assert((kmsg)->ikm_size == (size));				\
+MACRO_END
+
+#define ikm_set_header(kmsg, mtsize)					\
+MACRO_BEGIN												\
+(kmsg)->ikm_header = (mach_msg_header_t *)(kmsg + 1);	\
+MPASS(kmsg->ikm_size >= mtsize + sizeof(*kmsg));		\
+MACRO_END
+
+/*
+ *	Non-positive message sizes are special.  They indicate that
+ *	the message buffer doesn't come from ikm_alloc and
+ *	requires some special handling to free.
+ *
+ *	ipc_kmsg_free is the non-macro form of ikm_free.
+ *	It frees kmsgs of all varieties.
+ */
+
+#define	IKM_SIZE_NETWORK	-1
+#define	IKM_SIZE_INTR_KMSG	-2
+
+
+#define	ikm_free(kmsg)	ipc_kmsg_free(kmsg)
+
+struct ipc_kmsg_queue {
+	struct ipc_kmsg *ikmq_base;
+};
+
+typedef struct ipc_kmsg_queue *ipc_kmsg_queue_t;
+
+#define	IKMQ_NULL		((ipc_kmsg_queue_t) 0)
+extern uma_zone_t ipc_kmsg_zone;
+
+/*
+ * Exported interfaces
+ */
+
+#define	ipc_kmsg_queue_init(queue)		\
+MACRO_BEGIN					\
+	(queue)->ikmq_base = IKM_NULL;		\
+MACRO_END
+
+#define	ipc_kmsg_queue_empty(queue)	((queue)->ikmq_base == IKM_NULL)
+
+/* Enqueue a kmsg */
+extern void ipc_kmsg_enqueue(
+	ipc_kmsg_queue_t	queue,
+	ipc_kmsg_t		kmsg);
+
+/* Dequeue and return a kmsg */
+extern ipc_kmsg_t ipc_kmsg_dequeue(
+	ipc_kmsg_queue_t        queue);
+
+/* Pull a kmsg out of a queue */
+extern void ipc_kmsg_rmqueue(
+	ipc_kmsg_queue_t	queue,
+	ipc_kmsg_t		kmsg);
+
+#define	ipc_kmsg_queue_first(queue)		((queue)->ikmq_base)
+
+/* Return the kmsg following the given kmsg */
+extern ipc_kmsg_t ipc_kmsg_queue_next(
+	ipc_kmsg_queue_t	queue,
+	ipc_kmsg_t		kmsg);
+
+#define	ipc_kmsg_rmqueue_first_macro(queue, kmsg)			\
+MACRO_BEGIN								\
+	register ipc_kmsg_t _next;					\
+									\
+	assert((queue)->ikmq_base == (kmsg));				\
+									\
+	_next = (kmsg)->ikm_next;					\
+	if (_next == (kmsg)) {						\
+		assert((kmsg)->ikm_prev == (kmsg));			\
+		(queue)->ikmq_base = IKM_NULL;				\
+	} else {							\
+		register ipc_kmsg_t _prev = (kmsg)->ikm_prev;		\
+									\
+		(queue)->ikmq_base = _next;				\
+		_next->ikm_prev = _prev;				\
+		_prev->ikm_next = _next;				\
+	}								\
+  	/* XXX Debug paranoia */					\
+  	kmsg->ikm_next = IKM_BOGUS;					\
+  	kmsg->ikm_prev = IKM_BOGUS;					\
+MACRO_END
+
+#define	ipc_kmsg_enqueue_macro(queue, kmsg)				\
+MACRO_BEGIN								\
+	register ipc_kmsg_t _first = (queue)->ikmq_base;		\
+									\
+	if (_first == IKM_NULL) {					\
+		(queue)->ikmq_base = (kmsg);				\
+		(kmsg)->ikm_next = (kmsg);				\
+		(kmsg)->ikm_prev = (kmsg);				\
+	} else {							\
+		register ipc_kmsg_t _last = _first->ikm_prev;		\
+									\
+		(kmsg)->ikm_next = _first;				\
+		(kmsg)->ikm_prev = _last;				\
+		_first->ikm_prev = (kmsg);				\
+		_last->ikm_next = (kmsg);				\
+	}								\
+MACRO_END
+
+/* scatter list macros */
+
+#define SKIP_PORT_DESCRIPTORS(s, e)					\
+MACRO_BEGIN								\
+	if ((s) != MACH_MSG_DESCRIPTOR_NULL) {				\
+		while ((s) < (e)) {					\
+			if ((s)->type.type != MACH_MSG_PORT_DESCRIPTOR)	\
+				break;					\
+			(s)++;						\
+		}							\
+		if ((s) >= (e))						\
+			(s) = MACH_MSG_DESCRIPTOR_NULL;			\
+	}								\
+MACRO_END
+
+#define INCREMENT_SCATTER(s)						\
+MACRO_BEGIN								\
+	if ((s) != MACH_MSG_DESCRIPTOR_NULL) {				\
+		(s)++;							\
+	}								\
+MACRO_END
+
+/* Destroy kernel message */
+extern void ipc_kmsg_destroy(
+	ipc_kmsg_t	kmsg);
+
+/* Allocate a kernel message */
+extern ipc_kmsg_t ipc_kmsg_alloc(
+	mach_msg_size_t size);
+
+/* Free a kernel message buffer */
+extern void ipc_kmsg_free(
+	ipc_kmsg_t	kmsg);
+
+/* Allocate a kernel message buffer and copy a user message to the buffer */
+extern mach_msg_return_t ipc_kmsg_get(
+	mach_msg_header_t	*msg,
+	mach_msg_size_t		size,
+	ipc_kmsg_t		*kmsgp,
+	ipc_space_t		space);
+
+/* Allocate a kernel message buffer and copy a kernel message to the buffer */
+extern mach_msg_return_t ipc_kmsg_get_from_kernel(
+	mach_msg_header_t	*msg,
+	mach_msg_size_t		size,
+	ipc_kmsg_t		*kmsgp);
+
+/* Copy a kernel message buffer to a user message */
+extern mach_msg_return_t ipc_kmsg_put(
+	mach_msg_header_t	*msg,
+	ipc_kmsg_t		kmsg,
+	mach_msg_size_t		size);
+
+/* Copy a kernel message buffer to a kernel message */
+extern void ipc_kmsg_put_to_kernel(
+	mach_msg_header_t	*msg,
+	ipc_kmsg_t		kmsg,
+	mach_msg_size_t		size);
+
+/* Copyin port rights in the header of a message */
+extern mach_msg_return_t ipc_kmsg_copyin_header(
+	ipc_kmsg_t	kmsg,
+	ipc_space_t		space,
+	mach_port_name_t		notify);
+
+/* Copyin port rights and out-of-line memory from a user message */
+extern mach_msg_return_t ipc_kmsg_copyin(
+	ipc_kmsg_t	kmsg,
+	ipc_space_t	space,
+	vm_map_t	map,
+	mach_port_name_t	notify);
+
+/* Copyin port rights and out-of-line memory from a kernel message */
+extern void ipc_kmsg_copyin_from_kernel(
+	ipc_kmsg_t	kmsg);
+
+/* Copyout the header and body to a user message */
+extern mach_msg_return_t ipc_kmsg_copyout(
+	ipc_kmsg_t		kmsg,
+	ipc_space_t		space,
+	vm_map_t		map,
+	mach_msg_body_t		*slist,
+	mach_msg_option_t option);
+
+/* Compute size of message as copied out to the specified space/map */
+extern mach_msg_size_t ipc_kmsg_copyout_size(
+	ipc_kmsg_t		kmsg,
+	vm_map_t		map);
+
+/* Copyout port rights and out-of-line memory to a user message,
+   not reversing the ports in the header */
+extern mach_msg_return_t ipc_kmsg_copyout_pseudo(
+	ipc_kmsg_t		kmsg,
+	ipc_space_t		space,
+	vm_map_t		map,
+	mach_msg_body_t		*slist);
+
+/* Copyout the destination port in the message */
+extern void ipc_kmsg_copyout_dest( 
+	ipc_kmsg_t	kmsg,
+	ipc_space_t	space);
+
+/* kernel's version of ipc_kmsg_copyout_dest */
+extern void ipc_kmsg_copyout_to_kernel(
+	ipc_kmsg_t		kmsg,
+	ipc_space_t		space);
+
+/* Check scatter and gather lists for consistency */
+extern mach_msg_return_t ipc_kmsg_check_scatter(
+	ipc_kmsg_t		kmsg,
+	mach_msg_option_t	option,
+	mach_msg_body_t		**slistp,
+	mach_msg_size_t		*sizep);
+
+extern boolean_t	ikm_cache_get(
+	ipc_kmsg_t		*kmsg);
+extern boolean_t	ikm_cache_put(
+	ipc_kmsg_t		kmsg);
+
+#if 	MACH_KDB
+
+/* Do a formatted dump of a kernel message */
+extern void ipc_kmsg_print(
+	ipc_kmsg_t	kmsg);
+
+/* Do a formatted dump of a user message */
+extern void ipc_msg_print(
+	mach_msg_header_t	*msgh);
+
+#endif	/* MACH_KDB */
+
+#endif	/* _IPC_IPC_KMSG_H_ */


Property changes on: trunk/sys/sys/mach/ipc/ipc_kmsg.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_machdep.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_machdep.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_machdep.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,70 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.2  93/01/14  17:32:59  danner
+ * 	Created.
+ * 	[92/12/10            af]
+ */
+/* CMU_END_HIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+
+/*
+ * At times, we need to know the size of a port in bits
+ */
+
+/* 64 bit machines */
+#if	defined(__alpha)
+#define	PORT_T_SIZE_IN_BITS	64
+#endif
+
+/* default, 32 bit machines */
+#if	!defined(PORT_T_SIZE_IN_BITS)
+#define	PORT_T_SIZE_IN_BITS	32
+#endif
+


Property changes on: trunk/sys/sys/mach/ipc/ipc_machdep.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_mqueue.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_mqueue.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_mqueue.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,209 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6  91/08/28  11:13:37  jsb
+ * 	Added seqno argument to ipc_mqueue_receive.
+ * 	[91/08/10            rpd]
+ * 
+ * Revision 2.5  91/05/14  16:34:12  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:22:29  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:46:46  mrt]
+ * 
+ * Revision 2.3  91/01/08  15:14:42  rpd
+ * 	Changed continuation argument and IMQ_NULL_CONTINUE to (void (*)()).
+ * 	[90/12/18            rpd]
+ * 	Reorganized ipc_mqueue_receive.
+ * 	[90/11/22            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:50:44  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  20:57:40  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_mqueue.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Definitions for message queues.
+ */
+
+#ifndef	_IPC_IPC_MQUEUE_H_
+#define _IPC_IPC_MQUEUE_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/event.h>
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/ipc/ipc_thread.h>
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_types.h>
+#define TRACE_BUFFER 0
+#define TR_DECL(x)
+
+typedef struct ipc_mqueue {
+	struct ipc_kmsg_queue imq_messages;
+} *ipc_mqueue_t;
+
+struct ipc_pset;
+
+#define	IMQ_NULL		((ipc_mqueue_t) 0)
+#if 0
+#define	imq_lock_init(mq)	mach_mutex_init(&(mq)->imq_lock_data, \
+					   "ETAP_IPC_MQUEUE")
+#define	imq_lock(mq)		mtx_lock(&(mq)->imq_lock_data)
+#define	imq_lock_try(mq)	mtx_trylock(&(mq)->imq_lock_data)
+#define	imq_unlock(mq)		mtx_unlock(&(mq)->imq_lock_data)
+#define	imq_lock_addr(mq)	mtx_lock((mq)->imq_lock_data)
+#endif
+#define	IMQ_NULL_CONTINUE	((void (*)(void)) 0)
+
+/*
+ * Exported interfaces
+ */
+/* Initialize a newly-allocated message queue */
+extern void ipc_mqueue_init(
+	ipc_mqueue_t	mqueue);
+
+/* Move messages from one queue to another */
+extern void ipc_mqueue_move(
+	ipc_mqueue_t	dest,
+	ipc_mqueue_t	source,
+	ipc_port_t	port);
+
+/* Wake up receivers waiting in a message queue */
+extern void ipc_mqueue_changed(
+	ipc_mqueue_t		mqueue,
+	mach_msg_return_t	mr);
+
+/* Send a message to a port */
+extern mach_msg_return_t ipc_mqueue_send(
+	ipc_kmsg_t		kmsg,
+	mach_msg_option_t	option,
+	mach_msg_timeout_t	timeout);
+
+/* Deliver message to message queue or waiting receiver */
+extern mach_msg_return_t ipc_mqueue_deliver(
+	ipc_port_t	port,
+	ipc_kmsg_t	kmsg,
+	boolean_t	thread_context);
+
+/* Convert a name in a space to a message queue */
+extern mach_msg_return_t ipc_mqueue_copyin(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	natural_t *bitsp,
+	ipc_object_t	*objectp);
+
+/* Receive a message from a message queue */
+extern mach_msg_return_t ipc_mqueue_receive(
+	natural_t	bits,
+	mach_msg_option_t	option,
+	mach_msg_size_t		max_size,
+	mach_msg_timeout_t	timeout,
+	ipc_kmsg_t		*kmsgp,
+	mach_port_seqno_t	*seqnop,
+	thread_t thread);
+
+/* Receive a message from a message queue */
+extern mach_msg_return_t ipc_mqueue_pset_receive(
+	natural_t	bits,
+	mach_msg_option_t	option,
+	mach_msg_size_t		max_size,
+	mach_msg_timeout_t	timeout,
+	thread_t thread);
+
+/* Second half of ipc_mqueue_receive */
+extern mach_msg_return_t ipc_mqueue_finish_receive(
+	ipc_kmsg_t		*kmsgp,
+	ipc_port_t		port,
+	mach_msg_option_t	option,
+	mach_msg_size_t		max_size);
+
+/*
+ *	extern void
+ *	ipc_mqueue_send_always(ipc_kmsg_t);
+ *
+ *	Unfortunately, to avoid warnings/lint about unused variables
+ *	when assertions are turned off, we need two versions of this.
+ */
+
+#if	MACH_ASSERT
+
+#define	ipc_mqueue_send_always(kmsg)					\
+MACRO_BEGIN								\
+	mach_msg_return_t mr;						\
+									\
+	mr = ipc_mqueue_send((kmsg), MACH_SEND_ALWAYS,			\
+			     MACH_MSG_TIMEOUT_NONE);			\
+	assert(mr == MACH_MSG_SUCCESS);					\
+MACRO_END
+
+#else	/* MACH_ASSERT */
+
+#define	ipc_mqueue_send_always(kmsg)					\
+MACRO_BEGIN								\
+	(void) ipc_mqueue_send((kmsg), MACH_SEND_ALWAYS,		\
+			       MACH_MSG_TIMEOUT_NONE);			\
+MACRO_END
+
+#endif	/* MACH_ASSERT */
+
+#endif	/* _IPC_IPC_MQUEUE_H_ */


Property changes on: trunk/sys/sys/mach/ipc/ipc_mqueue.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_notify.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_notify.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_notify.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,108 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/14  16:34:40  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:22:39  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:48:56  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:50:55  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  20:58:15  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_notify.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Declarations of notification-sending functions.
+ */
+
+#ifndef	_IPC_IPC_NOTIFY_H_
+#define _IPC_IPC_NOTIFY_H_
+
+/*
+ * Exported interfaces 
+ */
+
+/* Initialize the notification subsystem */
+extern void ipc_notify_init(void);
+
+/* Send a port-deleted notification */
+extern void ipc_notify_port_deleted(
+	ipc_port_t	port,
+	mach_port_name_t	name);
+
+/* Send a port-destroyed notification */
+extern void ipc_notify_port_destroyed(
+	ipc_port_t	port,
+	ipc_port_t	right);
+
+/* Send a no-senders notification */
+extern void ipc_notify_no_senders(
+	ipc_port_t		port,
+	mach_port_mscount_t	mscount);
+
+/* Send a send-once notification */
+extern void ipc_notify_send_once(
+	ipc_port_t		port);
+
+/* Send a dead-name notification */
+extern void ipc_notify_dead_name(
+	ipc_port_t	port,
+	mach_port_name_t	name);
+
+#endif	/* _IPC_IPC_NOTIFY_H_ */


Property changes on: trunk/sys/sys/mach/ipc/ipc_notify.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_object.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_object.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_object.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,314 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6  91/10/09  16:09:27  af
+ * 	 Revision 2.5.2.1  91/09/16  10:15:46  rpd
+ * 	 	Added (unconditional) ipc_object_print declaration.
+ * 	 	[91/09/02            rpd]
+ * 
+ * Revision 2.5.2.1  91/09/16  10:15:46  rpd
+ * 	Added (unconditional) ipc_object_print declaration.
+ * 	[91/09/02            rpd]
+ * 
+ * Revision 2.5  91/05/14  16:35:04  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:22:53  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:49:25  mrt]
+ * 
+ * Revision 2.3  90/11/05  14:29:21  rpd
+ * 	Removed ipc_object_reference_macro, ipc_object_release_macro.
+ * 	Created new io_reference, io_release macros.
+ * 	[90/10/29            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:51:04  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:00:05  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_object.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Definitions for IPC objects, for which tasks have capabilities.
+ */
+
+#ifndef	_IPC_IPC_OBJECT_H_
+#define _IPC_IPC_OBJECT_H_
+
+#include <vm/uma.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/ipc/ipc_types.h>
+#include <sys/mach/ipc_common.h>	/* for ipc_object data defs */
+
+typedef struct ipc_object *ipc_object_t;
+
+#define	IO_NULL			((ipc_object_t) 0)
+#define	IO_DEAD			((ipc_object_t) -1)
+
+#define	IO_VALID(io)		(((io) != IO_NULL) && ((io) != IO_DEAD))
+
+/*
+ *	IPC steals the high-order bits from the kotype to use
+ *	for its own purposes.  This allows IPC to record facts
+ *	about ports that aren't otherwise obvious from the
+ *	existing port fields.  In particular, IPC can optionally
+ *	mark a port for no more senders detection.  Any change
+ *	to IO_BITS_PORT_INFO must be coordinated with bitfield
+ *	definitions in ipc_port.h.
+ */
+#define	IO_BITS_PORT_INFO	0x0000f000	/* stupid port tricks */
+#define	IO_BITS_KOTYPE		0x00000fff	/* used by the object */
+#define IO_BITS_OTYPE		0x7fff0000	/* determines a zone */
+#define	IO_BITS_ACTIVE		0x80000000	/* is object alive? */
+
+#define	io_active(io)		((io)->io_bits & IO_BITS_ACTIVE)
+				/* 1.3b26 hacked this to  .. < 0 why? */
+
+#define	io_otype(io)		(((io)->io_bits & IO_BITS_OTYPE) >> 16)
+#define	io_kotype(io)		((io)->io_bits & IO_BITS_KOTYPE)
+
+#define	io_makebits(active, otype, kotype)	\
+	(((active) ? IO_BITS_ACTIVE : 0) | ((otype) << 16) | (kotype))
+
+/*
+ * Object types: ports, port sets, kernel-loaded ports
+ */
+#define	IOT_PORT		0
+#define IOT_PORT_SET		1
+#define IOT_NUMBER		2		/* number of types used */
+extern uma_zone_t ipc_object_zones[IOT_NUMBER];
+#define	io_alloc(otype)		\
+	((ipc_object_t) uma_zalloc(ipc_object_zones[(otype)], M_WAITOK))
+
+#define	io_free(otype, io)	\
+		uma_zfree(ipc_object_zones[(otype)], (io))
+/*
+ * Here we depend on the ipc_object being first within the ipc_common_data,
+ * which is first within the rpc_common_data, which in turn must be first
+ * within any kernel data structure needing to lock an ipc_object
+ * (ipc_port and ipc_pset).
+ */
+
+#define io_lock_init(io) \
+	mtx_init(&((rpc_common_t)(io))->rcd_io_lock_data, "ETAP_IPC_RPC", NULL, MTX_DEF|MTX_DUPOK)
+#define	io_lock(io) \
+	mtx_lock(&((rpc_common_t)(io))->rcd_io_lock_data)
+#define	io_lock_owned(io) \
+	mtx_owned(&((rpc_common_t)(io))->rcd_io_lock_data)
+#define	io_lock_try(io) \
+	mtx_trylock(&((rpc_common_t)(io))->rcd_io_lock_data)
+#define	io_unlock(io) \
+	mtx_unlock(&((rpc_common_t)(io))->rcd_io_lock_data)
+#define io_unlock_assert(io) mtx_assert(&((rpc_common_t)(io))->rcd_io_lock_data, MA_NOTOWNED)
+#define io_lock_assert(io) mtx_assert(&((rpc_common_t)(io))->rcd_io_lock_data, MA_OWNED)
+
+#ifdef SMP
+#define _VOLATILE_ volatile
+#else	/* NCPUS > 1 */
+#define _VOLATILE_
+#endif	/* NCPUS > 1 */
+
+#define VERBOSE_DEBUGGING 0
+
+/* Sanity check the ref count.  If it is 0, we may be doubly zfreeing.
+ * If it is larger than max int, it has been corrupted, probably by being
+ * modified into an address (this is architecture dependent, but it's
+ * safe to assume there cannot really be max int references).
+ *
+ * NOTE: The 0 test alone will not catch double zfreeing of ipc_port
+ * structs, because the io_references field is the first word of the struct,
+ * and zfree modifies that to point to the next free zone element.
+ */
+#define IO_MAX_REFERENCES						\
+	(unsigned)(~0 ^ (1 << (sizeof(int)*BYTE_SIZE - 1)))
+
+
+extern void io_validate(ipc_object_t io);
+
+static inline void
+_io_reference(ipc_object_t io, char *file, int line) {
+
+	assert((io)->io_references > 0);
+	assert((io)->io_references < IO_MAX_REFERENCES);
+	atomic_add_int(&(io)->io_references, 1);
+#if VERBOSE_DEBUGGING
+	if (io->io_references < 5)
+		printf("ref %p refs: %d %s:%d\n", io, io->io_references, file, line);
+#endif
+}
+
+static inline void
+_io_release(ipc_object_t io, char* file, int line) {
+
+#if VERBOSE_DEBUGGING
+	if (io->io_references < 5)
+		printf("rel %p refs: %d %s:%d\n", io, io->io_references, file, line);
+#endif
+	assert((io)->io_references > 0);
+	MACH_VERIFY((io)->io_references < IO_MAX_REFERENCES, ("io_references: %d\n", (io)->io_references));
+	assert((io)->io_references < IO_MAX_REFERENCES);
+	if (atomic_fetchadd_int(&(io)->io_references, -1) == 1) {
+#ifdef INVARIANTS
+		io_validate(io);
+#endif
+		io_free(io_otype(io), io);
+	}
+}
+
+#define io_release(io)  _io_release(io, __FILE__, __LINE__)
+#define io_reference(io)  _io_reference(io, __FILE__, __LINE__)
+
+#define ipc_object_reference(io) io_reference(io)
+#define ipc_object_release(io) io_release(io)
+
+/*
+ * Exported interfaces
+ */
+
+/* Look up an object in a space */
+extern kern_return_t ipc_object_translate(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	mach_port_right_t	right,
+	ipc_object_t		*objectp);
+
+/* Allocate a dead-name entry */
+extern kern_return_t
+ipc_object_alloc_dead(
+	ipc_space_t	space,
+	mach_port_name_t 	*namep);
+
+/*  Allocate a dead-name entry, with a specific name */
+extern kern_return_t ipc_object_alloc_dead_name(
+	ipc_space_t	space,
+	mach_port_name_t	name);
+
+/* Allocate an object */
+extern kern_return_t ipc_object_alloc(
+	ipc_space_t		space,
+	ipc_object_type_t	otype,
+	mach_port_type_t	type,
+	mach_port_name_t		*namep,
+	ipc_object_t		*objectp);
+
+/* Allocate an object, with a specific name */
+extern kern_return_t ipc_object_alloc_name(
+	ipc_space_t		space,
+	ipc_object_type_t	otype,
+	mach_port_type_t	type,
+	mach_port_name_t		name,
+	ipc_object_t		*objectp);
+
+/* Convert a send type name to a received type name */
+extern mach_msg_type_name_t ipc_object_copyin_type(
+	mach_msg_type_name_t	msgt_name);
+
+/* Copyin a capability from a space */
+extern kern_return_t ipc_object_copyin(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	mach_msg_type_name_t	msgt_name,
+	ipc_object_t		*objectp);
+
+/* Copyin a naked capability from the kernel */
+extern void ipc_object_copyin_from_kernel(
+	ipc_object_t		object,
+	mach_msg_type_name_t	msgt_name);
+
+/* Destroy a naked capability */
+extern void ipc_object_destroy(
+	ipc_object_t		object,
+	mach_msg_type_name_t	msgt_name);
+
+/* Copyout a capability, placing it into a space */
+extern kern_return_t ipc_object_copyout(
+	ipc_space_t		space,
+	ipc_object_t		object,
+	mach_msg_type_name_t	msgt_name,
+	mach_port_name_t		*namep);
+
+/* Copyout a capability with a name, placing it into a space */
+extern kern_return_t ipc_object_copyout_name(
+	ipc_space_t		space,
+	ipc_object_t		object,
+	mach_msg_type_name_t	msgt_name,
+	mach_port_name_t		name);
+
+/* Translate/consume the destination right of a message */
+extern void ipc_object_copyout_dest(
+	ipc_space_t		space,
+	ipc_object_t		object,
+	mach_msg_type_name_t	msgt_name,
+	mach_port_name_t		*namep);
+
+/* Rename an entry in a space */
+extern kern_return_t ipc_object_rename(
+	ipc_space_t	space,
+	mach_port_name_t	oname,
+	mach_port_name_t	nname);
+
+
+#if	MACH_KDB
+/* Pretty-print an ipc object */
+
+extern void ipc_object_print(
+	ipc_object_t	object);
+
+#endif	/* MACH_KDB */
+
+#endif	/* _IPC_IPC_OBJECT_H_ */


Property changes on: trunk/sys/sys/mach/ipc/ipc_object.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_port.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_port.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_port.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,575 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.12.2.4  92/05/28  18:14:17  jeffreyh
+ * 	Change value of IP_NORMA_FAKE_DNREQUEST to 
+ * 	not get confused with MACH_IPC_COMPAT
+ * 
+ * Revision 2.12.2.3  92/05/26  18:54:02  jeffreyh
+ * 	Add dead name proxy definitions
+ * 	[92/05/25            dlb]
+ * 
+ * 	Added ip_norma_sync to allow thread synchronization on ports.
+ * 	[92/05/19            sjs]
+ * 
+ * 	Added norma_ip_forward to indicate a proxy cannot be thrown away
+ * 	until the root node has been updated to point at the new node.
+ * 	[92/05/18            sjs]
+ * 
+ * Revision 2.12.2.2.1.1  92/05/06  17:47:13  jeffreyh
+ * 	Add ip_norma_atrium_waiter for atrium message syncronization.
+ * 	[92/05/05            dlb]
+ * 
+ * Revision 2.12.2.2  92/02/21  11:23:37  jsb
+ * 	Removed ip_norma_queued. Added ip_norma_spare[1234].
+ * 	[92/02/18  07:44:11  jsb]
+ * 
+ * 	Added ip_norma_xmm_object_refs.
+ * 	[92/02/16  16:12:50  jsb]
+ * 
+ * 	Added ip_norma_xmm_object.
+ * 	[92/02/09  14:42:47  jsb]
+ * 
+ * Revision 2.12.2.1  92/01/03  16:35:50  jsb
+ * 	Renamed IP_NORMA_REQUEST macros to ip_nsproxy{,m,p}.
+ * 	They now look like Rich's ip_pdrequest macros.
+ * 	[91/12/30  07:53:29  jsb]
+ * 
+ * 	Added IP_NORMA_NSREQUEST macros for no-senders notification support.
+ * 	[91/12/28  17:03:42  jsb]
+ * 
+ * 	Added ip_norma_{queued,queue_next} for new norma_ipc_send
+ * 	implementation that maintains a list of ports with unsent
+ * 	remote messages. (The old implementation kept a single
+ * 	list of unsent messages for all ports.)
+ * 	[91/12/28  08:44:40  jsb]
+ * 
+ * 	Added ip_norma_atrium.
+ * 	[91/12/26  20:03:40  jsb]
+ * 
+ * 	Added ip_norma_sotransit. Removed ip_norma_{wanted,migrating}.
+ * 	Made ip_norma_dest_node unsigned.
+ * 	[91/12/25  16:44:29  jsb]
+ * 
+ * 	NORMA_IPC: removed unused fields from struct ipc_port. Corrected log.
+ * 	[91/12/24  14:16:33  jsb]
+ * 
+ * Revision 2.12  91/12/14  14:28:26  jsb
+ * 	NORMA_IPC: replaced dummy port struct fields with real names.
+ * 
+ * Revision 2.11  91/11/14  16:56:20  rpd
+ * 	Added ipc_fields.h hack, with fields in struct ipc_port to match.
+ *	Added IP_NORMA_IS_PROXY macro.
+ * 	[91/11/00            jsb]
+ * 
+ * Revision 2.10  91/10/09  16:10:01  af
+ * 	Added (unconditional) ipc_port_print declaration.
+ * 	[91/09/02            rpd]
+ * 
+ * Revision 2.9  91/08/28  11:13:50  jsb
+ * 	Added ip_seqno and ipc_port_set_seqno.
+ * 	[91/08/09            rpd]
+ * 	Renamed clport (now ip_norma) fields in struct ipc_port.
+ * 	[91/08/14  19:31:55  jsb]
+ * 
+ * Revision 2.8  91/08/03  18:18:37  jsb
+ * 	Fixed include. Added clport fields directly to struct ipc_port.
+ * 	[91/07/17  14:06:25  jsb]
+ * 
+ * Revision 2.7  91/06/17  15:46:26  jsb
+ * 	Renamed NORMA conditionals.
+ * 	[91/06/17  10:44:06  jsb]
+ * 
+ * Revision 2.6  91/05/14  16:35:34  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.5  91/02/05  17:23:10  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:50:04  mrt]
+ * 
+ * Revision 2.4  90/11/05  14:29:39  rpd
+ * 	Added ipc_port_reference, ipc_port_release.
+ * 	[90/10/29            rpd]
+ * 
+ * Revision 2.3  90/09/28  16:55:18  jsb
+ * 	Added NORMA_IPC support.
+ * 	[90/09/28  14:03:58  jsb]
+ * 
+ * Revision 2.2  90/06/02  14:51:13  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:01:25  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_port.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Definitions for ports.
+ */
+
+#ifndef	_IPC_IPC_PORT_H_
+#define _IPC_IPC_PORT_H_
+
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/port.h>
+#include <sys/mach/thread_pool.h>
+
+
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_mqueue.h>
+#include <sys/mach/ipc/ipc_table.h>
+#include <sys/mach/ipc/ipc_thread.h>
+#include <sys/mach/ipc/ipc_types.h>
+#include <sys/mach/ipc/ipc_entry.h>
+
+/*
+ * This structure defines the elements in common between
+ * ports and port sets.  The ipc_common_data MUST BE FIRST here,
+ * just as the ipc_object must be first within that.
+ *
+ * This structure must be used anywhere an ipc_object needs
+ * to be locked.
+ */
+typedef struct rpc_common_data {
+	struct ipc_common_data  rcd_comm;
+	struct thread_pool      rcd_thread_pool;
+	struct mtx rcd_io_lock_data;
+} *rpc_common_t;
+
+
+/*
+ *  A receive right (port) can be in four states:
+ *	1) dead (not active, ip_timestamp has death time)
+ *	2) in a space (ip_receiver_name != 0, ip_receiver points
+ *	to the space but doesn't hold a ref for it)
+ *	3) in transit (ip_receiver_name == 0, ip_destination points
+ *	to the destination port and holds a ref for it)
+ *	4) in limbo (ip_receiver_name == 0, ip_destination == IP_NULL)
+ *
+ *  If the port is active, and ip_receiver points to some space,
+ *  then ip_receiver_name != 0, and that space holds receive rights.
+ *  If the port is not active, then ip_timestamp contains a timestamp
+ *  taken when the port was destroyed.
+ */
+
+typedef unsigned int ipc_port_timestamp_t;
+
+typedef unsigned int ipc_port_flags_t;
+
+#define	IP_CONTEXT_FILE	0x1
+
+struct ipc_port {
+
+	/*
+	 * Initial sub-structure in common with ipc_pset and rpc_port
+	 * First element is an ipc_object
+	 */
+	struct rpc_common_data port_comm;
+
+	union {
+		struct ipc_space *receiver;
+		struct ipc_port *destination;
+		ipc_port_timestamp_t timestamp;
+	} data;
+
+	mach_port_mscount_t ip_mscount;
+	mach_port_rights_t ip_srights;
+	mach_port_rights_t ip_sorights;
+
+	struct ipc_port *ip_nsrequest;
+	struct ipc_port *ip_pdrequest;
+	struct ipc_port_request *ip_dnrequests;
+
+	struct ipc_pset *ip_pset;
+	mach_port_seqno_t ip_seqno;		/* locked by message queue */
+	mach_port_msgcount_t ip_msgcount;
+	mach_port_msgcount_t ip_qlimit;
+	struct ipc_mqueue ip_messages;
+	struct ipc_thread_queue ip_blocked;
+	ipc_port_flags_t ip_flags;
+	TAILQ_ENTRY(ipc_port) ip_next;
+	natural_t ip_sprequests: 1,
+		ip_spimportant:1,
+		ip_impdonation:1,
+		ip_tempowner:1,
+		ip_guarded:1,
+		ip_strict_guard:1,
+		ip_pad:26;
+	mach_vm_address_t ip_context;
+};
+
+
+#define ip_object		port_comm.rcd_comm.icd_object
+#define ip_references		ip_object.io_references
+#define ip_bits			ip_object.io_bits
+#define ip_kobject		port_comm.rcd_comm.icd_kobject
+#define ip_subsystem		port_comm.rcd_comm.icd_subsystem
+#define ip_receiver_name	port_comm.rcd_comm.icd_receiver_name
+
+#define ip_thread_pool		port_comm.rcd_thread_pool
+
+#define	ip_receiver		data.receiver
+#define	ip_destination		data.destination
+#define	ip_timestamp		data.timestamp
+
+#define	IP_NULL			((ipc_port_t) IO_NULL)
+#define	IP_DEAD			((ipc_port_t) IO_DEAD)
+
+#define	IP_VALID(port)		IO_VALID(&(port)->ip_object)
+
+#define	ip_active(port)		io_active(&(port)->ip_object)
+#define	ip_lock_init(port)	io_lock_init(&(port)->ip_object)
+#define	ip_lock(port)		io_lock(&(port)->ip_object)
+#define	ip_lock_try(port)	io_lock_try(&(port)->ip_object)
+#define	ip_unlock(port)		io_unlock(&(port)->ip_object)
+#define	ip_reference(port)	io_reference(&(port)->ip_object)
+#define	ip_release(port)	io_release(&(port)->ip_object)
+#define ip_lock_assert(port) io_lock_assert(&(port)->ip_object)
+#define ip_unlock_assert(port) io_unlock_assert(&(port)->ip_object)
+
+#define	ip_kotype(port)		io_kotype(&(port)->ip_object)
+
+/*
+ *	No more senders information.
+ */
+#define	IP_BIT_NMS		0x00008000	/* nms detection enabled? */
+#define	IP_SET_NMS(port)	((port)->ip_bits |= IP_BIT_NMS)
+#define IP_CLEAR_NMS(port)	((port)->ip_bits &= ~IP_BIT_NMS)
+#define	IP_NMS(port)		((port)->ip_bits & IP_BIT_NMS)
+
+typedef ipc_table_index_t ipc_port_request_index_t;
+
+typedef struct ipc_port_request {
+	union {
+		struct ipc_port *port;
+		ipc_port_request_index_t index;
+	} notify;
+
+	union {
+		mach_port_name_t name;
+		struct ipc_table_size *size;
+	} name;
+} *ipc_port_request_t;
+
+#define	ipr_next		notify.index
+#define	ipr_size		name.size
+
+#define	ipr_soright		notify.port
+#define	ipr_name		name.name
+
+#define	IPR_NULL		((ipc_port_request_t) 0)
+
+/*
+ *	Taking the ipc_port_multiple lock grants the privilege
+ *	to lock multiple ports at once.  No ports must locked
+ *	when it is taken.
+ */
+
+extern struct mtx ipc_port_multiple_lock_data;
+
+#define	ipc_port_multiple_lock_init()					\
+		mach_mutex_init(&ipc_port_multiple_lock_data, "ETAP_IPC_PORT_MULT")
+
+#define	ipc_port_multiple_lock()					\
+		mtx_lock(&ipc_port_multiple_lock_data)
+
+#define	ipc_port_multiple_unlock()					\
+		mtx_unlock(&ipc_port_multiple_lock_data)
+
+/*
+ *	The port timestamp facility provides timestamps
+ *	for port destruction.  It is used to serialize
+ *	mach_port_names with port death.
+ */
+
+decl_mutex_data(extern,ipc_port_timestamp_lock_data)
+extern ipc_port_timestamp_t ipc_port_timestamp_data;
+
+#define	ipc_port_timestamp_lock_init()					\
+		mach_mutex_init(&ipc_port_timestamp_lock_data, "ETAP_IPC_PORT_TIME")
+
+#define	ipc_port_timestamp_lock()					\
+		mtx_lock(&ipc_port_timestamp_lock_data)
+
+#define	ipc_port_timestamp_unlock()					\
+		mtx_unlock(&ipc_port_timestamp_lock_data)
+
+/* Retrieve a port timestamp value */
+extern ipc_port_timestamp_t ipc_port_timestamp(void);
+
+/*
+ *	Compares two timestamps, and returns TRUE if one
+ *	happened before two.  Note that this formulation
+ *	works when the timestamp wraps around at 2^32,
+ *	as long as one and two aren't too far apart.
+ */
+
+#define	IP_TIMESTAMP_ORDER(one, two)	((int) ((one) - (two)) < 0)
+
+#define	ipc_port_translate_receive(space, name, portp)			\
+		ipc_object_translate((space), (name),			\
+				     MACH_PORT_RIGHT_RECEIVE,		\
+				     (ipc_object_t *) (portp))
+
+#define	ipc_port_translate_send(space, name, portp)			\
+		ipc_object_translate((space), (name),			\
+				     MACH_PORT_RIGHT_SEND,		\
+				     (ipc_object_t *) (portp))
+
+/* Allocate a dead-name request slot */
+extern kern_return_t
+ipc_port_dnrequest(
+	ipc_port_t			port,
+	mach_port_name_t			name,
+	ipc_port_t			soright,
+	ipc_port_request_index_t	*indexp);
+
+/* Grow a port's table of dead-name requests */
+extern kern_return_t ipc_port_dngrow(
+	ipc_port_t	port,
+	int		target_size);
+
+/* Cancel a dead-name request and return the send-once right */
+extern ipc_port_t ipc_port_dncancel(
+	ipc_port_t			port,
+	mach_port_name_t			name,
+	ipc_port_request_index_t	index);
+
+#define	ipc_port_dnrename(port, index, oname, nname)			\
+MACRO_BEGIN								\
+	ipc_port_request_t ipr, table;					\
+									\
+	assert(ip_active(port));					\
+									\
+	table = port->ip_dnrequests;					\
+	assert(table != IPR_NULL);					\
+									\
+	ipr = &table[index];						\
+	assert(ipr->ipr_name == oname);					\
+									\
+	ipr->ipr_name = nname;						\
+MACRO_END
+
+/* Make a port-deleted request */
+extern void ipc_port_pdrequest(
+	ipc_port_t	port,
+	ipc_port_t	notify,
+	ipc_port_t	*previousp);
+
+/* Make a no-senders request */
+extern void ipc_port_nsrequest(
+	ipc_port_t		port,
+	mach_port_mscount_t	sync,
+	ipc_port_t		notify,
+	ipc_port_t		*previousp);
+
+/* Change a port's queue limit */
+extern void ipc_port_set_qlimit(
+	ipc_port_t		port,
+	mach_port_msgcount_t	qlimit);
+
+#define	ipc_port_set_mscount(port, mscount)				\
+MACRO_BEGIN								\
+	assert(ip_active(port));					\
+									\
+	(port)->ip_mscount = (mscount);					\
+MACRO_END
+
+/* Change a port's sequence number */
+extern void ipc_port_set_seqno(
+	ipc_port_t		port, 
+	mach_port_seqno_t 	seqno);
+
+/* Prepare a receive right for transmission/destruction */
+extern void ipc_port_clear_receiver(
+	ipc_port_t	port);
+
+/* Initialize a newly-allocated port */
+extern void ipc_port_init(
+	ipc_port_t	port,
+	ipc_space_t	space,
+	mach_port_name_t	name);
+
+/* Allocate a port */
+extern kern_return_t ipc_port_alloc(
+	ipc_space_t	space,
+	mach_port_name_t	*namep,
+	ipc_port_t	*portp);
+
+/* Allocate a port, with a specific name */
+extern kern_return_t ipc_port_alloc_name(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_port_t	*portp);
+
+/* Generate dead name notifications */
+extern void ipc_port_dnnotify(
+	ipc_port_t		port,
+	ipc_port_request_t	dnrequests);
+
+/* Destroy a port */
+extern void ipc_port_destroy(
+	ipc_port_t	port);
+
+/* Check if queueing "port" in a message for "dest" would create a circular 
+   group of ports and messages */
+extern boolean_t
+ipc_port_check_circularity(
+	ipc_port_t	port,
+	ipc_port_t	dest);
+
+/* Make a send-once notify port from a receive right */
+extern ipc_port_t ipc_port_lookup_notify(
+	ipc_space_t	space, 
+	mach_port_name_t 	name);
+
+/* Make a naked send right from a receive right */
+extern ipc_port_t ipc_port_make_send(
+	ipc_port_t	port);
+
+/* Make a naked send right from another naked send right */
+extern ipc_port_t ipc_port_copy_send(
+	ipc_port_t	port);
+
+/* Copyout a naked send right */
+extern mach_port_name_t ipc_port_copyout_send(
+	ipc_port_t	sright,
+	ipc_space_t	space);
+
+/* Release a (valid) naked send right */
+extern void ipc_port_release_send(
+	ipc_port_t	port);
+
+/* Make a naked send-once right from a receive right */
+extern ipc_port_t ipc_port_make_sonce(
+	ipc_port_t	port);
+
+/* Release a naked send-once right */
+extern void ipc_port_release_sonce(
+	ipc_port_t	port);
+
+/* Release a naked (in limbo or in transit) receive right */
+extern void ipc_port_release_receive(
+	ipc_port_t	port);
+
+/* Allocate a port in a special space */
+extern ipc_port_t ipc_port_alloc_special(
+	ipc_space_t	space);
+
+/* Deallocate a port in a special space */
+extern void ipc_port_dealloc_special(
+	ipc_port_t	port,
+	ipc_space_t	space);
+
+#if	MACH_ASSERT
+/* Track low-level port deallocation */
+extern void ipc_port_track_dealloc(
+	ipc_port_t	port);
+
+/* Initialize general port debugging state */
+extern void ipc_port_debug_init(void);
+#endif	/* MACH_ASSERT */
+
+#define	ipc_port_alloc_kernel()		\
+		ipc_port_alloc_special(ipc_space_kernel)
+#define	ipc_port_dealloc_kernel(port)	\
+		ipc_port_dealloc_special((port), ipc_space_kernel)
+
+#define	ipc_port_alloc_reply()		\
+		ipc_port_alloc_special(ipc_space_reply)
+#define	ipc_port_dealloc_reply(port)	\
+		ipc_port_dealloc_special((port), ipc_space_reply)
+
+#define	ipc_port_reference(port)	\
+		ipc_object_reference(&(port)->ip_object)
+
+#define	ipc_port_release(port)		\
+		ipc_object_release(&(port)->ip_object)
+
+/*
+ *	IP_IS_REMOTE:  Determine whether a port's receiver
+ *	is local or remote.  By local, we mean that the
+ *	receiver is located on the same node as the caller;
+ *	by remote, we mean that the receiver is on a different
+ *	node.
+ *
+ *	The caller must hold a reference on the port.  This call
+ *	may be made with the port unlocked; however, no guarantees
+ *	are made that the port will remain local (or remote) after
+ *	the call completes.  The caller must have additional
+ *	knowledge to be certain that the port doesn't migrate.
+ *
+ *	IP_PORT_NODE:  return the destination node of a port.
+ *	This call is provided as a compatibility hack!  In this
+ *	case, XMM knows about node names.
+ *
+ *	Strictly speaking, this call should only be made on a
+ *	proxy port; however, we mandate that, for a principal,
+ *	the returned value should be the name of the local node.
+ *	XXX Probably shouldn't use node_self in the non-DIPC case. XXX
+ *
+ *	The caller must hold a reference on the port.  No guarantee
+ *	can be made by the distributed IPC subsystem that the port
+ *	will not migrate after this call completes.
+ *
+ */
+
+#define	IP_IS_REMOTE(port)		FALSE
+#define	IP_PORT_NODE(port)		node_self()
+#define IP_WAS_REMOTE(port)		FALSE
+
+#endif	/* _IPC_IPC_PORT_H_ */


Property changes on: trunk/sys/sys/mach/ipc/ipc_port.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_print.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_print.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_print.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+
+#ifndef IPC_PRINT_H
+#define	IPC_PRINT_H
+
+#if 0
+#include <mach_kdb.h>
+#endif
+
+#include <sys/mach/ipc/ipc_pset.h>
+
+extern void ipc_pset_print(
+			ipc_pset_t	pset);
+
+#include <sys/mach/ipc/ipc_port.h>
+
+#if     MACH_KDB
+#include <ddb/db_expr.h>
+
+extern void ipc_port_print(
+			ipc_port_t	port,
+			boolean_t	have_addr,
+			db_expr_t	count,
+			char		*modif);
+
+#include <sys/mach/ipc/ipc_kmsg.h>
+
+extern void	ipc_kmsg_print(
+			ipc_kmsg_t      kmsg);
+
+#include <mach/message.h>
+
+extern void	ipc_msg_print(
+		mach_msg_header_t       *msgh);
+
+extern ipc_port_t ipc_name_to_data(
+			task_t		task,
+			mach_port_t	name);
+
+#endif  /* MACH_KDB */
+#endif	/* IPC_PRINT_H */


Property changes on: trunk/sys/sys/mach/ipc/ipc_print.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_pset.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_pset.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_pset.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,173 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6  91/10/09  16:10:13  af
+ * 	 Revision 2.5.2.1  91/09/16  10:15:55  rpd
+ * 	 	Added (unconditional) ipc_pset_print declaration.
+ * 	 	[91/09/02            rpd]
+ * 
+ * Revision 2.5.2.1  91/09/16  10:15:55  rpd
+ * 	Added (unconditional) ipc_pset_print declaration.
+ * 	[91/09/02            rpd]
+ * 
+ * Revision 2.5  91/05/14  16:35:58  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:23:20  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:50:34  mrt]
+ * 
+ * Revision 2.3  90/11/05  14:29:57  rpd
+ * 	Added ipc_pset_reference, ipc_pset_release.
+ * 	[90/10/29            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:51:23  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:02:09  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_pset.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Definitions for port sets.
+ */
+
+#ifndef	_IPC_IPC_PSET_H_
+#define _IPC_IPC_PSET_H_
+
+#include <sys/mach/port.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/ipc/ipc_object.h>
+#include <sys/mach/ipc/ipc_mqueue.h>
+#if 0
+#include <kern/thread_pool.h>
+#include <kern/rpc_common.h>
+
+#include <mach_kdb.h>
+#endif
+
+typedef struct ipc_pset {
+
+	/*
+	 * Initial sub-structure in common with ipc_port and rpc_port.
+	 * First element of pset_comm is an ipc_object.
+	 */
+	struct rpc_common_data	pset_comm;
+
+	mach_port_name_t		ips_local_name;
+	struct knlist			ips_note;
+	struct sx				ips_note_lock;
+	TAILQ_HEAD(_ips_ports, ipc_port) ips_ports;
+} *ipc_pset_t;
+
+#define ips_object		pset_comm.rcd_comm.icd_object
+#define	ips_references		ips_object.io_references
+#define ips_kobject		pset_comm.rcd_comm.icd_kobject
+#define ips_subsystem		pset_comm.rcd_comm.icd_subsystem
+#define ips_receiver_name	pset_comm.rcd_comm.icd_receiver_name
+#define ips_thread_pool		pset_comm.rcd_thread_pool
+
+#define	IPS_NULL		((ipc_pset_t) IO_NULL)
+
+#define	ips_active(pset)	io_active(&(pset)->ips_object)
+#define	ips_lock(pset)		io_lock(&(pset)->ips_object)
+#define	ips_lock_owned(pset)		io_lock_owned(&(pset)->ips_object)
+#define	ips_lock_try(pset)	io_lock_try(&(pset)->ips_object)
+#define	ips_unlock(pset)	io_unlock(&(pset)->ips_object)
+#define	ips_reference(pset)	io_reference(&(pset)->ips_object)
+#define	ips_release(pset)	io_release(&(pset)->ips_object)
+
+/* Allocate a port set */
+extern kern_return_t ipc_pset_alloc(
+	ipc_space_t	space,
+	mach_port_name_t	*namep,
+	ipc_pset_t	*psetp);
+
+/* Allocate a port set, with a specific name */
+extern kern_return_t ipc_pset_alloc_name(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_pset_t	*psetp);
+
+/* Remove a port from a port set */
+extern void ipc_pset_remove(
+	ipc_pset_t	pset,
+	ipc_port_t	port);
+
+/* Remove a port from its current port set to the specified port set */
+extern kern_return_t ipc_pset_move(
+	ipc_space_t	space,
+	ipc_port_t	port,
+	ipc_pset_t	nset);
+
+/* Destroy a port_set */
+extern void ipc_pset_destroy(
+	ipc_pset_t	pset);
+
+extern void ipc_pset_signal(
+	ipc_pset_t pset);
+
+#define	ipc_pset_reference(pset)	\
+		ipc_object_reference(&(pset)->ips_object)
+
+#define	ipc_pset_release(pset)		\
+		ipc_object_release(&(pset)->ips_object)
+
+
+#if	MACH_KDB
+int ipc_list_count(struct ipc_kmsg *base);
+#endif	/* MACH_KDB */
+
+#endif	/* _IPC_IPC_PSET_H_ */


Property changes on: trunk/sys/sys/mach/ipc/ipc_pset.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_right.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_right.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_right.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,214 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/14  16:36:32  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:23:39  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:51:08  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:51:35  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:02:56  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_right.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Declarations of functions to manipulate IPC capabilities.
+ */
+
+#ifndef	_IPC_IPC_RIGHT_H_
+#define	_IPC_IPC_RIGHT_H_
+
+#include <sys/mach/kern_return.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_entry.h>
+
+#define	ipc_right_lookup_read(a, b, c)	ipc_right_lookup(a, b, c, 0)
+#define	ipc_right_lookup_write(a, b, c)	ipc_right_lookup(a, b, c, 1)
+
+/* Find an entry in a space, given the name */
+extern kern_return_t ipc_right_lookup(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	*entryp,
+	int xlock);
+
+/* Translate (space, object) -> (name, entry) */
+extern boolean_t ipc_right_reverse(
+	ipc_space_t	space,
+	ipc_object_t	object,
+	mach_port_name_t	*namep,
+	ipc_entry_t	*entryp);
+
+/* Make a dead-name request, returning the registered send-once right */
+extern kern_return_t ipc_right_dnrequest(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	boolean_t	immediate,
+	ipc_port_t	notify,
+	ipc_port_t	*previousp);
+
+/* Cancel a dead-name request and return the send-once right */
+extern ipc_port_t ipc_right_dncancel(
+	ipc_space_t	space,
+	ipc_port_t	port,
+	mach_port_name_t	name,
+	ipc_entry_t	entry);
+
+#define	ipc_right_dncancel_macro(space, port, name, entry)		\
+		(((entry)->ie_request == 0) ? IP_NULL :			\
+		 ipc_right_dncancel((space), (port), (name), (entry)))
+
+/* Check if an entry is being used */
+extern boolean_t ipc_right_inuse(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	entry);
+
+/* Check if the port has died */
+extern boolean_t ipc_right_check(
+	ipc_space_t	space,
+	ipc_port_t	port,
+	mach_port_name_t	name,
+	ipc_entry_t	entry);
+
+/* Clean up an entry in a dead space */
+extern void ipc_right_clean(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	entry);
+
+/* Destroy an entry in a space */
+extern kern_return_t ipc_right_destroy(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	entry);
+
+/* Release a send/send-once/dead-name user reference */
+extern kern_return_t ipc_right_dealloc(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	entry);
+
+/* Modify the user-reference count for a right */
+extern kern_return_t ipc_right_delta(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	ipc_entry_t		entry,
+	mach_port_right_t	right,
+	mach_port_delta_t	delta);
+
+/* Retrieve information about a right */
+extern kern_return_t ipc_right_info(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	ipc_entry_t		entry,
+	mach_port_type_t	*typep,
+	mach_port_urefs_t	*urefsp);
+
+/* Check if a subsequent ipc_right_copyin would succeed */
+extern boolean_t ipc_right_copyin_check(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	ipc_entry_t		entry,
+	mach_msg_type_name_t	msgt_name);
+
+/* Copyin a capability from a space */
+extern kern_return_t ipc_right_copyin(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	ipc_entry_t		entry,
+	mach_msg_type_name_t	msgt_name,
+	boolean_t		deadok,
+	ipc_object_t		*objectp,
+	ipc_port_t		*sorightp);
+
+/* Undo the effects of an ipc_right_copyin */
+extern void ipc_right_copyin_undo(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	ipc_entry_t		entry,
+	mach_msg_type_name_t	msgt_name,
+	ipc_object_t		object,
+	ipc_port_t		soright);
+
+/* Copyin two send rights from a space */
+extern kern_return_t ipc_right_copyin_two(
+	ipc_space_t	space,
+	mach_port_name_t	name,
+	ipc_entry_t	entry,
+	ipc_object_t	*objectp,
+	ipc_port_t	*sorightp);
+
+/* Copyout a capability to a space */
+extern kern_return_t ipc_right_copyout(
+	ipc_space_t		space,
+	mach_port_name_t		name,
+	ipc_entry_t		entry,
+	mach_msg_type_name_t	msgt_name,
+	ipc_object_t		object);
+
+/* Reanme a capability */
+extern kern_return_t ipc_right_rename(
+	ipc_space_t	space,
+	mach_port_name_t	oname,
+	ipc_entry_t	oentry,
+	mach_port_name_t	nname,
+	ipc_entry_t	nentry);
+
+#endif	/* _IPC_IPC_RIGHT_H_ */


Property changes on: trunk/sys/sys/mach/ipc/ipc_right.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_space.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_space.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_space.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,203 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.7  91/06/17  15:46:29  jsb
+ * 	Renamed NORMA conditionals.
+ * 	[91/06/17  10:45:36  jsb]
+ * 
+ * Revision 2.6  91/05/14  16:36:57  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.5  91/03/16  14:48:45  rpd
+ * 	Added is_growing.
+ * 	[91/03/04            rpd]
+ * 
+ * Revision 2.4  91/02/05  17:23:48  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:51:32  mrt]
+ * 
+ * Revision 2.3  90/09/28  16:55:23  jsb
+ * 	Added NORMA_IPC support.
+ * 	[90/09/28  14:04:12  jsb]
+ * 
+ * Revision 2.2  90/06/02  14:51:43  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:03:27  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_space.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Definitions for IPC spaces of capabilities.
+ */
+
+#ifndef	_IPC_IPC_SPACE_H_
+#define _IPC_IPC_SPACE_H_
+
+#include <sys/mach/kern_return.h>
+
+#include <vm/uma.h>
+#include <sys/mach/ipc/ipc_entry.h>
+#include <sys/mach/ipc/ipc_types.h>
+#include <sys/lock.h>
+#include <sys/rwlock.h>
+
+/*
+ *	Every task has a space of IPC capabilities.
+ *	IPC operations like send and receive use this space.
+ *	IPC kernel calls manipulate the space of the target task.
+ *
+ *	Every space has a non-NULL is_table with is_table_size entries.
+ *	A space may have a NULL is_tree.  is_tree_small records the
+ *	number of entries in the tree that, if the table were to grow
+ *	to the next larger size, would move from the tree to the table.
+ *
+ *	is_growing marks when the table is in the process of growing.
+ *	When the table is growing, it can't be freed or grown by another
+ *	thread, because of krealloc/kmem_realloc's requirements.
+ *
+ */
+
+typedef natural_t ipc_space_refs_t;
+
+struct ipc_space {
+	decl_mutex_data(,is_ref_lock_data)
+	ipc_space_refs_t is_references;
+	LIST_HEAD(, ipc_entry) is_entry_list;
+	struct rwlock is_lock_data;
+	boolean_t is_active;		/* is the space alive? */
+	boolean_t is_growing;		/* is the space growing? */
+	ipc_entry_t *is_table;		/* an array of entries */
+	ipc_entry_num_t is_table_size;	/* current size of table */
+	struct ipc_table_size *is_table_next; /* info for larger table */
+	task_t is_task;
+	ipc_entry_num_t is_tree_total;	/* number of entries in the tree */
+	ipc_entry_num_t is_tree_small;	/* # of small entries in the tree */
+	ipc_entry_num_t is_tree_hash;	/* # of hashed entries in the tree */
+	boolean_t is_fast;              /* for is_fast_space() */
+};
+
+#define	IS_NULL			((ipc_space_t) 0)
+
+extern uma_zone_t ipc_space_zone;
+
+#define is_alloc()		((ipc_space_t) uma_zalloc(ipc_space_zone, M_WAITOK))
+#define	is_free(is)		uma_zfree(ipc_space_zone, (is))
+
+extern ipc_space_t ipc_space_kernel;
+extern ipc_space_t ipc_space_reply;
+
+#define is_fast_space(is)	((is)->is_fast)
+
+#define	is_ref_lock_init(is)	mach_mutex_init(&(is)->is_ref_lock_data, \
+					   "ETAP_IPC_IS_REF")
+
+#define	ipc_space_reference_macro(is)					\
+MACRO_BEGIN								\
+	mtx_lock(&(is)->is_ref_lock_data);				\
+	assert((is)->is_references > 0);				\
+	(is)->is_references++;						\
+	mtx_unlock(&(is)->is_ref_lock_data);				\
+MACRO_END
+
+#define	ipc_space_release_macro(is)					\
+MACRO_BEGIN								\
+	ipc_space_refs_t _refs;						\
+									\
+	mtx_lock(&(is)->is_ref_lock_data);				\
+	assert((is)->is_references > 0);				\
+	_refs = --(is)->is_references;					\
+	mtx_unlock(&(is)->is_ref_lock_data);				\
+									\
+	if (_refs == 0)							\
+		is_free(is);		\
+MACRO_END
+#define	is_lock_init(is)	rw_init(&(is)->is_lock_data, "ETAP_IPC_IS")
+
+#define	is_read_lock(is)	rw_rlock(&(is)->is_lock_data)
+#define is_read_unlock(is)	rw_runlock(&(is)->is_lock_data)
+
+#define	is_write_lock(is)	rw_wlock(&(is)->is_lock_data)
+#define	is_write_lock_try(is)	rw_trywlock(&(is)->is_lock_data)
+#define is_write_unlock(is)	rw_wunlock(&(is)->is_lock_data)
+
+#define	is_write_to_read_lock(is) rw_downgrade(&(is)->is_lock_data)
+
+
+/* Take a reference on a space */
+extern void ipc_space_reference(
+	ipc_space_t	space);
+
+/* Realase a reference on a space */
+extern void ipc_space_release(
+	ipc_space_t	space);
+
+#define	is_reference(is)	ipc_space_reference(is)
+#define	is_release(is)		ipc_space_release(is)
+
+/* Create  new IPC space */
+extern kern_return_t ipc_space_create(
+	ipc_table_size_t	initial,
+	ipc_space_t		*spacep);
+
+/* Create a special IPC space */
+extern kern_return_t ipc_space_create_special(
+	ipc_space_t	*spacep);
+
+/* Mark a space as dead and cleans up the entries*/
+extern void ipc_space_destroy(
+	ipc_space_t	space);
+
+#endif	/* _IPC_IPC_SPACE_H_ */


Property changes on: trunk/sys/sys/mach/ipc/ipc_space.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_table.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_table.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_table.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,179 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5  91/05/14  16:37:52  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/03/16  14:49:01  rpd
+ * 	Added ipc_table_realloc.
+ * 	[91/03/04            rpd]
+ * 
+ * Revision 2.3  91/02/05  17:24:19  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:52:19  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:52:02  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:04:35  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_table.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Definitions for tables, used for IPC capabilities (ipc_entry_t)
+ *	and dead-name requests (ipc_port_request_t).
+ */
+
+#ifndef	_IPC_IPC_TABLE_H_
+#define	_IPC_IPC_TABLE_H_
+
+
+/*
+ *	The is_table_next field of an ipc_space_t points to
+ *	an ipc_table_size structure.  These structures must
+ *	be elements of an array, ipc_table_entries.
+ *
+ *	The array must end with two elements with the same its_size value.
+ *	Except for the terminating element, the its_size values must
+ *	be strictly increasing.  The largest (last) its_size value
+ *	must be less than or equal to MACH_PORT_INDEX(MACH_PORT_DEAD).
+ *	This ensures that
+ *		1) MACH_PORT_INDEX(MACH_PORT_DEAD) isn't a valid index
+ *		in the table, so ipc_entry_get won't allocate it.
+ *		2) MACH_PORT_MAKE(index+1, 0) and MAKE_PORT_MAKE(size, 0)
+ *		won't ever overflow.
+ *
+ *
+ *	The ipr_size field of the first element in a table of
+ *	dead-name requests (ipc_port_request_t) points to the
+ *	ipc_table_size structure.  The structures must be elements
+ *	of ipc_table_dnrequests.  ipc_table_dnrequests must end
+ *	with an element with zero its_size, and except for this last
+ *	element, the its_size values must be strictly increasing.
+ *
+ *	The is_table_next field points to the ipc_table_size structure
+ *	for the next larger size of table, not the one currently in use.
+ *	The ipr_size field points to the currently used ipc_table_size.
+ */
+
+typedef natural_t ipc_table_index_t;	/* index into tables */
+typedef natural_t ipc_table_elems_t;	/* size of tables */
+
+typedef struct ipc_table_size {
+	ipc_table_elems_t its_size;	/* number of elements in table */
+} *ipc_table_size_t;
+
+#define	ITS_NULL	((ipc_table_size_t) 0)
+#define ITS_SIZE_NONE	-1
+
+extern ipc_table_size_t ipc_table_entries;
+extern ipc_table_size_t ipc_table_dnrequests;
+
+/* Initialize IPC capabilities table storage */
+extern void ipc_table_init(void);
+
+/*
+ *	Note that ipc_table_alloc, ipc_table_realloc, and ipc_table_free
+ *	all potentially use the VM system.  Hence simple locks can't
+ *	be held across them.
+ *
+ *	We can't use a copying realloc, because the realloc happens
+ *	with the data unlocked.  ipc_table_realloc remaps the data,
+ *	so it is OK.
+ */
+
+/* Allocate a table */
+extern vm_offset_t ipc_table_alloc(
+	vm_size_t	size);
+
+/* Reallocate a big table */
+extern vm_offset_t ipc_table_realloc(
+	vm_size_t	old_size,
+	vm_offset_t	old_table,
+	vm_size_t	new_size);
+
+/* Free a table */
+extern void ipc_table_free(
+	vm_size_t	size,
+	vm_offset_t	table);
+
+#define	it_entries_alloc(its)						\
+	((ipc_entry_t *)							\
+	 ipc_table_alloc((its)->its_size * sizeof(struct ipc_entry *)))
+
+#define it_entries_reallocable(its)					\
+	(((its)->its_size * sizeof(struct ipc_entry *)) >= PAGE_SIZE)
+
+#define	it_entries_realloc(its, table, nits)				\
+	((ipc_entry_t *)							\
+	 ipc_table_realloc((its)->its_size * sizeof(struct ipc_entry *),	\
+			   (vm_offset_t)(table),			\
+			   (nits)->its_size * sizeof(struct ipc_entry *)))
+
+#define	it_entries_free(its, table)					\
+	ipc_table_free((its)->its_size * sizeof(struct ipc_entry *),	\
+		       (vm_offset_t)(table))
+
+#define	it_dnrequests_alloc(its)					\
+	((ipc_port_request_t)						\
+	 ipc_table_alloc((its)->its_size *				\
+			 sizeof(struct ipc_port_request)))
+
+#define	it_dnrequests_free(its, table)					\
+	ipc_table_free((its)->its_size *				\
+		       sizeof(struct ipc_port_request),			\
+		       (vm_offset_t)(table))
+
+#endif	/* _IPC_IPC_TABLE_H_ */


Property changes on: trunk/sys/sys/mach/ipc/ipc_table.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_thread.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_thread.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_thread.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,169 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/14  16:38:20  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:24:26  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:52:42  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:52:10  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:05:03  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_thread.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Definitions for the IPC component of threads.
+ */
+
+#ifndef	_IPC_IPC_THREAD_H_
+#define _IPC_IPC_THREAD_H_
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/proc.h>
+
+typedef	struct timer_elt	timer_elt_data_t;
+
+typedef thread_t ipc_thread_t;
+
+#define counter(x)
+
+
+#define	ITH_NULL		THREAD_NULL
+
+typedef struct ipc_thread_queue {
+	ipc_thread_t ithq_base;
+} *ipc_thread_queue_t;
+
+#define	ITHQ_NULL		((ipc_thread_queue_t) 0)
+
+
+#define	ipc_thread_links_init(thread)		\
+MACRO_BEGIN					\
+	(thread)->ith_next = (thread);		\
+	(thread)->ith_prev = (thread);		\
+MACRO_END
+
+#define	ipc_thread_queue_init(queue)		\
+MACRO_BEGIN					\
+	(queue)->ithq_base = ITH_NULL;		\
+MACRO_END
+
+#define	ipc_thread_queue_empty(queue)	((queue)->ithq_base == ITH_NULL)
+
+#define	ipc_thread_queue_first(queue)	((queue)->ithq_base)
+
+#define	ipc_thread_rmqueue_first_macro(queue, thread)			\
+MACRO_BEGIN								\
+	register ipc_thread_t _next;					\
+									\
+	assert((queue)->ithq_base == (thread));				\
+									\
+	_next = (thread)->ith_next;					\
+	if (_next == (thread)) {					\
+		assert((thread)->ith_prev == (thread));			\
+		(queue)->ithq_base = ITH_NULL;				\
+	} else {							\
+		register ipc_thread_t _prev = (thread)->ith_prev;	\
+									\
+		(queue)->ithq_base = _next;				\
+		_next->ith_prev = _prev;				\
+		_prev->ith_next = _next;				\
+		ipc_thread_links_init(thread);				\
+	}								\
+MACRO_END
+
+#define	ipc_thread_enqueue_macro(queue, thread)				\
+MACRO_BEGIN								\
+	register ipc_thread_t _first = (queue)->ithq_base;		\
+									\
+	if (_first == ITH_NULL) {					\
+		(queue)->ithq_base = (thread);				\
+		assert((thread)->ith_next == (thread));			\
+		assert((thread)->ith_prev == (thread));			\
+	} else {							\
+		register ipc_thread_t _last = _first->ith_prev;		\
+									\
+		(thread)->ith_next = _first;				\
+		(thread)->ith_prev = _last;				\
+		_first->ith_prev = (thread);				\
+		_last->ith_next = (thread);				\
+	}								\
+MACRO_END
+
+/* Enqueue a thread on a message queue */
+extern void ipc_thread_enqueue(
+	ipc_thread_queue_t	queue,
+	ipc_thread_t		thread);
+
+/* Dequeue a thread from a message queue */
+extern ipc_thread_t ipc_thread_dequeue(
+	ipc_thread_queue_t	queue);
+
+/* Remove a thread from a message queue */
+extern void ipc_thread_rmqueue(
+	ipc_thread_queue_t	queue,
+	ipc_thread_t		thread);
+
+/* Check if a thread is on the queue */
+extern boolean_t ipc_thread_inqueue(
+	ipc_thread_queue_t	queue,
+	ipc_thread_t		thread);
+
+#endif	/* _IPC_IPC_THREAD_H_ */


Property changes on: trunk/sys/sys/mach/ipc/ipc_thread.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_types.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_types.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_types.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+
+
+#ifndef	_IPC_TYPES_H_
+#define	_IPC_TYPES_H_
+#ifdef _KERNEL
+#define IPC_OBJECT_NULL		((ipc_object_t) 0)
+#define IPC_OBJECT_DEAD		((ipc_object_t)~0)
+#define IPC_OBJECT_VALID(io)	(((io) != IPC_OBJECT_NULL) && \
+				 ((io) != IPC_OBJECT_DEAD))
+
+#endif
+typedef mach_port_name_t mach_port_index_t;
+#endif	/* _IPC_TYPES_H_ */
+


Property changes on: trunk/sys/sys/mach/ipc/ipc_types.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/ipc_voucher.h
===================================================================
--- trunk/sys/sys/mach/ipc/ipc_voucher.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/ipc_voucher.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,380 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+#ifndef	_IPC_IPC_VOUCHER_H_
+#define	_IPC_IPC_VOUCHER_H_
+
+#include <sys/mach/mach_types.h>
+#if 0
+#include <sys/mach/mach_voucher_types.h>
+#endif
+#include <sys/mach/ipc/ipc_types.h>
+
+#ifdef MACH_KERNEL_PRIVATE
+
+#include <kern/queue.h>
+#include <kern/locks.h>
+#include <kern/simple_lock.h>
+
+/* locking */
+extern lck_grp_t 	ipc_lck_grp;
+extern lck_attr_t 	ipc_lck_attr;
+
+extern void ipc_voucher_init(void);
+
+/* some shorthand for longer types */
+typedef mach_voucher_attr_value_handle_t        iv_value_handle_t;
+typedef mach_voucher_attr_value_reference_t     iv_value_refs_t;
+
+typedef natural_t		iv_refs_t;
+
+typedef natural_t 		iv_index_t;
+#define IV_UNUSED_VALINDEX	((iv_index_t) 0)
+#define IV_UNUSED_KEYINDEX 	((iv_index_t) ~0)
+
+typedef iv_index_t	 	*iv_entry_t;
+#define IVE_NULL		((iv_entry_t) 0)
+
+#define IV_ENTRIES_INLINE MACH_VOUCHER_ATTR_KEY_NUM_WELL_KNOWN
+
+/*
+ * IPC Voucher
+ *
+ * Vouchers are a reference counted immutable (once-created) set of
+ * indexes to particular resource manager attribute values
+ * (which themselves are reference counted).
+ */
+struct ipc_voucher {
+	iv_index_t		iv_hash;	/* checksum hash */
+	iv_index_t		iv_sum;		/* checksum of values */
+	iv_refs_t		iv_refs;	/* reference count */
+	iv_index_t		iv_table_size;	/* size of the voucher table */
+	iv_index_t		iv_inline_table[IV_ENTRIES_INLINE];
+	iv_entry_t		iv_table;	/* table of voucher attr entries */
+	ipc_port_t		iv_port;	/* port representing the voucher */
+	queue_chain_t		iv_hash_link;	/* link on hash chain */
+};
+
+#define IV_NULL 	IPC_VOUCHER_NULL
+
+
+/*
+ * Voucher Attribute Cache Control Object
+ *
+ * This is where the Voucher system stores its caches/references to
+ * returned resource manager attribute values.  Each value only appears
+ * once in the table.  If a value is returned more than once by the
+ * resource manager, the voucher system will increase the reference
+ * on the previous value.  
+ *
+ * The voucher itself contains one entry per key, that indexes into
+ * this table.
+ *
+ * A voucher that does not have an explicit index for a given key
+ * is assumed to have a reference on slot zero - which is where the
+ * voucher system stores the default value for the given attribute
+ * (specified at the time of resource manager registration).
+ *
+ * The ivace_releasing field limits the entry to a single concurrent
+ * return. Without it, a previous release's reply might still be
+ * working its way back to the voucher code, and a subsequent get-
+ * value could return the same value as was previously returned.  If
+ * the resource manager already knew that, it would return a failure
+ * on the return, and all is well.  We just treat the additional made
+ * references on the value as we normally would.  However, if the resource
+ * manager accepted the return, and the get-value response raced the
+ * release's reply, the newly made references will look like an extension
+ * of the old value's cache lifetime, rather than a new one.  Dropping
+ * that new lifetime's references to zero would result in a second 
+ * release callback to the resource manager - this time with the wrong
+ * "made" reference count.  We avoid the race with this flag.
+ */
+
+struct ivac_entry_s {
+	iv_value_handle_t       ivace_value;
+	iv_value_refs_t         ivace_layered:1,     /* layered effective entry */
+	                        ivace_releasing:1,   /* release in progress */
+				ivace_free:1,	     /* on freelist */
+	                        ivace_refs:29;       /* reference count */
+	union {
+		iv_value_refs_t ivaceu_made;         /* made count (non-layered) */
+		iv_index_t      ivaceu_layer;        /* next effective layer (layered) */
+	} ivace_u;
+	iv_index_t              ivace_next;          /* hash or freelist */
+	iv_index_t              ivace_index;         /* hash head (independent) */
+};
+typedef struct ivac_entry_s       ivac_entry;
+typedef ivac_entry              *ivac_entry_t;
+
+#define ivace_made              ivace_u.ivaceu_made
+#define ivace_layer             ivace_u.ivaceu_layer
+
+#define IVACE_NULL              ((ivac_entry_t) 0);
+
+#define IVACE_REFS_MAX          ((1 << 29) - 1)
+
+#define IVAC_ENTRIES_MIN        512
+#define IVAC_ENTRIES_MAX        524288
+
+struct ipc_voucher_attr_control {
+	iv_refs_t               ivac_refs;
+	boolean_t               ivac_is_growing;	/* is the table being grown */
+	ivac_entry_t            ivac_table;		/* table of voucher attr value entries */
+	iv_index_t              ivac_table_size;	/* size of the attr value table */
+	iv_index_t              ivac_init_table_size;	/* size of the attr value table */
+	iv_index_t              ivac_freelist;  	/* index of the first free element */
+	ipc_port_t              ivac_port;		/* port for accessing the cache control  */
+	lck_spin_t              ivac_lock_data;
+	iv_index_t              ivac_key_index;		/* key index for this value */
+};
+typedef ipc_voucher_attr_control_t iv_attr_control_t;
+
+#define IVAC_NULL                  IPC_VOUCHER_ATTR_CONTROL_NULL
+
+extern ipc_voucher_attr_control_t  ivac_alloc(iv_index_t);
+
+#define ivac_lock_init(ivac) \
+	lck_spin_init(&(ivac)->ivac_lock_data, &ipc_lck_grp, &ipc_lck_attr)
+#define ivac_lock_destroy(ivac) \
+	lck_spin_destroy(&(ivac)->ivac_lock_data, &ipc_lck_grp)
+#define	ivac_lock(ivac) \
+	lck_spin_lock(&(ivac)->ivac_lock_data)
+#define	ivac_lock_try(ivac) \
+	lck_spin_try_lock(&(ivac)->ivac_lock_data)
+#define	ivac_unlock(ivac) \
+	lck_spin_unlock(&(ivac)->ivac_lock_data)
+#define ivac_sleep(ivac) lck_spin_sleep(&(ivac)->ivac_lock_data,	\
+					LCK_SLEEP_DEFAULT,		\
+					(event_t)(ivac),		\
+					THREAD_UNINT)
+#define ivac_wakeup(ivac) thread_wakeup((event_t)(ivac))
+
+extern void ivac_dealloc(ipc_voucher_attr_control_t ivac);
+
+static inline void
+ivac_reference(ipc_voucher_attr_control_t ivac)
+{
+	(void)hw_atomic_add(&ivac->ivac_refs, 1);
+}
+
+static inline void
+ivac_release(ipc_voucher_attr_control_t ivac)
+{
+	iv_refs_t refs;
+
+	if (IVAC_NULL == ivac)
+		return;
+
+	refs = hw_atomic_sub(&ivac->ivac_refs, 1);
+	if (refs == 0)
+		ivac_dealloc(ivac);
+}
+
+#define IVAM_NULL IPC_VOUCHER_ATTR_MANAGER_NULL
+
+/*
+ * IPC voucher Resource Manager table element
+ *
+ * Information Associated with a specific registration of
+ * a voucher resource manager.
+ *
+ * NOTE: For now, this table is indexed directly by the key.  In the future,
+ * it will have to be growable and sparse by key.  When that is implemented
+ * the index will be independent from the key (but there will be a hash to
+ * find the index by key).
+ */
+typedef struct ipc_voucher_global_table_element {
+	ipc_voucher_attr_manager_t	ivgte_manager;
+	ipc_voucher_attr_control_t	ivgte_control;
+	mach_voucher_attr_key_t		ivgte_key;
+} ipc_voucher_global_table_element;
+
+typedef ipc_voucher_global_table_element *ipc_voucher_global_table_element_t;
+
+#endif /* MACH_KERNEL_PRIVATE */
+
+/*
+ * IPC voucher attribute recipe
+ *
+ * In-kernel recipe format with an ipc_voucher_t pointer for the previous
+ * voucher reference.
+ */
+#pragma pack(1)
+typedef struct ipc_voucher_attr_recipe_data {
+	mach_voucher_attr_key_t	                key;
+	mach_voucher_attr_recipe_command_t      command;
+	ipc_voucher_t		                previous_voucher;
+	mach_voucher_attr_content_size_t	content_size;
+	uint8_t				        content[];
+} ipc_voucher_attr_recipe_data_t;
+typedef ipc_voucher_attr_recipe_data_t *ipc_voucher_attr_recipe_t;
+typedef mach_msg_type_number_t ipc_voucher_attr_recipe_size_t;
+
+typedef uint8_t *ipc_voucher_attr_raw_recipe_t;
+typedef ipc_voucher_attr_raw_recipe_t ipc_voucher_attr_raw_recipe_array_t;
+typedef mach_msg_type_number_t ipc_voucher_attr_raw_recipe_size_t;
+typedef mach_msg_type_number_t ipc_voucher_attr_raw_recipe_array_size_t;
+
+#pragma pack()
+
+/*
+ * In-kernel Resource Manager Definition
+ *
+ * In-kernel resource managers are defined by a v-table like structure for
+ * the three callouts supported by a resource manager (and release function).
+ *
+ * There is a single in-kernel resource manager that represents all the
+ * outside kernel managers (and reflects the calls through MIG to user-space).
+ */
+
+typedef kern_return_t (*ipc_voucher_attr_manager_release_value_t)(ipc_voucher_attr_manager_t,
+								  mach_voucher_attr_key_t,
+								  mach_voucher_attr_value_handle_t,
+								  mach_voucher_attr_value_reference_t);
+
+typedef kern_return_t (*ipc_voucher_attr_manager_get_value_t)(ipc_voucher_attr_manager_t,
+							      mach_voucher_attr_key_t,
+							      mach_voucher_attr_recipe_command_t,
+							      mach_voucher_attr_value_handle_array_t,
+							      mach_voucher_attr_value_handle_array_size_t,
+							      mach_voucher_attr_content_t,
+							      mach_voucher_attr_content_size_t,
+							      mach_voucher_attr_value_handle_t *,
+							      ipc_voucher_t *);
+
+typedef kern_return_t (*ipc_voucher_attr_manager_extract_content_t)(ipc_voucher_attr_manager_t,
+								    mach_voucher_attr_key_t,
+								    mach_voucher_attr_value_handle_array_t,
+								    mach_voucher_attr_value_handle_array_size_t,
+								    mach_voucher_attr_recipe_command_t *,
+								    mach_voucher_attr_content_t,
+								    mach_voucher_attr_content_size_t *);
+
+typedef kern_return_t (*ipc_voucher_attr_manager_command_t)(ipc_voucher_attr_manager_t,
+							    mach_voucher_attr_key_t,
+							    mach_voucher_attr_value_handle_array_t,
+							    mach_voucher_attr_value_handle_array_size_t,
+							    mach_voucher_attr_command_t,
+							    mach_voucher_attr_content_t,
+							    mach_voucher_attr_content_size_t,
+							    mach_voucher_attr_content_t,
+							    mach_voucher_attr_content_size_t *);
+
+typedef void (*ipc_voucher_attr_manager_release_t)(ipc_voucher_attr_manager_t);
+
+struct ipc_voucher_attr_manager {
+	ipc_voucher_attr_manager_release_value_t	ivam_release_value;
+	ipc_voucher_attr_manager_get_value_t		ivam_get_value;
+	ipc_voucher_attr_manager_extract_content_t	ivam_extract_content;
+	ipc_voucher_attr_manager_command_t		ivam_command;
+	ipc_voucher_attr_manager_release_t		ivam_release;
+};
+
+__BEGIN_DECLS
+
+/* DEBUG/TRACE Convert from a port to a voucher */
+extern uintptr_t unsafe_convert_port_to_voucher(
+	ipc_port_t		port);
+
+/* Convert from a port to a voucher */
+extern ipc_voucher_t convert_port_to_voucher(
+	ipc_port_t		port);
+
+/* Convert from a port name to an ipc_voucher */
+extern ipc_voucher_t convert_port_name_to_voucher(
+	mach_port_name_t	name);
+
+/* add a reference to the specified voucher */
+extern void ipc_voucher_reference(
+	ipc_voucher_t		voucher);
+
+/* drop the voucher reference picked up above */
+extern void ipc_voucher_release(
+	ipc_voucher_t		voucher);
+
+/* deliver voucher notifications */
+extern void ipc_voucher_notify(
+	mach_msg_header_t 	*msg);
+
+/* Convert from a voucher to a port */
+extern ipc_port_t convert_voucher_to_port(
+	ipc_voucher_t		voucher);
+
+/* convert from a voucher attribute control to a port */
+extern ipc_port_t convert_voucher_attr_control_to_port(
+	ipc_voucher_attr_control_t	control);
+
+/* add a reference to the specified voucher */
+extern void ipc_voucher_attr_control_reference(
+	ipc_voucher_attr_control_t	control);
+
+/* drop the reference picked up above */
+extern void ipc_voucher_attr_control_release(
+	ipc_voucher_attr_control_t	control);
+
+/* deliver voucher control notifications */
+extern void ipc_voucher_attr_control_notify(
+	mach_msg_header_t 	*msg);
+
+/* convert from a port to a voucher attribute control */
+extern ipc_voucher_attr_control_t convert_port_to_voucher_attr_control(
+	ipc_port_t 		port);
+
+/*
+ * In-kernel equivalents to the user syscalls
+ */
+extern kern_return_t
+ipc_create_mach_voucher(
+	ipc_voucher_attr_raw_recipe_array_t	 	recipes,
+	ipc_voucher_attr_raw_recipe_array_size_t	recipe_size,
+	ipc_voucher_t 					*new_voucher);
+
+extern kern_return_t
+ipc_voucher_attr_control_create_mach_voucher(
+	ipc_voucher_attr_control_t			control,
+	ipc_voucher_attr_raw_recipe_array_t 		recipes,
+	ipc_voucher_attr_raw_recipe_array_size_t	recipe_size,
+	ipc_voucher_t 					*new_voucher);
+
+extern kern_return_t 
+ipc_register_well_known_mach_voucher_attr_manager(
+	ipc_voucher_attr_manager_t 		manager,
+	mach_voucher_attr_value_handle_t 	default_value,
+        mach_voucher_attr_key_t 		key,
+	ipc_voucher_attr_control_t 		*control);
+
+
+extern kern_return_t
+ipc_register_mach_voucher_attr_manager(
+	ipc_voucher_attr_manager_t 		manager,
+	mach_voucher_attr_value_handle_t 	default_value,
+        mach_voucher_attr_key_t 		*key,
+	ipc_voucher_attr_control_t 		*control);
+
+__END_DECLS
+					     
+#endif	/* _IPC_IPC_VOUCHER_H_ */


Property changes on: trunk/sys/sys/mach/ipc/ipc_voucher.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/mach_msg.h
===================================================================
--- trunk/sys/sys/mach/ipc/mach_msg.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/mach_msg.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,88 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5  91/08/28  11:14:01  jsb
+ * 	Added mach_msg_interrupt.
+ * 	[91/08/03            rpd]
+ * 
+ * Revision 2.4  91/05/14  16:39:03  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:24:59  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:53:24  mrt]
+ * 
+ * Revision 2.2  91/01/08  15:15:23  rpd
+ * 	Created.
+ * 	[90/11/22            rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/mach_msg.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Declarations of internal messaging primitives.
+ */
+
+#ifndef	_IPC_MACH_MSG_H_
+#define _IPC_MACH_MSG_H_
+
+#include <sys/mach/message.h>
+
+/* Indicate if thread waiting on a message is at a clean point */
+#define mach_msg_interruptible(thread) \
+	((thread)->ith_state == MACH_RCV_IN_PROGRESS ||		\
+	 (thread)->ith_state == MACH_RCV_IN_PROGRESS_TIMED)
+
+#endif	/* _IPC_MACH_MSG_H_ */


Property changes on: trunk/sys/sys/mach/ipc/mach_msg.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc/port.h
===================================================================
--- trunk/sys/sys/mach/ipc/port.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc/port.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,103 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5  91/05/14  16:39:33  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:25:23  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  15:53:51  mrt]
+ * 
+ * Revision 2.3  91/01/08  15:15:29  rpd
+ * 	Removed MACH_IPC_GENNOS.
+ * 	[90/11/08            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:52:36  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  21:06:32  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	ipc/ipc_port.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Implementation specific complement to mach/port.h.
+ */
+
+#ifndef	_IPC_PORT_H_
+#define _IPC_PORT_H_
+
+#include <sys/mach/port.h>
+
+#define	MACH_PORT_NGEN(name)		MACH_PORT_MAKE(0, MACH_PORT_GEN(name))
+
+/*
+ *	Typedefs for code cleanliness.  These must all have
+ *	the same (unsigned) type as mach_port_t.
+ */
+
+typedef mach_port_name_t mach_port_gen_t;		/* generation numbers */
+
+
+#define	MACH_PORT_UREFS_MAX	((mach_port_urefs_t) ((1 << 16) - 1))
+
+#define	MACH_PORT_UREFS_OVERFLOW(urefs, delta)				\
+		(((delta) > 0) &&					\
+		 ((((urefs) + (delta)) <= (urefs)) ||			\
+		  (((urefs) + (delta)) > MACH_PORT_UREFS_MAX)))
+
+#define	MACH_PORT_UREFS_UNDERFLOW(urefs, delta)				\
+		(((delta) < 0) && (-(delta) > (urefs)))
+
+#endif	/* _IPC_PORT_H_ */


Property changes on: trunk/sys/sys/mach/ipc/port.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc_common.h
===================================================================
--- trunk/sys/sys/mach/ipc_common.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc_common.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+
+#ifndef	_MACH_IPC_COMMON_H_
+#define _MACH_IPC_COMMON_H_
+
+typedef vm_offset_t ipc_kobject_t;	/* for kern/ipc_kobject.h	*/
+
+typedef natural_t ipc_object_refs_t;	/* for ipc/ipc_object.h		*/
+typedef natural_t ipc_object_bits_t;
+typedef natural_t ipc_object_type_t;
+
+/*
+ * There is no lock in the ipc_object; it is in the enclosing kernel
+ * data structure (rpc_common_data) used by both ipc_port and ipc_pset.
+ * The ipc_object is used to both tag and reference count these two data
+ * structures, and (Noto Bene!) pointers to either of these or the
+ * ipc_object at the head of these are freely cast back and forth; hence
+ * the ipc_object MUST BE FIRST in the ipc_common_data.
+ * 
+ * If the RPC implementation enabled user-mode code to use kernel-level
+ * data structures (as ours used to), this peculiar structuring would
+ * avoid having anything in user code depend on the kernel configuration
+ * (with which lock size varies).
+ */
+struct ipc_object {
+	ipc_object_refs_t io_references;
+	ipc_object_bits_t io_bits;
+};
+
+/*
+ * Common sub-structure at the head of each
+ * ipc_port and ipc_pset.  This sub-structure could
+ * also safely be made common to user-mode RPC
+ * code.
+ */
+typedef struct ipc_common_data {
+	struct ipc_object	icd_object;
+	ipc_kobject_t		icd_kobject;
+	struct rpc_subsystem *	icd_subsystem;
+	mach_port_name_t		icd_receiver_name;
+} *ipc_common_t;
+
+#endif	/* _MACH_IPC_COMMON_H_ */


Property changes on: trunk/sys/sys/mach/ipc_common.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc_host.h
===================================================================
--- trunk/sys/sys/mach/ipc_host.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc_host.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2000-2007 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+#ifndef	_KERN_IPC_HOST_H_
+#define	_KERN_IPC_HOST_H_
+
+#include <sys/mach/port.h>
+
+
+/* Initialize IPC host services */
+extern void ipc_host_init(void);
+
+/* Initialize ipc access to processor by allocating a port */
+extern void ipc_processor_init(
+	processor_t	processor);
+
+/* Enable ipc control of processor by setting port object */
+extern void ipc_processor_enable(
+	processor_t	processor);
+
+/* Initialize ipc control of a processor set */
+extern void ipc_pset_init(
+	processor_set_t		pset);
+
+/* Enable ipc access to a processor set */
+extern void ipc_pset_enable(
+	processor_set_t		pset);
+
+/* Initialize ipc control of a clock */
+extern void ipc_clock_init(
+	mach_clock_t		clock);
+
+/* Enable ipc access to a clock */
+extern void ipc_clock_enable(
+	mach_clock_t		clock);
+
+/* Convert from a port to a clock */
+extern mach_clock_t convert_port_to_clock(
+	ipc_port_t	port);
+
+/* Convert from a port to a clock control */
+extern mach_clock_t convert_port_to_clock_ctrl(
+	ipc_port_t	port);
+
+/* Convert from a clock to a port */
+extern ipc_port_t convert_clock_to_port(
+	mach_clock_t		clock);
+
+/* Convert from a clock control to a port */
+extern ipc_port_t convert_clock_ctrl_to_port(
+	mach_clock_t		clock);
+
+/* Convert from a clock name to a clock pointer */
+extern mach_clock_t port_name_to_clock(
+	mach_port_name_t clock_name);
+
+/* Convert from a port to a host */
+extern host_t convert_port_to_host(
+	ipc_port_t	port);
+
+/* Convert from a port to a host privilege port */
+extern host_t convert_port_to_host_priv(
+	ipc_port_t	port);
+
+/*  Convert from a port to a host paging port */
+extern host_t convert_port_to_host_paging(
+	ipc_port_t	port);
+
+/* Convert from a host to a port */
+extern ipc_port_t convert_host_to_port(
+	host_t		host);
+
+/* Convert from a port to a processor */
+extern processor_t convert_port_to_processor(
+	ipc_port_t	port);
+
+/* Convert from a processor to a port */
+extern ipc_port_t convert_processor_to_port(
+	processor_t	processor);
+
+/* Convert from a port to a processor set */
+extern processor_set_t convert_port_to_pset(
+	ipc_port_t	port);
+
+/* Convert from a port to a processor set name */
+extern processor_set_t convert_port_to_pset_name(
+	ipc_port_t	port);
+
+/* Convert from a processor set to a port */
+extern ipc_port_t convert_pset_to_port(
+	processor_set_t		processor);
+
+/* Convert from a processor set name to a port */
+extern ipc_port_t convert_pset_name_to_port(
+	processor_set_t		processor);
+
+/* Convert from a port to a host security port */
+extern host_t convert_port_to_host_security(
+        ipc_port_t	port);
+
+
+#endif	/* _KERN_IPC_HOST_H_ */


Property changes on: trunk/sys/sys/mach/ipc_host.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc_kobject.h
===================================================================
--- trunk/sys/sys/mach/ipc_kobject.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc_kobject.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,190 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6.4.4  92/06/24  18:05:20  jeffreyh
+ * 	Added IKOT_HOST_PAGING
+ * 	[92/06/24  17:51:05  jeffreyh]
+ * 
+ * Revision 2.6.4.3  92/03/03  16:20:05  jeffreyh
+ * 	Merge in mainline. Number for IKOT_PAGING_NAME
+ * 	needed to change to avoid merge conflicts.
+ * 	[92/02/24            jeffreyh]
+ * 
+ * Revision 2.7  92/01/14  16:44:52  rpd
+ * 	Added IKOT_PAGING_NAME.
+ * 	[91/12/28            rpd]
+ * 
+ * Revision 2.6.4.2  92/02/21  11:23:53  jsb
+ * 	Added IKOT_PAGER_TERMINATING.
+ * 	[92/02/16  16:14:31  jsb]
+ * 
+ * 	One more xmm kobject shuffle.
+ * 	[92/02/10  16:36:53  jsb]
+ * 
+ * 	Removed IKOT_XMM_{MOBJ,KOBJ}; added IKOT_XMM_{PAGING,PROXY}_REQUEST.
+ * 	[92/02/09  14:43:55  jsb]
+ * 
+ * Revision 2.6.4.1  92/01/21  21:50:45  jsb
+ * 	Added IKOT_XMM_{MOBJ,KOBJ,REPLY}.
+ * 	[92/01/21  18:59:57  jsb]
+ * 
+ * Revision 2.6  91/08/28  11:14:31  jsb
+ * 	Add support for using page lists with devices.  Split the macro
+ * 	that says whether to use page lists into a macro that says whether
+ * 	to use them (vm_page_list) and a macro that says whether the pages
+ * 	should be stolen (vm_page_steal).
+ * 	[91/07/31  15:05:17  dlb]
+ * 
+ * Revision 2.5  91/07/01  08:24:58  jsb
+ * 	For NORMA_VM: added IKOT_XMM_PAGER, for memory_objects mapped only
+ * 	by other kernels.
+ * 
+ * 	From David Black at OSF: added ipc_kobject_vm_special.
+ * 	[91/06/29  14:33:34  jsb]
+ * 
+ * Revision 2.4  91/05/14  16:42:08  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:26:40  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  16:12:58  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:54:12  rpd
+ * 	Created for new IPC.
+ * 	[90/03/26  23:47:04  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	kern/ipc_kobject.h
+ *	Author:	Rich Draves
+ *	Date:	1989
+ *
+ *	Declarations for letting a port represent a kernel object.
+ */
+
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc_common.h>	/* for ipc_kobject_t */
+
+#ifndef	_KERN_IPC_KOBJECT_H_
+#define _KERN_IPC_KOBJECT_H_
+
+#include <sys/mach/vm_types.h>
+
+#define	IKO_NULL	((ipc_kobject_t) 0)
+
+typedef natural_t ipc_kobject_type_t;
+
+#define	IKOT_NONE		0
+#define IKOT_THREAD		1
+#define	IKOT_TASK		2
+#define	IKOT_HOST		3
+#define	IKOT_HOST_PRIV		4
+#define	IKOT_PROCESSOR		5
+#define	IKOT_PSET		6
+#define	IKOT_PSET_NAME		7
+#define	IKOT_PAGER		8
+#define	IKOT_PAGING_REQUEST	9
+#define	IKOT_DEVICE		10
+#define	IKOT_XMM_OBJECT		11
+#define	IKOT_XMM_PAGER		12
+#define	IKOT_XMM_KERNEL		13
+#define	IKOT_XMM_REPLY		14
+#define	IKOT_PAGER_TERMINATING	15
+#define IKOT_HOST_SECURITY	17
+#define	IKOT_LEDGER		18
+#define IKOT_MASTER_DEVICE	19
+#define IKOT_ACT		20
+#define IKOT_SUBSYSTEM		21
+#define IKOT_IO_DONE_QUEUE	22
+#define IKOT_SEMAPHORE		23
+#define IKOT_LOCK_SET		24
+#define IKOT_CLOCK		25
+#define IKOT_CLOCK_CTRL		26
+					/* << new entries here	*/
+#define	IKOT_UNKNOWN		27	/* magic catchall	*/
+#define	IKOT_MAX_TYPE		28	/* # of IKOT_ types	*/
+ /* Please keep ipc/ipc_object.c:ikot_print_array up to date	*/
+
+#define is_ipc_kobject(ikot)	(ikot != IKOT_NONE)
+
+/*
+ *	Define types of kernel objects that use page lists instead
+ *	of entry lists for copyin of out of line memory.
+ */
+
+#define ipc_kobject_vm_page_list(ikot) 			\
+	((ikot == IKOT_PAGING_REQUEST) || (ikot == IKOT_DEVICE))
+
+#define ipc_kobject_vm_page_steal(ikot)	(ikot == IKOT_PAGING_REQUEST)
+
+/* Initialize kernel server dispatch table */
+extern void mig_init(void);
+
+/* Dispatch a kernel server function */
+extern ipc_kmsg_t ipc_kobject_server(
+	ipc_kmsg_t	request);
+
+/* Make a port represent a kernel object of the given type */
+extern void ipc_kobject_set(
+	ipc_port_t		port,
+	ipc_kobject_t		kobject,
+	ipc_kobject_type_t	type);
+
+/* Release any kernel object resources associated with a port */
+extern void ipc_kobject_destroy(
+	ipc_port_t		port);
+
+#define	null_conversion(port)	(port)
+
+#endif	/* _KERN_IPC_KOBJECT_H_ */


Property changes on: trunk/sys/sys/mach/ipc_kobject.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc_mig.h
===================================================================
--- trunk/sys/sys/mach/ipc_mig.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc_mig.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+
+#ifndef	_KERN_IPC_MIG_H_
+#define	_KERN_IPC_MIG_H_
+
+#include <sys/cdefs.h>
+
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#if 0
+#include <sys/mach/kern_types.h>
+#endif
+
+#ifdef	XNU_KERNEL_PRIVATE
+
+#include <sys/kdebug.h>
+
+/*
+ * Define the trace points for MIG-generated calls.  One traces the input parameters
+ * to MIG called things, another traces the outputs, and one traces bad message IDs.
+ */
+#ifdef _MIG_TRACE_PARAMETERS_
+
+#define __BeforeRcvCallTrace(msgid,arg1,arg2,arg3,arg4)				      \
+	KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,          \
+			      KDBG_MIGCODE(msgid) | DBG_FUNC_START,   \
+			      (unsigned int)(arg1),				      \
+			      (unsigned int)(arg2),				      \
+			      (unsigned int)(arg3),				      \
+			      (unsigned int)(arg4),				      \
+			      (unsigned int)(0));
+
+#define __AfterRcvCallTrace(msgid,arg1,arg2,arg3,arg4)				      \
+	KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,          \
+			      KDBG_MIGCODE(msgid) | DBG_FUNC_END,     \
+			      (unsigned int)(arg1),				      \
+			      (unsigned int)(arg2),				      \
+			      (unsigned int)(arg3),				      \
+			      (unsigned int)(arg4),				      \
+			      (unsigned int)(0));
+
+#define __BeforeSimpleCallTrace(msgid,arg1,arg2,arg3,arg4)			      \
+	KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,          \
+			      KDBG_MIGCODE(msgid) | DBG_FUNC_START,   \
+			      (unsigned int)(arg1),				      \
+			      (unsigned int)(arg2),				      \
+			      (unsigned int)(arg3),				      \
+			      (unsigned int)(arg4),				      \
+			      (unsigned int)(0));
+
+#define __AfterSimpleCallTrace(msgid,arg1,arg2,arg3,arg4)			      \
+	KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,          \
+	              KDBG_MIGCODE(msgid) | DBG_FUNC_END,     \
+			      (unsigned int)(arg1),				      \
+			      (unsigned int)(arg2),				      \
+			      (unsigned int)(arg3),				      \
+			      (unsigned int)(arg4),				      \
+			      (unsigned int)(0));
+
+#else /* !_MIG_TRACE_PARAMETERS_ */
+
+#define	__BeforeRcvRpc(msgid, _NAME_)						      \
+	KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,          \
+			      KDBG_MIGCODE(msgid) | DBG_FUNC_START,   \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0));
+
+#define	__AfterRcvRpc(msgid, _NAME_)						      \
+	KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,          \
+	              KDBG_MIGCODE(msgid) | DBG_FUNC_END,     \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0));
+
+
+#define	__BeforeRcvSimple(msgid, _NAME_)					      \
+	KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,          \
+			      KDBG_MIGCODE(msgid) | DBG_FUNC_START,   \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0));
+
+#define	__AfterRcvSimple(msgid, _NAME_)						      \
+	KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,          \
+			      KDBG_MIGCODE(msgid) | DBG_FUNC_END,     \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0));
+
+#endif /* !_MIG_TRACE_PARAMETERS_ */
+
+#define _MIG_MSGID_INVALID(msgid)						      \
+	KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,          \
+			      MACHDBG_CODE(DBG_MACH_MSGID_INVALID, (msgid)),  \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0),				      \
+			      (unsigned int)(0))
+
+#endif	/* XNU_KERNEL_PRIVATE */
+
+__BEGIN_DECLS
+
+/* Send a message from the kernel */
+
+extern mach_msg_return_t mach_msg_send_from_kernel_proper(
+	mach_msg_header_t	*msg,
+	mach_msg_size_t		send_size);
+
+#define mach_msg_send_from_kernel mach_msg_send_from_kernel_proper
+
+extern mach_msg_return_t
+mach_msg_rpc_from_kernel_proper(
+	mach_msg_header_t	*msg,
+	mach_msg_size_t		send_size,
+	mach_msg_size_t		rcv_size);
+
+#define mach_msg_rpc_from_kernel mach_msg_rpc_from_kernel_proper
+
+#ifdef XNU_KERNEL_PRIVATE
+extern mach_msg_return_t mach_msg_send_from_kernel_with_options_legacy(
+	mach_msg_header_t	*msg,
+	mach_msg_size_t		send_size,
+	mach_msg_option_t	option,
+	mach_msg_timeout_t	timeout_val);
+#endif /* XNU_KERNEL_PRIVATE */
+
+extern mach_msg_return_t mach_msg_send_from_kernel_with_options(
+	mach_msg_header_t	*msg,
+	mach_msg_size_t		send_size,
+	mach_msg_option_t	option,
+	mach_msg_timeout_t	timeout_val);
+
+__END_DECLS
+
+#ifdef	MACH_KERNEL_PRIVATE
+
+extern void mach_msg_receive_continue(void);
+
+/* Initialize kernel server dispatch table */
+extern void		mig_init(void);
+
+/*
+ * Kernel implementation of the MIG object base class
+ *
+ * Conforms to the MIGObjectInterface defined in <mach/mig.h>
+ * Ports are automatically allocated for the duration of outstanding
+ * cross-task references and then released.  
+ */
+
+typedef struct mig_object {
+			const IMIGObjectVtbl	*pVtbl; /* our interface def */
+			mach_port_t		port;	 /* our port pointer  */
+} mig_object_data_t;
+
+
+/*
+ * MIG notify base class definition
+ * These are chained off the mig object to which the are registered.
+ * When that object triggers a notification delivery, we walk this
+ * chain and deliver the appropriate notification.
+ */
+typedef struct mig_notify_object {
+			const IMIGNotifyObjectVtbl *pVtbl; /* our interface def */
+			mach_port_t		port;	 /* our port pointer  */
+} mig_notify_object_data_t;
+
+extern kern_return_t mig_object_init(
+			mig_object_t		mig_object,
+			const IMIGObject	*interface);
+
+extern void mig_object_destroy(
+			mig_object_t		mig_object);
+
+extern void mig_object_reference(
+			mig_object_t		mig_object);
+
+extern void mig_object_deallocate(
+			mig_object_t		mig_object);
+
+extern ipc_port_t convert_mig_object_to_port(
+			mig_object_t		mig_object);
+
+extern mig_object_t convert_port_to_mig_object(
+			ipc_port_t		port,
+			const MIGIID		*iid);
+
+boolean_t mig_object_no_senders(
+			ipc_port_t		port,
+			mach_port_mscount_t	mscount);
+
+#endif  /* MACH_KERNEL_PRIVATE */
+
+#endif	/* _KERN_IPC_MIG_H_ */


Property changes on: trunk/sys/sys/mach/ipc_mig.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc_sync.h
===================================================================
--- trunk/sys/sys/mach/ipc_sync.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc_sync.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ * 
+ */
+#ifndef _KERN_IPC_SYNC_H_
+#define _KERN_IPC_SYNC_H_
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/ipc/ipc_types.h>
+
+semaphore_t convert_port_to_semaphore (ipc_port_t port);
+ipc_port_t  convert_semaphore_to_port (semaphore_t semaphore);
+#ifdef SHOW_UNUSED
+lock_set_t  convert_port_to_lock_set  (ipc_port_t port);
+ipc_port_t  convert_lock_set_to_port  (lock_set_t lock_set);
+#endif
+kern_return_t	port_name_to_semaphore(
+				      mach_port_name_t	name,
+				      semaphore_t	*semaphore);
+
+extern  void            semaphore_reference     (semaphore_t semaphore);
+extern  void            semaphore_dereference   (semaphore_t semaphore);
+
+#endif /* _KERN_IPC_SYNC_H_ */


Property changes on: trunk/sys/sys/mach/ipc_sync.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ipc_tt.h
===================================================================
--- trunk/sys/sys/mach/ipc_tt.h	                        (rev 0)
+++ trunk/sys/sys/mach/ipc_tt.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+#ifndef	_KERN_IPC_TT_H_
+#define _KERN_IPC_TT_H_
+
+#include <sys/mach/port.h>
+#include <sys/mach/ipc_kobject.h>
+#include <sys/mach/ipc/ipc_space.h>
+#include <sys/mach/ipc/ipc_table.h>
+#include <sys/mach/ipc/ipc_port.h>
+#include <sys/mach/ipc/ipc_right.h>
+#include <sys/mach/ipc/ipc_entry.h>
+#include <sys/mach/ipc/ipc_object.h>
+
+
+/* Initialize a task's IPC state */
+extern void ipc_task_init(
+	task_t		task,
+	task_t		parent);
+
+/* Enable a task for IPC access */
+extern void ipc_task_enable(
+	task_t		task);
+
+/* Disable IPC access to a task */
+extern void ipc_task_disable(
+	task_t		task);
+
+/* Clear out a task's IPC state */
+extern void ipc_task_reset(
+	task_t		task);
+
+/* Clean up and destroy a task's IPC state */
+extern void ipc_task_terminate(
+	task_t		task);
+
+/* Initialize a thread's IPC state */
+extern void ipc_thread_init(
+	thread_t	thread);
+
+extern void ipc_thread_init_exc_actions(
+	thread_t	thread);
+
+extern void ipc_thread_destroy_exc_actions(
+	thread_t	thread);
+
+/* Disable IPC access to a thread */
+extern void ipc_thread_disable(
+	thread_t	thread);
+
+/* Clean up and destroy a thread's IPC state */
+extern void ipc_thread_terminate(
+	thread_t	thread);
+
+/* Clear out a thread's IPC state */
+extern void ipc_thread_reset(
+	thread_t	thread);
+
+/* Return a send right for the task's user-visible self port */
+extern ipc_port_t retrieve_task_self_fast(
+	task_t		task);
+
+/* Return a send right for the thread's user-visible self port */
+extern ipc_port_t retrieve_thread_self_fast(
+	thread_t	thread);
+
+/* Convert from a port to a task name */
+extern task_name_t convert_port_to_task_name(
+	ipc_port_t	port);
+
+/* Convert from a port to a task */
+extern task_t convert_port_to_task(
+	ipc_port_t	port);
+
+extern task_t port_name_to_task(
+	mach_port_name_t name);
+
+extern boolean_t ref_task_port_locked(
+	ipc_port_t port, task_t *ptask);
+
+/* Convert from a port to a space */
+extern ipc_space_t convert_port_to_space(
+	ipc_port_t	port);
+
+extern boolean_t ref_space_port_locked(
+	ipc_port_t port, ipc_space_t *pspace);
+
+/* Convert from a port to a map */
+extern vm_map_t convert_port_to_map(
+	ipc_port_t	port);
+
+/* Convert from a port to a thread */
+extern thread_t	convert_port_to_thread(
+	ipc_port_t		port);
+
+extern thread_t	port_name_to_thread(
+	mach_port_name_t	port_name);
+
+/* Deallocate a space ref produced by convert_port_to_space */
+extern void space_deallocate(
+	ipc_space_t		space);
+
+/* Convert from a map entry port to a map */
+extern vm_map_t convert_port_entry_to_map(
+        ipc_port_t      port);
+
+/* Convert from a port to a vm_object */
+extern vm_object_t convert_port_entry_to_object(
+        ipc_port_t      port);
+
+extern ipc_port_t convert_thread_to_port(thread_t);
+
+/* Allocate a reply port */
+extern mach_port_name_t mach_reply_port(void);
+
+
+extern ipc_port_t retrieve_thread_self_fast(thread_t thr_act);
+
+extern void set_security_token(task_t);
+
+
+extern void ipc_thr_act_init(thread_act_t);
+
+extern void ipc_thr_act_terminate(thread_act_t);
+
+#endif	/* _KERN_IPC_TT_H_ */


Property changes on: trunk/sys/sys/mach/ipc_tt.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/kern_return.h
===================================================================
--- trunk/sys/sys/mach/kern_return.h	                        (rev 0)
+++ trunk/sys/sys/mach/kern_return.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,364 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5.2.1  92/09/15  17:23:24  jeffreyh
+ * 	Added KERN_RETURN_MAX, an upper bound on return values
+ * 	[92/07/28            sjs]
+ * 
+ * Revision 2.5  91/05/14  16:54:08  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:33:06  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:17:20  mrt]
+ * 
+ * Revision 2.3  90/08/07  18:00:17  rpd
+ * 	Added KERN_MEMORY_PRESENT (not used yet).
+ * 	[90/08/06            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:58:03  rpd
+ * 	Added codes for new IPC.
+ * 	[90/03/26  22:30:08  rpd]
+ * 
+ * Revision 2.1  89/08/03  16:02:22  rwd
+ * Created.
+ * 
+ * Revision 2.6  89/02/25  18:13:36  gm0w
+ * 	Changes for cleanup.
+ * 
+ * Revision 2.5  89/02/07  00:52:16  mwyoung
+ * Relocated from sys/kern_return.h
+ * 
+ * Revision 2.4  88/08/24  02:31:47  mwyoung
+ * 	Adjusted include file references.
+ * 	[88/08/17  02:15:07  mwyoung]
+ * 
+ * Revision 2.3  88/07/20  16:48:31  rpd
+ * Added KERN_NAME_EXISTS.
+ * Added KERN_ALREADY_IN_SET, KERN_NOT_IN_SET.
+ * Made comments legible.
+ * 
+ *  3-Feb-88  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Added memory management error conditions.
+ *	Documented.
+ *
+ * 23-Feb-87  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Deleted kern_return_t casts on error codes so that they may be
+ *	used in assembly code.
+ *
+ * 17-Sep-85  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Created.
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	h/kern_return.h
+ *	Author:	Avadis Tevanian, Jr.
+ *	Date:	1985
+ *
+ *	Kernel return codes.
+ *
+ */
+
+#ifndef	_MACH_KERN_RETURN_H_
+#define _MACH_KERN_RETURN_H_
+
+typedef int kern_return_t;
+
+/*
+ * N.B.:	If you add errors, please update
+ *			mach_services/lib/libmach/err_kern.sub
+ */
+
+#define KERN_SUCCESS			0
+
+#define KERN_INVALID_ADDRESS		1
+		/* Specified address is not currently valid.
+		 */
+
+#define KERN_PROTECTION_FAILURE		2
+		/* Specified memory is valid, but does not permit the
+		 * required forms of access.
+		 */
+
+#define KERN_NO_SPACE			3
+		/* The address range specified is already in use, or
+		 * no address range of the size specified could be
+		 * found.
+		 */
+
+#define KERN_INVALID_ARGUMENT		4
+		/* The function requested was not applicable to this
+		 * type of argument, or an argument
+		 */
+
+#define KERN_FAILURE			5
+		/* The function could not be performed.  A catch-all.
+		 */
+
+#define KERN_RESOURCE_SHORTAGE		6
+		/* A system resource could not be allocated to fulfill
+		 * this request.  This failure may not be permanent.
+		 */
+
+#define KERN_NOT_RECEIVER		7
+		/* The task in question does not hold receive rights
+		 * for the port argument.
+		 */
+
+#define KERN_NO_ACCESS			8
+		/* Bogus access restriction.
+		 */
+
+#define KERN_MEMORY_FAILURE		9
+		/* During a page fault, the target address refers to a
+		 * memory object that has been destroyed.  This
+		 * failure is permanent.
+		 */
+
+#define KERN_MEMORY_ERROR		10
+		/* During a page fault, the memory object indicated
+		 * that the data could not be returned.  This failure
+		 * may be temporary; future attempts to access this
+		 * same data may succeed, as defined by the memory
+		 * object.
+		 */
+
+/*	KERN_ALREADY_IN_SET		11	obsolete */
+
+#define KERN_NOT_IN_SET			12
+		/* The receive right is not a member of a port set.
+		 */
+
+#define KERN_NAME_EXISTS		13
+		/* The name already denotes a right in the task.
+		 */
+
+#define KERN_ABORTED			14
+		/* The operation was aborted.  Ipc code will
+		 * catch this and reflect it as a message error.
+		 */
+
+#define KERN_INVALID_NAME		15
+		/* The name doesn't denote a right in the task.
+		 */
+
+#define	KERN_INVALID_TASK		16
+		/* Target task isn't an active task.
+		 */
+
+#define KERN_INVALID_RIGHT		17
+		/* The name denotes a right, but not an appropriate right.
+		 */
+
+#define KERN_INVALID_VALUE		18
+		/* A blatant range error.
+		 */
+
+#define	KERN_UREFS_OVERFLOW		19
+		/* Operation would overflow limit on user-references.
+		 */
+
+#define	KERN_INVALID_CAPABILITY		20
+		/* The supplied (port) capability is improper.
+		 */
+
+#define KERN_RIGHT_EXISTS		21
+		/* The task already has send or receive rights
+		 * for the port under another name.
+		 */
+
+#define	KERN_INVALID_HOST		22
+		/* Target host isn't actually a host.
+		 */
+
+#define KERN_MEMORY_PRESENT		23
+		/* An attempt was made to supply "precious" data
+		 * for memory that is already present in a
+		 * memory object.
+		 */
+
+#define KERN_MEMORY_DATA_MOVED		24
+		/* A page was requested of a memory manager via
+		 * memory_object_data_request for an object using
+		 * a MEMORY_OBJECT_COPY_CALL strategy, with the
+		 * VM_PROT_WANTS_COPY flag being used to specify
+		 * that the page desired is for a copy of the
+		 * object, and the memory manager has detected
+		 * the page was pushed into a copy of the object
+		 * while the kernel was walking the shadow chain
+		 * from the copy to the object. This error code
+		 * is delivered via memory_object_data_error
+		 * and is handled by the kernel (it forces the
+		 * kernel to restart the fault). It will not be
+		 * seen by users.
+		 */
+
+#define KERN_MEMORY_RESTART_COPY	25
+		/* A strategic copy was attempted of an object
+		 * upon which a quicker copy is now possible.
+		 * The caller should retry the copy using
+		 * vm_object_copy_quickly. This error code
+		 * is seen only by the kernel.
+		 */
+
+#define KERN_INVALID_PROCESSOR_SET	26
+		/* An argument applied to assert processor set privilege
+		 * was not a processor set control port.
+		 */
+
+#define KERN_POLICY_LIMIT		27
+		/* The specified scheduling attributes exceed the thread's
+		 * limits.
+		 */
+
+#define KERN_INVALID_POLICY		28
+		/* The specified scheduling policy is not currently
+		 * enabled for the processor set.
+		 */
+
+#define KERN_INVALID_OBJECT		29
+		/* The external memory manager failed to initialize the
+		 * memory object.
+		 */
+
+#define KERN_ALREADY_WAITING		30
+		/* A thread is attempting to wait for an event for which 
+		 * there is already a waiting thread.
+		 */
+
+#define KERN_DEFAULT_SET		31
+		/* An attempt was made to destroy the default processor
+		 * set.
+		 */
+
+#define KERN_EXCEPTION_PROTECTED	32
+		/* An attempt was made to fetch an exception port that is
+		 * protected, or to abort a thread while processing a
+		 * protected exception.
+		 */
+
+#define KERN_INVALID_LEDGER		33
+		/* A ledger was required but not supplied.
+		 */
+
+#define KERN_INVALID_MEMORY_CONTROL	34
+		/* The port was not a memory cache control port.
+		 */
+
+#define KERN_INVALID_SECURITY		35
+		/* An argument supplied to assert security privilege 	
+		 * was not a host security port.
+		 */
+		
+#define KERN_NOT_DEPRESSED		36
+		/* thread_depress_abort was called on a thread which
+		 * was not currently depressed.
+		 */
+		
+#define KERN_TERMINATED			37
+		/* Object has been terminated and is no longer available
+		 */
+
+#define KERN_LOCK_SET_DESTROYED		38
+		/* Lock set has been destroyed and is no longer available.
+		 */
+
+#define KERN_LOCK_UNSTABLE		39
+		/* The thread holding the lock terminated before releasing
+		 * the lock
+		 */
+
+#define KERN_LOCK_OWNED			40
+		/* The lock is already owned by another thread
+		 */
+
+#define KERN_LOCK_OWNED_SELF		41
+		/* The lock is already owned by the calling thread
+		 */
+
+#define KERN_SEMAPHORE_DESTROYED	42
+		/* Semaphore has been destroyed and is no longer available.
+		 */
+
+#define KERN_RPC_SERVER_TERMINATED	43
+		/* Return from RPC indicating the target server was 
+		 * terminated before it successfully replied 
+		 */
+
+#define KERN_RPC_TERMINATE_ORPHAN	44
+		/* Terminate an orphaned activation.
+		 */
+
+#define KERN_RPC_CONTINUE_ORPHAN	45
+		/* Allow an orphaned activation to continue executing.
+		 */
+
+#define	KERN_NOT_SUPPORTED			46
+		/* Unsupported operation
+		 */
+
+#define	KERN_NODE_DOWN			47
+		/* Remote node down or inaccessible.
+		 */
+
+#define KERN_NOT_WAITING		48
+		/* A signalled thread was not actually waiting. */
+
+#define	KERN_OPERATION_TIMED_OUT        49
+		/* Some thread-oriented operation (semaphore_wait) timed out
+		 */
+
+#define	KERN_RETURN_MAX			0x100
+		/* Maximum return value allowable
+		 */
+
+#endif	/* _MACH_KERN_RETURN_H_ */


Property changes on: trunk/sys/sys/mach/kern_return.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/mach.h
===================================================================
--- trunk/sys/sys/mach/mach.h	                        (rev 0)
+++ trunk/sys/sys/mach/mach.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,127 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ * MkLinux
+ */
+/* 
+ *  Includes all the types that a normal user
+ *  of Mach programs should need
+ */
+
+#ifndef	_MACH_H_
+#define	_MACH_H_
+
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/mach_interface.h>
+#include <sys/mach/port.h>
+#include <sys/mach/mach_init.h>
+
+/*
+ * Standard prototypes
+ */
+extern void			panic_init(mach_port_t);
+extern void			panic(const char *, ...);
+
+extern void			safe_gets(char *,
+					  char *,
+					  int);
+
+extern void			slot_name(cpu_type_t,
+					  cpu_subtype_t,
+					  char **,
+					  char **);
+
+extern void			mig_reply_setup(mach_msg_header_t *,
+						mach_msg_header_t *);
+
+extern void			mach_msg_destroy(mach_msg_header_t *);
+
+extern mach_msg_return_t	mach_msg_receive(mach_msg_header_t *);
+
+extern mach_msg_return_t	mach_msg_send(mach_msg_header_t *);
+
+extern mach_msg_return_t	mach_msg_server_once(boolean_t (*)
+						     (mach_msg_header_t *,
+						      mach_msg_header_t *),
+						     mach_msg_size_t,
+						     mach_port_t,
+						     mach_msg_options_t);
+extern mach_msg_return_t	mach_msg_server(boolean_t (*)
+						(mach_msg_header_t *,
+						 mach_msg_header_t *),
+						mach_msg_size_t,
+						mach_port_t,
+						mach_msg_options_t);
+
+extern kern_return_t		device_read_overwrite_request(mach_port_t,
+							      mach_port_t,
+							      dev_mode_t,
+							      recnum_t,
+							      io_buf_len_t,
+							      vm_address_t);
+
+extern kern_return_t		device_read_overwrite(mach_port_t,
+						      dev_mode_t,
+						      recnum_t,
+						      io_buf_len_t,
+						      vm_address_t,
+						      mach_msg_type_number_t *);
+
+/*
+ * Prototypes for compatibility
+ */
+extern kern_return_t	clock_get_res(mach_port_t,
+				      clock_res_t *);
+extern kern_return_t	clock_set_res(mach_port_t,
+				      clock_res_t);
+
+extern kern_return_t	clock_sleep(mach_port_name_t,
+									mach_sleep_type_t,
+									int,
+									int,
+				    tvalspec_t *);
+#endif	/* _MACH_H_ */


Property changes on: trunk/sys/sys/mach/mach.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/mach_host_server.h
===================================================================
--- trunk/sys/sys/mach/mach_host_server.h	                        (rev 0)
+++ trunk/sys/sys/mach/mach_host_server.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,1455 @@
+#ifndef	_mach_host_server_
+#define	_mach_host_server_
+
+/* Module mach_host */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#ifdef _KERNEL
+#include <sys/mach/ndr.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#else /* !_KERNEL */
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#endif /*_KERNEL */
+
+#ifdef AUTOTEST
+#ifndef FUNCTION_PTR_T
+#define FUNCTION_PTR_T
+typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
+typedef struct {
+        char            *name;
+        function_ptr_t  function;
+} function_table_entry;
+typedef function_table_entry   *function_table_t;
+#endif /* FUNCTION_PTR_T */
+#endif /* AUTOTEST */
+
+#ifndef	mach_host_MSG_COUNT
+#define	mach_host_MSG_COUNT	25
+#endif	/* mach_host_MSG_COUNT */
+
+#include <sys/mach/std_types.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc_mig.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach_debug/mach_debug_types.h>
+
+#ifdef __BeforeMigServerHeader
+__BeforeMigServerHeader
+#endif /* __BeforeMigServerHeader */
+
+
+/* Routine host_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_info
+#if	defined(LINTLIBRARY)
+    (host, flavor, host_info_out, host_info_outCnt)
+	host_t host;
+	host_flavor_t flavor;
+	host_info_t host_info_out;
+	mach_msg_type_number_t *host_info_outCnt;
+{ return host_info(host, flavor, host_info_out, host_info_outCnt); }
+#else
+(
+	host_t host,
+	host_flavor_t flavor,
+	host_info_t host_info_out,
+	mach_msg_type_number_t *host_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_kernel_version */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_kernel_version
+#if	defined(LINTLIBRARY)
+    (host, kernel_version)
+	host_t host;
+	kernel_version_t kernel_version;
+{ return host_kernel_version(host, kernel_version); }
+#else
+(
+	host_t host,
+	kernel_version_t kernel_version
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_page_size */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_page_size
+#if	defined(LINTLIBRARY)
+    (host, out_page_size)
+	host_t host;
+	vm_size_t *out_page_size;
+{ return host_page_size(host, out_page_size); }
+#else
+(
+	host_t host,
+	vm_size_t *out_page_size
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_memory_object_memory_entry */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_memory_object_memory_entry
+#if	defined(LINTLIBRARY)
+    (host, internal, size, permission, pager, entry_handle)
+	host_t host;
+	boolean_t internal;
+	vm_size_t size;
+	vm_prot_t permission;
+	memory_object_t pager;
+	mach_port_t *entry_handle;
+{ return mach_memory_object_memory_entry(host, internal, size, permission, pager, entry_handle); }
+#else
+(
+	host_t host,
+	boolean_t internal,
+	vm_size_t size,
+	vm_prot_t permission,
+	memory_object_t pager,
+	mach_port_t *entry_handle
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_processor_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_processor_info
+#if	defined(LINTLIBRARY)
+    (host, flavor, out_processor_count, out_processor_info, out_processor_infoCnt)
+	host_t host;
+	processor_flavor_t flavor;
+	natural_t *out_processor_count;
+	processor_info_array_t *out_processor_info;
+	mach_msg_type_number_t *out_processor_infoCnt;
+{ return host_processor_info(host, flavor, out_processor_count, out_processor_info, out_processor_infoCnt); }
+#else
+(
+	host_t host,
+	processor_flavor_t flavor,
+	natural_t *out_processor_count,
+	processor_info_array_t *out_processor_info,
+	mach_msg_type_number_t *out_processor_infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_clock_service */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_clock_service
+#if	defined(LINTLIBRARY)
+    (host, clock_id, clock_serv)
+	host_t host;
+	clock_id_t clock_id;
+	clock_serv_t *clock_serv;
+{ return host_get_clock_service(host, clock_id, clock_serv); }
+#else
+(
+	host_t host,
+	clock_id_t clock_id,
+	clock_serv_t *clock_serv
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_virtual_physical_table_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_virtual_physical_table_info
+#if	defined(LINTLIBRARY)
+    (host, info, infoCnt)
+	host_t host;
+	hash_info_bucket_array_t *info;
+	mach_msg_type_number_t *infoCnt;
+{ return host_virtual_physical_table_info(host, info, infoCnt); }
+#else
+(
+	host_t host,
+	hash_info_bucket_array_t *info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine processor_set_default */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t processor_set_default
+#if	defined(LINTLIBRARY)
+    (host, default_set)
+	host_t host;
+	processor_set_name_t *default_set;
+{ return processor_set_default(host, default_set); }
+#else
+(
+	host_t host,
+	processor_set_name_t *default_set
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine processor_set_create */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t processor_set_create
+#if	defined(LINTLIBRARY)
+    (host, new_set, new_name)
+	host_t host;
+	processor_set_t *new_set;
+	processor_set_name_t *new_name;
+{ return processor_set_create(host, new_set, new_name); }
+#else
+(
+	host_t host,
+	processor_set_t *new_set,
+	processor_set_name_t *new_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_memory_object_memory_entry_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_memory_object_memory_entry_64
+#if	defined(LINTLIBRARY)
+    (host, internal, size, permission, pager, entry_handle)
+	host_t host;
+	boolean_t internal;
+	memory_object_size_t size;
+	vm_prot_t permission;
+	memory_object_t pager;
+	mach_port_t *entry_handle;
+{ return mach_memory_object_memory_entry_64(host, internal, size, permission, pager, entry_handle); }
+#else
+(
+	host_t host,
+	boolean_t internal,
+	memory_object_size_t size,
+	vm_prot_t permission,
+	memory_object_t pager,
+	mach_port_t *entry_handle
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_statistics */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_statistics
+#if	defined(LINTLIBRARY)
+    (host_priv, flavor, host_info_out, host_info_outCnt)
+	host_t host_priv;
+	host_flavor_t flavor;
+	host_info_t host_info_out;
+	mach_msg_type_number_t *host_info_outCnt;
+{ return host_statistics(host_priv, flavor, host_info_out, host_info_outCnt); }
+#else
+(
+	host_t host_priv,
+	host_flavor_t flavor,
+	host_info_t host_info_out,
+	mach_msg_type_number_t *host_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_request_notification */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_request_notification
+#if	defined(LINTLIBRARY)
+    (host, notify_type, notify_port)
+	host_t host;
+	host_flavor_t notify_type;
+	mach_port_t notify_port;
+{ return host_request_notification(host, notify_type, notify_port); }
+#else
+(
+	host_t host,
+	host_flavor_t notify_type,
+	mach_port_t notify_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_statistics64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_statistics64
+#if	defined(LINTLIBRARY)
+    (host_priv, flavor, host_info64_out, host_info64_outCnt)
+	host_t host_priv;
+	host_flavor_t flavor;
+	host_info64_t host_info64_out;
+	mach_msg_type_number_t *host_info64_outCnt;
+{ return host_statistics64(host_priv, flavor, host_info64_out, host_info64_outCnt); }
+#else
+(
+	host_t host_priv,
+	host_flavor_t flavor,
+	host_info64_t host_info64_out,
+	mach_msg_type_number_t *host_info64_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_zone_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_zone_info
+#if	defined(LINTLIBRARY)
+    (host, names, namesCnt, info, infoCnt)
+	host_priv_t host;
+	mach_zone_name_array_t *names;
+	mach_msg_type_number_t *namesCnt;
+	mach_zone_info_array_t *info;
+	mach_msg_type_number_t *infoCnt;
+{ return mach_zone_info(host, names, namesCnt, info, infoCnt); }
+#else
+(
+	host_priv_t host,
+	mach_zone_name_array_t *names,
+	mach_msg_type_number_t *namesCnt,
+	mach_zone_info_array_t *info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_create_mach_voucher */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_create_mach_voucher
+#if	defined(LINTLIBRARY)
+    (host, recipes, recipesCnt, voucher)
+	host_t host;
+	mach_voucher_attr_raw_recipe_array_t recipes;
+	mach_msg_type_number_t recipesCnt;
+	ipc_voucher_t *voucher;
+{ return host_create_mach_voucher(host, recipes, recipesCnt, voucher); }
+#else
+(
+	host_t host,
+	mach_voucher_attr_raw_recipe_array_t recipes,
+	mach_msg_type_number_t recipesCnt,
+	ipc_voucher_t *voucher
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_register_mach_voucher_attr_manager */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_register_mach_voucher_attr_manager
+#if	defined(LINTLIBRARY)
+    (host, attr_manager, default_value, new_key, new_attr_control)
+	host_t host;
+	mach_voucher_attr_manager_t attr_manager;
+	mach_voucher_attr_value_handle_t default_value;
+	mach_voucher_attr_key_t *new_key;
+	ipc_voucher_attr_control_t *new_attr_control;
+{ return host_register_mach_voucher_attr_manager(host, attr_manager, default_value, new_key, new_attr_control); }
+#else
+(
+	host_t host,
+	mach_voucher_attr_manager_t attr_manager,
+	mach_voucher_attr_value_handle_t default_value,
+	mach_voucher_attr_key_t *new_key,
+	ipc_voucher_attr_control_t *new_attr_control
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_register_well_known_mach_voucher_attr_manager */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_register_well_known_mach_voucher_attr_manager
+#if	defined(LINTLIBRARY)
+    (host, attr_manager, default_value, key, new_attr_control)
+	host_t host;
+	mach_voucher_attr_manager_t attr_manager;
+	mach_voucher_attr_value_handle_t default_value;
+	mach_voucher_attr_key_t key;
+	ipc_voucher_attr_control_t *new_attr_control;
+{ return host_register_well_known_mach_voucher_attr_manager(host, attr_manager, default_value, key, new_attr_control); }
+#else
+(
+	host_t host,
+	mach_voucher_attr_manager_t attr_manager,
+	mach_voucher_attr_value_handle_t default_value,
+	mach_voucher_attr_key_t key,
+	ipc_voucher_attr_control_t *new_attr_control
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_info
+#if	defined(LINTLIBRARY)
+    (host, flavor, host_info_out, host_info_outCnt)
+	host_t host;
+	host_flavor_t flavor;
+	host_info_t host_info_out;
+	mach_msg_type_number_t *host_info_outCnt;
+{ return host_info(host, flavor, host_info_out, host_info_outCnt); }
+#else
+(
+	host_t host,
+	host_flavor_t flavor,
+	host_info_t host_info_out,
+	mach_msg_type_number_t *host_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_kernel_version */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_kernel_version
+#if	defined(LINTLIBRARY)
+    (host, kernel_version)
+	host_t host;
+	kernel_version_t kernel_version;
+{ return host_kernel_version(host, kernel_version); }
+#else
+(
+	host_t host,
+	kernel_version_t kernel_version
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_page_size */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_page_size
+#if	defined(LINTLIBRARY)
+    (host, out_page_size)
+	host_t host;
+	vm_size_t *out_page_size;
+{ return host_page_size(host, out_page_size); }
+#else
+(
+	host_t host,
+	vm_size_t *out_page_size
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_memory_object_memory_entry */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_memory_object_memory_entry
+#if	defined(LINTLIBRARY)
+    (host, internal, size, permission, pager, entry_handle)
+	host_t host;
+	boolean_t internal;
+	vm_size_t size;
+	vm_prot_t permission;
+	memory_object_t pager;
+	mach_port_t *entry_handle;
+{ return mach_memory_object_memory_entry(host, internal, size, permission, pager, entry_handle); }
+#else
+(
+	host_t host,
+	boolean_t internal,
+	vm_size_t size,
+	vm_prot_t permission,
+	memory_object_t pager,
+	mach_port_t *entry_handle
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_processor_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_processor_info
+#if	defined(LINTLIBRARY)
+    (host, flavor, out_processor_count, out_processor_info, out_processor_infoCnt)
+	host_t host;
+	processor_flavor_t flavor;
+	natural_t *out_processor_count;
+	processor_info_array_t *out_processor_info;
+	mach_msg_type_number_t *out_processor_infoCnt;
+{ return host_processor_info(host, flavor, out_processor_count, out_processor_info, out_processor_infoCnt); }
+#else
+(
+	host_t host,
+	processor_flavor_t flavor,
+	natural_t *out_processor_count,
+	processor_info_array_t *out_processor_info,
+	mach_msg_type_number_t *out_processor_infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_get_clock_service */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_get_clock_service
+#if	defined(LINTLIBRARY)
+    (host, clock_id, clock_serv)
+	host_t host;
+	clock_id_t clock_id;
+	clock_serv_t *clock_serv;
+{ return host_get_clock_service(host, clock_id, clock_serv); }
+#else
+(
+	host_t host,
+	clock_id_t clock_id,
+	clock_serv_t *clock_serv
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_virtual_physical_table_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_virtual_physical_table_info
+#if	defined(LINTLIBRARY)
+    (host, info, infoCnt)
+	host_t host;
+	hash_info_bucket_array_t *info;
+	mach_msg_type_number_t *infoCnt;
+{ return host_virtual_physical_table_info(host, info, infoCnt); }
+#else
+(
+	host_t host,
+	hash_info_bucket_array_t *info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine processor_set_default */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t processor_set_default
+#if	defined(LINTLIBRARY)
+    (host, default_set)
+	host_t host;
+	processor_set_name_t *default_set;
+{ return processor_set_default(host, default_set); }
+#else
+(
+	host_t host,
+	processor_set_name_t *default_set
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine processor_set_create */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t processor_set_create
+#if	defined(LINTLIBRARY)
+    (host, new_set, new_name)
+	host_t host;
+	processor_set_t *new_set;
+	processor_set_name_t *new_name;
+{ return processor_set_create(host, new_set, new_name); }
+#else
+(
+	host_t host,
+	processor_set_t *new_set,
+	processor_set_name_t *new_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_memory_object_memory_entry_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_memory_object_memory_entry_64
+#if	defined(LINTLIBRARY)
+    (host, internal, size, permission, pager, entry_handle)
+	host_t host;
+	boolean_t internal;
+	memory_object_size_t size;
+	vm_prot_t permission;
+	memory_object_t pager;
+	mach_port_t *entry_handle;
+{ return mach_memory_object_memory_entry_64(host, internal, size, permission, pager, entry_handle); }
+#else
+(
+	host_t host,
+	boolean_t internal,
+	memory_object_size_t size,
+	vm_prot_t permission,
+	memory_object_t pager,
+	mach_port_t *entry_handle
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_statistics */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_statistics
+#if	defined(LINTLIBRARY)
+    (host_priv, flavor, host_info_out, host_info_outCnt)
+	host_t host_priv;
+	host_flavor_t flavor;
+	host_info_t host_info_out;
+	mach_msg_type_number_t *host_info_outCnt;
+{ return host_statistics(host_priv, flavor, host_info_out, host_info_outCnt); }
+#else
+(
+	host_t host_priv,
+	host_flavor_t flavor,
+	host_info_t host_info_out,
+	mach_msg_type_number_t *host_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_request_notification */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_request_notification
+#if	defined(LINTLIBRARY)
+    (host, notify_type, notify_port)
+	host_t host;
+	host_flavor_t notify_type;
+	mach_port_t notify_port;
+{ return host_request_notification(host, notify_type, notify_port); }
+#else
+(
+	host_t host,
+	host_flavor_t notify_type,
+	mach_port_t notify_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_statistics64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_statistics64
+#if	defined(LINTLIBRARY)
+    (host_priv, flavor, host_info64_out, host_info64_outCnt)
+	host_t host_priv;
+	host_flavor_t flavor;
+	host_info64_t host_info64_out;
+	mach_msg_type_number_t *host_info64_outCnt;
+{ return host_statistics64(host_priv, flavor, host_info64_out, host_info64_outCnt); }
+#else
+(
+	host_t host_priv,
+	host_flavor_t flavor,
+	host_info64_t host_info64_out,
+	mach_msg_type_number_t *host_info64_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_zone_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_zone_info
+#if	defined(LINTLIBRARY)
+    (host, names, namesCnt, info, infoCnt)
+	host_priv_t host;
+	mach_zone_name_array_t *names;
+	mach_msg_type_number_t *namesCnt;
+	mach_zone_info_array_t *info;
+	mach_msg_type_number_t *infoCnt;
+{ return mach_zone_info(host, names, namesCnt, info, infoCnt); }
+#else
+(
+	host_priv_t host,
+	mach_zone_name_array_t *names,
+	mach_msg_type_number_t *namesCnt,
+	mach_zone_info_array_t *info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_create_mach_voucher */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_create_mach_voucher
+#if	defined(LINTLIBRARY)
+    (host, recipes, recipesCnt, voucher)
+	host_t host;
+	mach_voucher_attr_raw_recipe_array_t recipes;
+	mach_msg_type_number_t recipesCnt;
+	ipc_voucher_t *voucher;
+{ return host_create_mach_voucher(host, recipes, recipesCnt, voucher); }
+#else
+(
+	host_t host,
+	mach_voucher_attr_raw_recipe_array_t recipes,
+	mach_msg_type_number_t recipesCnt,
+	ipc_voucher_t *voucher
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_register_mach_voucher_attr_manager */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_register_mach_voucher_attr_manager
+#if	defined(LINTLIBRARY)
+    (host, attr_manager, default_value, new_key, new_attr_control)
+	host_t host;
+	mach_voucher_attr_manager_t attr_manager;
+	mach_voucher_attr_value_handle_t default_value;
+	mach_voucher_attr_key_t *new_key;
+	ipc_voucher_attr_control_t *new_attr_control;
+{ return host_register_mach_voucher_attr_manager(host, attr_manager, default_value, new_key, new_attr_control); }
+#else
+(
+	host_t host,
+	mach_voucher_attr_manager_t attr_manager,
+	mach_voucher_attr_value_handle_t default_value,
+	mach_voucher_attr_key_t *new_key,
+	ipc_voucher_attr_control_t *new_attr_control
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine host_register_well_known_mach_voucher_attr_manager */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t host_register_well_known_mach_voucher_attr_manager
+#if	defined(LINTLIBRARY)
+    (host, attr_manager, default_value, key, new_attr_control)
+	host_t host;
+	mach_voucher_attr_manager_t attr_manager;
+	mach_voucher_attr_value_handle_t default_value;
+	mach_voucher_attr_key_t key;
+	ipc_voucher_attr_control_t *new_attr_control;
+{ return host_register_well_known_mach_voucher_attr_manager(host, attr_manager, default_value, key, new_attr_control); }
+#else
+(
+	host_t host,
+	mach_voucher_attr_manager_t attr_manager,
+	mach_voucher_attr_value_handle_t default_value,
+	mach_voucher_attr_key_t key,
+	ipc_voucher_attr_control_t *new_attr_control
+);
+#endif	/* defined(LINTLIBRARY) */
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+boolean_t mach_host_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+mig_routine_t mach_host_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+extern const struct mach_host_subsystem {
+	mig_server_routine_t	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[25];
+} mach_host_subsystem;
+
+/* typedefs for all requests */
+
+#ifndef __Request__mach_host_subsystem__defined
+#define __Request__mach_host_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t flavor;
+		mach_msg_type_number_t host_info_outCnt;
+	} __Request__host_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__host_kernel_version_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__host_page_size_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t pager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t internal;
+		vm_size_t size;
+		vm_prot_t permission;
+	} __Request__mach_memory_object_memory_entry_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		processor_flavor_t flavor;
+	} __Request__host_processor_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		clock_id_t clock_id;
+	} __Request__host_get_clock_service_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__host_virtual_physical_table_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__processor_set_default_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__processor_set_create_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t pager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t internal;
+		memory_object_size_t size;
+		vm_prot_t permission;
+	} __Request__mach_memory_object_memory_entry_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t flavor;
+		mach_msg_type_number_t host_info_outCnt;
+	} __Request__host_statistics_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t notify_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t notify_type;
+	} __Request__host_request_notification_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		host_flavor_t flavor;
+		mach_msg_type_number_t host_info64_outCnt;
+	} __Request__host_statistics64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__mach_zone_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t recipesCnt;
+		uint8_t recipes[5120];
+	} __Request__host_create_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t attr_manager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_voucher_attr_value_handle_t default_value;
+	} __Request__host_register_mach_voucher_attr_manager_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t attr_manager;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_voucher_attr_value_handle_t default_value;
+		mach_voucher_attr_key_t key;
+	} __Request__host_register_well_known_mach_voucher_attr_manager_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__mach_host_subsystem__defined */
+
+
+/* union of all requests */
+
+#ifndef __RequestUnion__mach_host_subsystem__defined
+#define __RequestUnion__mach_host_subsystem__defined
+union __RequestUnion__mach_host_subsystem {
+	__Request__host_info_t Request_host_info;
+	__Request__host_kernel_version_t Request_host_kernel_version;
+	__Request__host_page_size_t Request_host_page_size;
+	__Request__mach_memory_object_memory_entry_t Request_mach_memory_object_memory_entry;
+	__Request__host_processor_info_t Request_host_processor_info;
+	__Request__host_get_clock_service_t Request_host_get_clock_service;
+	__Request__host_virtual_physical_table_info_t Request_host_virtual_physical_table_info;
+	__Request__processor_set_default_t Request_processor_set_default;
+	__Request__processor_set_create_t Request_processor_set_create;
+	__Request__mach_memory_object_memory_entry_64_t Request_mach_memory_object_memory_entry_64;
+	__Request__host_statistics_t Request_host_statistics;
+	__Request__host_request_notification_t Request_host_request_notification;
+	__Request__host_statistics64_t Request_host_statistics64;
+	__Request__mach_zone_info_t Request_mach_zone_info;
+	__Request__host_create_mach_voucher_t Request_host_create_mach_voucher;
+	__Request__host_register_mach_voucher_attr_manager_t Request_host_register_mach_voucher_attr_manager;
+	__Request__host_register_well_known_mach_voucher_attr_manager_t Request_host_register_well_known_mach_voucher_attr_manager;
+};
+#endif /* __RequestUnion__mach_host_subsystem__defined */
+/* typedefs for all replies */
+
+#ifndef __Reply__mach_host_subsystem__defined
+#define __Reply__mach_host_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t host_info_outCnt;
+		integer_t host_info_out[68];
+	} __Reply__host_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t kernel_versionOffset; /* MiG doesn't use it */
+		mach_msg_type_number_t kernel_versionCnt;
+		char kernel_version[512];
+	} __Reply__host_kernel_version_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_size_t out_page_size;
+	} __Reply__host_page_size_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t entry_handle;
+		/* end of the kernel processed data */
+	} __Reply__mach_memory_object_memory_entry_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t out_processor_info;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		natural_t out_processor_count;
+		mach_msg_type_number_t out_processor_infoCnt;
+	} __Reply__host_processor_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t clock_serv;
+		/* end of the kernel processed data */
+	} __Reply__host_get_clock_service_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t info;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t infoCnt;
+	} __Reply__host_virtual_physical_table_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t default_set;
+		/* end of the kernel processed data */
+	} __Reply__processor_set_default_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_set;
+		mach_msg_port_descriptor_t new_name;
+		/* end of the kernel processed data */
+	} __Reply__processor_set_create_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t entry_handle;
+		/* end of the kernel processed data */
+	} __Reply__mach_memory_object_memory_entry_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t host_info_outCnt;
+		integer_t host_info_out[68];
+	} __Reply__host_statistics_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__host_request_notification_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t host_info64_outCnt;
+		integer_t host_info64_out[256];
+	} __Reply__host_statistics64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t names;
+		mach_msg_ool_descriptor_t info;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t namesCnt;
+		mach_msg_type_number_t infoCnt;
+	} __Reply__mach_zone_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t voucher;
+		/* end of the kernel processed data */
+	} __Reply__host_create_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_attr_control;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_voucher_attr_key_t new_key;
+	} __Reply__host_register_mach_voucher_attr_manager_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_attr_control;
+		/* end of the kernel processed data */
+	} __Reply__host_register_well_known_mach_voucher_attr_manager_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__mach_host_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__mach_host_subsystem__defined
+#define __ReplyUnion__mach_host_subsystem__defined
+union __ReplyUnion__mach_host_subsystem {
+	__Reply__host_info_t Reply_host_info;
+	__Reply__host_kernel_version_t Reply_host_kernel_version;
+	__Reply__host_page_size_t Reply_host_page_size;
+	__Reply__mach_memory_object_memory_entry_t Reply_mach_memory_object_memory_entry;
+	__Reply__host_processor_info_t Reply_host_processor_info;
+	__Reply__host_get_clock_service_t Reply_host_get_clock_service;
+	__Reply__host_virtual_physical_table_info_t Reply_host_virtual_physical_table_info;
+	__Reply__processor_set_default_t Reply_processor_set_default;
+	__Reply__processor_set_create_t Reply_processor_set_create;
+	__Reply__mach_memory_object_memory_entry_64_t Reply_mach_memory_object_memory_entry_64;
+	__Reply__host_statistics_t Reply_host_statistics;
+	__Reply__host_request_notification_t Reply_host_request_notification;
+	__Reply__host_statistics64_t Reply_host_statistics64;
+	__Reply__mach_zone_info_t Reply_mach_zone_info;
+	__Reply__host_create_mach_voucher_t Reply_host_create_mach_voucher;
+	__Reply__host_register_mach_voucher_attr_manager_t Reply_host_register_mach_voucher_attr_manager;
+	__Reply__host_register_well_known_mach_voucher_attr_manager_t Reply_host_register_well_known_mach_voucher_attr_manager;
+};
+#endif /* __RequestUnion__mach_host_subsystem__defined */
+
+#ifndef subsystem_to_name_map_mach_host
+#define subsystem_to_name_map_mach_host \
+    { "host_info", 200 },\
+    { "host_kernel_version", 201 },\
+    { "host_page_size", 202 },\
+    { "mach_memory_object_memory_entry", 203 },\
+    { "host_processor_info", 204 },\
+    { "host_get_clock_service", 206 },\
+    { "host_virtual_physical_table_info", 209 },\
+    { "processor_set_default", 213 },\
+    { "processor_set_create", 214 },\
+    { "mach_memory_object_memory_entry_64", 215 },\
+    { "host_statistics", 216 },\
+    { "host_request_notification", 217 },\
+    { "host_statistics64", 219 },\
+    { "mach_zone_info", 220 },\
+    { "host_create_mach_voucher", 222 },\
+    { "host_register_mach_voucher_attr_manager", 223 },\
+    { "host_register_well_known_mach_voucher_attr_manager", 224 }
+#endif
+
+#ifdef __AfterMigServerHeader
+__AfterMigServerHeader
+#endif /* __AfterMigServerHeader */
+
+#endif	 /* _mach_host_server_ */


Property changes on: trunk/sys/sys/mach/mach_host_server.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/mach_init.h
===================================================================
--- trunk/sys/sys/mach/mach_init.h	                        (rev 0)
+++ trunk/sys/sys/mach/mach_init.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987,1986 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+
+/*
+ *	Items provided by the Mach environment initialization.
+ */
+
+#ifndef	_MACH_INIT_
+#define	_MACH_INIT_	1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <sys/mach/mach_types.h>
+#ifndef _KERNEL
+#include <stdarg.h>
+#endif
+
+/*
+ *	Kernel-related ports; how a task/thread controls itself
+ */
+
+__BEGIN_DECLS
+extern mach_port_name_t mach_host_self(void);
+extern mach_port_name_t mach_thread_self(void);
+#if 0
+extern kern_return_t host_page_size(host_t, vm_size_t *);
+#endif
+#ifndef _KERNEL
+extern mach_port_t	mach_task_self_;
+#define	mach_task_self() mach_task_self_
+#define	current_task()	mach_task_self()
+
+__END_DECLS
+#include <mach/mach_traps.h>
+__BEGIN_DECLS
+
+/*
+ *	fprintf_stderr uses vprintf_stderr_func to produce
+ *	error messages, this can be overridden by a user
+ *	application to point to a user-specified output function
+ */
+extern int (*vprintf_stderr_func)(const char *format, va_list ap);
+#else
+extern mach_port_name_t mach_task_self(void);
+
+#endif
+/*
+ *	Other important ports in the Mach user environment
+ */
+
+extern	mach_port_t	bootstrap_port;
+
+/*
+ *	Where these ports occur in the "mach_ports_register"
+ *	collection... only servers or the runtime library need know.
+ */
+
+#define	NAME_SERVER_SLOT	0
+#define	ENVIRONMENT_SLOT	1
+#define SERVICE_SLOT		2
+
+#define	MACH_PORTS_SLOTS_USED	3
+
+__END_DECLS
+
+#endif	/* _MACH_INIT_ */


Property changes on: trunk/sys/sys/mach/mach_init.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/mach_interface.h
===================================================================
--- trunk/sys/sys/mach/mach_interface.h	                        (rev 0)
+++ trunk/sys/sys/mach/mach_interface.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,6 @@
+#include <sys/mach/message.h>
+#include <sys/mach/ipc/ipc_types.h>
+#include <sys/mach/device/device_types.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/port.h>
+#include <sys/mach/mach_types.h>


Property changes on: trunk/sys/sys/mach/mach_interface.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/mach_param.h
===================================================================
--- trunk/sys/sys/mach/mach_param.h	                        (rev 0)
+++ trunk/sys/sys/mach/mach_param.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,118 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5.2.1  92/03/03  16:20:11  jeffreyh
+ * 	19-Feb-92 David L. Black (dlb) at Open Software Foundation
+ * 		Double object slop in PORT_MAX, allow for extra (non-task)
+ * 	ipc spaces (e.g. ipc_space_remote) in SPACE_MAX
+ * 	[92/02/26  11:54:50  jeffreyh]
+ * 
+ * Revision 2.5  91/05/14  16:44:25  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:27:56  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  16:15:07  mrt]
+ * 
+ * Revision 2.3  90/06/02  14:55:13  rpd
+ * 	Added new IPC parameters.
+ * 	[90/03/26  22:11:55  rpd]
+ * 
+ *
+ * Condensed history:
+ *	Moved TASK_MAX, PORT_MAX, etc. here from mach/mach_param.h (rpd).
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	kern/mach_param.h
+ *	Author:	Avadis Tevanian, Jr., Michael Wayne Young
+ *	Date:	1986
+ *
+ *	Mach system sizing parameters
+ *
+ */
+
+#ifndef	_KERN_MACH_PARAM_H_
+#define _KERN_MACH_PARAM_H_
+
+#define THREAD_MAX	1024		/* Max number of threads */
+#define THREAD_CHUNK	64		/* Allocation chunk */
+
+#define TASK_MAX	1024		/* Max number of tasks */
+#define TASK_CHUNK	64		/* Allocation chunk */
+
+#if 0
+/* used by VM */
+#define	ACT_MAX		1024		/* Max number of acts */
+#endif
+#define ACT_CHUNK	64		/* Allocation chunk */
+
+#define	THREAD_POOL_MAX	1024		/* Max number of thread_pools */
+#define THREAD_POOL_CHUNK 64		/* Allocation chunk */
+
+#define PORT_MAX	((TASK_MAX * 3 + THREAD_MAX)	/* kernel */ \
+				+ (THREAD_MAX * 2)	/* user */ \
+				+ 40000)		/* slop for objects */
+					/* Number of ports, system-wide */
+
+#define SET_MAX		(TASK_MAX + THREAD_MAX + 200)
+					/* Max number of port sets */
+
+#define	ITE_MAX		(1 << 16)	/* Max number of splay tree entries */
+
+#define	SPACE_MAX	(TASK_MAX + 5)	/* Max number of IPC spaces */
+
+#define	IMAR_MAX	(1 << 10)	/* Max number of msg-accepted reqs */
+
+#define TASK_PORT_REGISTER_MAX	3
+
+#endif	/* _KERN_MACH_PARAM_H_ */


Property changes on: trunk/sys/sys/mach/mach_param.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/mach_port_server.h
===================================================================
--- trunk/sys/sys/mach/mach_port_server.h	                        (rev 0)
+++ trunk/sys/sys/mach/mach_port_server.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,2823 @@
+#ifndef	_mach_port_server_
+#define	_mach_port_server_
+
+/* Module mach_port */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#ifdef _KERNEL
+#include <sys/mach/ndr.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#else /* !_KERNEL */
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#endif /*_KERNEL */
+
+#ifdef AUTOTEST
+#ifndef FUNCTION_PTR_T
+#define FUNCTION_PTR_T
+typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
+typedef struct {
+        char            *name;
+        function_ptr_t  function;
+} function_table_entry;
+typedef function_table_entry   *function_table_t;
+#endif /* FUNCTION_PTR_T */
+#endif /* AUTOTEST */
+
+#ifndef	mach_port_MSG_COUNT
+#define	mach_port_MSG_COUNT	36
+#endif	/* mach_port_MSG_COUNT */
+
+#include <sys/mach/std_types.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc_mig.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach_debug/mach_debug_types.h>
+
+#ifdef __BeforeMigServerHeader
+__BeforeMigServerHeader
+#endif /* __BeforeMigServerHeader */
+
+
+/* Routine mach_port_names */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_names
+#if	defined(LINTLIBRARY)
+    (task, names, namesCnt, types, typesCnt)
+	ipc_space_t task;
+	mach_port_name_array_t *names;
+	mach_msg_type_number_t *namesCnt;
+	mach_port_type_array_t *types;
+	mach_msg_type_number_t *typesCnt;
+{ return mach_port_names(task, names, namesCnt, types, typesCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_array_t *names,
+	mach_msg_type_number_t *namesCnt,
+	mach_port_type_array_t *types,
+	mach_msg_type_number_t *typesCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_type */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_type
+#if	defined(LINTLIBRARY)
+    (task, name, ptype)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_type_t *ptype;
+{ return mach_port_type(task, name, ptype); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_type_t *ptype
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_rename */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_rename
+#if	defined(LINTLIBRARY)
+    (task, old_name, new_name)
+	ipc_space_t task;
+	mach_port_name_t old_name;
+	mach_port_name_t new_name;
+{ return mach_port_rename(task, old_name, new_name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t old_name,
+	mach_port_name_t new_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_allocate_name */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_allocate_name
+#if	defined(LINTLIBRARY)
+    (task, right, name)
+	ipc_space_t task;
+	mach_port_right_t right;
+	mach_port_name_t name;
+{ return mach_port_allocate_name(task, right, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_right_t right,
+	mach_port_name_t name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_allocate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_allocate
+#if	defined(LINTLIBRARY)
+    (task, right, name)
+	ipc_space_t task;
+	mach_port_right_t right;
+	mach_port_name_t *name;
+{ return mach_port_allocate(task, right, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_right_t right,
+	mach_port_name_t *name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_deallocate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_deallocate
+#if	defined(LINTLIBRARY)
+    (task, name)
+	ipc_space_t task;
+	mach_port_name_t name;
+{ return mach_port_deallocate(task, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_insert_right */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_insert_right
+#if	defined(LINTLIBRARY)
+    (task, name, poly, polyPoly)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_t poly;
+	mach_msg_type_name_t polyPoly;
+{ return mach_port_insert_right(task, name, poly, polyPoly); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_t poly,
+	mach_msg_type_name_t polyPoly
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_extract_right */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_extract_right
+#if	defined(LINTLIBRARY)
+    (task, name, msgt_name, poly, polyPoly)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_msg_type_name_t msgt_name;
+	mach_port_t *poly;
+	mach_msg_type_name_t *polyPoly;
+{ return mach_port_extract_right(task, name, msgt_name, poly, polyPoly); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_msg_type_name_t msgt_name,
+	mach_port_t *poly,
+	mach_msg_type_name_t *polyPoly
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_mod_refs */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_mod_refs
+#if	defined(LINTLIBRARY)
+    (task, name, right, delta)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_right_t right;
+	mach_port_delta_t delta;
+{ return mach_port_mod_refs(task, name, right, delta); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_right_t right,
+	mach_port_delta_t delta
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_move_member */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_move_member
+#if	defined(LINTLIBRARY)
+    (task, member, after)
+	ipc_space_t task;
+	mach_port_name_t member;
+	mach_port_name_t after;
+{ return mach_port_move_member(task, member, after); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t member,
+	mach_port_name_t after
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_destroy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_destroy
+#if	defined(LINTLIBRARY)
+    (task, name)
+	ipc_space_t task;
+	mach_port_name_t name;
+{ return mach_port_destroy(task, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_refs */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_refs
+#if	defined(LINTLIBRARY)
+    (task, name, right, refs)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_right_t right;
+	mach_port_urefs_t *refs;
+{ return mach_port_get_refs(task, name, right, refs); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_right_t right,
+	mach_port_urefs_t *refs
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_peek */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_peek
+#if	defined(LINTLIBRARY)
+    (task, name, trailer_type, request_seqnop, msg_sizep, msg_idp, trailer_infop, trailer_infopCnt)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_msg_trailer_type_t trailer_type;
+	mach_port_seqno_t *request_seqnop;
+	mach_msg_size_t *msg_sizep;
+	mach_msg_id_t *msg_idp;
+	mach_msg_trailer_info_t trailer_infop;
+	mach_msg_type_number_t *trailer_infopCnt;
+{ return mach_port_peek(task, name, trailer_type, request_seqnop, msg_sizep, msg_idp, trailer_infop, trailer_infopCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_msg_trailer_type_t trailer_type,
+	mach_port_seqno_t *request_seqnop,
+	mach_msg_size_t *msg_sizep,
+	mach_msg_id_t *msg_idp,
+	mach_msg_trailer_info_t trailer_infop,
+	mach_msg_type_number_t *trailer_infopCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_set_mscount */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_set_mscount
+#if	defined(LINTLIBRARY)
+    (task, name, mscount)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_mscount_t mscount;
+{ return mach_port_set_mscount(task, name, mscount); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_mscount_t mscount
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_set_status */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_set_status
+#if	defined(LINTLIBRARY)
+    (task, name, members, membersCnt)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_name_array_t *members;
+	mach_msg_type_number_t *membersCnt;
+{ return mach_port_get_set_status(task, name, members, membersCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_name_array_t *members,
+	mach_msg_type_number_t *membersCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_request_notification */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_request_notification
+#if	defined(LINTLIBRARY)
+    (task, name, msgid, sync, notify, previous)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_msg_id_t msgid;
+	mach_port_mscount_t sync;
+	mach_port_t notify;
+	mach_port_t *previous;
+{ return mach_port_request_notification(task, name, msgid, sync, notify, previous); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_msg_id_t msgid,
+	mach_port_mscount_t sync,
+	mach_port_t notify,
+	mach_port_t *previous
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_set_seqno */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_set_seqno
+#if	defined(LINTLIBRARY)
+    (task, name, seqno)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_seqno_t seqno;
+{ return mach_port_set_seqno(task, name, seqno); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_seqno_t seqno
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_attributes */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_attributes
+#if	defined(LINTLIBRARY)
+    (task, name, flavor, port_info_out, port_info_outCnt)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_flavor_t flavor;
+	mach_port_info_t port_info_out;
+	mach_msg_type_number_t *port_info_outCnt;
+{ return mach_port_get_attributes(task, name, flavor, port_info_out, port_info_outCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_flavor_t flavor,
+	mach_port_info_t port_info_out,
+	mach_msg_type_number_t *port_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_set_attributes */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_set_attributes
+#if	defined(LINTLIBRARY)
+    (task, name, flavor, port_info, port_infoCnt)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_flavor_t flavor;
+	mach_port_info_t port_info;
+	mach_msg_type_number_t port_infoCnt;
+{ return mach_port_set_attributes(task, name, flavor, port_info, port_infoCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_flavor_t flavor,
+	mach_port_info_t port_info,
+	mach_msg_type_number_t port_infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_allocate_qos */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_allocate_qos
+#if	defined(LINTLIBRARY)
+    (task, right, qos, name)
+	ipc_space_t task;
+	mach_port_right_t right;
+	mach_port_qos_t *qos;
+	mach_port_name_t *name;
+{ return mach_port_allocate_qos(task, right, qos, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_right_t right,
+	mach_port_qos_t *qos,
+	mach_port_name_t *name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_allocate_full */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_allocate_full
+#if	defined(LINTLIBRARY)
+    (task, right, proto, qos, name)
+	ipc_space_t task;
+	mach_port_right_t right;
+	mach_port_t proto;
+	mach_port_qos_t *qos;
+	mach_port_name_t *name;
+{ return mach_port_allocate_full(task, right, proto, qos, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_right_t right,
+	mach_port_t proto,
+	mach_port_qos_t *qos,
+	mach_port_name_t *name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_port_space */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_port_space
+#if	defined(LINTLIBRARY)
+    (task, table_entries)
+	ipc_space_t task;
+	int table_entries;
+{ return task_set_port_space(task, table_entries); }
+#else
+(
+	ipc_space_t task,
+	int table_entries
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_srights */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_srights
+#if	defined(LINTLIBRARY)
+    (task, name, srights)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_rights_t *srights;
+{ return mach_port_get_srights(task, name, srights); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_rights_t *srights
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_space_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_space_info
+#if	defined(LINTLIBRARY)
+    (task, space_info, table_info, table_infoCnt, tree_info, tree_infoCnt)
+	ipc_space_t task;
+	ipc_info_space_t *space_info;
+	ipc_info_name_array_t *table_info;
+	mach_msg_type_number_t *table_infoCnt;
+	ipc_info_tree_name_array_t *tree_info;
+	mach_msg_type_number_t *tree_infoCnt;
+{ return mach_port_space_info(task, space_info, table_info, table_infoCnt, tree_info, tree_infoCnt); }
+#else
+(
+	ipc_space_t task,
+	ipc_info_space_t *space_info,
+	ipc_info_name_array_t *table_info,
+	mach_msg_type_number_t *table_infoCnt,
+	ipc_info_tree_name_array_t *tree_info,
+	mach_msg_type_number_t *tree_infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_dnrequest_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_dnrequest_info
+#if	defined(LINTLIBRARY)
+    (task, name, dnr_total, dnr_used)
+	ipc_space_t task;
+	mach_port_name_t name;
+	unsigned *dnr_total;
+	unsigned *dnr_used;
+{ return mach_port_dnrequest_info(task, name, dnr_total, dnr_used); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	unsigned *dnr_total,
+	unsigned *dnr_used
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_insert_member */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_insert_member
+#if	defined(LINTLIBRARY)
+    (task, name, pset)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_name_t pset;
+{ return mach_port_insert_member(task, name, pset); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_name_t pset
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_extract_member */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_extract_member
+#if	defined(LINTLIBRARY)
+    (task, name, pset)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_name_t pset;
+{ return mach_port_extract_member(task, name, pset); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_name_t pset
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_context */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_context
+#if	defined(LINTLIBRARY)
+    (task, name, context)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_vm_address_t *context;
+{ return mach_port_get_context(task, name, context); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_vm_address_t *context
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_set_context */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_set_context
+#if	defined(LINTLIBRARY)
+    (task, name, context)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_vm_address_t context;
+{ return mach_port_set_context(task, name, context); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_vm_address_t context
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_kobject */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_kobject
+#if	defined(LINTLIBRARY)
+    (task, name, object_type, object_addr)
+	ipc_space_t task;
+	mach_port_name_t name;
+	natural_t *object_type;
+	mach_vm_address_t *object_addr;
+{ return mach_port_kobject(task, name, object_type, object_addr); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	natural_t *object_type,
+	mach_vm_address_t *object_addr
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_construct */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_construct
+#if	defined(LINTLIBRARY)
+    (task, options, context, name)
+	ipc_space_t task;
+	mach_port_options_ptr_t options;
+	uint64_t context;
+	mach_port_name_t *name;
+{ return mach_port_construct(task, options, context, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_options_ptr_t options,
+	uint64_t context,
+	mach_port_name_t *name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_destruct */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_destruct
+#if	defined(LINTLIBRARY)
+    (task, name, srdelta, guard)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_delta_t srdelta;
+	uint64_t guard;
+{ return mach_port_destruct(task, name, srdelta, guard); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_delta_t srdelta,
+	uint64_t guard
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_guard */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_guard
+#if	defined(LINTLIBRARY)
+    (task, name, guard, strict)
+	ipc_space_t task;
+	mach_port_name_t name;
+	uint64_t guard;
+	boolean_t strict;
+{ return mach_port_guard(task, name, guard, strict); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	uint64_t guard,
+	boolean_t strict
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_unguard */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_unguard
+#if	defined(LINTLIBRARY)
+    (task, name, guard)
+	ipc_space_t task;
+	mach_port_name_t name;
+	uint64_t guard;
+{ return mach_port_unguard(task, name, guard); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	uint64_t guard
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_space_basic_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_space_basic_info
+#if	defined(LINTLIBRARY)
+    (task, basic_info)
+	ipc_space_t task;
+	ipc_info_space_basic_t *basic_info;
+{ return mach_port_space_basic_info(task, basic_info); }
+#else
+(
+	ipc_space_t task,
+	ipc_info_space_basic_t *basic_info
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_names */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_names
+#if	defined(LINTLIBRARY)
+    (task, names, namesCnt, types, typesCnt)
+	ipc_space_t task;
+	mach_port_name_array_t *names;
+	mach_msg_type_number_t *namesCnt;
+	mach_port_type_array_t *types;
+	mach_msg_type_number_t *typesCnt;
+{ return mach_port_names(task, names, namesCnt, types, typesCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_array_t *names,
+	mach_msg_type_number_t *namesCnt,
+	mach_port_type_array_t *types,
+	mach_msg_type_number_t *typesCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_type */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_type
+#if	defined(LINTLIBRARY)
+    (task, name, ptype)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_type_t *ptype;
+{ return mach_port_type(task, name, ptype); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_type_t *ptype
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_rename */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_rename
+#if	defined(LINTLIBRARY)
+    (task, old_name, new_name)
+	ipc_space_t task;
+	mach_port_name_t old_name;
+	mach_port_name_t new_name;
+{ return mach_port_rename(task, old_name, new_name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t old_name,
+	mach_port_name_t new_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_allocate_name */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_allocate_name
+#if	defined(LINTLIBRARY)
+    (task, right, name)
+	ipc_space_t task;
+	mach_port_right_t right;
+	mach_port_name_t name;
+{ return mach_port_allocate_name(task, right, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_right_t right,
+	mach_port_name_t name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_allocate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_allocate
+#if	defined(LINTLIBRARY)
+    (task, right, name)
+	ipc_space_t task;
+	mach_port_right_t right;
+	mach_port_name_t *name;
+{ return mach_port_allocate(task, right, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_right_t right,
+	mach_port_name_t *name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_deallocate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_deallocate
+#if	defined(LINTLIBRARY)
+    (task, name)
+	ipc_space_t task;
+	mach_port_name_t name;
+{ return mach_port_deallocate(task, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_insert_right */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_insert_right
+#if	defined(LINTLIBRARY)
+    (task, name, poly, polyPoly)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_t poly;
+	mach_msg_type_name_t polyPoly;
+{ return mach_port_insert_right(task, name, poly, polyPoly); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_t poly,
+	mach_msg_type_name_t polyPoly
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_extract_right */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_extract_right
+#if	defined(LINTLIBRARY)
+    (task, name, msgt_name, poly, polyPoly)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_msg_type_name_t msgt_name;
+	mach_port_t *poly;
+	mach_msg_type_name_t *polyPoly;
+{ return mach_port_extract_right(task, name, msgt_name, poly, polyPoly); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_msg_type_name_t msgt_name,
+	mach_port_t *poly,
+	mach_msg_type_name_t *polyPoly
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_mod_refs */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_mod_refs
+#if	defined(LINTLIBRARY)
+    (task, name, right, delta)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_right_t right;
+	mach_port_delta_t delta;
+{ return mach_port_mod_refs(task, name, right, delta); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_right_t right,
+	mach_port_delta_t delta
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_move_member */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_move_member
+#if	defined(LINTLIBRARY)
+    (task, member, after)
+	ipc_space_t task;
+	mach_port_name_t member;
+	mach_port_name_t after;
+{ return mach_port_move_member(task, member, after); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t member,
+	mach_port_name_t after
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_destroy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_destroy
+#if	defined(LINTLIBRARY)
+    (task, name)
+	ipc_space_t task;
+	mach_port_name_t name;
+{ return mach_port_destroy(task, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_refs */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_refs
+#if	defined(LINTLIBRARY)
+    (task, name, right, refs)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_right_t right;
+	mach_port_urefs_t *refs;
+{ return mach_port_get_refs(task, name, right, refs); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_right_t right,
+	mach_port_urefs_t *refs
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_peek */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_peek
+#if	defined(LINTLIBRARY)
+    (task, name, trailer_type, request_seqnop, msg_sizep, msg_idp, trailer_infop, trailer_infopCnt)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_msg_trailer_type_t trailer_type;
+	mach_port_seqno_t *request_seqnop;
+	mach_msg_size_t *msg_sizep;
+	mach_msg_id_t *msg_idp;
+	mach_msg_trailer_info_t trailer_infop;
+	mach_msg_type_number_t *trailer_infopCnt;
+{ return mach_port_peek(task, name, trailer_type, request_seqnop, msg_sizep, msg_idp, trailer_infop, trailer_infopCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_msg_trailer_type_t trailer_type,
+	mach_port_seqno_t *request_seqnop,
+	mach_msg_size_t *msg_sizep,
+	mach_msg_id_t *msg_idp,
+	mach_msg_trailer_info_t trailer_infop,
+	mach_msg_type_number_t *trailer_infopCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_set_mscount */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_set_mscount
+#if	defined(LINTLIBRARY)
+    (task, name, mscount)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_mscount_t mscount;
+{ return mach_port_set_mscount(task, name, mscount); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_mscount_t mscount
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_set_status */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_set_status
+#if	defined(LINTLIBRARY)
+    (task, name, members, membersCnt)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_name_array_t *members;
+	mach_msg_type_number_t *membersCnt;
+{ return mach_port_get_set_status(task, name, members, membersCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_name_array_t *members,
+	mach_msg_type_number_t *membersCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_request_notification */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_request_notification
+#if	defined(LINTLIBRARY)
+    (task, name, msgid, sync, notify, previous)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_msg_id_t msgid;
+	mach_port_mscount_t sync;
+	mach_port_t notify;
+	mach_port_t *previous;
+{ return mach_port_request_notification(task, name, msgid, sync, notify, previous); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_msg_id_t msgid,
+	mach_port_mscount_t sync,
+	mach_port_t notify,
+	mach_port_t *previous
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_set_seqno */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_set_seqno
+#if	defined(LINTLIBRARY)
+    (task, name, seqno)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_seqno_t seqno;
+{ return mach_port_set_seqno(task, name, seqno); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_seqno_t seqno
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_attributes */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_attributes
+#if	defined(LINTLIBRARY)
+    (task, name, flavor, port_info_out, port_info_outCnt)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_flavor_t flavor;
+	mach_port_info_t port_info_out;
+	mach_msg_type_number_t *port_info_outCnt;
+{ return mach_port_get_attributes(task, name, flavor, port_info_out, port_info_outCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_flavor_t flavor,
+	mach_port_info_t port_info_out,
+	mach_msg_type_number_t *port_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_set_attributes */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_set_attributes
+#if	defined(LINTLIBRARY)
+    (task, name, flavor, port_info, port_infoCnt)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_flavor_t flavor;
+	mach_port_info_t port_info;
+	mach_msg_type_number_t port_infoCnt;
+{ return mach_port_set_attributes(task, name, flavor, port_info, port_infoCnt); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_flavor_t flavor,
+	mach_port_info_t port_info,
+	mach_msg_type_number_t port_infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_allocate_qos */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_allocate_qos
+#if	defined(LINTLIBRARY)
+    (task, right, qos, name)
+	ipc_space_t task;
+	mach_port_right_t right;
+	mach_port_qos_t *qos;
+	mach_port_name_t *name;
+{ return mach_port_allocate_qos(task, right, qos, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_right_t right,
+	mach_port_qos_t *qos,
+	mach_port_name_t *name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_allocate_full */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_allocate_full
+#if	defined(LINTLIBRARY)
+    (task, right, proto, qos, name)
+	ipc_space_t task;
+	mach_port_right_t right;
+	mach_port_t proto;
+	mach_port_qos_t *qos;
+	mach_port_name_t *name;
+{ return mach_port_allocate_full(task, right, proto, qos, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_right_t right,
+	mach_port_t proto,
+	mach_port_qos_t *qos,
+	mach_port_name_t *name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_port_space */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_port_space
+#if	defined(LINTLIBRARY)
+    (task, table_entries)
+	ipc_space_t task;
+	int table_entries;
+{ return task_set_port_space(task, table_entries); }
+#else
+(
+	ipc_space_t task,
+	int table_entries
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_srights */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_srights
+#if	defined(LINTLIBRARY)
+    (task, name, srights)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_rights_t *srights;
+{ return mach_port_get_srights(task, name, srights); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_rights_t *srights
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_space_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_space_info
+#if	defined(LINTLIBRARY)
+    (task, space_info, table_info, table_infoCnt, tree_info, tree_infoCnt)
+	ipc_space_t task;
+	ipc_info_space_t *space_info;
+	ipc_info_name_array_t *table_info;
+	mach_msg_type_number_t *table_infoCnt;
+	ipc_info_tree_name_array_t *tree_info;
+	mach_msg_type_number_t *tree_infoCnt;
+{ return mach_port_space_info(task, space_info, table_info, table_infoCnt, tree_info, tree_infoCnt); }
+#else
+(
+	ipc_space_t task,
+	ipc_info_space_t *space_info,
+	ipc_info_name_array_t *table_info,
+	mach_msg_type_number_t *table_infoCnt,
+	ipc_info_tree_name_array_t *tree_info,
+	mach_msg_type_number_t *tree_infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_dnrequest_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_dnrequest_info
+#if	defined(LINTLIBRARY)
+    (task, name, dnr_total, dnr_used)
+	ipc_space_t task;
+	mach_port_name_t name;
+	unsigned *dnr_total;
+	unsigned *dnr_used;
+{ return mach_port_dnrequest_info(task, name, dnr_total, dnr_used); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	unsigned *dnr_total,
+	unsigned *dnr_used
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_insert_member */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_insert_member
+#if	defined(LINTLIBRARY)
+    (task, name, pset)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_name_t pset;
+{ return mach_port_insert_member(task, name, pset); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_name_t pset
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_extract_member */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_extract_member
+#if	defined(LINTLIBRARY)
+    (task, name, pset)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_name_t pset;
+{ return mach_port_extract_member(task, name, pset); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_name_t pset
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_get_context */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_get_context
+#if	defined(LINTLIBRARY)
+    (task, name, context)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_vm_address_t *context;
+{ return mach_port_get_context(task, name, context); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_vm_address_t *context
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_set_context */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_set_context
+#if	defined(LINTLIBRARY)
+    (task, name, context)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_vm_address_t context;
+{ return mach_port_set_context(task, name, context); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_vm_address_t context
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_kobject */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_kobject
+#if	defined(LINTLIBRARY)
+    (task, name, object_type, object_addr)
+	ipc_space_t task;
+	mach_port_name_t name;
+	natural_t *object_type;
+	mach_vm_address_t *object_addr;
+{ return mach_port_kobject(task, name, object_type, object_addr); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	natural_t *object_type,
+	mach_vm_address_t *object_addr
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_construct */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_construct
+#if	defined(LINTLIBRARY)
+    (task, options, context, name)
+	ipc_space_t task;
+	mach_port_options_ptr_t options;
+	uint64_t context;
+	mach_port_name_t *name;
+{ return mach_port_construct(task, options, context, name); }
+#else
+(
+	ipc_space_t task,
+	mach_port_options_ptr_t options,
+	uint64_t context,
+	mach_port_name_t *name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_destruct */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_destruct
+#if	defined(LINTLIBRARY)
+    (task, name, srdelta, guard)
+	ipc_space_t task;
+	mach_port_name_t name;
+	mach_port_delta_t srdelta;
+	uint64_t guard;
+{ return mach_port_destruct(task, name, srdelta, guard); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	mach_port_delta_t srdelta,
+	uint64_t guard
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_guard */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_guard
+#if	defined(LINTLIBRARY)
+    (task, name, guard, strict)
+	ipc_space_t task;
+	mach_port_name_t name;
+	uint64_t guard;
+	boolean_t strict;
+{ return mach_port_guard(task, name, guard, strict); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	uint64_t guard,
+	boolean_t strict
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_unguard */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_unguard
+#if	defined(LINTLIBRARY)
+    (task, name, guard)
+	ipc_space_t task;
+	mach_port_name_t name;
+	uint64_t guard;
+{ return mach_port_unguard(task, name, guard); }
+#else
+(
+	ipc_space_t task,
+	mach_port_name_t name,
+	uint64_t guard
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_port_space_basic_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_port_space_basic_info
+#if	defined(LINTLIBRARY)
+    (task, basic_info)
+	ipc_space_t task;
+	ipc_info_space_basic_t *basic_info;
+{ return mach_port_space_basic_info(task, basic_info); }
+#else
+(
+	ipc_space_t task,
+	ipc_info_space_basic_t *basic_info
+);
+#endif	/* defined(LINTLIBRARY) */
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+boolean_t mach_port_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+mig_routine_t mach_port_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+extern const struct mach_port_subsystem {
+	mig_server_routine_t	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[36];
+} mach_port_subsystem;
+
+/* typedefs for all requests */
+
+#ifndef __Request__mach_port_subsystem__defined
+#define __Request__mach_port_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__mach_port_names_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_type_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t old_name;
+		mach_port_name_t new_name;
+	} __Request__mach_port_rename_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_right_t right;
+		mach_port_name_t name;
+	} __Request__mach_port_allocate_name_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_right_t right;
+	} __Request__mach_port_allocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_deallocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t poly;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_insert_right_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_type_name_t msgt_name;
+	} __Request__mach_port_extract_right_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_right_t right;
+		mach_port_delta_t delta;
+	} __Request__mach_port_mod_refs_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t member;
+		mach_port_name_t after;
+	} __Request__mach_port_move_member_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_destroy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_right_t right;
+	} __Request__mach_port_get_refs_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_trailer_type_t trailer_type;
+		mach_port_seqno_t request_seqnop;
+		mach_msg_type_number_t trailer_infopCnt;
+	} __Request__mach_port_peek_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_mscount_t mscount;
+	} __Request__mach_port_set_mscount_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_get_set_status_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t notify;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_msg_id_t msgid;
+		mach_port_mscount_t sync;
+	} __Request__mach_port_request_notification_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_seqno_t seqno;
+	} __Request__mach_port_set_seqno_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_flavor_t flavor;
+		mach_msg_type_number_t port_info_outCnt;
+	} __Request__mach_port_get_attributes_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_flavor_t flavor;
+		mach_msg_type_number_t port_infoCnt;
+		integer_t port_info[17];
+	} __Request__mach_port_set_attributes_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_right_t right;
+		mach_port_qos_t qos;
+	} __Request__mach_port_allocate_qos_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t proto;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_right_t right;
+		mach_port_qos_t qos;
+		mach_port_name_t name;
+	} __Request__mach_port_allocate_full_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int table_entries;
+	} __Request__task_set_port_space_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_get_srights_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__mach_port_space_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_dnrequest_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_name_t pset;
+	} __Request__mach_port_insert_member_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_name_t pset;
+	} __Request__mach_port_extract_member_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_get_context_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_vm_address_t context;
+	} __Request__mach_port_set_context_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+	} __Request__mach_port_kobject_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t options;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		uint64_t context;
+	} __Request__mach_port_construct_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		mach_port_delta_t srdelta;
+		uint64_t guard;
+	} __Request__mach_port_destruct_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		uint64_t guard;
+		boolean_t strict;
+	} __Request__mach_port_guard_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_port_name_t name;
+		uint64_t guard;
+	} __Request__mach_port_unguard_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__mach_port_space_basic_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__mach_port_subsystem__defined */
+
+
+/* union of all requests */
+
+#ifndef __RequestUnion__mach_port_subsystem__defined
+#define __RequestUnion__mach_port_subsystem__defined
+union __RequestUnion__mach_port_subsystem {
+	__Request__mach_port_names_t Request_mach_port_names;
+	__Request__mach_port_type_t Request_mach_port_type;
+	__Request__mach_port_rename_t Request_mach_port_rename;
+	__Request__mach_port_allocate_name_t Request_mach_port_allocate_name;
+	__Request__mach_port_allocate_t Request_mach_port_allocate;
+	__Request__mach_port_deallocate_t Request_mach_port_deallocate;
+	__Request__mach_port_insert_right_t Request_mach_port_insert_right;
+	__Request__mach_port_extract_right_t Request_mach_port_extract_right;
+	__Request__mach_port_mod_refs_t Request_mach_port_mod_refs;
+	__Request__mach_port_move_member_t Request_mach_port_move_member;
+	__Request__mach_port_destroy_t Request_mach_port_destroy;
+	__Request__mach_port_get_refs_t Request_mach_port_get_refs;
+	__Request__mach_port_peek_t Request_mach_port_peek;
+	__Request__mach_port_set_mscount_t Request_mach_port_set_mscount;
+	__Request__mach_port_get_set_status_t Request_mach_port_get_set_status;
+	__Request__mach_port_request_notification_t Request_mach_port_request_notification;
+	__Request__mach_port_set_seqno_t Request_mach_port_set_seqno;
+	__Request__mach_port_get_attributes_t Request_mach_port_get_attributes;
+	__Request__mach_port_set_attributes_t Request_mach_port_set_attributes;
+	__Request__mach_port_allocate_qos_t Request_mach_port_allocate_qos;
+	__Request__mach_port_allocate_full_t Request_mach_port_allocate_full;
+	__Request__task_set_port_space_t Request_task_set_port_space;
+	__Request__mach_port_get_srights_t Request_mach_port_get_srights;
+	__Request__mach_port_space_info_t Request_mach_port_space_info;
+	__Request__mach_port_dnrequest_info_t Request_mach_port_dnrequest_info;
+	__Request__mach_port_insert_member_t Request_mach_port_insert_member;
+	__Request__mach_port_extract_member_t Request_mach_port_extract_member;
+	__Request__mach_port_get_context_t Request_mach_port_get_context;
+	__Request__mach_port_set_context_t Request_mach_port_set_context;
+	__Request__mach_port_kobject_t Request_mach_port_kobject;
+	__Request__mach_port_construct_t Request_mach_port_construct;
+	__Request__mach_port_destruct_t Request_mach_port_destruct;
+	__Request__mach_port_guard_t Request_mach_port_guard;
+	__Request__mach_port_unguard_t Request_mach_port_unguard;
+	__Request__mach_port_space_basic_info_t Request_mach_port_space_basic_info;
+};
+#endif /* __RequestUnion__mach_port_subsystem__defined */
+/* typedefs for all replies */
+
+#ifndef __Reply__mach_port_subsystem__defined
+#define __Reply__mach_port_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t names;
+		mach_msg_ool_descriptor_t types;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t namesCnt;
+		mach_msg_type_number_t typesCnt;
+	} __Reply__mach_port_names_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_type_t ptype;
+	} __Reply__mach_port_type_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_rename_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_allocate_name_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_name_t name;
+	} __Reply__mach_port_allocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_deallocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_insert_right_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t poly;
+		/* end of the kernel processed data */
+	} __Reply__mach_port_extract_right_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_mod_refs_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_move_member_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_destroy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_urefs_t refs;
+	} __Reply__mach_port_get_refs_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_seqno_t request_seqnop;
+		mach_msg_size_t msg_sizep;
+		mach_msg_id_t msg_idp;
+		mach_msg_type_number_t trailer_infopCnt;
+		char trailer_infop[68];
+	} __Reply__mach_port_peek_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_set_mscount_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t members;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t membersCnt;
+	} __Reply__mach_port_get_set_status_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t previous;
+		/* end of the kernel processed data */
+	} __Reply__mach_port_request_notification_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_set_seqno_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t port_info_outCnt;
+		integer_t port_info_out[17];
+	} __Reply__mach_port_get_attributes_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_set_attributes_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_qos_t qos;
+		mach_port_name_t name;
+	} __Reply__mach_port_allocate_qos_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_qos_t qos;
+		mach_port_name_t name;
+	} __Reply__mach_port_allocate_full_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_port_space_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_rights_t srights;
+	} __Reply__mach_port_get_srights_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t table_info;
+		mach_msg_ool_descriptor_t tree_info;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		ipc_info_space_t space_info;
+		mach_msg_type_number_t table_infoCnt;
+		mach_msg_type_number_t tree_infoCnt;
+	} __Reply__mach_port_space_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		unsigned dnr_total;
+		unsigned dnr_used;
+	} __Reply__mach_port_dnrequest_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_insert_member_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_extract_member_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_vm_address_t context;
+	} __Reply__mach_port_get_context_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_set_context_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		natural_t object_type;
+		mach_vm_address_t object_addr;
+	} __Reply__mach_port_kobject_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_port_name_t name;
+	} __Reply__mach_port_construct_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_destruct_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_guard_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_port_unguard_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		ipc_info_space_basic_t basic_info;
+	} __Reply__mach_port_space_basic_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__mach_port_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__mach_port_subsystem__defined
+#define __ReplyUnion__mach_port_subsystem__defined
+union __ReplyUnion__mach_port_subsystem {
+	__Reply__mach_port_names_t Reply_mach_port_names;
+	__Reply__mach_port_type_t Reply_mach_port_type;
+	__Reply__mach_port_rename_t Reply_mach_port_rename;
+	__Reply__mach_port_allocate_name_t Reply_mach_port_allocate_name;
+	__Reply__mach_port_allocate_t Reply_mach_port_allocate;
+	__Reply__mach_port_deallocate_t Reply_mach_port_deallocate;
+	__Reply__mach_port_insert_right_t Reply_mach_port_insert_right;
+	__Reply__mach_port_extract_right_t Reply_mach_port_extract_right;
+	__Reply__mach_port_mod_refs_t Reply_mach_port_mod_refs;
+	__Reply__mach_port_move_member_t Reply_mach_port_move_member;
+	__Reply__mach_port_destroy_t Reply_mach_port_destroy;
+	__Reply__mach_port_get_refs_t Reply_mach_port_get_refs;
+	__Reply__mach_port_peek_t Reply_mach_port_peek;
+	__Reply__mach_port_set_mscount_t Reply_mach_port_set_mscount;
+	__Reply__mach_port_get_set_status_t Reply_mach_port_get_set_status;
+	__Reply__mach_port_request_notification_t Reply_mach_port_request_notification;
+	__Reply__mach_port_set_seqno_t Reply_mach_port_set_seqno;
+	__Reply__mach_port_get_attributes_t Reply_mach_port_get_attributes;
+	__Reply__mach_port_set_attributes_t Reply_mach_port_set_attributes;
+	__Reply__mach_port_allocate_qos_t Reply_mach_port_allocate_qos;
+	__Reply__mach_port_allocate_full_t Reply_mach_port_allocate_full;
+	__Reply__task_set_port_space_t Reply_task_set_port_space;
+	__Reply__mach_port_get_srights_t Reply_mach_port_get_srights;
+	__Reply__mach_port_space_info_t Reply_mach_port_space_info;
+	__Reply__mach_port_dnrequest_info_t Reply_mach_port_dnrequest_info;
+	__Reply__mach_port_insert_member_t Reply_mach_port_insert_member;
+	__Reply__mach_port_extract_member_t Reply_mach_port_extract_member;
+	__Reply__mach_port_get_context_t Reply_mach_port_get_context;
+	__Reply__mach_port_set_context_t Reply_mach_port_set_context;
+	__Reply__mach_port_kobject_t Reply_mach_port_kobject;
+	__Reply__mach_port_construct_t Reply_mach_port_construct;
+	__Reply__mach_port_destruct_t Reply_mach_port_destruct;
+	__Reply__mach_port_guard_t Reply_mach_port_guard;
+	__Reply__mach_port_unguard_t Reply_mach_port_unguard;
+	__Reply__mach_port_space_basic_info_t Reply_mach_port_space_basic_info;
+};
+#endif /* __RequestUnion__mach_port_subsystem__defined */
+
+#ifndef subsystem_to_name_map_mach_port
+#define subsystem_to_name_map_mach_port \
+    { "mach_port_names", 3200 },\
+    { "mach_port_type", 3201 },\
+    { "mach_port_rename", 3202 },\
+    { "mach_port_allocate_name", 3203 },\
+    { "mach_port_allocate", 3204 },\
+    { "mach_port_deallocate", 3205 },\
+    { "mach_port_insert_right", 3206 },\
+    { "mach_port_extract_right", 3207 },\
+    { "mach_port_mod_refs", 3208 },\
+    { "mach_port_move_member", 3209 },\
+    { "mach_port_destroy", 3210 },\
+    { "mach_port_get_refs", 3211 },\
+    { "mach_port_peek", 3212 },\
+    { "mach_port_set_mscount", 3213 },\
+    { "mach_port_get_set_status", 3214 },\
+    { "mach_port_request_notification", 3215 },\
+    { "mach_port_set_seqno", 3216 },\
+    { "mach_port_get_attributes", 3217 },\
+    { "mach_port_set_attributes", 3218 },\
+    { "mach_port_allocate_qos", 3219 },\
+    { "mach_port_allocate_full", 3220 },\
+    { "task_set_port_space", 3221 },\
+    { "mach_port_get_srights", 3222 },\
+    { "mach_port_space_info", 3223 },\
+    { "mach_port_dnrequest_info", 3224 },\
+    { "mach_port_insert_member", 3226 },\
+    { "mach_port_extract_member", 3227 },\
+    { "mach_port_get_context", 3228 },\
+    { "mach_port_set_context", 3229 },\
+    { "mach_port_kobject", 3230 },\
+    { "mach_port_construct", 3231 },\
+    { "mach_port_destruct", 3232 },\
+    { "mach_port_guard", 3233 },\
+    { "mach_port_unguard", 3234 },\
+    { "mach_port_space_basic_info", 3235 }
+#endif
+
+#ifdef __AfterMigServerHeader
+__AfterMigServerHeader
+#endif /* __AfterMigServerHeader */
+
+#endif	 /* _mach_port_server_ */


Property changes on: trunk/sys/sys/mach/mach_port_server.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/mach_time.h
===================================================================
--- trunk/sys/sys/mach/mach_time.h	                        (rev 0)
+++ trunk/sys/sys/mach/mach_time.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2001-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+#ifndef	_MACH_MACH_TIME_H_
+#define	_MACH_MACH_TIME_H_
+
+#include <sys/mach/mach_types.h>
+
+#include <sys/cdefs.h>
+
+struct mach_timebase_info {
+	uint32_t	numer;
+	uint32_t	denom;
+};
+
+typedef struct mach_timebase_info	*mach_timebase_info_t;
+typedef struct mach_timebase_info	mach_timebase_info_data_t;
+
+__BEGIN_DECLS
+#ifndef	KERNEL
+
+kern_return_t		mach_timebase_info(
+						mach_timebase_info_t	info);
+
+kern_return_t		mach_wait_until(
+						uint64_t		deadline);
+
+#endif	/* KERNEL */
+
+uint64_t			mach_absolute_time(void);
+uint64_t			mach_approximate_time(void);
+__END_DECLS
+
+#endif /* _MACH_MACH_TIME_H_ */


Property changes on: trunk/sys/sys/mach/mach_time.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/mach_traps.h
===================================================================
--- trunk/sys/sys/mach/mach_traps.h	                        (rev 0)
+++ trunk/sys/sys/mach/mach_traps.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,742 @@
+/*
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Definitions of general Mach system traps.
+ *
+ *	These are the definitions as seen from user-space.
+ *	The kernel definitions are in <mach/syscall_sw.h>.
+ *	Kernel RPC functions are defined in <mach/mach_interface.h>.
+ */
+
+#ifndef	_SYS_MACH_MACH_TRAPS_H_
+#define _SYS_MACH_MACH_TRAPS_H_
+
+__BEGIN_DECLS
+
+#ifndef	_KERNEL
+#include <mach/std_types.h>
+#include <mach/mach_types.h>
+#include <mach/kern_return.h>
+#include <mach/port.h>
+#include <mach/vm_types.h>
+#include <mach/clock_types.h>
+
+#include <machine/endian.h>
+
+#include <sys/cdefs.h>
+
+#include <stdint.h>
+
+
+#ifdef	PRIVATE
+extern mach_port_name_t mach_reply_port(void);
+
+extern mach_port_name_t thread_self_trap(void);
+
+extern mach_port_name_t host_self_trap(void);
+
+extern mach_msg_return_t mach_msg_trap(
+				mach_msg_header_t *msg,
+				mach_msg_option_t option,
+				mach_msg_size_t send_size,
+				mach_msg_size_t rcv_size,
+				mach_port_name_t rcv_name,
+				mach_msg_timeout_t timeout,
+				mach_port_name_t notify);
+
+extern mach_msg_return_t mach_msg_overwrite_trap(
+				mach_msg_header_t *msg,
+				mach_msg_option_t option,
+				mach_msg_size_t send_size,
+				mach_msg_size_t rcv_size,
+				mach_port_name_t rcv_name,
+				mach_msg_timeout_t timeout,
+				mach_port_name_t notify,
+				mach_msg_header_t *rcv_msg,
+				mach_msg_size_t rcv_limit);
+
+extern kern_return_t semaphore_signal_trap(
+				mach_port_name_t signal_name);
+					      
+extern kern_return_t semaphore_signal_all_trap(
+				mach_port_name_t signal_name);
+
+extern kern_return_t semaphore_signal_thread_trap(
+				mach_port_name_t signal_name,
+				mach_port_name_t thread_name);
+
+extern kern_return_t semaphore_wait_trap(
+				mach_port_name_t wait_name);
+
+extern kern_return_t semaphore_wait_signal_trap(
+				mach_port_name_t wait_name,
+				mach_port_name_t signal_name);
+
+extern kern_return_t semaphore_timedwait_trap(
+				mach_port_name_t wait_name,
+				unsigned int sec,
+				clock_res_t nsec);
+
+extern kern_return_t semaphore_timedwait_signal_trap(
+				mach_port_name_t wait_name,
+				mach_port_name_t signal_name,
+				unsigned int sec,
+				clock_res_t nsec);
+
+#endif	/* PRIVATE */
+
+extern kern_return_t clock_sleep_trap(
+				mach_port_name_t clock_name,
+				sleep_type_t sleep_type,
+				int sleep_sec,
+				int sleep_nsec,
+				mach_timespec_t	*wakeup_time);
+
+extern kern_return_t _kernelrpc_mach_vm_allocate_trap(
+				mach_port_name_t target,
+				mach_vm_offset_t *addr,
+				mach_vm_size_t size,
+				int flags);
+
+extern kern_return_t _kernelrpc_mach_vm_deallocate_trap(
+				mach_port_name_t target,
+				mach_vm_address_t address,
+				mach_vm_size_t size
+);
+
+extern kern_return_t _kernelrpc_mach_vm_protect_trap(
+				mach_port_name_t target,
+				mach_vm_address_t address,
+				mach_vm_size_t size,
+				boolean_t set_maximum,
+				vm_prot_t new_protection
+);
+
+extern kern_return_t _kernelrpc_mach_vm_map_trap(
+				mach_port_name_t target,
+				mach_vm_offset_t *address,
+				mach_vm_size_t size,
+				mach_vm_offset_t mask,
+				int flags,
+				vm_prot_t cur_protection
+);
+
+extern kern_return_t _kernelrpc_mach_port_allocate_trap(
+				mach_port_name_t target,
+				mach_port_right_t right,
+				mach_port_name_t *name
+);
+
+extern kern_return_t _kernelrpc_mach_port_destroy_trap(
+				mach_port_name_t target,
+				mach_port_name_t name
+);
+
+extern kern_return_t _kernelrpc_mach_port_deallocate_trap(
+				mach_port_name_t target,
+				mach_port_name_t name
+);
+
+extern kern_return_t _kernelrpc_mach_port_mod_refs_trap(
+				mach_port_name_t target,
+				mach_port_name_t name,
+				mach_port_right_t right,
+				mach_port_delta_t delta
+);
+
+extern kern_return_t _kernelrpc_mach_port_move_member_trap(
+				mach_port_name_t target,
+				mach_port_name_t member,
+				mach_port_name_t after
+);
+
+extern kern_return_t _kernelrpc_mach_port_insert_right_trap(
+				mach_port_name_t target,
+				mach_port_name_t name,
+				mach_port_name_t poly,
+				mach_msg_type_name_t polyPoly
+);
+
+extern kern_return_t _kernelrpc_mach_port_insert_member_trap(
+				mach_port_name_t target,
+				mach_port_name_t name,
+				mach_port_name_t pset
+);
+
+extern kern_return_t _kernelrpc_mach_port_extract_member_trap(
+				mach_port_name_t target,
+				mach_port_name_t name,
+				mach_port_name_t pset
+);
+
+extern kern_return_t _kernelrpc_mach_port_construct_trap(
+				mach_port_name_t target,
+				mach_port_options_t *options,
+				uint64_t context,
+				mach_port_name_t *name
+);
+
+extern kern_return_t _kernelrpc_mach_port_destruct_trap(
+				mach_port_name_t target,
+				mach_port_name_t name,
+				mach_port_delta_t srdelta,
+				uint64_t guard
+);
+
+extern kern_return_t _kernelrpc_mach_port_guard_trap(
+				mach_port_name_t target,
+				mach_port_name_t name,
+				uint64_t guard,
+				boolean_t strict
+);
+
+extern kern_return_t _kernelrpc_mach_port_unguard_trap(
+				mach_port_name_t target,
+				mach_port_name_t name,
+				uint64_t guard
+);
+
+extern kern_return_t macx_swapon(
+				uint64_t filename,
+				int flags,
+				int size,
+				int priority);
+
+extern kern_return_t macx_swapoff(
+				uint64_t filename,
+				int flags);
+
+extern kern_return_t macx_triggers(
+				int hi_water,
+				int low_water,
+				int flags,
+				mach_port_t alert_port);
+
+extern kern_return_t macx_backing_store_suspend(
+				boolean_t suspend);
+
+extern kern_return_t macx_backing_store_recovery(
+				int pid);
+
+extern boolean_t swtch_pri(int pri);
+
+extern boolean_t swtch(void);
+
+extern kern_return_t thread_switch(
+				mach_port_name_t thread_name,
+				int option,
+				mach_msg_timeout_t option_time);
+
+extern mach_port_name_t task_self_trap(void);
+
+/*
+ *	Obsolete interfaces.
+ */
+
+extern kern_return_t task_for_pid(
+				mach_port_name_t target_tport,
+				int pid,
+				mach_port_name_t *t);
+
+extern kern_return_t task_name_for_pid(
+				mach_port_name_t target_tport,
+				int pid,
+				mach_port_name_t *tn);
+
+extern kern_return_t pid_for_task(
+				mach_port_name_t t,
+				int *x);
+
+#else	/* KERNEL */
+
+mach_port_name_t	mach_reply_port(void);
+
+mach_port_name_t	mach_thread_self(void);
+
+mach_port_name_t	mach_task_self(void);
+
+mach_port_name_t	mach_host_self(void);
+
+
+#ifdef	XNU_KERNEL_PRIVATE
+
+/* Syscall data translations routines
+ *
+ * The kernel may support multiple userspace ABIs, and must use
+ * argument structures with elements large enough for any of them.
+ */
+#if CONFIG_REQUIRES_U32_MUNGING
+#define	PAD_(t)	(sizeof(uint64_t) <= sizeof(t) \
+ 		? 0 : sizeof(uint64_t) - sizeof(t))
+#define PAD_ARG_8
+#else
+#define	PAD_(t)	(sizeof(uint32_t) <= sizeof(t) \
+ 		? 0 : sizeof(uint32_t) - sizeof(t))
+#define PAD_ARG_8 char arg8_pad_[sizeof(uint32_t)];
+#endif
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define	PADL_(t)	0
+#define	PADR_(t)	PAD_(t)
+#else
+#define	PADL_(t)	PAD_(t)
+#define	PADR_(t)	0
+#endif
+
+#define PAD_ARG_(arg_type, arg_name) \
+  char arg_name##_l_[PADL_(arg_type)]; arg_type arg_name; char arg_name##_r_[PADR_(arg_type)];
+
+/*
+ * To support 32-bit clients as well as 64-bit clients, argument
+ * structures may need to be munged to repack the arguments. All
+ * active architectures do this inline in the code to dispatch Mach
+ * traps, without calling out to the BSD system call mungers.
+ */
+
+struct kern_invalid_args {
+	int32_t dummy;
+};
+extern kern_return_t kern_invalid(
+				struct kern_invalid_args *args);
+
+struct mach_reply_port_args {
+	int32_t dummy;
+};
+extern mach_port_name_t mach_reply_port(
+				struct mach_reply_port_args *args);
+
+struct thread_self_trap_args {
+	int32_t dummy;
+};
+extern mach_port_name_t thread_self_trap(
+				struct thread_self_trap_args *args);
+
+struct task_self_trap_args {
+	int32_t dummy;
+};
+extern mach_port_name_t task_self_trap(
+				struct task_self_trap_args *args);
+
+struct host_self_trap_args {
+	int32_t dummy;
+};
+extern mach_port_name_t host_self_trap(
+				struct host_self_trap_args *args);
+
+struct mach_msg_overwrite_trap_args {
+	PAD_ARG_(user_addr_t, msg);
+	PAD_ARG_(mach_msg_option_t, option);
+	PAD_ARG_(mach_msg_size_t, send_size);
+	PAD_ARG_(mach_msg_size_t, rcv_size);
+	PAD_ARG_(mach_port_name_t, rcv_name);
+	PAD_ARG_(mach_msg_timeout_t, timeout);
+	PAD_ARG_(mach_port_name_t, notify);
+	PAD_ARG_8
+	PAD_ARG_(user_addr_t, rcv_msg);  /* Unused on mach_msg_trap */
+};
+extern mach_msg_return_t mach_msg_trap(
+				struct mach_msg_overwrite_trap_args *args);
+extern mach_msg_return_t mach_msg_overwrite_trap(
+				struct mach_msg_overwrite_trap_args *args);
+
+struct semaphore_signal_trap_args {
+	PAD_ARG_(mach_port_name_t, signal_name);
+};
+extern kern_return_t semaphore_signal_trap(
+				struct semaphore_signal_trap_args *args);
+					      
+struct semaphore_signal_all_trap_args {
+	PAD_ARG_(mach_port_name_t, signal_name);
+};
+extern kern_return_t semaphore_signal_all_trap(
+				struct semaphore_signal_all_trap_args *args);
+
+struct semaphore_signal_thread_trap_args {
+	PAD_ARG_(mach_port_name_t, signal_name);
+	PAD_ARG_(mach_port_name_t, thread_name);
+};
+extern kern_return_t semaphore_signal_thread_trap(
+				struct semaphore_signal_thread_trap_args *args);
+
+struct semaphore_wait_trap_args {
+	PAD_ARG_(mach_port_name_t, wait_name);
+};
+extern kern_return_t semaphore_wait_trap(
+				struct semaphore_wait_trap_args *args);
+
+struct semaphore_wait_signal_trap_args {
+	PAD_ARG_(mach_port_name_t, wait_name);
+	PAD_ARG_(mach_port_name_t, signal_name);
+};
+extern kern_return_t semaphore_wait_signal_trap(
+				struct semaphore_wait_signal_trap_args *args);
+
+struct semaphore_timedwait_trap_args {
+	PAD_ARG_(mach_port_name_t, wait_name);
+	PAD_ARG_(unsigned int, sec);
+	PAD_ARG_(clock_res_t, nsec);
+};
+extern kern_return_t semaphore_timedwait_trap(
+				struct semaphore_timedwait_trap_args *args);
+
+struct semaphore_timedwait_signal_trap_args {
+	PAD_ARG_(mach_port_name_t, wait_name);
+	PAD_ARG_(mach_port_name_t, signal_name);
+	PAD_ARG_(unsigned int, sec);
+	PAD_ARG_(clock_res_t, nsec);
+};
+extern kern_return_t semaphore_timedwait_signal_trap(
+				struct semaphore_timedwait_signal_trap_args *args);
+
+struct task_for_pid_args {
+	PAD_ARG_(mach_port_name_t, target_tport);
+	PAD_ARG_(int, pid);
+	PAD_ARG_(user_addr_t, t);
+};
+extern kern_return_t task_for_pid(
+				struct task_for_pid_args *args);
+
+struct task_name_for_pid_args {
+	PAD_ARG_(mach_port_name_t, target_tport);
+	PAD_ARG_(int, pid);
+	PAD_ARG_(user_addr_t, t);
+};
+extern kern_return_t task_name_for_pid(
+				struct task_name_for_pid_args *args);
+
+struct pid_for_task_args {
+	PAD_ARG_(mach_port_name_t, t);
+	PAD_ARG_(user_addr_t, pid);
+};
+extern kern_return_t pid_for_task(
+				struct pid_for_task_args *args);
+
+struct macx_swapon_args {
+	PAD_ARG_(uint64_t, filename);
+	PAD_ARG_(int, flags);
+	PAD_ARG_(int, size);
+	PAD_ARG_(int, priority);
+};
+extern kern_return_t macx_swapon(
+				struct macx_swapon_args *args);
+
+struct macx_swapoff_args {
+    PAD_ARG_(uint64_t, filename);
+    PAD_ARG_(int, flags);
+};
+extern kern_return_t macx_swapoff(
+				struct macx_swapoff_args *args);
+
+struct macx_triggers_args {
+	PAD_ARG_(int, hi_water);
+	PAD_ARG_(int, low_water);
+	PAD_ARG_(int, flags);
+	PAD_ARG_(mach_port_t, alert_port);
+};
+extern kern_return_t macx_triggers(
+				struct macx_triggers_args *args);
+
+struct macx_backing_store_suspend_args {
+	PAD_ARG_(boolean_t, suspend);
+};
+extern kern_return_t macx_backing_store_suspend(
+				struct macx_backing_store_suspend_args *args);
+
+struct macx_backing_store_recovery_args {
+	PAD_ARG_(int, pid);
+};
+extern kern_return_t macx_backing_store_recovery(
+				struct macx_backing_store_recovery_args *args);
+
+struct pfz_exit_args {
+	int32_t dummy;
+};
+extern kern_return_t pfz_exit(
+				struct pfz_exit_args *args);
+
+struct swtch_args {
+    int32_t dummy;
+};
+extern boolean_t swtch(
+				struct swtch_args *args);
+
+struct clock_sleep_trap_args{
+	PAD_ARG_(mach_port_name_t, clock_name);
+	PAD_ARG_(sleep_type_t, sleep_type);
+	PAD_ARG_(int, sleep_sec);
+	PAD_ARG_(int, sleep_nsec);
+	PAD_ARG_(user_addr_t, wakeup_time);
+};
+extern kern_return_t clock_sleep_trap(
+				struct clock_sleep_trap_args *args);
+
+struct thread_switch_args {
+	PAD_ARG_(mach_port_name_t, thread_name);
+	PAD_ARG_(int, option);
+	PAD_ARG_(mach_msg_timeout_t, option_time);
+};
+extern kern_return_t thread_switch(
+				struct thread_switch_args *args);
+
+struct mach_timebase_info_trap_args {
+	PAD_ARG_(user_addr_t, info);
+};
+extern kern_return_t mach_timebase_info_trap(
+				struct mach_timebase_info_trap_args *args);
+
+struct mach_wait_until_trap_args {
+	PAD_ARG_(uint64_t, deadline);
+};
+extern kern_return_t mach_wait_until_trap(
+				struct mach_wait_until_trap_args *args);
+
+struct mk_timer_create_trap_args {
+    int32_t dummy;
+};
+extern mach_port_name_t mk_timer_create_trap(
+				struct mk_timer_create_trap_args *args);
+
+struct mk_timer_destroy_trap_args {
+	PAD_ARG_(mach_port_name_t, name);
+};
+extern kern_return_t mk_timer_destroy_trap(
+				struct mk_timer_destroy_trap_args *args);
+
+struct mk_timer_arm_trap_args {
+	PAD_ARG_(mach_port_name_t, name);
+	PAD_ARG_(uint64_t, expire_time);
+};
+extern kern_return_t mk_timer_arm_trap(
+				struct mk_timer_arm_trap_args *args);
+
+struct mk_timer_cancel_trap_args {
+    PAD_ARG_(mach_port_name_t, name);
+    PAD_ARG_(user_addr_t, result_time);
+};
+extern kern_return_t mk_timer_cancel_trap(
+				struct mk_timer_cancel_trap_args *args);
+
+struct _kernelrpc_mach_vm_allocate_trap_args {
+	PAD_ARG_(mach_port_name_t, target);	/* 1 word */
+	PAD_ARG_(user_addr_t, addr);		/* 1 word */
+	PAD_ARG_(mach_vm_size_t, size);		/* 2 words */
+	PAD_ARG_(int, flags);			/* 1 word */
+};						/* Total: 5 */
+
+extern kern_return_t _kernelrpc_mach_vm_allocate_trap(
+				struct _kernelrpc_mach_vm_allocate_trap_args *args);
+
+struct _kernelrpc_mach_vm_deallocate_args {
+	PAD_ARG_(mach_port_name_t, target);	/* 1 word */
+	PAD_ARG_(mach_vm_address_t, address);	/* 2 words */
+	PAD_ARG_(mach_vm_size_t, size);		/* 2 words */
+};						/* Total: 5 */
+extern kern_return_t _kernelrpc_mach_vm_deallocate_trap(
+				struct _kernelrpc_mach_vm_deallocate_args *args);
+
+struct _kernelrpc_mach_vm_protect_args {
+	PAD_ARG_(mach_port_name_t, target);	/* 1 word */
+	PAD_ARG_(mach_vm_address_t, address);	/* 2 words */
+	PAD_ARG_(mach_vm_size_t, size);		/* 2 words */
+	PAD_ARG_(boolean_t, set_maximum);	/* 1 word */
+	PAD_ARG_(vm_prot_t, new_protection);	/* 1 word */
+};						/* Total: 7 */
+extern kern_return_t _kernelrpc_mach_vm_protect_trap(
+				struct _kernelrpc_mach_vm_protect_args *args);
+
+struct _kernelrpc_mach_vm_map_trap_args {
+	PAD_ARG_(mach_port_name_t, target);
+	PAD_ARG_(user_addr_t, addr);
+	PAD_ARG_(mach_vm_size_t, size);
+	PAD_ARG_(mach_vm_offset_t, mask);
+	PAD_ARG_(int, flags);
+	PAD_ARG_8
+	PAD_ARG_(vm_prot_t, cur_protection);
+};
+extern kern_return_t _kernelrpc_mach_vm_map_trap(
+				struct _kernelrpc_mach_vm_map_trap_args *args);
+
+struct _kernelrpc_mach_port_allocate_args {
+	PAD_ARG_(mach_port_name_t, target);
+	PAD_ARG_(mach_port_right_t, right);
+	PAD_ARG_(user_addr_t, name);
+};
+extern kern_return_t _kernelrpc_mach_port_allocate_trap(
+				struct _kernelrpc_mach_port_allocate_args *args);
+
+
+struct _kernelrpc_mach_port_destroy_args {
+	PAD_ARG_(mach_port_name_t, target);
+	PAD_ARG_(mach_port_name_t, name);
+};
+extern kern_return_t _kernelrpc_mach_port_destroy_trap(
+				struct _kernelrpc_mach_port_destroy_args *args);
+
+struct _kernelrpc_mach_port_deallocate_args {
+	PAD_ARG_(mach_port_name_t, target);
+	PAD_ARG_(mach_port_name_t, name);
+};
+extern kern_return_t _kernelrpc_mach_port_deallocate_trap(
+				struct _kernelrpc_mach_port_deallocate_args *args);
+
+struct _kernelrpc_mach_port_mod_refs_args {
+	PAD_ARG_(mach_port_name_t, target);
+	PAD_ARG_(mach_port_name_t, name);
+	PAD_ARG_(mach_port_right_t, right);
+	PAD_ARG_(mach_port_delta_t, delta);
+};
+extern kern_return_t _kernelrpc_mach_port_mod_refs_trap(
+				struct _kernelrpc_mach_port_mod_refs_args *args);
+
+struct _kernelrpc_mach_port_move_member_args {
+	PAD_ARG_(mach_port_name_t, target);
+	PAD_ARG_(mach_port_name_t, member);
+	PAD_ARG_(mach_port_name_t, after);
+};
+extern kern_return_t _kernelrpc_mach_port_move_member_trap(
+				struct _kernelrpc_mach_port_move_member_args *args);
+
+struct _kernelrpc_mach_port_insert_right_args {
+	PAD_ARG_(mach_port_name_t, target);
+	PAD_ARG_(mach_port_name_t, name);
+	PAD_ARG_(mach_port_name_t, poly);
+	PAD_ARG_(mach_msg_type_name_t, polyPoly);
+};
+extern kern_return_t _kernelrpc_mach_port_insert_right_trap(
+				struct _kernelrpc_mach_port_insert_right_args *args);
+
+struct _kernelrpc_mach_port_insert_member_args {
+	PAD_ARG_(mach_port_name_t, target);
+	PAD_ARG_(mach_port_name_t, name);
+	PAD_ARG_(mach_port_name_t, pset);
+};
+extern kern_return_t _kernelrpc_mach_port_insert_member_trap(
+				struct _kernelrpc_mach_port_insert_member_args *args);
+
+struct _kernelrpc_mach_port_extract_member_args {
+	PAD_ARG_(mach_port_name_t, target);
+	PAD_ARG_(mach_port_name_t, name);
+	PAD_ARG_(mach_port_name_t, pset);
+};
+extern kern_return_t _kernelrpc_mach_port_extract_member_trap(
+				struct _kernelrpc_mach_port_extract_member_args *args);
+
+struct _kernelrpc_mach_port_construct_args {
+	PAD_ARG_(mach_port_name_t, target);
+	PAD_ARG_(user_addr_t, options);
+	PAD_ARG_(uint64_t, context);
+	PAD_ARG_(user_addr_t, name);
+};
+extern kern_return_t _kernelrpc_mach_port_construct_trap(
+				struct _kernelrpc_mach_port_construct_args *args);
+
+struct _kernelrpc_mach_port_destruct_args {
+	PAD_ARG_(mach_port_name_t, target);
+	PAD_ARG_(mach_port_name_t, name);
+	PAD_ARG_(mach_port_delta_t, srdelta);
+	PAD_ARG_(uint64_t, guard);
+};
+extern kern_return_t _kernelrpc_mach_port_destruct_trap(
+				struct _kernelrpc_mach_port_destruct_args *args);
+
+struct _kernelrpc_mach_port_guard_args {
+	PAD_ARG_(mach_port_name_t, target);
+	PAD_ARG_(mach_port_name_t, name);
+	PAD_ARG_(uint64_t, guard);
+	PAD_ARG_(boolean_t, strict);
+};
+extern kern_return_t _kernelrpc_mach_port_guard_trap(
+				struct _kernelrpc_mach_port_guard_args *args);
+
+struct _kernelrpc_mach_port_unguard_args {
+	PAD_ARG_(mach_port_name_t, target);
+	PAD_ARG_(mach_port_name_t, name);
+	PAD_ARG_(uint64_t, guard);
+};
+extern kern_return_t _kernelrpc_mach_port_unguard_trap(
+				struct _kernelrpc_mach_port_unguard_args *args);
+
+
+/* not published to LP64 clients yet */
+struct iokit_user_client_trap_args {
+	PAD_ARG_(void *, userClientRef);
+	PAD_ARG_(uint32_t, index);
+	PAD_ARG_(void *, p1);
+	PAD_ARG_(void *, p2);
+	PAD_ARG_(void *, p3);
+	PAD_ARG_(void *, p4);
+	PAD_ARG_(void *, p5);
+    	PAD_ARG_8
+	PAD_ARG_(void *, p6);
+};
+kern_return_t iokit_user_client_trap(
+				struct iokit_user_client_trap_args *args);
+
+#undef PAD_
+#undef PADL_
+#undef PADR_
+#undef PAD_ARG_
+#undef PAD_ARG_8
+
+#endif	/* XNU_KERNEL_PRIVATE */
+
+#endif	/* KERNEL */
+
+__END_DECLS
+
+#endif	/* _SYS_MACH_MACH_TRAPS_H_ */


Property changes on: trunk/sys/sys/mach/mach_traps.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/mach_types.defs
===================================================================
--- trunk/sys/sys/mach/mach_types.defs	                        (rev 0)
+++ trunk/sys/sys/mach/mach_types.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,605 @@
+/*
+ * Copyright (c) 2000-2010 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ * NOTICE: This file was modified by McAfee Research in 2004 to introduce
+ * support for mandatory and extensible security protections.  This notice
+ * is included in support of clause 2.2 (b) of the Apple Public License,
+ * Version 2.0.
+ */
+/*
+ */
+/*
+ *	Mach kernel interface type declarations
+ */
+
+#ifndef	_MACH_MACH_TYPES_DEFS_
+#define _MACH_MACH_TYPES_DEFS_
+
+
+#include <mach/std_types.defs>
+
+type memory_object_offset_t 	= uint64_t;
+type memory_object_size_t 	= uint64_t;
+type memory_object_cluster_size_t = uint32_t;
+type memory_object_fault_info_t = array[16] of integer_t;
+
+#ifdef KERNEL_PRIVATE
+
+/* Universal Page Lists - restricted to (in-kernel) pagers for now */
+type upl_size_t			= uint32_t;
+type upl_offset_t			= uint32_t;
+type upl_page_info_t		= struct[2] of integer_t;
+type upl_page_info_array_t	= array[*:256] of upl_page_info_t;
+
+type upl_t = mach_port_t
+		intran: upl_t convert_port_to_upl(mach_port_t)
+		outtran: mach_port_t convert_upl_to_port(upl_t)
+		destructor: upl_deallocate(upl_t)
+		;
+
+#endif /* KERNEL_PRIVATE */
+
+type mach_port_status_t = struct[10] of integer_t;	/* obsolete */
+type mach_port_info_ext_t = struct[17] of integer_t;
+
+		/* mach_port_info_t: can hold either a
+		 * mach_port_status_t (9 ints) or a
+		 * mach_port_limits_t (1 int) or a 
+		 * mach_port_info_ext_t (17 ints). If new flavors of
+		 * mach_port_{get,set}_attributes are added, the size of
+		 * this array may have to be increased. (See mach/port.h)
+		 */
+type mach_port_flavor_t 	= int;
+type mach_port_info_t		= array[*:17] of integer_t;
+
+     		/*
+		 * mach_msg_max_trailer_t: can hold
+		 * mach_msg_trailer_type_t (1 int)
+		 * mach_msg_trailer_size_t (1 int)
+		 * mach_port_seqno_t (1 int)
+		 * security_token_t (2 ints)
+		 * audit_token_t (8 ints)
+		 * mach_port_context_t (2 ints)
+		 * msgh_ad (1 int)
+		 * msg_labels_t (1 int)
+		 */
+type mach_msg_trailer_type_t = int;
+type mach_msg_trailer_info_t	= array[*:68] of char;
+
+type task_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: task_t convert_port_to_task(mach_port_t)
+		outtran: mach_port_t convert_task_to_port(task_t)
+		destructor: task_deallocate(task_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type task_name_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: task_name_t convert_port_to_task_name(mach_port_t)
+		outtran: mach_port_t convert_task_name_to_port(task_name_t)
+		destructor: task_name_deallocate(task_name_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type thread_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: thread_t convert_port_to_thread(mach_port_t)
+		outtran: mach_port_t convert_thread_to_port(thread_t)
+		destructor: thread_deallocate(thread_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type thread_act_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: thread_act_t convert_port_to_thread(mach_port_t)
+		outtran: mach_port_t convert_thread_to_port(thread_act_t)
+		destructor: thread_deallocate(thread_act_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type thread_act_consume_ref_t = mach_port_move_send_t
+		cusertype: thread_act_t
+#if	KERNEL_SERVER
+		intran: thread_act_t convert_port_to_thread(mach_port_t)
+		destructor: thread_deallocate(thread_act_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+		/* thread_state_t: This inline array can hold
+		 * a machine-dependent amount of data, defined in
+		 * mach/machine/???? (currently THREAD_STATE_MAX,
+		 * in mach/thread_state.h)
+		 */
+import <sys/mach/thread_status.h>;
+#ifndef THREAD_STATE_MAX
+#define THREAD_STATE_MAX 32
+#endif
+type thread_state_flavor_t	= int;
+type thread_state_t		= array[*:THREAD_STATE_MAX] of natural_t;
+
+type task_array_t = ^array[] of task_t;
+type thread_array_t = ^array[] of thread_t;
+type thread_act_array_t = ^array[] of thread_act_t;
+type act_params_t = array[6] of int;
+
+type mach_vm_map_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: vm_map_t convert_port_to_map(mach_port_t)
+		destructor: vm_map_deallocate(vm_map_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type vm_task_entry_t = mach_port_t
+		cusertype: mach_vm_map_t
+#if	KERNEL_SERVER
+		intran: vm_map_t convert_port_entry_to_map(mach_port_t)
+		destructor: vm_map_deallocate(vm_map_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type ipc_space_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: ipc_space_t convert_port_to_space(mach_port_t)
+		destructor: space_deallocate(ipc_space_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type vm_prot_t = int;
+type vm_inherit_t = int;
+type vm_purgable_t = int;
+type xxx_vm_statistics_data_t = struct[13] of integer_t;
+type vm_behavior_t = int;
+type vm_statistics_data_t = struct[15] of integer_t;
+type vm_machine_attribute_t = int;
+type vm_machine_attribute_val_t = int;
+type vm_sync_t = int;
+
+		/* thread_info_t: this inline array can hold any of:
+		 * thread_basic_info_t (10 ints)
+		 * policy_timeshare_info_t (5 ints)
+		 * policy_fifo_info_t (4 ints)
+		 * policy_rr_info_t (5 ints)
+		 * if other thread_info flavors are added, this
+		 * definition may need to be changed. (See
+		 * mach/thread_info.h and mach/policy.h) */
+type thread_flavor_t		= int;
+type thread_info_t		= array[*:12] of integer_t;
+
+type thread_policy_flavor_t	= natural_t;
+type thread_policy_t		= array[*:16] of integer_t;
+
+		/* task_info_t: this inline array can hold any of:
+		 * task_basic_info_32_t (8 ints)
+		 * task_basic_info_64_t (10 ints)
+		 * task_events_info_t (8 ints)
+		 * task_thread_times_info_t (4 ints)
+		 * policy_timeshare_info_t (5 ints)
+		 * policy_fifo_info_t (4 ints)
+		 * policy_rr_info_t (5 ints)
+		 * task security token (2 ints)
+		 * task audit token (8 ints)
+		 * dyld info (2 64-bit ints and 1 int)
+		 * task_extmod_info_t (8 64-bit ints)
+		 * task_basic_info_64_2_t
+		 * mach_task_basic_info_t (12 ints)
+		 * task_power_info_t (18 ints)
+		 * If other task_info flavors are added, this
+		 * definition may need to be changed. (See
+		 * mach/task_info.h and mach/policy.h) */
+type task_flavor_t		= int;
+type task_info_t		= array[*:52] of integer_t;
+
+type task_purgable_info_t	= struct[68] of integer_t;
+
+type task_policy_flavor_t	= natural_t;
+type task_policy_t		= array[*:16] of integer_t;
+
+type mem_entry_name_port_t = mach_port_t
+#if     KERNEL_SERVER
+		intran: mem_entry_name_port_t null_conversion(mach_port_t)
+		outtran: mach_port_t null_conversion(mem_entry_name_port_t)
+#endif  /* KERNEL_SERVER */
+		;
+
+type mem_entry_name_port_move_send_t = mach_port_move_send_t
+	cusertype: mem_entry_name_port_t
+#if     KERNEL_SERVER
+		intran: mem_entry_name_port_t null_conversion(mach_port_t)
+		outtran: mach_port_t null_conversion(mem_entry_name_port_t)
+#endif  /* KERNEL_SERVER */
+		;
+
+type memory_object_default_t = mach_port_t
+#if	KERNEL_PRIVATE
+		intran: memory_object_default_t null_conversion(mach_port_t)
+		outtran: mach_port_t null_conversion(memory_object_default_t)
+#endif	/* KERNEL_PRIVATE */
+		;
+ 
+type memory_object_t = mach_port_t
+#if	KERNEL_PRIVATE
+		intran: memory_object_t convert_port_to_memory_object(mach_port_t)
+		outtran: mach_port_t convert_memory_object_to_port(memory_object_t)
+#endif	/* KERNEL_PRIVATE */
+		;
+
+
+type memory_object_control_t = mach_port_t
+#if	KERNEL_PRIVATE
+		intran: memory_object_control_t convert_port_to_mo_control(mach_port_t)
+		outtran: mach_port_t convert_mo_control_to_port(memory_object_control_t)
+		destructor: memory_object_control_deallocate(memory_object_control_t)
+#endif	/* KERNEL_PRIVATE */
+		;
+
+type memory_object_name_t = mach_port_t
+		ctype: mach_port_t
+		;
+
+
+type memory_object_copy_strategy_t = int;
+type memory_object_return_t = int;
+
+type machine_info_data_t = struct[5] of integer_t;
+type machine_slot_data_t = struct[8] of integer_t;
+
+type host_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: host_t convert_port_to_host(mach_port_t)
+		outtran: mach_port_t convert_host_to_port(host_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type host_priv_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: host_priv_t convert_port_to_host_priv(mach_port_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type host_security_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: host_security_t convert_port_to_host_security(mach_port_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+		/* 
+		 * host_info_t: variable-sized inline array that can contain:
+		 * 
+		 * 	host_basic_info_old_t (5 ints)
+		 * 	host_basic_info_t (12 ints)
+		 * 	host_sched_info_t (2 ints)
+		 * 	kernel_resource_sizes_t (5 ints)
+		 * 	host_load_info_t (6 ints)
+		 * 	vm_statistics32_t (15 ints)
+		 * 	host_purgable_info_t (68 ints)
+		 *	host_expired_task_info uses a task_power_info (18 ints)
+		 * 
+		 * If other host_info flavors are added, this definition may
+		 * need to be changed. (See mach/{host_info,vm_statistics}.h)
+		 */
+type host_flavor_t		= int;
+type host_info_t 		= array[*:68] of integer_t;
+		/* 
+		 * host_info64_t: variable-sized inline array that can contain:
+		 * 
+		 *	vm_statistics_t (6 ints and 9 longs)
+		 *	vm_extmod_statistics_t (6 64-bit ints)
+		 */
+type host_info64_t		= array[*:256] of integer_t;
+
+type processor_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: processor_t convert_port_to_processor(mach_port_t)
+		outtran: mach_port_t convert_processor_to_port(processor_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type processor_array_t 	= ^array[] of processor_t;
+
+		/* processor_info_t: variable-sized inline array that can
+		 * contain:
+		 * processor_basic_info_t:   (5 ints)
+		 * processor_cpu_load_info_t:(4 ints)
+		 * processor_machine_info_t :(12 ints)
+		 * If other processor_info flavors are added, this definition
+		 * may need to be changed. (See mach/processor_info.h) */
+type processor_flavor_t		= int;
+type processor_info_t		= array[*:12] of integer_t;
+type processor_info_array_t	= ^array[] of integer_t;
+
+type processor_set_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: processor_set_t convert_port_to_pset(mach_port_t)
+		outtran: mach_port_t convert_pset_to_port(processor_set_t)
+		destructor: pset_deallocate(processor_set_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type processor_set_array_t = ^array[] of processor_set_t;
+
+type processor_set_name_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: processor_set_name_t convert_port_to_pset_name(mach_port_t)
+		outtran: mach_port_t convert_pset_name_to_port(processor_set_name_t)
+		destructor: pset_deallocate(processor_set_name_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type processor_set_name_array_t = ^array[] of processor_set_name_t;
+
+		/* processor_set_info_t: variable-size inline array
+		 * that can hold:
+		 * processor_set_basic_info (5 ints)
+		 * processor_set_load_info (4 ints)
+		 * policy_timeshare_base_t (1 int)
+		 * policy_fifo_base_t (1 int)
+		 * policy_rr_base_t (1 int)
+		 * policy_timeshare_base_t (1 int)
+		 * policy_fifo_base_t (1 int)
+		 * policy_rr_base_t (1 int)
+		 * policy_t (1 int)
+		 * If other flavors are added, this definition may
+		 * need to be changed. (see mach/processor.h) */
+type processor_set_flavor_t	= int;
+type processor_set_info_t	= array[*:5] of integer_t;	
+
+type bootstrap_t = mach_port_t;
+
+type kernel_version_t           = c_string[*:512];
+type kernel_boot_info_t         = c_string[*:4096];
+
+type time_value_t = struct[2] of integer_t;
+
+type mach_port_qos_t = struct[2] of integer_t;
+
+type mach_port_options_t = struct[3] of uint64_t;
+type mach_port_options_ptr_t = ^ mach_port_options_t;
+
+type emulation_vector_t		= ^array[] of vm_offset_t;
+
+type inline_existence_map_t	= array[*:512] of char;
+
+type policy_t			= int;
+		/* policy_info_t: variable-size inline array. Can hold:
+		 * policy_timeshare_info_t (5 ints)
+		 * policy_fifo_info_t (4 ints)
+		 * policy_rr_info_t (5 ints) */
+type policy_base_t		= array[*:5] of integer_t;
+type policy_info_t		= array[*:2] of integer_t;
+type policy_limit_t		= array[*:1] of integer_t;
+
+type ledger_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: ledger_t convert_port_to_ledger(mach_port_t)
+		outtran: mach_port_t convert_ledger_to_port(ledger_t)
+#endif	/* KERNEL_SERVER */
+                ;
+
+type ledger_array_t	 	= ^array[] of ledger_t;
+type ledger_item_t		= integer_t;
+     				  /* DEPRECATED */
+
+type ledger_amount_t		= int64_t;
+
+type security_token_t		= struct[2] of uint32_t;
+type audit_token_t		= struct[8] of uint32_t;
+
+type msg_labels_t = mach_port_t;
+
+		/* memory_object_info_t: variable-size inline array:
+		 * memory_object_attr_info_t (5 ints)
+		 * XXX actually it's 6 ints temporarily (object_ready!)
+		 * memory_object_behave_info_t (4 ints)
+		 * memory_object_perf_info_t (2 ints)
+		 * old_memory_object_attr_info_t (3 ints)
+		 * If other flavors are added, this definition may
+		 * need to be changed. (see mach/memory_object.h) */
+type memory_object_flavor_t	= int;
+type memory_object_info_t	= array[*:6] of int;
+
+		/* vm_region_info_t: variable-size inline array that can hold:
+		 * vm_region_basic_info_t (8 ints)
+		 * If other flavors are added, this definition may
+		 * need to be changed. (see mach/vm_region.h) */
+type vm_region_flavor_t		= int;
+type vm_region_info_t		= array[*:10] of int;
+type vm_region_recurse_info_t	= array[*:19] of int;
+
+type vm_page_info_flavor_t	= int;
+type vm_page_info_t		= array[*:32] of int;
+
+type mach_vm_read_entry_t = array[512] of mach_vm_offset_t;
+type vm_read_entry_t = array[512] of vm_offset_t;
+#if VM32_SUPPORT
+type vm32_read_entry_t = array[512] of vm32_offset_t;
+#endif
+
+type exception_mask_t		= int;
+type exception_behavior_t	= int;
+
+type    exception_handler_t = mach_port_t;
+
+type	exception_handler_array_t	=
+			array[*:32] of exception_handler_t;
+
+type	exception_behavior_array_t	=
+			array[*:32] of exception_behavior_t;
+
+type	exception_flavor_array_t	=
+			array[*:32] of thread_state_flavor_t;
+
+type	exception_mask_array_t	=
+			array[*:32] of exception_mask_t;
+
+type semaphore_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: semaphore_t convert_port_to_semaphore(mach_port_t)
+		outtran: mach_port_t convert_semaphore_to_port(semaphore_t)
+		destructor: semaphore_dereference(semaphore_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type semaphore_consume_ref_t = mach_port_move_send_t
+		cusertype: semaphore_t
+#if	KERNEL_SERVER
+		intran: semaphore_t convert_port_to_semaphore(mach_port_t)
+		outtran: mach_port_t convert_semaphore_to_port(semaphore_t)
+		destructor: semaphore_dereference(semaphore_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type lock_set_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: lock_set_t convert_port_to_lock_set(mach_port_t)
+		outtran: mach_port_t convert_lock_set_to_port(lock_set_t)
+		destructor: lock_set_dereference(lock_set_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type task_suspension_token_t = mach_port_move_send_once_t
+#if	KERNEL_SERVER
+		intran: task_suspension_token_t convert_port_to_task_suspension_token(mach_port_t)
+		outtran: mach_port_t convert_task_suspension_token_to_port(task_suspension_token_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+
+/* public voucher types */
+
+/* Mach voucher object */
+type mach_voucher_t = mach_port_t;
+type mach_voucher_name_t = mach_port_name_t;
+
+type mach_voucher_attr_manager_t = mach_port_t;
+type mach_voucher_attr_control_t = mach_port_t;
+
+/* IPC voucher internal object */
+type ipc_voucher_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: ipc_voucher_t convert_port_to_voucher(mach_port_t)
+		outtran: mach_port_t convert_voucher_to_port(ipc_voucher_t)
+		destructor: ipc_voucher_release(ipc_voucher_t)
+#endif	/* KERNEL_SERVER */
+	        ;
+
+/* IPC voucher attribute control internal object */
+type ipc_voucher_attr_control_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: ipc_voucher_attr_control_t convert_port_to_voucher_attr_control(mach_port_t)
+		outtran: mach_port_t convert_voucher_attr_control_to_port(ipc_voucher_attr_control_t)
+		destructor: ipc_voucher_attr_control_release(ipc_voucher_attr_control_t)
+#endif	/* KERNEL_SERVER */
+                ;
+
+type mach_voucher_attr_key_t = uint32_t;
+
+type mach_voucher_attr_command_t = uint32_t;
+type mach_voucher_attr_recipe_command_t = uint32_t;
+
+type mach_voucher_attr_content_size_t = uint32_t;
+type mach_voucher_attr_content_t = array[*:4096] of uint8_t;
+type mach_voucher_attr_content_array_t = array[*:5120] of uint8_t;
+
+type mach_voucher_attr_raw_recipe_size_t = uint32_t;
+type mach_voucher_attr_raw_recipe_t = array[*:4096] of uint8_t;
+type mach_voucher_attr_raw_recipe_array_t = array[*:5120] of uint8_t;
+
+type mach_voucher_selector_t = uint32_t;
+
+type mach_voucher_attr_value_handle_t = uint64_t;
+type mach_voucher_attr_value_handle_array_t = array[*:4] of mach_voucher_attr_value_handle_t;
+type mach_voucher_attr_value_reference_t = uint32_t;
+
+/* kernel module loader */
+type kmod_t = int;
+type kmod_control_flavor_t = int;
+
+type kmod_args_t = ^array[] of MACH_MSG_TYPE_BYTE
+	ctype: kmod_args_t;
+
+type io_master_t = mach_port_t;
+type UNDServerRef = mach_port_t;
+
+#if KERNEL_SERVER
+#ifdef	MACH_KERNEL_PRIVATE
+simport <sys/mach/ipc/ipc_voucher.h>;	/* for voucher conversions */
+simport <kern/ipc_kobject.h>;	/* for null conversion */
+simport <kern/ipc_host.h>;	/* for host/processor/pset conversions */
+simport <kern/ipc_sync.h>;      /* for lock_set and semaphore conversions */
+simport <kern/ledger.h>;	/* for ledger conversions */
+simport <kern/processor.h>;	/* for processor conversions */
+simport <kern/sync_lock.h>;	/* for lock-set conversions */
+simport <kern/sync_sema.h>;	/* for semaphore conversions */
+simport <vm/memory_object.h>;	/* for memory object type conversions */
+simport <vm/vm_map.h>;		/* for vm_map conversions */
+#endif	/* MACH_KERNEL_PRIVATE */
+simport <sys/mach/ipc_sync.h>;      /* for lock_set and semaphore conversions */
+simport <sys/mach/ipc/ipc_voucher.h>;	/* for voucher conversions */
+simport <sys/mach/ipc_host.h>;	/* for host/processor/pset conversions */
+simport <sys/mach/ipc_tt.h>;	/* for task/thread conversion */
+
+
+simport <sys/mach/ipc_mig.h>;	/* pick up kernel-specific MIG things */
+
+#endif /* KERNEL_SERVER */
+
+import <sys/mach/mig.h>;
+import <sys/mach/mach_types.h>;
+
+#endif	/* _MACH_MACH_TYPES_DEFS_ */
+
+/* vim: set ft=c : */

Added: trunk/sys/sys/mach/mach_types.h
===================================================================
--- trunk/sys/sys/mach/mach_types.h	                        (rev 0)
+++ trunk/sys/sys/mach/mach_types.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,364 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.8.2.3  92/09/15  17:23:39  jeffreyh
+ * 	Added mach/prof_types.h
+ * 	[92/07/24            bernadat]
+ * 
+ * Revision 2.8.2.2  92/06/24  18:05:31  jeffreyh
+ * 	Added host_paging_t for NORMA_IPC
+ * 	[92/06/17            jeffreyh]
+ * 
+ * Revision 2.8.2.1  92/02/21  11:24:01  jsb
+ * 	NORMA_VM: define mach_xmm_obj_t and xmm_kobj_lookup().
+ * 	[92/02/10  08:47:29  jsb]
+ * 
+ * Revision 2.8  91/06/25  10:30:20  rpd
+ * 	Added KERNEL-compilation includes for *_array_t types.
+ * 	[91/05/23            rpd]
+ * 
+ * Revision 2.7  91/06/06  17:08:07  jsb
+ * 	Added emulation_vector_t for new get/set emulation vector calls.
+ * 	[91/05/24  17:46:31  jsb]
+ * 
+ * Revision 2.6  91/05/14  16:55:17  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.5  91/02/05  17:33:43  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:18:38  mrt]
+ * 
+ * Revision 2.4  90/08/07  18:00:30  rpd
+ * 	Added processor_set_name_array_t.
+ * 	Removed vm_region_t, vm_region_array_t.
+ * 	[90/08/07            rpd]
+ * 
+ * Revision 2.3  90/06/02  14:58:42  rpd
+ * 	Converted to new IPC.
+ * 	[90/03/26  22:33:59  rpd]
+ * 
+ * Revision 2.2  90/01/22  23:05:48  af
+ * 	Added inclusion of vm_attributes.
+ * 	[89/12/09            af]
+ * 
+ * 	Moved KERNEL type definitions into kern/mach_types_kernel.h, so
+ * 	that changing them will not affect user programs.
+ * 	[89/04/06            dbg]
+ * 
+ * 	Removed io_buf_t, io_buf_ptr_t in favor of device interface.
+ * 	Removed include of ipc_netport.h.  Removed vm_page_data_t
+ * 	(obsolete).
+ * 	[89/01/14            dbg]
+ * 
+ * Revision 2.1  89/08/03  16:02:27  rwd
+ * Created.
+ * 
+ * Revision 2.3  89/02/25  18:38:04  gm0w
+ * 	Changes for cleanup.
+ * 
+ * Revision 2.2  89/01/15  16:30:50  rpd
+ * 	Moved from kern/ to mach/.
+ * 	[89/01/15  14:35:53  rpd]
+ * 
+ * Revision 2.10  89/01/12  11:15:18  rpd
+ * 	Removed pointer_t declaration; it belongs in std_types.h.
+ * 
+ * Revision 2.9  89/01/12  07:57:53  rpd
+ * 	Moved basic stuff to std_types.h.  Removed debugging definitions.
+ * 	Moved io_buf definitions to device_types.h.
+ * 	[89/01/12  04:51:54  rpd]
+ * 
+ * Revision 2.8  89/01/04  13:37:34  rpd
+ * 	Include <kern/fpa_counters.h>, for fpa_counters_t.
+ * 	[89/01/01  15:03:52  rpd]
+ * 
+ * Revision 2.7  88/09/25  22:15:28  rpd
+ * 	Changed sys/callout.h to kern/callout_statistics.h.
+ * 	[88/09/09  14:00:19  rpd]
+ * 	
+ * 	Changed includes to the new style.
+ * 	Added include of sys/callout.h.
+ * 	[88/09/09  04:47:42  rpd]
+ * 
+ * Revision 2.6  88/08/06  18:22:34  rpd
+ * Changed sys/mach_ipc_netport.h to kern/ipc_netport.h.
+ * 
+ * Revision 2.5  88/07/21  00:36:06  rpd
+ * Added include of ipc_statistics.h.
+ * 
+ * Revision 2.4  88/07/17  19:33:20  mwyoung
+ * *** empty log message ***
+ * 
+ * 29-Jun-88  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Use new <mach/memory_object.h>.
+ *
+ *  9-Apr-88  Daniel Julin (dpj) at Carnegie-Mellon University
+ *	Changed mach_ipc_vmtp.h to mach_ipc_netport.h.
+ *
+ *  1-Mar-88  Mary Thompson (mrt) at Carnegie Mellon
+ *	Added a conditional on _MACH_INIT_ before the include
+ *	of mach_init.h so that the kernel make of mach_user_internal
+ *	would not include mach_init.h
+ *
+ * 18-Jan-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Added includes of task_info, thread_info, task_special_ports,
+ *	thread_special_ports for new interfaces.
+ *
+ * 12-Dec-87  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Reduced old history.
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/mach_types.h
+ *	Author:	Avadis Tevanian, Jr., Michael Wayne Young
+ *	Date:	1986
+ *
+ *	Mach external interface definitions.
+ *
+ */
+
+#ifndef	_MACH_MACH_TYPES_H_
+#define _MACH_MACH_TYPES_H_
+#include <sys/cdefs.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/sx.h>
+#include <sys/malloc.h>
+#include <vm/vm.h>
+
+#ifndef THREAD_STATE_MAX
+#define THREAD_STATE_MAX 32
+#endif
+
+#include <sys/mach/host_info.h>
+#include <sys/mach/machine.h>
+#include <sys/mach/memory_object.h>
+#include <sys/mach/exception_types.h>
+#include <sys/mach/port.h>
+#include <sys/mach/processor_info.h>
+#include <sys/mach/task_info.h>
+#include <sys/mach/task_policy.h>
+#include <sys/mach/task_special_ports.h>
+#include <sys/mach/thread_info.h>
+#include <sys/mach/thread_special_ports.h>
+#include <sys/mach/thread_status.h>
+#include <sys/mach/time_value.h>
+#include <sys/mach/clock_types.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/mach_voucher_types.h>
+#include <sys/mach/vm_attributes.h>
+#include <sys/mach/vm_inherit.h>
+#include <sys/mach/vm_behavior.h>
+#include <sys/mach/vm_prot.h>
+#include <sys/mach/vm_statistics.h>
+#include <sys/mach/vm_sync.h>
+#include <sys/mach/vm_region.h>
+#include <sys/mach/prof_types.h>
+#include <sys/mach/host_notify.h>
+
+#define __MigPackStructs 1
+
+#ifdef	_KERNEL
+
+#define __MigTypeCheck 1
+#define __MigKernelSpecificCode 1
+
+typedef struct ipc_space	*ipc_space_t;
+typedef struct mach_task                     *task_name_t, *task_suspension_token_t;
+typedef struct thread_shuttle *thread_t, *thread_act_t;
+typedef struct coalition                *coalition_t;
+typedef struct host                     *host_t;
+typedef struct host                     *host_priv_t;
+typedef struct host                     *host_security_t;
+typedef struct processor_set            *processor_set_t, *processor_set_control_t;
+typedef struct semaphore                *semaphore_t;
+typedef struct alarm                    *alarm_t;
+typedef struct clock                    *clock_serv_t;
+typedef struct clock                    *clock_ctrl_t;
+typedef struct ledger					*ledger_t;
+typedef processor_set_t         processor_set_name_t;
+MALLOC_DECLARE(M_MACH_TMP);
+#ifdef INVARIANTS
+#define M_MACH_IPC_KMSG M_MACH_TMP
+#define M_MACH_IPC_ENTRY M_MACH_TMP
+#define M_MACH_IPC_TABLE M_MACH_TMP
+#define M_MACH_KALLOC M_MACH_TMP
+#define M_MACH_VM M_MACH_TMP
+#else
+MALLOC_DECLARE(M_MACH_IPC_KMSG);
+MALLOC_DECLARE(M_MACH_IPC_ENTRY);
+MALLOC_DECLARE(M_MACH_IPC_TABLE);
+MALLOC_DECLARE(M_MACH_KALLOC);
+MALLOC_DECLARE(M_MACH_VM);
+#endif
+#else	/* MACH_KERNEL */
+
+typedef mach_port_t		task_t;
+typedef mach_port_t		task_port_t;
+typedef mach_port_t		task_name_t;
+typedef mach_port_t		lock_set_t;
+typedef mach_port_t		semaphore_t;
+typedef mach_port_t     ledger_t;
+typedef mach_port_t		processor_t;
+typedef mach_port_t		processor_set_t;
+typedef mach_port_t		processor_set_control_t;
+typedef mach_port_t		alarm_t;
+typedef mach_port_t		clock_serv_t;
+typedef mach_port_t		clock_ctrl_t;
+typedef mach_port_t		io_master_t;
+typedef mach_port_t		ipc_space_t;
+
+typedef mach_port_t             task_suspension_token_t;
+typedef mach_port_t             host_t;
+typedef mach_port_t             host_priv_t;
+typedef mach_port_t             host_security_t;
+typedef host_t                  host_name_t;
+typedef host_t                  host_name_port_t;
+
+typedef	task_port_t		*task_port_array_t;
+typedef mach_port_t		thread_port_t;
+typedef	thread_port_t		*thread_port_array_t;
+typedef mach_port_t		processor_set_control_port_t;
+typedef mach_port_t		processor_set_name_port_t;
+typedef vm_offset_t		*emulation_vector_t;
+typedef	mach_port_t		thread_t, thread_act_t;
+typedef mach_port_t		thread_act_port_t;
+typedef	thread_act_port_t	*thread_act_port_array_t;
+typedef mach_port_t		lock_set_port_t;
+typedef mach_port_t		semaphore_port_t;
+typedef mach_port_t		security_port_t;
+typedef integer_t		ledger_item_t;
+typedef mach_port_t		*processor_array_t;
+typedef processor_set_t         processor_set_name_t;
+typedef processor_set_name_t		*processor_set_name_array_t;
+
+#endif	/* MACH_KERNEL */
+typedef mach_port_t           clock_reply_t;
+typedef        mach_port_t             mem_entry_name_port_t;
+typedef ledger_t               *ledger_array_t;
+typedef thread_act_t            *thread_act_array_t;
+
+
+typedef void * kmod_args_t;
+typedef mach_port_t             exception_handler_t;
+typedef exception_handler_t     *exception_handler_array_t;
+typedef int kmod_t;
+typedef int kmod_control_flavor_t;
+
+
+typedef mach_port_t UNDServerRef;
+typedef mach_port_t		*ledger_port_array_t;
+typedef mach_port_t    		ledger_port_t;
+typedef char			*user_subsystem_t;
+typedef int mach_clock_res_t;
+typedef int mach_sleep_type_t;
+typedef int mach_absolute_time_t;
+
+
+
+
+/*
+ *	Backwards compatibility, for those programs written
+ *	before mach/{std,mach}_types.{defs,h} were set up.
+ */
+#include <sys/mach/std_types.h>
+#include <sys/mach/mach_time.h>
+#ifdef _KERNEL
+#include <sys/mach/processor.h>	/* for processor_array_t,
+				       processor_set_array_t,
+				       processor_set_name_array_t */
+
+#ifdef __MIG_check__Request__vm_map_subsystem__
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/mach_vm_server.h>
+
+int mach_vm_map_page_query(vm_map_t target_map, vm_offset_t offset, integer_t *disposition, integer_t *ref_count);
+int mach_vm_mapped_pages_info(vm_map_t task, page_address_array_t *pages, mach_msg_type_number_t *pagesCnt);
+
+
+#define vm_copy(a0, a1, a2, a3) mach_vm_copy(a0, a1, a2, a3)
+#define vm_map(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) mach_vm_map(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
+#define vm_inherit(a0, a1, a2, a3) mach_vm_inherit(a0, a1, a2, a3)
+#define vm_map_64(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) mach_vm_map(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
+#define vm_msync(a0, a1, a2, a3) mach_vm_msync(a0, a1, a2, a3)
+#define vm_protect(a0, a1, a2, a3, a4) mach_vm_protect(a0, a1, a2, a3, a4)
+#define vm_read(target_task, address, size, data, dataCnt) mach_vm_read(target_task, address, size, data, dataCnt)
+#ifdef notyet
+#define vm_read_list(target_task, data_list, count) mach_vm_read_list(target_task, (mach_vm_read_entry_t)&data_list, count)
+#endif
+#define vm_read_overwrite(target_task, address, size, data, outsize) mach_vm_read_overwrite(target_task, address, size, data, outsize)
+#define vm_region(a0, a1, a2, a3, a4, a5, a6) mach_vm_region(a0, a1, a2, a3, a4, a5, a6)
+#define vm_map(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) mach_vm_map(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
+#define vm_write(target_task, address, data, dataCnt) mach_vm_write(target_task, address, data, dataCnt)
+#define vm_machine_attribute(target_task, address, size, attribute, value) mach_vm_machine_attribute(target_task, address, size, attribute, value)
+#define vm_purgable_control(target_task, address, control, state) mach_vm_purgable_control(target_task, address, control, state)
+#define vm_behavior_set(target_task, address, size, new_behavior) mach_vm_behavior_set(target_task, address, size, new_behavior) 
+#define vm_remap(target_task, target_address, size, mask, flags, src_task, src_address, copy, cur_protection, max_protection, inheritance) mach_vm_remap(target_task, target_address, size, mask, flags, src_task, src_address, copy, cur_protection, max_protection, inheritance)
+#define vm_region_64(target_task, address, size, flavor, info, infoCnt, object_name)  mach_vm_region(target_task, address, size, flavor, info, infoCnt, object_name)
+#define vm_region_recurse(target_task, address, size, nesting_depth, info, infoCnt) mach_vm_region_recurse(target_task, address, size, nesting_depth, info, infoCnt)
+#define vm_region_recurse_64(target_task, address, size, nesting_depth, info, infoCnt) mach_vm_region_recurse(target_task, address, size, nesting_depth, info, infoCnt)
+#define vm_map_page_query(target_map, offset, disposition, ref_count) mach_vm_map_page_query(target_map, offset, disposition, ref_count)
+#define vm_mapped_pages_info(task, pages, pagesCnt) mach_vm_mapped_pages_info(task, pages, pagesCnt)
+
+#endif
+#ifdef __MIG_check__Request__host_priv_subsystem__
+#include <sys/mach/ipc/ipc_kmsg.h>
+#include <sys/mach/mach_vm_server.h>
+int mach_vm_wire_32(host_priv_t host_priv, vm_map_t task, vm_address_t address, vm_size_t size, vm_prot_t desired_access);
+
+#define vm_wire(host_priv, task, address, size, desired_access) mach_vm_wire_32(host_priv, task, address, size, desired_access)	
+
+#endif
+#endif
+#endif	/* _MACH_MACH_TYPES_H_ */


Property changes on: trunk/sys/sys/mach/mach_types.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/mach_vm.h
===================================================================
--- trunk/sys/sys/mach/mach_vm.h	                        (rev 0)
+++ trunk/sys/sys/mach/mach_vm.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,120 @@
+#ifndef MACH_VM_H_
+#define MACH_VM_H_
+#include <vm/vm.h>
+#include <vm/vm_object.h>
+
+struct vm_map_links {
+	struct vm_map_entry	*prev;		/* previous entry */
+	struct vm_map_entry	*next;		/* next entry */
+	vm_offset_t		start;		/* start address */
+	vm_offset_t		end;		/* end address */
+};
+
+/*
+ *	Type:		struct vm_map_header
+ *
+ *	Description:
+ *		Header for a vm_map and a vm_map_copy.
+ */
+struct vm_map_header {
+	struct vm_map_links	links;		/* first, last, min, max */
+	int			nentries;	/* Number of entries */
+	boolean_t		entries_pageable;
+						/* are map entries pageable? */
+};
+
+
+struct vm_map_copy {
+	int			type;
+#define VM_MAP_COPY_ENTRY_LIST		1
+#define VM_MAP_COPY_OBJECT		2
+#define VM_MAP_COPY_OBJECT_PREALLOC 3
+#define VM_MAP_COPY_KERNEL_BUFFER	4
+	vm_offset_t		offset;
+	vm_size_t		size;
+	union {
+	    struct vm_map_header	hdr;	/* ENTRY_LIST */
+		vm_object_t		object; /* OBJECT */
+	    struct {				/* KERNEL_BUFFER */
+		vm_offset_t		kdata;
+		vm_size_t		kalloc_size;  /* size of this copy_t */
+	    } c_k;
+	} c_u;
+};
+
+#define cpy_hdr			c_u.hdr
+
+#define cpy_object		c_u.object
+#define	cpy_index		c_u.c_o.index
+
+#define cpy_kdata		c_u.c_k.kdata
+#define cpy_kalloc_size		c_u.c_k.kalloc_size
+
+#define	VM_MAP_COPY_NULL	((vm_map_copy_t) 0)
+#define	VM_MAP_NULL		((vm_map_t) 0)
+
+#define vm_map_copy_to_entry(copy)		\
+		((struct vm_map_entry *) &(copy)->cpy_hdr.links)
+#define vm_map_copy_first_entry(copy)		\
+		((copy)->cpy_hdr.links.next)
+#define vm_map_copy_last_entry(copy)		\
+		((copy)->cpy_hdr.links.prev)
+
+typedef struct vm_map_copy *vm_map_copy_t;
+
+/* Discard a copy without using it */
+extern void		vm_map_copy_discard(
+				vm_map_copy_t		copy);
+
+/* Overwrite existing memory with a copy */
+extern kern_return_t	vm_map_copy_overwrite(
+				vm_map_t                dst_map,
+				vm_map_address_t        dst_addr,
+				vm_map_copy_t           copy,
+				boolean_t               interruptible);
+
+/* Place a copy into a map */
+extern kern_return_t	vm_map_copyout(
+				vm_map_t		dst_map,
+				vm_map_address_t	*dst_addr,	/* OUT */
+				vm_map_copy_t		copy);
+
+extern kern_return_t	vm_map_copyin(
+				vm_map_t			src_map,
+				vm_map_address_t	src_addr,
+				vm_map_size_t		len,
+				boolean_t			src_destroy,
+				vm_map_copy_t		*copy_result);	/* OUT */
+
+extern kern_return_t	vm_map_copyin_common(
+				vm_map_t		src_map,
+				vm_map_address_t	src_addr,
+				vm_map_size_t		len,
+				boolean_t		src_destroy,
+				boolean_t		src_volatile,
+				vm_map_copy_t		*copy_result,	/* OUT */
+				boolean_t		use_maxprot);
+
+extern kern_return_t	vm_map_copy_extract(
+	vm_map_t		src_map,
+	vm_map_address_t	src_addr,
+	vm_map_size_t		len,
+	vm_map_copy_t		*copy_result,	/* OUT */
+	vm_prot_t		*cur_prot,	/* OUT */
+	vm_prot_t		*max_prot);
+
+
+extern void vm_map_copy_discard(
+				vm_map_copy_t copy);
+
+
+int mach_vm_allocate(vm_map_t map, vm_offset_t *addr, size_t _size, int flags);
+int mach_vm_deallocate(vm_map_t target __unused, mach_vm_address_t addr, mach_vm_size_t len);
+
+int
+mach_vm_map(vm_map_t map, mach_vm_address_t *address, mach_vm_size_t _size,
+			mach_vm_offset_t _mask, int _flags, mem_entry_name_port_t object __unused,
+			memory_object_offset_t offset __unused, boolean_t copy __unused,
+			vm_prot_t cur_protection, vm_prot_t max_protection, vm_inherit_t inh);
+
+#endif /* MACH_VM_H_ */


Property changes on: trunk/sys/sys/mach/mach_vm.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/mach_vm_server.h
===================================================================
--- trunk/sys/sys/mach/mach_vm_server.h	                        (rev 0)
+++ trunk/sys/sys/mach/mach_vm_server.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,1557 @@
+#ifndef	_mach_vm_server_
+#define	_mach_vm_server_
+
+/* Module mach_vm */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#ifdef _KERNEL
+#include <sys/mach/ndr.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#else /* !_KERNEL */
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#endif /*_KERNEL */
+
+#ifdef AUTOTEST
+#ifndef FUNCTION_PTR_T
+#define FUNCTION_PTR_T
+typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
+typedef struct {
+        char            *name;
+        function_ptr_t  function;
+} function_table_entry;
+typedef function_table_entry   *function_table_t;
+#endif /* FUNCTION_PTR_T */
+#endif /* AUTOTEST */
+
+#ifndef	mach_vm_MSG_COUNT
+#define	mach_vm_MSG_COUNT	20
+#endif	/* mach_vm_MSG_COUNT */
+
+#include <sys/mach/std_types.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc_mig.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach_debug/mach_debug_types.h>
+
+#ifdef __BeforeMigServerHeader
+__BeforeMigServerHeader
+#endif /* __BeforeMigServerHeader */
+
+
+/* Routine mach_vm_protect */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_protect
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, set_maximum, new_protection)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	boolean_t set_maximum;
+	vm_prot_t new_protection;
+{ return mach_vm_protect(target_task, address, size, set_maximum, new_protection); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	boolean_t set_maximum,
+	vm_prot_t new_protection
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_inherit */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_inherit
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, new_inheritance)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_inherit_t new_inheritance;
+{ return mach_vm_inherit(target_task, address, size, new_inheritance); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_inherit_t new_inheritance
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_read */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_read
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, data, dataCnt)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_offset_t *data;
+	mach_msg_type_number_t *dataCnt;
+{ return mach_vm_read(target_task, address, size, data, dataCnt); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_offset_t *data,
+	mach_msg_type_number_t *dataCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_read_list */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_read_list
+#if	defined(LINTLIBRARY)
+    (target_task, data_list, count)
+	vm_map_t target_task;
+	mach_vm_read_entry_t data_list;
+	natural_t count;
+{ return mach_vm_read_list(target_task, data_list, count); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_read_entry_t data_list,
+	natural_t count
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_write */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_write
+#if	defined(LINTLIBRARY)
+    (target_task, address, data, dataCnt)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	vm_offset_t data;
+	mach_msg_type_number_t dataCnt;
+{ return mach_vm_write(target_task, address, data, dataCnt); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	vm_offset_t data,
+	mach_msg_type_number_t dataCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_copy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_copy
+#if	defined(LINTLIBRARY)
+    (target_task, source_address, size, dest_address)
+	vm_map_t target_task;
+	mach_vm_address_t source_address;
+	mach_vm_size_t size;
+	mach_vm_address_t dest_address;
+{ return mach_vm_copy(target_task, source_address, size, dest_address); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t source_address,
+	mach_vm_size_t size,
+	mach_vm_address_t dest_address
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_read_overwrite */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_read_overwrite
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, data, outsize)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	mach_vm_address_t data;
+	mach_vm_size_t *outsize;
+{ return mach_vm_read_overwrite(target_task, address, size, data, outsize); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	mach_vm_address_t data,
+	mach_vm_size_t *outsize
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_msync */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_msync
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, sync_flags)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_sync_t sync_flags;
+{ return mach_vm_msync(target_task, address, size, sync_flags); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_sync_t sync_flags
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_behavior_set */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_behavior_set
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, new_behavior)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_behavior_t new_behavior;
+{ return mach_vm_behavior_set(target_task, address, size, new_behavior); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_behavior_t new_behavior
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_machine_attribute */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_machine_attribute
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, attribute, value)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_machine_attribute_t attribute;
+	vm_machine_attribute_val_t *value;
+{ return mach_vm_machine_attribute(target_task, address, size, attribute, value); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_machine_attribute_t attribute,
+	vm_machine_attribute_val_t *value
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_remap */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_remap
+#if	defined(LINTLIBRARY)
+    (target_task, target_address, size, mask, flags, src_task, src_address, copy, cur_protection, max_protection, inheritance)
+	vm_map_t target_task;
+	mach_vm_address_t *target_address;
+	mach_vm_size_t size;
+	mach_vm_offset_t mask;
+	int flags;
+	vm_map_t src_task;
+	mach_vm_address_t src_address;
+	boolean_t copy;
+	vm_prot_t *cur_protection;
+	vm_prot_t *max_protection;
+	vm_inherit_t inheritance;
+{ return mach_vm_remap(target_task, target_address, size, mask, flags, src_task, src_address, copy, cur_protection, max_protection, inheritance); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t *target_address,
+	mach_vm_size_t size,
+	mach_vm_offset_t mask,
+	int flags,
+	vm_map_t src_task,
+	mach_vm_address_t src_address,
+	boolean_t copy,
+	vm_prot_t *cur_protection,
+	vm_prot_t *max_protection,
+	vm_inherit_t inheritance
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_page_query */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_page_query
+#if	defined(LINTLIBRARY)
+    (target_map, offset, disposition, ref_count)
+	vm_map_t target_map;
+	mach_vm_offset_t offset;
+	integer_t *disposition;
+	integer_t *ref_count;
+{ return mach_vm_page_query(target_map, offset, disposition, ref_count); }
+#else
+(
+	vm_map_t target_map,
+	mach_vm_offset_t offset,
+	integer_t *disposition,
+	integer_t *ref_count
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_region_recurse */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_region_recurse
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, nesting_depth, info, infoCnt)
+	vm_map_t target_task;
+	mach_vm_address_t *address;
+	mach_vm_size_t *size;
+	natural_t *nesting_depth;
+	vm_region_recurse_info_t info;
+	mach_msg_type_number_t *infoCnt;
+{ return mach_vm_region_recurse(target_task, address, size, nesting_depth, info, infoCnt); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t *address,
+	mach_vm_size_t *size,
+	natural_t *nesting_depth,
+	vm_region_recurse_info_t info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_region */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_region
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, flavor, info, infoCnt, object_name)
+	vm_map_t target_task;
+	mach_vm_address_t *address;
+	mach_vm_size_t *size;
+	vm_region_flavor_t flavor;
+	vm_region_info_t info;
+	mach_msg_type_number_t *infoCnt;
+	mach_port_t *object_name;
+{ return mach_vm_region(target_task, address, size, flavor, info, infoCnt, object_name); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t *address,
+	mach_vm_size_t *size,
+	vm_region_flavor_t flavor,
+	vm_region_info_t info,
+	mach_msg_type_number_t *infoCnt,
+	mach_port_t *object_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine _mach_make_memory_entry */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t _mach_make_memory_entry
+#if	defined(LINTLIBRARY)
+    (target_task, size, offset, permission, object_handle, parent_handle)
+	vm_map_t target_task;
+	memory_object_size_t *size;
+	memory_object_offset_t offset;
+	vm_prot_t permission;
+	mem_entry_name_port_t *object_handle;
+	mem_entry_name_port_t parent_handle;
+{ return _mach_make_memory_entry(target_task, size, offset, permission, object_handle, parent_handle); }
+#else
+(
+	vm_map_t target_task,
+	memory_object_size_t *size,
+	memory_object_offset_t offset,
+	vm_prot_t permission,
+	mem_entry_name_port_t *object_handle,
+	mem_entry_name_port_t parent_handle
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_purgable_control */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_purgable_control
+#if	defined(LINTLIBRARY)
+    (target_task, address, control, state)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	vm_purgable_t control;
+	int *state;
+{ return mach_vm_purgable_control(target_task, address, control, state); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	vm_purgable_t control,
+	int *state
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_page_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_page_info
+#if	defined(LINTLIBRARY)
+    (target_task, address, flavor, info, infoCnt)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	vm_page_info_flavor_t flavor;
+	vm_page_info_t info;
+	mach_msg_type_number_t *infoCnt;
+{ return mach_vm_page_info(target_task, address, flavor, info, infoCnt); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	vm_page_info_flavor_t flavor,
+	vm_page_info_t info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_protect */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_protect
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, set_maximum, new_protection)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	boolean_t set_maximum;
+	vm_prot_t new_protection;
+{ return mach_vm_protect(target_task, address, size, set_maximum, new_protection); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	boolean_t set_maximum,
+	vm_prot_t new_protection
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_inherit */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_inherit
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, new_inheritance)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_inherit_t new_inheritance;
+{ return mach_vm_inherit(target_task, address, size, new_inheritance); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_inherit_t new_inheritance
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_read */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_read
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, data, dataCnt)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_offset_t *data;
+	mach_msg_type_number_t *dataCnt;
+{ return mach_vm_read(target_task, address, size, data, dataCnt); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_offset_t *data,
+	mach_msg_type_number_t *dataCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_read_list */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_read_list
+#if	defined(LINTLIBRARY)
+    (target_task, data_list, count)
+	vm_map_t target_task;
+	mach_vm_read_entry_t data_list;
+	natural_t count;
+{ return mach_vm_read_list(target_task, data_list, count); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_read_entry_t data_list,
+	natural_t count
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_write */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_write
+#if	defined(LINTLIBRARY)
+    (target_task, address, data, dataCnt)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	vm_offset_t data;
+	mach_msg_type_number_t dataCnt;
+{ return mach_vm_write(target_task, address, data, dataCnt); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	vm_offset_t data,
+	mach_msg_type_number_t dataCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_copy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_copy
+#if	defined(LINTLIBRARY)
+    (target_task, source_address, size, dest_address)
+	vm_map_t target_task;
+	mach_vm_address_t source_address;
+	mach_vm_size_t size;
+	mach_vm_address_t dest_address;
+{ return mach_vm_copy(target_task, source_address, size, dest_address); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t source_address,
+	mach_vm_size_t size,
+	mach_vm_address_t dest_address
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_read_overwrite */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_read_overwrite
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, data, outsize)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	mach_vm_address_t data;
+	mach_vm_size_t *outsize;
+{ return mach_vm_read_overwrite(target_task, address, size, data, outsize); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	mach_vm_address_t data,
+	mach_vm_size_t *outsize
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_msync */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_msync
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, sync_flags)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_sync_t sync_flags;
+{ return mach_vm_msync(target_task, address, size, sync_flags); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_sync_t sync_flags
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_behavior_set */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_behavior_set
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, new_behavior)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_behavior_t new_behavior;
+{ return mach_vm_behavior_set(target_task, address, size, new_behavior); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_behavior_t new_behavior
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_machine_attribute */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_machine_attribute
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, attribute, value)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	mach_vm_size_t size;
+	vm_machine_attribute_t attribute;
+	vm_machine_attribute_val_t *value;
+{ return mach_vm_machine_attribute(target_task, address, size, attribute, value); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	mach_vm_size_t size,
+	vm_machine_attribute_t attribute,
+	vm_machine_attribute_val_t *value
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_remap */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_remap
+#if	defined(LINTLIBRARY)
+    (target_task, target_address, size, mask, flags, src_task, src_address, copy, cur_protection, max_protection, inheritance)
+	vm_map_t target_task;
+	mach_vm_address_t *target_address;
+	mach_vm_size_t size;
+	mach_vm_offset_t mask;
+	int flags;
+	vm_map_t src_task;
+	mach_vm_address_t src_address;
+	boolean_t copy;
+	vm_prot_t *cur_protection;
+	vm_prot_t *max_protection;
+	vm_inherit_t inheritance;
+{ return mach_vm_remap(target_task, target_address, size, mask, flags, src_task, src_address, copy, cur_protection, max_protection, inheritance); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t *target_address,
+	mach_vm_size_t size,
+	mach_vm_offset_t mask,
+	int flags,
+	vm_map_t src_task,
+	mach_vm_address_t src_address,
+	boolean_t copy,
+	vm_prot_t *cur_protection,
+	vm_prot_t *max_protection,
+	vm_inherit_t inheritance
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_page_query */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_page_query
+#if	defined(LINTLIBRARY)
+    (target_map, offset, disposition, ref_count)
+	vm_map_t target_map;
+	mach_vm_offset_t offset;
+	integer_t *disposition;
+	integer_t *ref_count;
+{ return mach_vm_page_query(target_map, offset, disposition, ref_count); }
+#else
+(
+	vm_map_t target_map,
+	mach_vm_offset_t offset,
+	integer_t *disposition,
+	integer_t *ref_count
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_region_recurse */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_region_recurse
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, nesting_depth, info, infoCnt)
+	vm_map_t target_task;
+	mach_vm_address_t *address;
+	mach_vm_size_t *size;
+	natural_t *nesting_depth;
+	vm_region_recurse_info_t info;
+	mach_msg_type_number_t *infoCnt;
+{ return mach_vm_region_recurse(target_task, address, size, nesting_depth, info, infoCnt); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t *address,
+	mach_vm_size_t *size,
+	natural_t *nesting_depth,
+	vm_region_recurse_info_t info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_region */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_region
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, flavor, info, infoCnt, object_name)
+	vm_map_t target_task;
+	mach_vm_address_t *address;
+	mach_vm_size_t *size;
+	vm_region_flavor_t flavor;
+	vm_region_info_t info;
+	mach_msg_type_number_t *infoCnt;
+	mach_port_t *object_name;
+{ return mach_vm_region(target_task, address, size, flavor, info, infoCnt, object_name); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t *address,
+	mach_vm_size_t *size,
+	vm_region_flavor_t flavor,
+	vm_region_info_t info,
+	mach_msg_type_number_t *infoCnt,
+	mach_port_t *object_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine _mach_make_memory_entry */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t _mach_make_memory_entry
+#if	defined(LINTLIBRARY)
+    (target_task, size, offset, permission, object_handle, parent_handle)
+	vm_map_t target_task;
+	memory_object_size_t *size;
+	memory_object_offset_t offset;
+	vm_prot_t permission;
+	mem_entry_name_port_t *object_handle;
+	mem_entry_name_port_t parent_handle;
+{ return _mach_make_memory_entry(target_task, size, offset, permission, object_handle, parent_handle); }
+#else
+(
+	vm_map_t target_task,
+	memory_object_size_t *size,
+	memory_object_offset_t offset,
+	vm_prot_t permission,
+	mem_entry_name_port_t *object_handle,
+	mem_entry_name_port_t parent_handle
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_purgable_control */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_purgable_control
+#if	defined(LINTLIBRARY)
+    (target_task, address, control, state)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	vm_purgable_t control;
+	int *state;
+{ return mach_vm_purgable_control(target_task, address, control, state); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	vm_purgable_t control,
+	int *state
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_page_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_page_info
+#if	defined(LINTLIBRARY)
+    (target_task, address, flavor, info, infoCnt)
+	vm_map_t target_task;
+	mach_vm_address_t address;
+	vm_page_info_flavor_t flavor;
+	vm_page_info_t info;
+	mach_msg_type_number_t *infoCnt;
+{ return mach_vm_page_info(target_task, address, flavor, info, infoCnt); }
+#else
+(
+	vm_map_t target_task,
+	mach_vm_address_t address,
+	vm_page_info_flavor_t flavor,
+	vm_page_info_t info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+boolean_t mach_vm_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+mig_routine_t mach_vm_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+extern const struct mach_vm_subsystem {
+	mig_server_routine_t	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[20];
+} mach_vm_subsystem;
+
+/* typedefs for all requests */
+
+#ifndef __Request__mach_vm_subsystem__defined
+#define __Request__mach_vm_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		boolean_t set_maximum;
+		vm_prot_t new_protection;
+	} __Request__mach_vm_protect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_inherit_t new_inheritance;
+	} __Request__mach_vm_inherit_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+	} __Request__mach_vm_read_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_read_entry_t data_list;
+		natural_t count;
+	} __Request__mach_vm_read_list_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_msg_type_number_t dataCnt;
+	} __Request__mach_vm_write_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t source_address;
+		mach_vm_size_t size;
+		mach_vm_address_t dest_address;
+	} __Request__mach_vm_copy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		mach_vm_address_t data;
+	} __Request__mach_vm_read_overwrite_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_sync_t sync_flags;
+	} __Request__mach_vm_msync_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_behavior_t new_behavior;
+	} __Request__mach_vm_behavior_set_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		vm_machine_attribute_t attribute;
+		vm_machine_attribute_val_t value;
+	} __Request__mach_vm_machine_attribute_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t src_task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t target_address;
+		mach_vm_size_t size;
+		mach_vm_offset_t mask;
+		int flags;
+		mach_vm_address_t src_address;
+		boolean_t copy;
+		vm_inherit_t inheritance;
+	} __Request__mach_vm_remap_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_offset_t offset;
+	} __Request__mach_vm_page_query_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+	} __Request__mach_vm_region_recurse_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		vm_region_flavor_t flavor;
+		mach_msg_type_number_t infoCnt;
+	} __Request__mach_vm_region_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t parent_handle;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		memory_object_size_t size;
+		memory_object_offset_t offset;
+		vm_prot_t permission;
+	} __Request___mach_make_memory_entry_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		vm_purgable_t control;
+		int state;
+	} __Request__mach_vm_purgable_control_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		vm_page_info_flavor_t flavor;
+		mach_msg_type_number_t infoCnt;
+	} __Request__mach_vm_page_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__mach_vm_subsystem__defined */
+
+
+/* union of all requests */
+
+#ifndef __RequestUnion__mach_vm_subsystem__defined
+#define __RequestUnion__mach_vm_subsystem__defined
+union __RequestUnion__mach_vm_subsystem {
+	__Request__mach_vm_protect_t Request_mach_vm_protect;
+	__Request__mach_vm_inherit_t Request_mach_vm_inherit;
+	__Request__mach_vm_read_t Request_mach_vm_read;
+	__Request__mach_vm_read_list_t Request_mach_vm_read_list;
+	__Request__mach_vm_write_t Request_mach_vm_write;
+	__Request__mach_vm_copy_t Request_mach_vm_copy;
+	__Request__mach_vm_read_overwrite_t Request_mach_vm_read_overwrite;
+	__Request__mach_vm_msync_t Request_mach_vm_msync;
+	__Request__mach_vm_behavior_set_t Request_mach_vm_behavior_set;
+	__Request__mach_vm_machine_attribute_t Request_mach_vm_machine_attribute;
+	__Request__mach_vm_remap_t Request_mach_vm_remap;
+	__Request__mach_vm_page_query_t Request_mach_vm_page_query;
+	__Request__mach_vm_region_recurse_t Request_mach_vm_region_recurse;
+	__Request__mach_vm_region_t Request_mach_vm_region;
+	__Request___mach_make_memory_entry_t Request__mach_make_memory_entry;
+	__Request__mach_vm_purgable_control_t Request_mach_vm_purgable_control;
+	__Request__mach_vm_page_info_t Request_mach_vm_page_info;
+};
+#endif /* __RequestUnion__mach_vm_subsystem__defined */
+/* typedefs for all replies */
+
+#ifndef __Reply__mach_vm_subsystem__defined
+#define __Reply__mach_vm_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_vm_protect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_vm_inherit_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t dataCnt;
+	} __Reply__mach_vm_read_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_vm_read_entry_t data_list;
+	} __Reply__mach_vm_read_list_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_vm_write_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_vm_copy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_vm_size_t outsize;
+	} __Reply__mach_vm_read_overwrite_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_vm_msync_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_vm_behavior_set_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_machine_attribute_val_t value;
+	} __Reply__mach_vm_machine_attribute_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_vm_address_t target_address;
+		vm_prot_t cur_protection;
+		vm_prot_t max_protection;
+	} __Reply__mach_vm_remap_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		integer_t disposition;
+		integer_t ref_count;
+	} __Reply__mach_vm_page_query_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+		int info[19];
+	} __Reply__mach_vm_region_recurse_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t object_name;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_vm_address_t address;
+		mach_vm_size_t size;
+		mach_msg_type_number_t infoCnt;
+		int info[10];
+	} __Reply__mach_vm_region_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t object_handle;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		memory_object_size_t size;
+	} __Reply___mach_make_memory_entry_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int state;
+	} __Reply__mach_vm_purgable_control_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t infoCnt;
+		int info[32];
+	} __Reply__mach_vm_page_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__mach_vm_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__mach_vm_subsystem__defined
+#define __ReplyUnion__mach_vm_subsystem__defined
+union __ReplyUnion__mach_vm_subsystem {
+	__Reply__mach_vm_protect_t Reply_mach_vm_protect;
+	__Reply__mach_vm_inherit_t Reply_mach_vm_inherit;
+	__Reply__mach_vm_read_t Reply_mach_vm_read;
+	__Reply__mach_vm_read_list_t Reply_mach_vm_read_list;
+	__Reply__mach_vm_write_t Reply_mach_vm_write;
+	__Reply__mach_vm_copy_t Reply_mach_vm_copy;
+	__Reply__mach_vm_read_overwrite_t Reply_mach_vm_read_overwrite;
+	__Reply__mach_vm_msync_t Reply_mach_vm_msync;
+	__Reply__mach_vm_behavior_set_t Reply_mach_vm_behavior_set;
+	__Reply__mach_vm_machine_attribute_t Reply_mach_vm_machine_attribute;
+	__Reply__mach_vm_remap_t Reply_mach_vm_remap;
+	__Reply__mach_vm_page_query_t Reply_mach_vm_page_query;
+	__Reply__mach_vm_region_recurse_t Reply_mach_vm_region_recurse;
+	__Reply__mach_vm_region_t Reply_mach_vm_region;
+	__Reply___mach_make_memory_entry_t Reply__mach_make_memory_entry;
+	__Reply__mach_vm_purgable_control_t Reply_mach_vm_purgable_control;
+	__Reply__mach_vm_page_info_t Reply_mach_vm_page_info;
+};
+#endif /* __RequestUnion__mach_vm_subsystem__defined */
+
+#ifndef subsystem_to_name_map_mach_vm
+#define subsystem_to_name_map_mach_vm \
+    { "mach_vm_protect", 4802 },\
+    { "mach_vm_inherit", 4803 },\
+    { "mach_vm_read", 4804 },\
+    { "mach_vm_read_list", 4805 },\
+    { "mach_vm_write", 4806 },\
+    { "mach_vm_copy", 4807 },\
+    { "mach_vm_read_overwrite", 4808 },\
+    { "mach_vm_msync", 4809 },\
+    { "mach_vm_behavior_set", 4810 },\
+    { "mach_vm_machine_attribute", 4812 },\
+    { "mach_vm_remap", 4813 },\
+    { "mach_vm_page_query", 4814 },\
+    { "mach_vm_region_recurse", 4815 },\
+    { "mach_vm_region", 4816 },\
+    { "_mach_make_memory_entry", 4817 },\
+    { "mach_vm_purgable_control", 4818 },\
+    { "mach_vm_page_info", 4819 }
+#endif
+
+#ifdef __AfterMigServerHeader
+__AfterMigServerHeader
+#endif /* __AfterMigServerHeader */
+
+#endif	 /* _mach_vm_server_ */


Property changes on: trunk/sys/sys/mach/mach_vm_server.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/mach_voucher_types.h
===================================================================
--- trunk/sys/sys/mach/mach_voucher_types.h	                        (rev 0)
+++ trunk/sys/sys/mach/mach_voucher_types.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2013 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+#ifndef	_MACH_VOUCHER_TYPES_H_
+#define	_MACH_VOUCHER_TYPES_H_
+
+#include <sys/mach/port.h>
+#include <sys/mach/message.h>
+
+/*
+ * Mach Voucher - an immutable collection of attribute value handles.
+ *
+ * The mach voucher is such that it can be passed between processes
+ * as a Mach port send right (by convention in the mach_msg_header_t’s
+ * msgh_voucher field).
+ *
+ * You may construct a new mach voucher by passing a construction
+ * recipe to host_create_mach_voucher().  The construction recipe supports
+ * generic commands for copying, removing, and redeeming attribute value
+ * handles from previous vouchers, or running attribute-mananger-specific
+ * commands within the recipe.
+ *
+ * Once the set of attribute value handles is constructed and returned,
+ * that set will not change for the life of the voucher (just because the
+ * attribute value handle itself doesn't change, the value the handle refers
+ * to is free to change at will).
+ */
+typedef mach_port_t		mach_voucher_t;
+#define MACH_VOUCHER_NULL	((mach_voucher_t) 0)
+
+typedef mach_port_name_t	mach_voucher_name_t;
+#define MACH_VOUCHER_NAME_NULL	((mach_voucher_name_t) 0)
+
+typedef mach_voucher_name_t	*mach_voucher_name_array_t;
+#define MACH_VOUCHER_NAME_ARRAY_NULL ((mach_voucher_name_array_t) 0)
+
+/*
+ * This type changes appearance between user-space and kernel.  It is
+ * a port at user-space and a reference to an ipc_voucher structure in-kernel.
+ */
+typedef mach_voucher_t		ipc_voucher_t;
+#define IPC_VOUCHER_NULL	((ipc_voucher_t) 0)
+
+/*
+ * mach_voucher_selector_t - A means of specifying which thread/task value to extract -
+ *  the current voucher set at this level, or a voucher representing
+ * the full [layered] effective value for the task/thread.
+ */
+typedef uint32_t mach_voucher_selector_t;
+#define MACH_VOUCHER_SELECTOR_CURRENT 		((mach_voucher_selector_t)0)
+#define MACH_VOUCHER_SELECTOR_EFFECTIVE 	((mach_voucher_selector_t)1)
+
+
+/*
+ * mach_voucher_attr_key_t - The key used to identify a particular managed resource or
+ * to select the specific resource manager’s data associated
+ * with a given voucher.
+ */ 
+typedef uint32_t mach_voucher_attr_key_t;
+typedef mach_voucher_attr_key_t *mach_voucher_attr_key_array_t;
+
+#define MACH_VOUCHER_ATTR_KEY_ALL 		((mach_voucher_attr_key_t)~0)
+#define MACH_VOUCHER_ATTR_KEY_NONE 		((mach_voucher_attr_key_t)0)
+
+/* other well-known-keys will be added here */
+#define MACH_VOUCHER_ATTR_KEY_ATM		((mach_voucher_attr_key_t)1)
+#define MACH_VOUCHER_ATTR_KEY_IMPORTANCE	((mach_voucher_attr_key_t)2)
+#define MACH_VOUCHER_ATTR_KEY_BANK		((mach_voucher_attr_key_t)3)
+
+#define MACH_VOUCHER_ATTR_KEY_USER_DATA		((mach_voucher_attr_key_t)7)
+#define MACH_VOUCHER_ATTR_KEY_BITS		MACH_VOUCHER_ATTR_KEY_USER_DATA /* deprecated */
+#define MACH_VOUCHER_ATTR_KEY_TEST 		((mach_voucher_attr_key_t)8)
+
+#define MACH_VOUCHER_ATTR_KEY_NUM_WELL_KNOWN	MACH_VOUCHER_ATTR_KEY_TEST
+
+/*
+ * mach_voucher_attr_content_t
+ *
+ * Data passed to a resource manager for modifying an attribute
+ * value or returned from the resource manager in response to a
+ * request to externalize the current value for that attribute.
+ */
+typedef uint8_t *mach_voucher_attr_content_t;
+typedef uint32_t mach_voucher_attr_content_size_t;
+
+/*
+ * mach_voucher_attr_command_t - The private verbs implemented by each voucher
+ * attribute manager via mach_voucher_attr_command().
+ */
+typedef uint32_t mach_voucher_attr_command_t;
+
+/*
+ * mach_voucher_attr_recipe_command_t 
+ * 
+ * The verbs used to create/morph a voucher attribute value.
+ * We define some system-wide commands here - related to creation, and transport of
+ * vouchers and attributes.  Additional commands can be defined by, and supported by,
+ * individual attribute resource managers.
+ */
+typedef uint32_t mach_voucher_attr_recipe_command_t;
+typedef mach_voucher_attr_recipe_command_t *mach_voucher_attr_recipe_command_array_t;
+
+#define MACH_VOUCHER_ATTR_NOOP			((mach_voucher_attr_recipe_command_t)0)
+#define MACH_VOUCHER_ATTR_COPY 			((mach_voucher_attr_recipe_command_t)1)
+#define MACH_VOUCHER_ATTR_REMOVE		((mach_voucher_attr_recipe_command_t)2)
+#define MACH_VOUCHER_ATTR_SET_VALUE_HANDLE	((mach_voucher_attr_recipe_command_t)3)
+
+/* redeem is on its way out? */
+#define MACH_VOUCHER_ATTR_REDEEM 		((mach_voucher_attr_recipe_command_t)10)
+
+/* recipe command(s) for importance attribute manager */
+#define MACH_VOUCHER_ATTR_IMPORTANCE_SELF	((mach_voucher_attr_recipe_command_t)200)
+
+/* recipe command(s) for bit-store attribute manager */
+#define MACH_VOUCHER_ATTR_USER_DATA_STORE 	((mach_voucher_attr_recipe_command_t)211)
+#define MACH_VOUCHER_ATTR_BITS_STORE 		MACH_VOUCHER_ATTR_USER_DATA_STORE /* deprecated */
+
+/* recipe command(s) for test attribute manager */
+#define MACH_VOUCHER_ATTR_TEST_STORE 		MACH_VOUCHER_ATTR_USER_DATA_STORE
+
+/*
+ * mach_voucher_attr_recipe_t
+ *
+ * An element in a recipe list to create a voucher.
+ */
+#pragma pack(1)
+
+typedef struct mach_voucher_attr_recipe_data {
+	mach_voucher_attr_key_t	                key;
+	mach_voucher_attr_recipe_command_t      command;
+	mach_voucher_name_t                     previous_voucher;
+	mach_voucher_attr_content_size_t	content_size;
+	uint8_t				        content[];
+} mach_voucher_attr_recipe_data_t;
+typedef mach_voucher_attr_recipe_data_t *mach_voucher_attr_recipe_t;
+typedef mach_msg_type_number_t mach_voucher_attr_recipe_size_t;
+
+/* Make the above palatable to MIG */
+typedef uint8_t *mach_voucher_attr_raw_recipe_t;
+typedef mach_voucher_attr_raw_recipe_t mach_voucher_attr_raw_recipe_array_t;
+typedef mach_msg_type_number_t mach_voucher_attr_raw_recipe_size_t;
+typedef mach_msg_type_number_t mach_voucher_attr_raw_recipe_array_size_t;
+
+#pragma pack()
+
+/*
+ * VOUCHER ATTRIBUTE MANAGER Writer types
+ */
+ 
+/*
+ * mach_voucher_attr_manager_t
+ *
+ * A handle through which the mach voucher mechanism communicates with the voucher
+ * attribute manager for a given attribute key.
+ */
+typedef mach_port_t			mach_voucher_attr_manager_t;
+#define MACH_VOUCHER_ATTR_MANAGER_NULL  ((mach_voucher_attr_manager_t) 0)
+
+/*
+ * mach_voucher_attr_control_t
+ *
+ * A handle provided to the voucher attribute manager for a given attribute key
+ * through which it makes inquiries or control operations of the mach voucher mechanism.
+ */
+typedef mach_port_t			mach_voucher_attr_control_t;
+#define MACH_VOUCHER_ATTR_CONTROL_NULL  ((mach_voucher_attr_control_t) 0)
+
+/*
+ * These types are different in-kernel vs user-space.  They are ports in user-space,
+ * pointers to opaque structs in most of the kernel, and pointers to known struct
+ * types in the Mach portion of the kernel.
+ */
+typedef mach_port_t		ipc_voucher_attr_manager_t;
+typedef mach_port_t		ipc_voucher_attr_control_t;
+#define IPC_VOUCHER_ATTR_MANAGER_NULL ((ipc_voucher_attr_manager_t) 0)
+#define IPC_VOUCHER_ATTR_CONTROL_NULL ((ipc_voucher_attr_control_t) 0)
+
+/*
+ * mach_voucher_attr_value_handle_t
+ * 
+ * The private handle that the voucher attribute manager provides to
+ * the mach voucher mechanism to represent a given attr content/value.
+ */ 
+typedef uint64_t mach_voucher_attr_value_handle_t;
+typedef mach_voucher_attr_value_handle_t *mach_voucher_attr_value_handle_array_t;
+
+typedef mach_msg_type_number_t mach_voucher_attr_value_handle_array_size_t;
+#define MACH_VOUCHER_ATTR_VALUE_MAX_NESTED 	((mach_voucher_attr_value_handle_array_size_t)4)
+
+typedef uint32_t mach_voucher_attr_value_reference_t;
+
+/* USE - TBD */
+typedef uint32_t mach_voucher_attr_control_flags_t;
+#define MACH_VOUCHER_ATTR_CONTROL_FLAGS_NONE 	((mach_voucher_attr_control_flags_t)0)
+
+/*
+ * Commands and types for the IPC Importance Attribute Manager
+ *
+ * These are the valid mach_voucher_attr_command() options with the 
+ * MACH_VOUCHER_ATTR_KEY_IMPORTANCE key.
+ */
+#define MACH_VOUCHER_IMPORTANCE_ATTR_ADD_EXTERNAL       1  /* Add some number of external refs (not supported) */
+#define MACH_VOUCHER_IMPORTANCE_ATTR_DROP_EXTERNAL      2  /* Drop some number of external refs */
+typedef uint32_t mach_voucher_attr_importance_refs;
+
+#endif	/* _MACH_VOUCHER_TYPES_H_ */


Property changes on: trunk/sys/sys/mach/mach_voucher_types.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/machine.h
===================================================================
--- trunk/sys/sys/mach/machine.h	                        (rev 0)
+++ trunk/sys/sys/mach/machine.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,431 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.13.5.4  92/09/15  17:23:42  jeffreyh
+ * 	New 860 names from Intel
+ * 	[92/09/10            jeffreyh]
+ * 
+ * Revision 2.13.5.3  92/05/27  00:46:46  jeffreyh
+ * 	Initial Paragon support.
+ * 	[andyp at ssd.intel.com]
+ * 
+ * Revision 2.13.5.2  92/03/28  10:11:11  jeffreyh
+ * 	Pick up changes from MK71
+ * 	[92/03/20  13:21:20  jeffreyh]
+ * 
+ * Revision 2.14  92/02/19  15:08:38  elf
+ * 	Added more Sparc subtypes.
+ * 	[92/02/19            rpd]
+ * 
+ * Revision 2.13.5.1  92/02/18  19:13:35  jeffreyh
+ * 	Added sub cpu type for Corollary MP
+ * 	[91/06/25            bernadat]
+ *
+ * Revision 2.13  91/12/10  16:32:50  jsb
+ * 	Fixes from Intel
+ * 	[91/12/10  15:51:57  jsb]
+ * 
+ * Revision 2.12  91/07/31  17:53:56  dbg
+ * 	Remove declaration of interrupt_stack - it is machine-dependent.
+ * 	Changed CPU_SUBTYPE_LUNA88K - there's already a (potential)
+ * 	mc88000 port.
+ * 	[91/07/26            dbg]
+ * 
+ * Revision 2.11  91/07/09  23:22:06  danner
+ * 	   Added CPU_SUBTYPE_LUNA88K
+ * 	[91/05/06            danner]
+ * 
+ * Revision 2.10  91/05/14  16:55:24  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.9  91/05/08  12:49:54  dbg
+ * 	Add CPU_SUBTYPE_SYMMETRY.
+ * 	[91/04/26  14:44:44  dbg]
+ * 
+ * Revision 2.8  91/02/05  17:33:48  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:18:51  mrt]
+ * 
+ * Revision 2.7  90/12/04  14:51:27  jsb
+ * 	Renamed CPU_SUBTYPE_iPSC2 as CPU_SUBTYPE_iPSC386.
+ * 	[90/12/03  22:22:25  jsb]
+ * 
+ * Revision 2.6  90/11/25  17:48:28  jsb
+ * 	Added CPU_TYPE_I860 and CPU_SUBTYPE_iPSC860.
+ * 	[90/11/25  16:51:44  jsb]
+ * 
+ * Revision 2.5  90/09/23  17:45:42  jsb
+ * 	Added CPU_SUBTYPE_iPSC2.
+ * 	[90/09/21  16:43:01  jsb]
+ * 
+ * Revision 2.4  90/08/07  22:23:05  rpd
+ * 	Added new MIPS subtypes for R3000, fix old defs.
+ * 	[90/08/07  15:54:40  af]
+ * 
+ * Revision 2.3  90/06/02  14:58:47  rpd
+ * 	Picked up new cpu types.
+ * 	[90/03/26  22:34:38  rpd]
+ * 
+ * Revision 2.2  89/11/29  14:09:32  af
+ * 	Changes for MACH_KERNEL:
+ * 	. Removed should_exit.
+ * 
+ * 	17-May-1989 Randall W. Dean (rwd)
+ * 	changed machine/vm_types.h to mach/vm_param.h
+ * 	[89/05/23            dbg]
+ * 
+ * Revision 2.1  89/08/03  16:02:33  rwd
+ * Created.
+ * 
+ * Revision 2.11  89/04/18  16:43:32  mwyoung
+ * 	Use <machine/vm_types.h> rather than <vm/vm_param.h> to get
+ * 	VM types.  Remove old history... none of it was insightful.
+ * 
+ * 	The variable declarations should be moved elsewhere.
+ * 	[89/01/24            mwyoung]
+ * 
+ * Revision 2.2.4.1  90/06/11  10:59:52  af
+ * 	Added new MIPS subtypes for R3000, fix old defs.
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*	File:	machine.h
+ *	Author:	Avadis Tevanian, Jr.
+ *	Date:	1986
+ *
+ *	Machine independent machine abstraction.
+ */
+
+#ifndef	_MACH_MACHINE_H_
+#define _MACH_MACHINE_H_
+
+#ifdef	MACH_KERNEL
+#include <cpus.h>
+#endif	/* MACH_KERNEL */
+
+#include <sys/mach/vm_types.h>
+
+/*
+ *	For each host, there is a maximum possible number of
+ *	cpus that may be available in the system.  This is the
+ *	compile-time constant NCPUS, which is defined in cpus.h.
+ *
+ *	In addition, there is a machine_slot specifier for each
+ *	possible cpu in the system.
+ */
+
+struct machine_info {
+	integer_t	major_version;	/* kernel major version id */
+	integer_t	minor_version;	/* kernel minor version id */
+	int		max_cpus;	/* max number of cpus compiled */
+	int		avail_cpus;	/* number actually available */
+	vm_size_t	memory_size;	/* size of memory in bytes */
+};
+
+typedef struct machine_info	*machine_info_t;
+typedef struct machine_info	machine_info_data_t;	/* bogus */
+
+typedef integer_t	cpu_type_t;
+typedef integer_t	cpu_subtype_t;
+
+#define CPU_STATE_MAX		4
+
+#define CPU_STATE_USER		0
+#define CPU_STATE_NICE		1
+#define CPU_STATE_SYSTEM	2
+#define CPU_STATE_IDLE		3
+
+struct machine_slot {
+	boolean_t	is_cpu;		/* is there a cpu in this slot? */
+	cpu_type_t	cpu_type;	/* type of cpu */
+	cpu_subtype_t	cpu_subtype;	/* subtype of cpu */
+	integer_t	running;	/* is cpu running */
+	integer_t	cpu_ticks[CPU_STATE_MAX];
+	integer_t	clock_freq;	/* clock interrupt frequency */
+};
+
+typedef struct machine_slot	*machine_slot_t;
+typedef struct machine_slot	machine_slot_data_t;	/* bogus */
+
+#ifdef	MACH_KERNEL
+extern struct machine_info	machine_info;
+extern struct machine_slot	machine_slot[NCPUS];
+#endif	/* MACH_KERNEL */
+
+/*
+ *	Machine types known by all.
+ *
+ *	When adding new types & subtypes, please also update slot_name.c
+ *	in the libmach sources.
+ */
+
+#define CPU_TYPE_VAX		((cpu_type_t) 1)
+#define CPU_TYPE_ROMP		((cpu_type_t) 2)
+#define CPU_TYPE_MC68020	((cpu_type_t) 3)
+#define CPU_TYPE_NS32032	((cpu_type_t) 4)
+#define CPU_TYPE_NS32332        ((cpu_type_t) 5)
+#define CPU_TYPE_NS32532        ((cpu_type_t) 6)
+#define CPU_TYPE_I386		((cpu_type_t) 7)
+#define CPU_TYPE_MIPS		((cpu_type_t) 8)
+#define	CPU_TYPE_MC68030	((cpu_type_t) 9)
+#define CPU_TYPE_MC68040	((cpu_type_t) 10)
+#define CPU_TYPE_HPPA           ((cpu_type_t) 11)
+#define CPU_TYPE_ARM		((cpu_type_t) 12)
+#define CPU_TYPE_MC88000	((cpu_type_t) 13)
+#define CPU_TYPE_SPARC		((cpu_type_t) 14)
+#define CPU_TYPE_I860		((cpu_type_t) 15)
+#define CPU_TYPE_ALPHA		((cpu_type_t) 16)
+#define	CPU_TYPE_I486		((cpu_type_t) 17)
+#define	CPU_TYPE_PENTIUM	((cpu_type_t) 18)
+#define	CPU_TYPE_PENTIUMPRO	((cpu_type_t) 19)
+#define CPU_TYPE_POWERPC	((cpu_type_t) 20)
+
+/*
+ *	Machine subtypes (these are defined here, instead of in a machine
+ *	dependent directory, so that any program can get all definitions
+ *	regardless of where is it compiled).
+ */
+
+/*
+ *	VAX subtypes (these do *not* necessarily conform to the actual cpu
+ *	ID assigned by DEC available via the SID register).
+ */
+
+#define CPU_SUBTYPE_VAX780	((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_VAX785	((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_VAX750	((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_VAX730	((cpu_subtype_t) 4)
+#define CPU_SUBTYPE_UVAXI	((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_UVAXII	((cpu_subtype_t) 6)
+#define CPU_SUBTYPE_VAX8200	((cpu_subtype_t) 7)
+#define CPU_SUBTYPE_VAX8500	((cpu_subtype_t) 8)
+#define CPU_SUBTYPE_VAX8600	((cpu_subtype_t) 9)
+#define CPU_SUBTYPE_VAX8650	((cpu_subtype_t) 10)
+#define CPU_SUBTYPE_VAX8800	((cpu_subtype_t) 11)
+#define CPU_SUBTYPE_UVAXIII	((cpu_subtype_t) 12)
+
+/*
+ *	Alpha subtypes (these do *not* necessary conform to the actual cpu
+ *	ID assigned by DEC available via the SID register).
+ */
+
+#define CPU_SUBTYPE_ALPHA_ADU		((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_DEC_4000		((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_DEC_7000		((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_DEC_3000_500	((cpu_subtype_t) 4)
+#define CPU_SUBTYPE_DEC_3000_400	((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_DEC_10000		((cpu_subtype_t) 6)
+#define CPU_SUBTYPE_DEC_3000_300        ((cpu_subtype_t) 7)
+#define CPU_SUBTYPE_DEC_2000_300        ((cpu_subtype_t) 8)
+#define CPU_SUBTYPE_DEC_2100_A500	((cpu_subtype_t) 9)
+#define CPU_SUBTYPE_DEC_MORGAN		((cpu_subtype_t) 11)
+#define CPU_SUBTYPE_DEC_AVANTI          ((cpu_subtype_t) 13)
+#define CPU_SUBTYPE_DEC_MUSTANG         ((cpu_subtype_t) 14)
+
+/*
+ *	ROMP subtypes.
+ */
+
+#define CPU_SUBTYPE_RT_PC	((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_RT_APC	((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_RT_135	((cpu_subtype_t) 3)
+
+/*
+ *	68020 subtypes.
+ */
+
+#define CPU_SUBTYPE_SUN3_50	((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_SUN3_160	((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_SUN3_260	((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_SUN3_110	((cpu_subtype_t) 4)
+#define CPU_SUBTYPE_SUN3_60	((cpu_subtype_t) 5)
+
+#define CPU_SUBTYPE_HP_320	((cpu_subtype_t) 6)
+	/* 16.67 Mhz HP 300 series, custom MMU [HP 320] */
+#define CPU_SUBTYPE_HP_330	((cpu_subtype_t) 7)
+	/* 16.67 Mhz HP 300 series, MC68851 MMU [HP 318,319,330,349] */
+#define CPU_SUBTYPE_HP_350	((cpu_subtype_t) 8)
+	/* 25.00 Mhz HP 300 series, custom MMU [HP 350] */
+
+/*
+ *	32032/32332/32532 subtypes.
+ */
+
+#define CPU_SUBTYPE_MMAX_DPC	    ((cpu_subtype_t) 1)	/* 032 CPU */
+#define CPU_SUBTYPE_SQT		    ((cpu_subtype_t) 2) /* Symmetry */
+#define CPU_SUBTYPE_MMAX_APC_FPU    ((cpu_subtype_t) 3)	/* 32081 FPU */
+#define CPU_SUBTYPE_MMAX_APC_FPA    ((cpu_subtype_t) 4)	/* Weitek FPA */
+#define CPU_SUBTYPE_MMAX_XPC	    ((cpu_subtype_t) 5)	/* 532 CPU */
+#define CPU_SUBTYPE_SQT86	    ((cpu_subtype_t) 6) /* ?? */
+
+/*
+ *	80386/80486/Pentium subtypes.
+ */
+
+#define CPU_SUBTYPE_AT386	((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_EXL		((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_iPSC386	((cpu_subtype_t) 3)
+#define	CPU_SUBTYPE_SYMMETRY	((cpu_subtype_t) 4)	/* Sequent */
+#define	CPU_SUBTYPE_CBUS	((cpu_subtype_t) 5)	/* Cbus (Compaq) */
+#define	CPU_SUBTYPE_MBUS	((cpu_subtype_t) 6)	/* Mbus (Corollary) */
+#define	CPU_SUBTYPE_MPS		((cpu_subtype_t) 7)	/* Intel MP Spec. */
+
+/*
+ *	Mips subtypes.
+ */
+
+#define CPU_SUBTYPE_MIPS_R2300	((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_MIPS_R2600	((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_MIPS_R2800	((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_MIPS_R2000a	((cpu_subtype_t) 4)	/* pmax */
+#define CPU_SUBTYPE_MIPS_R2000	((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_MIPS_R3000a	((cpu_subtype_t) 6)	/* 3max */
+#define CPU_SUBTYPE_MIPS_R3000	((cpu_subtype_t) 7)
+
+/*
+ * 	MC68030 subtypes.
+ */
+
+#define CPU_SUBTYPE_NeXT	((cpu_subtype_t) 1) 
+	/* NeXt thinks MC68030 is 6 rather than 9 */
+#define CPU_SUBTYPE_HP_340	((cpu_subtype_t) 2) 
+	/* 16.67 Mhz HP 300 series [HP 332,340] */
+#define CPU_SUBTYPE_HP_360	((cpu_subtype_t) 3) 
+	/* 25.00 Mhz HP 300 series [HP 360] */
+#define CPU_SUBTYPE_HP_370	((cpu_subtype_t) 4) 
+	/* 33.33 Mhz HP 300 series [HP 370] */
+
+/*
+ *	HPPA subtypes.
+ */
+
+#define CPU_SUBTYPE_HPPA_825		((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_HPPA_835		((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_HPPA_840		((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_HPPA_850		((cpu_subtype_t) 4)
+#define CPU_SUBTYPE_HPPA_855		((cpu_subtype_t) 5)
+#define	CPU_SUBTYPE_HPPA_705		((cpu_subtype_t) 6)
+#define	CPU_SUBTYPE_HPPA_710		((cpu_subtype_t) 7)
+#define	CPU_SUBTYPE_HPPA_720		((cpu_subtype_t) 8)
+#define	CPU_SUBTYPE_HPPA_725		((cpu_subtype_t) 9)
+#define	CPU_SUBTYPE_HPPA_730       	((cpu_subtype_t)10)
+#define	CPU_SUBTYPE_HPPA_750		((cpu_subtype_t)11)
+#define	CPU_SUBTYPE_HPPA_770		((cpu_subtype_t)12)
+#define	CPU_SUBTYPE_HPPA_777		((cpu_subtype_t)13)
+#define	CPU_SUBTYPE_HPPA_712		((cpu_subtype_t)14)
+#define	CPU_SUBTYPE_HPPA_715		((cpu_subtype_t)15)
+
+/*
+ * 	ARM subtypes.
+ */
+
+#define CPU_SUBTYPE_ARM_A500_ARCH	((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_ARM_A500		((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_ARM_A440		((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_ARM_M4		((cpu_subtype_t) 4)
+#define CPU_SUBTYPE_ARM_A680		((cpu_subtype_t) 5)
+
+/*
+ *	MC88000 subtypes.
+ */
+
+#define CPU_SUBTYPE_MMAX_JPC		((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_LUNA88K             ((cpu_subtype_t) 2)
+
+/*
+ *	Sparc subtypes.
+ */
+
+#define CPU_SUBTYPE_SUN4_260		((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_SUN4_110		((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_SUN4_330		((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_SUN4C_60		((cpu_subtype_t) 4)
+#define CPU_SUBTYPE_SUN4C_65		((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_SUN4C_20		((cpu_subtype_t) 6)
+#define CPU_SUBTYPE_SUN4C_30		((cpu_subtype_t) 7)
+#define CPU_SUBTYPE_SUN4C_40		((cpu_subtype_t) 8)
+#define CPU_SUBTYPE_SUN4C_50		((cpu_subtype_t) 9)
+#define CPU_SUBTYPE_SUN4C_75		((cpu_subtype_t) 10)
+
+/*
+ *	i860 subtypes.
+ */
+
+#define CPU_SUBTYPE_iPSC860		((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_PARAGON860		((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_PARAGON860_MP	((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_OKI860		((cpu_subtype_t) 4)
+
+/*
+ *	Alpha subtypes.
+ */
+
+#define CPU_SUBTYPE_ALPHA_EV3		((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_ALPHA_EV4		((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_ALPHA_ISP		((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_ALPHA_21064		((cpu_subtype_t) 4)
+
+/*
+ *	PowerPc subtypes. These are defined as the values in the upper
+ *	16 bits of the PVR register of the CPU in question.
+ */
+
+#define CPU_SUBTYPE_PPC601		((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_PPC603		((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_PPC604		((cpu_subtype_t) 4)
+#define CPU_SUBTYPE_PPC602		((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_PPC603e		((cpu_subtype_t) 6)
+#define CPU_SUBTYPE_PPC603ev		((cpu_subtype_t) 7)
+#define CPU_SUBTYPE_PPC604e		((cpu_subtype_t) 9)
+#define CPU_SUBTYPE_PPC620		((cpu_subtype_t) 20)
+
+#endif	/* _MACH_MACHINE_H_ */


Property changes on: trunk/sys/sys/mach/machine.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/machine_types.defs
===================================================================
--- trunk/sys/sys/mach/machine_types.defs	                        (rev 0)
+++ trunk/sys/sys/mach/machine_types.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2000-2007 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+
+/*
+ *	Header file for basic, machine-dependent data types.  arm+i386 version.
+ */
+ 
+#ifndef _MACH_MACHINE_MACHNINE_TYPES_DEFS
+#define _MACH_MACHINE_MACHNINE_TYPES_DEFS
+
+type short = int16_t;
+type int = int32_t;
+type unsigned = uint32_t;
+
+type float = MACH_MSG_TYPE_REAL_32;
+type double = MACH_MSG_TYPE_REAL_64;
+
+
+/* from ISO/IEC 988:1999 spec */
+/* 7.18.1.4 Integer types capable of hgolding object pointers */
+/*
+ * The [u]intptr_t types for the native
+ * integer type, e.g. 32 or 64 or.. whatever
+ * register size the machine has.  They are
+ * used for entities that might be either
+ * [unsigned] integers or pointers, and for
+ * type-casting between the two.
+ *
+ * For instance, the IPC system represents
+ * a port in user space as an integer and
+ * in kernel space as a pointer.
+ */
+#if defined(__LP64__)
+type uintptr_t = uint64_t;
+type intptr_t = int64_t;
+#else
+type uintptr_t = uint32_t;
+type intptr_t = int32_t;
+#endif
+
+/*
+ * These are the legacy Mach types that are
+ * the [rough] equivalents of the standards above.
+ * They were defined in terms of int, not
+ * long int, so they remain separate.
+ */
+#if defined(__LP64__)
+type register_t = int64_t;
+#else
+type register_t = int32_t;
+#endif
+type integer_t = int32_t;
+type natural_t = uint32_t;
+
+/*
+ * These are the VM types that scale with the address
+ * space size of a given process.
+ */
+
+#if defined(__LP64__)
+type vm_address_t = uint64_t;
+type vm_offset_t = uint64_t;
+type vm_size_t = uint64_t;
+#else
+type vm_address_t = natural_t;
+type vm_offset_t = natural_t;
+type vm_size_t = natural_t;
+#endif
+
+/* This is a bit of a hack for arm.  We implement the backend with a wide type, but present a native-sized type to callers */
+type mach_port_context_t = uint64_t;
+
+/*
+ * The mach_vm_xxx_t types are sized to hold the
+ * maximum pointer, offset, etc... supported on the
+ * platform.
+ */
+type mach_vm_address_t = uint64_t;
+type mach_vm_offset_t = uint64_t;
+type mach_vm_size_t = uint64_t;
+
+#if	MACH_IPC_COMPAT
+/*
+ * For the old IPC interface
+ */
+#define	MSG_TYPE_PORT_NAME	natural_t
+
+#endif	/* MACH_IPC_COMPAT */
+
+/*
+ * These are types used internal to Mach to implement the
+ * legacy 32-bit VM APIs published by the kernel.
+ */
+#define	VM32_SUPPORT	1
+
+type vm32_address_t = uint32_t;
+type vm32_offset_t = uint32_t;
+type vm32_size_t = uint32_t;
+
+#endif /* _MACH_MACHINE_MACHNINE_TYPES_DEFS */
+
+/* vim: set ft=c : */

Added: trunk/sys/sys/mach/macro_help.h
===================================================================
--- trunk/sys/sys/mach/macro_help.h	                        (rev 0)
+++ trunk/sys/sys/mach/macro_help.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,99 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.3  91/05/14  16:44:49  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.2  91/02/05  17:28:09  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  16:15:31  mrt]
+ * 
+ * Revision 2.1  89/08/03  15:53:45  rwd
+ * Created.
+ * 
+ * Revision 2.2  88/10/18  03:36:20  mwyoung
+ * 	Added a form of return that can be used within macros that
+ * 	does not result in "statement not reached" noise.
+ * 	[88/10/17            mwyoung]
+ * 	
+ * 	Add MACRO_BEGIN, MACRO_END.
+ * 	[88/10/11            mwyoung]
+ * 	
+ * 	Created.
+ * 	[88/10/08            mwyoung]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	kern/macro_help.h
+ *
+ *	Provide help in making lint-free macro routines
+ *
+ */  
+
+#ifndef	_KERN_MACRO_HELP_H_
+#define	_KERN_MACRO_HELP_H_
+
+#ifdef	lint
+boolean_t	NEVER;
+boolean_t	ALWAYS;
+#else	/* lint */
+#define		NEVER		FALSE
+#define		ALWAYS		TRUE
+#endif	/* lint */
+
+#define		MACRO_BEGIN	do {
+#define		MACRO_END	} while (NEVER)
+
+#define		MACRO_RETURN	if (ALWAYS) return
+
+#endif	/* _KERN_MACRO_HELP_H_ */


Property changes on: trunk/sys/sys/mach/macro_help.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/memory_object.h
===================================================================
--- trunk/sys/sys/mach/memory_object.h	                        (rev 0)
+++ trunk/sys/sys/mach/memory_object.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,284 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6.2.1  92/02/21  11:24:08  jsb
+ * 	Added MEMORY_OBJECT_COPY_TEMPORARY.
+ * 	[92/02/11  07:56:35  jsb]
+ * 
+ * Revision 2.6  91/08/28  11:15:22  jsb
+ * 	Add defs for memory_object_return_t.
+ * 	[91/07/03  14:06:26  dlb]
+ * 
+ * Revision 2.5  91/05/18  14:35:05  rpd
+ * 	Removed memory_manager_default.
+ * 	[91/03/22            rpd]
+ * 
+ * Revision 2.4  91/05/14  16:55:55  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:34:01  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:19:11  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:58:56  rpd
+ * 	Converted to new IPC.
+ * 	[90/03/26  22:35:26  rpd]
+ * 
+ * Revision 2.1  89/08/03  16:02:52  rwd
+ * Created.
+ * 
+ * Revision 2.5  89/02/25  18:38:23  gm0w
+ * 	Changes for cleanup.
+ * 
+ * Revision 2.4  89/02/07  00:54:07  mwyoung
+ * Relocated from vm/memory_object.h
+ * 
+ * Revision 2.3  89/01/30  22:08:42  rpd
+ * 	Updated includes to the new style.  Fixed log.
+ * 	Made variable declarations use "extern".
+ * 	[89/01/25  15:25:20  rpd]
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	memory_object.h
+ *	Author:	Michael Wayne Young
+ *
+ *	External memory management interface definition.
+ */
+
+#ifndef	_MACH_MEMORY_OBJECT_H_
+#define _MACH_MEMORY_OBJECT_H_
+
+/*
+ *	User-visible types used in the external memory
+ *	management interface:
+ */
+#include <sys/mach/port.h>
+
+typedef mach_port_t  memory_object_default_t;
+typedef unsigned long long	memory_object_offset_t;
+typedef unsigned long long	memory_object_size_t;
+typedef natural_t		memory_object_cluster_size_t;
+typedef natural_t *		memory_object_fault_info_t;
+
+typedef unsigned long long 	vm_object_id_t;
+
+typedef	mach_port_t	memory_object_t;
+					/* A memory object ... */
+					/*  Used by the kernel to retrieve */
+					/*  or store data */
+
+typedef	mach_port_t	memory_object_control_t;
+					/* Provided to a memory manager; ... */
+					/*  used to control a memory object */
+
+typedef	mach_port_t	memory_object_name_t;
+					/* Used to describe the memory ... */
+					/*  object in vm_regions() calls */
+
+typedef mach_port_t     memory_object_rep_t;
+					/* Per-client handle for mem object */
+					/*  Used by user programs to specify */
+					/*  the object to map */
+
+typedef	int		memory_object_copy_strategy_t;
+					/* How memory manager handles copy: */
+#define		MEMORY_OBJECT_COPY_NONE		0
+					/* ... No special support */
+#define		MEMORY_OBJECT_COPY_CALL		1
+					/* ... Make call on memory manager */
+#define		MEMORY_OBJECT_COPY_DELAY 	2
+					/* ... Memory manager doesn't
+					 *     change data externally.
+					 */
+#define		MEMORY_OBJECT_COPY_TEMPORARY 	3
+					/* ... Memory manager doesn't
+					 *     change data externally, and
+					 *     doesn't need to see changes.
+					 */
+#define		MEMORY_OBJECT_COPY_SYMMETRIC 	4
+					/* ... Memory manager doesn't
+					 *     change data externally,
+					 *     doesn't need to see changes,
+					 *     and object will not be
+					 *     multiply mapped.
+					 *
+					 *     XXX
+					 *     Not yet safe for non-kernel use.
+					 */
+
+#define		MEMORY_OBJECT_COPY_INVALID	5
+					/* ...	An invalid copy strategy,
+					 *	for external objects which
+					 *	have not been initialized.
+					 *	Allows copy_strategy to be
+					 *	examined without also
+					 *	examining pager_ready and
+					 *	internal.
+					 */
+
+typedef	int		memory_object_return_t;
+					/* Which pages to return to manager
+					   this time (lock_request) */
+#define		MEMORY_OBJECT_RETURN_NONE	0
+					/* ... don't return any. */
+#define		MEMORY_OBJECT_RETURN_DIRTY	1
+					/* ... only dirty pages. */
+#define		MEMORY_OBJECT_RETURN_ALL	2
+					/* ... dirty and precious pages. */
+#define		MEMORY_OBJECT_RETURN_ANYTHING	3
+					/* ... any resident page. */
+
+#define		MEMORY_OBJECT_NULL	MACH_PORT_NULL
+
+
+/*
+ *	Types for the memory object flavor interfaces
+ */
+
+#define MEMORY_OBJECT_INFO_MAX      (1024) 
+typedef int     *memory_object_info_t;      
+typedef int	 memory_object_flavor_t;
+typedef int      memory_object_info_data_t[MEMORY_OBJECT_INFO_MAX];
+
+
+#define OLD_MEMORY_OBJECT_BEHAVIOR_INFO 	10	
+#define MEMORY_OBJECT_PERFORMANCE_INFO	11
+#define OLD_MEMORY_OBJECT_ATTRIBUTE_INFO	12
+#define MEMORY_OBJECT_NORMA_INFO	13
+#define MEMORY_OBJECT_ATTRIBUTE_INFO	14
+#define MEMORY_OBJECT_BEHAVIOR_INFO 	15	
+
+
+struct old_memory_object_behave_info {
+	memory_object_copy_strategy_t	copy_strategy;	
+	boolean_t			temporary;
+	boolean_t			invalidate;
+};
+
+struct memory_object_perf_info {
+	vm_size_t			cluster_size;
+	boolean_t			may_cache;
+};
+
+struct old_memory_object_attr_info {			/* old attr list */
+        boolean_t       		object_ready;
+        boolean_t       		may_cache;
+        memory_object_copy_strategy_t 	copy_strategy;
+};
+
+/* NOTE: this is now only by the ad1 server. */
+struct memory_object_norma_info {			/* old norma list */
+        boolean_t       		object_ready;
+        boolean_t       		may_cache;
+	boolean_t			write_completions;
+        memory_object_copy_strategy_t 	copy_strategy;
+	vm_size_t			cluster_size;
+};
+
+struct memory_object_attr_info {
+	memory_object_copy_strategy_t	copy_strategy;
+	vm_offset_t			cluster_size;
+	boolean_t			may_cache_object;
+	boolean_t			temporary;
+};
+
+struct memory_object_behave_info {
+	memory_object_copy_strategy_t	copy_strategy;	
+	boolean_t			temporary;
+	boolean_t			invalidate;
+	boolean_t			silent_overwrite;
+	boolean_t			advisory_pageout;
+};
+
+typedef struct old_memory_object_behave_info *old_memory_object_behave_info_t;
+typedef struct old_memory_object_behave_info old_memory_object_behave_info_data_t;
+
+typedef struct memory_object_behave_info *memory_object_behave_info_t;
+typedef struct memory_object_behave_info memory_object_behave_info_data_t;
+
+typedef struct memory_object_perf_info 	*memory_object_perf_info_t;
+typedef struct memory_object_perf_info	memory_object_perf_info_data_t;
+
+typedef struct old_memory_object_attr_info *old_memory_object_attr_info_t;
+typedef struct old_memory_object_attr_info old_memory_object_attr_info_data_t;
+
+typedef struct memory_object_attr_info	*memory_object_attr_info_t;
+typedef struct memory_object_attr_info	memory_object_attr_info_data_t;
+
+typedef struct memory_object_norma_info	*memory_object_norma_info_t;
+typedef struct memory_object_norma_info	memory_object_norma_info_data_t;
+
+
+#define OLD_MEMORY_OBJECT_BEHAVE_INFO_COUNT   	\
+                (sizeof(old_memory_object_behave_info_data_t)/sizeof(int))
+#define MEMORY_OBJECT_BEHAVE_INFO_COUNT   	\
+                (sizeof(memory_object_behave_info_data_t)/sizeof(int))
+#define MEMORY_OBJECT_PERF_INFO_COUNT		\
+		(sizeof(memory_object_perf_info_data_t)/sizeof(int))
+#define OLD_MEMORY_OBJECT_ATTR_INFO_COUNT		\
+		(sizeof(old_memory_object_attr_info_data_t)/sizeof(int))
+#define MEMORY_OBJECT_ATTR_INFO_COUNT		\
+		(sizeof(memory_object_attr_info_data_t)/sizeof(int))
+#define MEMORY_OBJECT_NORMA_INFO_COUNT		\
+		(sizeof(memory_object_norma_info_data_t)/sizeof(int))
+
+#define invalid_memory_object_flavor(f)					\
+	(f != MEMORY_OBJECT_NORMA_INFO && 				\
+	 f != MEMORY_OBJECT_ATTRIBUTE_INFO && 				\
+	 f != MEMORY_OBJECT_PERFORMANCE_INFO && 			\
+	 f != OLD_MEMORY_OBJECT_BEHAVIOR_INFO &&				\
+	 f != MEMORY_OBJECT_BEHAVIOR_INFO &&				\
+	 f != OLD_MEMORY_OBJECT_ATTRIBUTE_INFO)
+
+
+#endif	/* _MACH_MEMORY_OBJECT_H_ */


Property changes on: trunk/sys/sys/mach/memory_object.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/memory_object_types.h
===================================================================
--- trunk/sys/sys/mach/memory_object_types.h	                        (rev 0)
+++ trunk/sys/sys/mach/memory_object_types.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,749 @@
+/*
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	memory_object.h
+ *	Author:	Michael Wayne Young
+ *
+ *	External memory management interface definition.
+ */
+#if 0
+#ifndef	_MACH_MEMORY_OBJECT_TYPES_H_
+#define _MACH_MEMORY_OBJECT_TYPES_H_
+
+/*
+ *	User-visible types used in the external memory
+ *	management interface:
+ */
+
+#include <sys/mach/port.h>
+#include <sys/mach/message.h>
+#include <sys/mach/vm_prot.h>
+#include <sys/mach/vm_sync.h>
+#include <sys/mach/vm_types.h>
+#include <machine/mach/vm_types.h>
+
+#include <sys/cdefs.h>
+
+#define VM_64_BIT_DATA_OBJECTS
+
+typedef unsigned long long	memory_object_offset_t;
+typedef unsigned long long	memory_object_size_t;
+typedef natural_t		memory_object_cluster_size_t;
+typedef natural_t *		memory_object_fault_info_t;
+
+typedef unsigned long long 	vm_object_id_t;
+
+
+/*
+ * Temporary until real EMMI version gets re-implemented
+ */
+
+#ifdef	KERNEL_PRIVATE
+
+struct memory_object_pager_ops;	/* forward declaration */
+
+typedef struct 		memory_object {
+	unsigned int	_pad1; /* struct ipc_object_header */
+#ifdef __LP64__
+	unsigned int	_pad2; /* pad to natural boundary */
+#endif
+	const struct memory_object_pager_ops	*mo_pager_ops;
+} *memory_object_t;
+
+typedef struct		memory_object_control {
+	unsigned int	moc_ikot; /* struct ipc_object_header */
+#ifdef __LP64__
+	unsigned int	_pad; /* pad to natural boundary */
+#endif
+	struct vm_object *moc_object;
+} *memory_object_control_t;
+
+typedef const struct memory_object_pager_ops {
+	void (*memory_object_reference)(
+		memory_object_t mem_obj);
+	void (*memory_object_deallocate)(
+		memory_object_t mem_obj);
+	kern_return_t (*memory_object_init)(
+		memory_object_t mem_obj,
+		memory_object_control_t mem_control,
+		memory_object_cluster_size_t size);
+	kern_return_t (*memory_object_terminate)(
+		memory_object_t mem_obj);
+	kern_return_t (*memory_object_data_request)(
+		memory_object_t mem_obj,
+		memory_object_offset_t offset,
+		memory_object_cluster_size_t length,
+		vm_prot_t desired_access,
+		memory_object_fault_info_t fault_info);
+	kern_return_t (*memory_object_data_return)(
+		memory_object_t mem_obj,
+		memory_object_offset_t offset,
+		memory_object_cluster_size_t size,
+		memory_object_offset_t *resid_offset,
+		int *io_error,
+		boolean_t dirty,
+		boolean_t kernel_copy,
+		int upl_flags);
+	kern_return_t (*memory_object_data_initialize)(
+		memory_object_t mem_obj,
+		memory_object_offset_t offset,
+		memory_object_cluster_size_t size);
+	kern_return_t (*memory_object_data_unlock)(
+		memory_object_t mem_obj,
+		memory_object_offset_t offset,
+		memory_object_size_t size,
+		vm_prot_t desired_access);
+	kern_return_t (*memory_object_synchronize)(
+		memory_object_t mem_obj,
+		memory_object_offset_t offset,
+		memory_object_size_t size,
+		vm_sync_t sync_flags);
+	kern_return_t (*memory_object_map)(
+		memory_object_t mem_obj,
+		vm_prot_t prot);
+	kern_return_t (*memory_object_last_unmap)(
+		memory_object_t mem_obj);
+	kern_return_t (*memory_object_data_reclaim)(
+		memory_object_t mem_obj,
+		boolean_t reclaim_backing_store);
+	const char *memory_object_pager_name;
+} * memory_object_pager_ops_t;
+
+#else	/* KERNEL_PRIVATE */
+
+typedef mach_port_t	memory_object_t;
+typedef mach_port_t	memory_object_control_t;
+
+#endif	/* KERNEL_PRIVATE */
+
+typedef memory_object_t *memory_object_array_t;
+					/* A memory object ... */
+					/*  Used by the kernel to retrieve */
+					/*  or store data */
+
+typedef	mach_port_t	memory_object_name_t;
+					/* Used to describe the memory ... */
+					/*  object in vm_regions() calls */
+
+typedef mach_port_t	memory_object_default_t;
+					/* Registered with the host ... */
+					/*  for creating new internal objects */
+
+#define MEMORY_OBJECT_NULL		((memory_object_t) 0)
+#define MEMORY_OBJECT_CONTROL_NULL	((memory_object_control_t) 0)
+#define MEMORY_OBJECT_NAME_NULL		((memory_object_name_t) 0)
+#define MEMORY_OBJECT_DEFAULT_NULL	((memory_object_default_t) 0)
+
+
+typedef	int		memory_object_copy_strategy_t;
+					/* How memory manager handles copy: */
+#define		MEMORY_OBJECT_COPY_NONE		0
+					/* ... No special support */
+#define		MEMORY_OBJECT_COPY_CALL		1
+					/* ... Make call on memory manager */
+#define		MEMORY_OBJECT_COPY_DELAY 	2
+					/* ... Memory manager doesn't
+					 *     change data externally.
+					 */
+#define		MEMORY_OBJECT_COPY_TEMPORARY 	3
+					/* ... Memory manager doesn't
+					 *     change data externally, and
+					 *     doesn't need to see changes.
+					 */
+#define		MEMORY_OBJECT_COPY_SYMMETRIC 	4
+					/* ... Memory manager doesn't
+					 *     change data externally,
+					 *     doesn't need to see changes,
+					 *     and object will not be
+					 *     multiply mapped.
+					 *
+					 *     XXX
+					 *     Not yet safe for non-kernel use.
+					 */
+
+#define		MEMORY_OBJECT_COPY_INVALID	5
+					/* ...	An invalid copy strategy,
+					 *	for external objects which
+					 *	have not been initialized.
+					 *	Allows copy_strategy to be
+					 *	examined without also
+					 *	examining pager_ready and
+					 *	internal.
+					 */
+
+typedef	int		memory_object_return_t;
+					/* Which pages to return to manager
+					   this time (lock_request) */
+#define		MEMORY_OBJECT_RETURN_NONE	0
+					/* ... don't return any. */
+#define		MEMORY_OBJECT_RETURN_DIRTY	1
+					/* ... only dirty pages. */
+#define		MEMORY_OBJECT_RETURN_ALL	2
+					/* ... dirty and precious pages. */
+#define		MEMORY_OBJECT_RETURN_ANYTHING	3
+					/* ... any resident page. */
+
+/* 
+ *	Data lock request flags
+ */
+
+#define		MEMORY_OBJECT_DATA_FLUSH 	0x1
+#define		MEMORY_OBJECT_DATA_NO_CHANGE	0x2
+#define		MEMORY_OBJECT_DATA_PURGE	0x4
+#define		MEMORY_OBJECT_COPY_SYNC		0x8
+#define		MEMORY_OBJECT_DATA_SYNC		0x10
+#define         MEMORY_OBJECT_IO_SYNC           0x20
+#define		MEMORY_OBJECT_DATA_FLUSH_ALL	0x40
+
+/*
+ *	Types for the memory object flavor interfaces
+ */
+
+#define MEMORY_OBJECT_INFO_MAX      (1024) 
+typedef int     *memory_object_info_t;      
+typedef int	 memory_object_flavor_t;
+typedef int      memory_object_info_data_t[MEMORY_OBJECT_INFO_MAX];
+
+
+#define MEMORY_OBJECT_PERFORMANCE_INFO	11
+#define MEMORY_OBJECT_ATTRIBUTE_INFO	14
+#define MEMORY_OBJECT_BEHAVIOR_INFO 	15	
+
+#ifdef	PRIVATE
+
+#define OLD_MEMORY_OBJECT_BEHAVIOR_INFO 	10	
+#define OLD_MEMORY_OBJECT_ATTRIBUTE_INFO	12
+
+struct old_memory_object_behave_info {
+	memory_object_copy_strategy_t	copy_strategy;	
+	boolean_t			temporary;
+	boolean_t			invalidate;
+};
+
+struct old_memory_object_attr_info {			/* old attr list */
+        boolean_t       		object_ready;
+        boolean_t       		may_cache;
+        memory_object_copy_strategy_t 	copy_strategy;
+};
+
+typedef struct old_memory_object_behave_info *old_memory_object_behave_info_t;
+typedef struct old_memory_object_behave_info old_memory_object_behave_info_data_t;
+typedef struct old_memory_object_attr_info *old_memory_object_attr_info_t;
+typedef struct old_memory_object_attr_info old_memory_object_attr_info_data_t;
+
+#define OLD_MEMORY_OBJECT_BEHAVE_INFO_COUNT   	((mach_msg_type_number_t) \
+                (sizeof(old_memory_object_behave_info_data_t)/sizeof(int)))
+#define OLD_MEMORY_OBJECT_ATTR_INFO_COUNT	((mach_msg_type_number_t) \
+		(sizeof(old_memory_object_attr_info_data_t)/sizeof(int)))
+
+#ifdef KERNEL
+
+__BEGIN_DECLS
+extern void memory_object_reference(memory_object_t object);
+extern void memory_object_deallocate(memory_object_t object);
+
+extern void memory_object_default_reference(memory_object_default_t);
+extern void memory_object_default_deallocate(memory_object_default_t);
+
+extern void memory_object_control_reference(memory_object_control_t control);
+extern void memory_object_control_deallocate(memory_object_control_t control);
+extern int  memory_object_control_uiomove(memory_object_control_t, memory_object_offset_t, void *, int, int, int, int);
+__END_DECLS
+
+#endif  /* KERNEL */
+
+#endif	/* PRIVATE */
+
+struct memory_object_perf_info {
+	memory_object_cluster_size_t	cluster_size;
+	boolean_t			may_cache;
+};
+
+struct memory_object_attr_info {
+	memory_object_copy_strategy_t	copy_strategy;
+	memory_object_cluster_size_t	cluster_size;
+	boolean_t			may_cache_object;
+	boolean_t			temporary;
+};
+
+struct memory_object_behave_info {
+	memory_object_copy_strategy_t	copy_strategy;	
+	boolean_t			temporary;
+	boolean_t			invalidate;
+	boolean_t			silent_overwrite;
+	boolean_t			advisory_pageout;
+};
+
+
+typedef struct memory_object_behave_info *memory_object_behave_info_t;
+typedef struct memory_object_behave_info memory_object_behave_info_data_t;
+
+typedef struct memory_object_perf_info 	*memory_object_perf_info_t;
+typedef struct memory_object_perf_info	memory_object_perf_info_data_t;
+
+typedef struct memory_object_attr_info	*memory_object_attr_info_t;
+typedef struct memory_object_attr_info	memory_object_attr_info_data_t;
+
+#define MEMORY_OBJECT_BEHAVE_INFO_COUNT ((mach_msg_type_number_t)	\
+                (sizeof(memory_object_behave_info_data_t)/sizeof(int)))
+#define MEMORY_OBJECT_PERF_INFO_COUNT	((mach_msg_type_number_t)	\
+		(sizeof(memory_object_perf_info_data_t)/sizeof(int)))
+#define MEMORY_OBJECT_ATTR_INFO_COUNT	((mach_msg_type_number_t)	\
+		(sizeof(memory_object_attr_info_data_t)/sizeof(int)))
+
+#define invalid_memory_object_flavor(f)					\
+	(f != MEMORY_OBJECT_ATTRIBUTE_INFO && 				\
+	 f != MEMORY_OBJECT_PERFORMANCE_INFO && 			\
+	 f != OLD_MEMORY_OBJECT_BEHAVIOR_INFO &&			\
+	 f != MEMORY_OBJECT_BEHAVIOR_INFO &&				\
+	 f != OLD_MEMORY_OBJECT_ATTRIBUTE_INFO)
+
+
+/*
+ * Used to support options on memory_object_release_name call
+ */
+#define MEMORY_OBJECT_TERMINATE_IDLE	0x1
+#define MEMORY_OBJECT_RESPECT_CACHE	0x2
+#define MEMORY_OBJECT_RELEASE_NO_OP	0x4
+
+
+/* named entry processor mapping options */
+/* enumerated */
+#define MAP_MEM_NOOP		0
+#define MAP_MEM_COPYBACK	1
+#define MAP_MEM_IO		2
+#define MAP_MEM_WTHRU		3
+#define MAP_MEM_WCOMB		4	/* Write combining mode */
+					/* aka store gather     */
+#define MAP_MEM_INNERWBACK	5
+
+#define GET_MAP_MEM(flags)	\
+	((((unsigned int)(flags)) >> 24) & 0xFF)
+
+#define SET_MAP_MEM(caching, flags)	\
+	((flags) = ((((unsigned int)(caching)) << 24) \
+			& 0xFF000000) | ((flags) & 0xFFFFFF));
+
+/* leave room for vm_prot bits */
+#define MAP_MEM_ONLY		0x010000 /* change processor caching  */
+#define MAP_MEM_NAMED_CREATE	0x020000 /* create extant object      */
+#define MAP_MEM_PURGABLE	0x040000 /* create a purgable VM object */
+#define MAP_MEM_NAMED_REUSE	0x080000 /* reuse provided entry if identical */
+#define MAP_MEM_USE_DATA_ADDR	0x100000 /* preserve address of data, rather than base of page */
+#define MAP_MEM_VM_COPY		0x200000 /* make a copy of a VM range */
+#define MAP_MEM_VM_SHARE	0x400000 /* extract a VM range for remap */
+
+#ifdef KERNEL
+
+/*
+ *  Universal Page List data structures
+ *
+ *  A UPL describes a bounded set of physical pages
+ *  associated with some range of an object or map
+ *  and a snapshot of the attributes associated with
+ *  each of those pages.
+ */
+#ifdef PRIVATE
+#define MAX_UPL_TRANSFER_BYTES	(1024 * 1024)
+#define MAX_UPL_SIZE_BYTES	(1024 * 1024 * 64)
+
+#define MAX_UPL_SIZE		(MAX_UPL_SIZE_BYTES / PAGE_SIZE)
+#define	MAX_UPL_TRANSFER	(MAX_UPL_TRANSFER_BYTES / PAGE_SIZE)
+
+
+struct upl_page_info {
+	ppnum_t		phys_addr;	/* physical page index number */
+	unsigned int
+#ifdef  XNU_KERNEL_PRIVATE
+		pageout:1,      /* page is to be removed on commit */
+		absent:1,       /* No valid data in this page */
+		dirty:1,        /* Page must be cleaned (O) */
+		precious:1,     /* must be cleaned, we have only copy */
+		device:1,	/* no page data, mapped dev memory */
+		speculative:1,  /* page is valid, but not yet accessed */
+		cs_validated:1,	/* CODE SIGNING: page was validated */
+		cs_tainted:1,	/* CODE SIGNING: page is tainted */
+		needed:1,	/* page should be left in cache on abort */
+		:0;		/* force to long boundary */
+#else
+		opaque;		/* use upl_page_xxx() accessor funcs */
+#endif /* XNU_KERNEL_PRIVATE */
+};
+
+#else
+
+struct upl_page_info {
+	unsigned int	opaque[2];	/* use upl_page_xxx() accessor funcs */
+};
+
+#endif /* PRIVATE */
+
+typedef struct upl_page_info	upl_page_info_t;
+typedef upl_page_info_t		*upl_page_info_array_t;
+typedef upl_page_info_array_t	upl_page_list_ptr_t;
+
+typedef uint32_t	upl_offset_t;	/* page-aligned byte offset */
+typedef uint32_t	upl_size_t;	/* page-aligned byte size */
+
+/* upl invocation flags */
+/* top nibble is used by super upl */
+
+#define UPL_FLAGS_NONE		0x00000000
+#define UPL_COPYOUT_FROM	0x00000001
+#define UPL_PRECIOUS		0x00000002
+#define UPL_NO_SYNC		0x00000004
+#define UPL_CLEAN_IN_PLACE	0x00000008
+#define UPL_NOBLOCK		0x00000010
+#define UPL_RET_ONLY_DIRTY	0x00000020
+#define UPL_SET_INTERNAL	0x00000040
+#define UPL_QUERY_OBJECT_TYPE	0x00000080
+#define UPL_RET_ONLY_ABSENT	0x00000100 /* used only for COPY_FROM = FALSE */
+#define UPL_FILE_IO             0x00000200
+#define UPL_SET_LITE		0x00000400
+#define UPL_SET_INTERRUPTIBLE	0x00000800
+#define UPL_SET_IO_WIRE		0x00001000
+#define UPL_FOR_PAGEOUT		0x00002000
+#define UPL_WILL_BE_DUMPED      0x00004000
+#define UPL_FORCE_DATA_SYNC	0x00008000
+/* continued after the ticket bits... */
+
+#define UPL_PAGE_TICKET_MASK	0x000F0000
+#define UPL_PAGE_TICKET_SHIFT   16
+
+/* ... flags resume here */
+#define UPL_BLOCK_ACCESS	0x00100000
+#define UPL_ENCRYPT		0x00200000
+#define UPL_NOZEROFILL		0x00400000
+#define UPL_WILL_MODIFY		0x00800000 /* caller will modify the pages */
+
+#define UPL_NEED_32BIT_ADDR	0x01000000
+#define UPL_UBC_MSYNC		0x02000000
+#define UPL_UBC_PAGEOUT		0x04000000
+#define UPL_UBC_PAGEIN		0x08000000
+#define UPL_REQUEST_SET_DIRTY	0x10000000
+#define UPL_REQUEST_NO_FAULT	0x20000000 /* fail if pages not all resident */
+#define UPL_NOZEROFILLIO	0x40000000 /* allow non zerofill pages present */
+#define UPL_REQUEST_FORCE_COHERENCY	0x80000000
+
+/* UPL flags known by this kernel */
+#define UPL_VALID_FLAGS		0xFFFFFFFF
+
+
+/* upl abort error flags */
+#define UPL_ABORT_RESTART		0x1
+#define UPL_ABORT_UNAVAILABLE	0x2
+#define UPL_ABORT_ERROR		0x4
+#define UPL_ABORT_FREE_ON_EMPTY	0x8  /* only implemented in wrappers */
+#define UPL_ABORT_DUMP_PAGES	0x10
+#define UPL_ABORT_NOTIFY_EMPTY	0x20
+/* deprecated: #define UPL_ABORT_ALLOW_ACCESS	0x40 */
+#define UPL_ABORT_REFERENCE	0x80
+
+/* upl pages check flags */
+#define UPL_CHECK_DIRTY         0x1
+
+
+/*
+ *  upl pagein/pageout  flags
+ *
+ * 
+ * when I/O is issued from this UPL it should be done synchronously
+ */
+#define UPL_IOSYNC	0x1
+
+/*
+ * the passed in UPL should not have either a commit or abort 
+ * applied to it by the underlying layers... the site that
+ * created the UPL is responsible for cleaning it up.
+ */
+#define UPL_NOCOMMIT	0x2
+
+/*
+ * turn off any speculative read-ahead applied at the I/O layer
+ */
+#define UPL_NORDAHEAD	0x4
+
+/*
+ * pageout request is targeting a real file
+ * as opposed to a swap file.
+ */
+
+#define UPL_VNODE_PAGER	0x8
+/*
+ * this pageout is being originated as part of an explicit
+ * memory synchronization operation... no speculative clustering
+ * should be applied, only the range specified should be pushed.
+ */
+#define UPL_MSYNC		0x10
+
+/*
+ *
+ */
+#define UPL_PAGING_ENCRYPTED	0x20
+
+/*
+ * this pageout is being originated as part of an explicit
+ * memory synchronization operation that is checking for I/O
+ * errors and taking it's own action... if an error occurs,
+ * just abort the pages back into the cache unchanged
+ */
+#define UPL_KEEPCACHED		0x40
+
+/*
+ * this pageout originated from within cluster_io to deal
+ * with a dirty page that hasn't yet been seen by the FS
+ * that backs it... tag it so that the FS can take the
+ * appropriate action w/r to its locking model since the
+ * pageout will reenter the FS for the same file currently
+ * being handled in this context.
+ */
+#define UPL_NESTED_PAGEOUT	0x80
+
+/*
+ * we've detected a sequential access pattern and
+ * we are speculatively and aggressively pulling
+ * pages in... do not count these as real PAGEINs
+ * w/r to our hard throttle maintenance
+ */
+#define UPL_IOSTREAMING		0x100
+
+/*
+ * Currently, it's only used for the swap pagein path.
+ * Since the swap + compressed pager layer manage their
+ * pages, these pages are not marked "absent" i.e. these
+ * are "valid" pages. The pagein path will _not_ issue an
+ * I/O (correctly) for valid pages. So, this flag is used
+ * to override that logic in the vnode I/O path.
+ */
+#define UPL_IGNORE_VALID_PAGE_CHECK	0x200
+
+
+
+/* upl commit flags */
+#define UPL_COMMIT_FREE_ON_EMPTY	0x1 /* only implemented in wrappers */
+#define UPL_COMMIT_CLEAR_DIRTY		0x2
+#define UPL_COMMIT_SET_DIRTY		0x4
+#define UPL_COMMIT_INACTIVATE		0x8
+#define UPL_COMMIT_NOTIFY_EMPTY		0x10
+/* deprecated: #define UPL_COMMIT_ALLOW_ACCESS		0x20 */
+#define UPL_COMMIT_CS_VALIDATED		0x40
+#define UPL_COMMIT_CLEAR_PRECIOUS	0x80
+#define UPL_COMMIT_SPECULATE		0x100
+#define UPL_COMMIT_FREE_ABSENT		0x200
+#define UPL_COMMIT_WRITTEN_BY_KERNEL	0x400
+
+#define UPL_COMMIT_KERNEL_ONLY_FLAGS	(UPL_COMMIT_CS_VALIDATED | UPL_COMMIT_FREE_ABSENT)
+
+/* flags for return of state from vm_map_get_upl,  vm_upl address space */
+/* based call */
+#define UPL_DEV_MEMORY			0x1
+#define UPL_PHYS_CONTIG			0x2
+
+
+/* 
+ * Flags for the UPL page ops routine.  This routine is not exported
+ * out of the kernel at the moment and so the defs live here.
+ */
+#define UPL_POP_DIRTY		0x1
+#define UPL_POP_PAGEOUT		0x2
+#define UPL_POP_PRECIOUS		0x4
+#define UPL_POP_ABSENT		0x8
+#define UPL_POP_BUSY			0x10
+
+#define UPL_POP_PHYSICAL	0x10000000
+#define UPL_POP_DUMP		0x20000000
+#define UPL_POP_SET		0x40000000
+#define UPL_POP_CLR		0x80000000
+
+/* 
+ * Flags for the UPL range op routine.  This routine is not exported 
+ * out of the kernel at the moemet and so the defs live here.
+ */
+/*
+ * UPL_ROP_ABSENT: Returns the extent of the range presented which
+ * is absent, starting with the start address presented    
+ */
+#define UPL_ROP_ABSENT		0x01
+/*
+ * UPL_ROP_PRESENT: Returns the extent of the range presented which
+ * is present (i.e. resident), starting with the start address presented
+ */
+#define UPL_ROP_PRESENT		0x02
+/*
+ * UPL_ROP_DUMP: Dump the pages which are found in the target object
+ * for the target range.
+ */
+#define UPL_ROP_DUMP			0x04
+
+#ifdef	PRIVATE
+
+#define UPL_REPRIO_INFO_MASK 	(0xFFFFFFFF)
+#define UPL_REPRIO_INFO_SHIFT 	32
+
+/* access macros for upl_t */
+
+#define UPL_DEVICE_PAGE(upl) \
+	(((upl)[0].phys_addr != 0) ? ((upl)[0].device) : FALSE)
+
+#define UPL_PAGE_PRESENT(upl, index) \
+	((upl)[(index)].phys_addr != 0)
+
+#define UPL_PHYS_PAGE(upl, index) \
+	((upl)[(index)].phys_addr)
+
+#define UPL_SPECULATIVE_PAGE(upl, index) \
+	(((upl)[(index)].phys_addr != 0) ? ((upl)[(index)].speculative) : FALSE)
+
+#define UPL_DIRTY_PAGE(upl, index) \
+	(((upl)[(index)].phys_addr != 0) ? ((upl)[(index)].dirty) : FALSE)
+
+#define UPL_PRECIOUS_PAGE(upl, index) \
+	(((upl)[(index)].phys_addr != 0) ? ((upl)[(index)].precious) : FALSE)
+
+#define UPL_VALID_PAGE(upl, index) \
+	(((upl)[(index)].phys_addr != 0) ? (!((upl)[(index)].absent)) : FALSE)
+
+#define UPL_PAGEOUT_PAGE(upl, index) \
+	(((upl)[(index)].phys_addr != 0) ? ((upl)[(index)].pageout) : FALSE)
+
+#define UPL_SET_PAGE_FREE_ON_COMMIT(upl, index) \
+	(((upl)[(index)].phys_addr != 0) ?	      \
+	 ((upl)[(index)].pageout = TRUE) : FALSE)
+
+#define UPL_CLR_PAGE_FREE_ON_COMMIT(upl, index) \
+	(((upl)[(index)].phys_addr != 0) ?       \
+	 ((upl)[(index)].pageout = FALSE) : FALSE)
+
+#define UPL_REPRIO_INFO_BLKNO(upl, index) \
+	(((upl)->upl_reprio_info[(index)]) & UPL_REPRIO_INFO_MASK) 
+
+#define UPL_REPRIO_INFO_LEN(upl, index) \
+	((((upl)->upl_reprio_info[(index)]) >> UPL_REPRIO_INFO_SHIFT) & UPL_REPRIO_INFO_MASK)
+
+/* modifier macros for upl_t */
+
+#define UPL_SET_CS_VALIDATED(upl, index, value) \
+	((upl)[(index)].cs_validated = ((value) ? TRUE : FALSE))
+
+#define UPL_SET_CS_TAINTED(upl, index, value) \
+	((upl)[(index)].cs_tainted = ((value) ? TRUE : FALSE))
+
+#define UPL_SET_REPRIO_INFO(upl, index, blkno, len) \
+	((upl)->upl_reprio_info[(index)]) = (((uint64_t)(blkno) & UPL_REPRIO_INFO_MASK) | \
+	(((uint64_t)(len) & UPL_REPRIO_INFO_MASK) << UPL_REPRIO_INFO_SHIFT))
+
+/* The call prototyped below is used strictly by UPL_GET_INTERNAL_PAGE_LIST */
+
+extern vm_size_t	upl_offset_to_pagelist;
+extern vm_size_t 	upl_get_internal_pagelist_offset(void);
+extern void*		upl_get_internal_vectorupl(upl_t);
+extern upl_page_info_t*		upl_get_internal_vectorupl_pagelist(upl_t);
+
+/*Use this variant to get the UPL's page list iff:*/
+/*- the upl being passed in is already part of a vector UPL*/
+/*- the page list you want is that of this "sub-upl" and not that of the entire vector-upl*/
+
+#define UPL_GET_INTERNAL_PAGE_LIST_SIMPLE(upl) \
+	((upl_page_info_t *)((upl_offset_to_pagelist == 0) ?  \
+	(uintptr_t)upl + (unsigned int)(upl_offset_to_pagelist = upl_get_internal_pagelist_offset()): \
+	(uintptr_t)upl + (unsigned int)upl_offset_to_pagelist))
+
+/* UPL_GET_INTERNAL_PAGE_LIST is only valid on internal objects where the */
+/* list request was made with the UPL_INTERNAL flag */
+
+
+#define UPL_GET_INTERNAL_PAGE_LIST(upl) \
+	((upl_get_internal_vectorupl(upl) != NULL ) ? (upl_get_internal_vectorupl_pagelist(upl)) : \
+	((upl_page_info_t *)((upl_offset_to_pagelist == 0) ?  \
+	(uintptr_t)upl + (unsigned int)(upl_offset_to_pagelist = upl_get_internal_pagelist_offset()): \
+	(uintptr_t)upl + (unsigned int)upl_offset_to_pagelist)))
+
+__BEGIN_DECLS
+
+extern ppnum_t	upl_phys_page(upl_page_info_t *upl, int index);
+extern boolean_t	upl_device_page(upl_page_info_t *upl);
+extern boolean_t	upl_speculative_page(upl_page_info_t *upl, int index);
+extern void	upl_clear_dirty(upl_t upl, boolean_t value);
+extern void	upl_set_referenced(upl_t upl, boolean_t value);
+extern void	upl_range_needed(upl_t upl, int index, int count);
+#if CONFIG_IOSCHED
+extern int64_t upl_blkno(upl_page_info_t *upl, int index);
+extern void 	upl_set_blkno(upl_t upl, vm_offset_t upl_offset, int size, int64_t blkno);
+#endif
+
+__END_DECLS
+
+#endif /* PRIVATE */
+
+__BEGIN_DECLS
+
+extern boolean_t	upl_page_present(upl_page_info_t *upl, int index);
+extern boolean_t	upl_dirty_page(upl_page_info_t *upl, int index);
+extern boolean_t	upl_valid_page(upl_page_info_t *upl, int index);
+extern void		upl_deallocate(upl_t upl);
+extern void 		upl_mark_decmp(upl_t upl);
+extern void 		upl_unmark_decmp(upl_t upl);
+
+__END_DECLS
+
+#endif  /* KERNEL */
+
+#endif	/* _MACH_MEMORY_OBJECT_TYPES_H_ */
+#else
+#include <sys/mach/memory_object.h>
+#endif


Property changes on: trunk/sys/sys/mach/memory_object_types.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/message.h
===================================================================
--- trunk/sys/sys/mach/message.h	                        (rev 0)
+++ trunk/sys/sys/mach/message.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,864 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.11.2.2  92/03/03  16:22:15  jeffreyh
+ * 	Changes from TRUNK
+ * 	[92/02/26  12:10:31  jeffreyh]
+ * 
+ * Revision 2.12  92/01/15  13:44:29  rpd
+ * 	Changed MACH_IPC_COMPAT conditionals to default to not present.
+ *
+ * Revision 2.11.2.1  92/01/03  16:36:23  jsb
+ * 	Added MACH_MSGH_BITS_MIGRATED (NORMA_IPC internal).
+ * 	[91/12/25  16:42:44  jsb]
+ * 
+ * Revision 2.11  91/10/09  16:12:14  af
+ * 	Revision 2.10.1.1  91/10/05  15:44:57  rpd
+ *  	Added check for __STDC__ to get function prototypes.
+ *  	Removed MACH_MSGH_KIND_NOTIFICATION compatibility definition.
+ * 
+ * Revision 2.10  91/08/28  11:15:27  jsb
+ * 	Replaced msgh_kind with msgh_seqno.
+ * 	[91/08/09            rpd]
+ * 
+ * Revision 2.9  91/08/03  18:19:05  jsb
+ * 	Added MACH_MSGH_BITS_COMPLEX_{PORTS,DATA}.
+ * 	[91/07/04  12:38:13  jsb]
+ * 
+ * Revision 2.8  91/05/14  16:56:21  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.7  91/02/05  17:34:12  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:19:32  mrt]
+ * 
+ * Revision 2.6  90/06/19  22:59:59  rpd
+ * 	Changed mach_msg_timeout_t to unsigned.
+ * 	[90/06/06            rpd]
+ * 
+ * Revision 2.5  90/06/02  14:59:06  rpd
+ * 	Revised the comments.
+ * 	[90/05/13            rpd]
+ * 	Converted to new IPC.
+ * 	[90/03/26  22:36:07  rpd]
+ * 
+ *
+ * Condensed history:
+ *	Named unused bits in message structures (rpd).
+ *	Added MSG_TYPE_POLYMORPHIC (rpd).
+ *	Put ownership rights under MACH_IPC_XXXHACK (rpd).
+ * 	Removed some unused defines (rpd).
+ *	Made MSG_TYPE_PORT_NAME a separate type (rpd).
+ *	Added SEND_SWITCH (mwyoung).
+ *	Added SEND_MSG_SIZE_CHANGE (mwyoung).
+ *	Added msg_size_t, msg_timeout_t (mwyoung).
+ *	Added MSG_TYPE_INTERNAL_MEMORY (mwyoung).
+ *	Use unsigned ints/shorts (avie).
+ *	Added SEND_INTERRUPT (mwyoung).
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/message.h
+ *
+ *	Mach IPC message and primitive function definitions.
+ */
+
+#ifndef	_MACH_MESSAGE_H_
+#define _MACH_MESSAGE_H_
+
+#define MACH_ASSERT 0
+#define MACH_KDB 0
+#define NCPUS (SMP ? 32 : 1)
+#define NORMA_VM 0
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <vm/vm.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/port.h>
+
+
+/*
+ *  The timeout mechanism uses mach_msg_timeout_t values,
+ *  passed by value.  The timeout units are milliseconds.
+ *  It is controlled with the MACH_SEND_TIMEOUT
+ *  and MACH_RCV_TIMEOUT options.
+ */
+
+typedef natural_t mach_msg_timeout_t;
+
+typedef char *mach_msg_trailer_info_t;
+
+/*
+ *  The value to be used when there is no timeout.
+ *  (No MACH_SEND_TIMEOUT/MACH_RCV_TIMEOUT option.)
+ */
+
+#define MACH_MSG_TIMEOUT_NONE		((mach_msg_timeout_t) 0)
+
+/*
+ *  The kernel uses MACH_MSGH_BITS_COMPLEX as a hint.  It it isn't on, it
+ *  assumes the body of the message doesn't contain port rights or OOL
+ *  data.  The field is set in received messages.  A user task must
+ *  use caution in interpreting the body of a message if the bit isn't
+ *  on, because the mach_msg_type's in the body might "lie" about the
+ *  contents.  If the bit isn't on, but the mach_msg_types
+ *  in the body specify rights or OOL data, the behavior is undefined.
+ *  (Ie, an error may or may not be produced.)
+ *
+ *  The value of MACH_MSGH_BITS_REMOTE determines the interpretation
+ *  of the msgh_remote_port field.  It is handled like a msgt_name.
+ *
+ *  The value of MACH_MSGH_BITS_LOCAL determines the interpretation
+ *  of the msgh_local_port field.  It is handled like a msgt_name.
+ *
+ *  MACH_MSGH_BITS() combines two MACH_MSG_TYPE_* values, for the remote
+ *  and local fields, into a single value suitable for msgh_bits.
+ *
+ *  MACH_MSGH_BITS_CIRCULAR should be zero; is is used internally.
+ *
+ *  MACH_MSGH_BITS_RTALLOC indicates that rtalloc/rtfree should be used
+ *  instead of kalloc/kfree for the kmsg and associated data buffers.
+ *
+ *  The unused bits should be zero and are reserved for the kernel
+ *  or for future interface expansion.
+ */
+
+#define MACH_MSGH_BITS_ZERO		0x00000000
+
+#define MACH_MSGH_BITS_REMOTE_MASK	0x0000001f
+#define MACH_MSGH_BITS_LOCAL_MASK	0x00001f00
+#define MACH_MSGH_BITS_VOUCHER_MASK	0x001f0000
+
+#define	MACH_MSGH_BITS_PORTS_MASK		\
+		(MACH_MSGH_BITS_REMOTE_MASK |	\
+		 MACH_MSGH_BITS_LOCAL_MASK |	\
+		 MACH_MSGH_BITS_VOUCHER_MASK)
+
+#define MACH_MSGH_BITS_COMPLEX		0x80000000U
+#define	MACH_MSGH_BITS_CIRCULAR		0x10000000	/* internal use only */
+
+#define MACH_MSGH_BITS(remote, local)				\
+	((remote) | ((local) << 8))
+#define	MACH_MSGH_BITS_SET_PORTS(remote, local, voucher)	\
+	(((remote) & MACH_MSGH_BITS_REMOTE_MASK) | 		\
+	 (((local) << 8) & MACH_MSGH_BITS_LOCAL_MASK) | 	\
+	 (((voucher) << 16) & MACH_MSGH_BITS_VOUCHER_MASK))
+#define MACH_MSGH_BITS_SET(remote, local, voucher, other)	\
+	(MACH_MSGH_BITS_SET_PORTS((remote), (local), (voucher)) \
+	 | ((other) &~ MACH_MSGH_BITS_PORTS_MASK))
+
+#define	MACH_MSGH_BITS_REMOTE(bits)				\
+		((bits) & MACH_MSGH_BITS_REMOTE_MASK)
+#define	MACH_MSGH_BITS_LOCAL(bits)				\
+		(((bits) & MACH_MSGH_BITS_LOCAL_MASK) >> 8)
+#define	MACH_MSGH_BITS_PORTS(bits)				\
+		((bits) & MACH_MSGH_BITS_PORTS_MASK)
+#define	MACH_MSGH_BITS_OTHER(bits)				\
+		((bits) &~ MACH_MSGH_BITS_PORTS_MASK)
+
+/*
+ *  Every message starts with a message header.
+ *  Following the message header are zero or more pairs of
+ *  type descriptors (mach_msg_type_t/mach_msg_type_long_t) and
+ *  data values.  The size of the message must be specified in bytes,
+ *  and includes the message header, type descriptors, inline
+ *  data, and inline pointer for out-of-line data.
+ *
+ *  The msgh_remote_port field specifies the destination of the message.
+ *  It must specify a valid send or send-once right for a port.
+ *
+ *  The msgh_local_port field specifies a "reply port".  Normally,
+ *  This field carries a send-once right that the receiver will use
+ *  to reply to the message.  It may carry the values MACH_PORT_NULL,
+ *  MACH_PORT_DEAD, a send-once right, or a send right.
+ *
+ *  The msgh_seqno field carries a sequence number associated with the
+ *  received-from port.  A port's sequence number is incremented every
+ *  time a message is received from it.  In sent messages, the field's
+ *  value is ignored.
+ *
+ *  The msgh_id field is uninterpreted by the message primitives.
+ *  It normally carries information specifying the format
+ *  or meaning of the message.
+ */
+
+typedef unsigned int mach_msg_bits_t;
+typedef	natural_t mach_msg_size_t;
+typedef integer_t mach_msg_id_t;
+
+
+#define MACH_MSG_SIZE_NULL (mach_msg_size_t *) 0
+
+typedef uint8_t mach_msg_type_name_t;
+
+#define MACH_MSG_TYPE_MOVE_RECEIVE	16	/* Must hold receive rights */
+#define MACH_MSG_TYPE_MOVE_SEND		17	/* Must hold send rights */
+#define MACH_MSG_TYPE_MOVE_SEND_ONCE	18	/* Must hold sendonce rights */
+#define MACH_MSG_TYPE_COPY_SEND		19	/* Must hold send rights */
+#define MACH_MSG_TYPE_MAKE_SEND		20	/* Must hold receive rights */
+#define MACH_MSG_TYPE_MAKE_SEND_ONCE	21	/* Must hold receive rights */
+
+#define MACH_MSG_TYPE_DISPOSE_RECEIVE	24	/* must hold receive right */
+#define MACH_MSG_TYPE_DISPOSE_SEND	25	/* must hold send right(s) */
+#define MACH_MSG_TYPE_DISPOSE_SEND_ONCE 26	/* must hold sendonce right */
+
+typedef unsigned int mach_msg_copy_options_t;
+
+#define MACH_MSG_PHYSICAL_COPY		0
+#define MACH_MSG_VIRTUAL_COPY   	1
+#define MACH_MSG_ALLOCATE		2
+#define MACH_MSG_OVERWRITE		3
+#ifdef  _KERNEL
+#define MACH_MSG_KALLOC_COPY_T		4
+#define MACH_MSG_PAGE_LIST_COPY_T	5
+#endif  /* MACH_KERNEL */
+
+
+typedef unsigned int mach_msg_descriptor_type_t;
+
+#define MACH_MSG_PORT_DESCRIPTOR 		0
+#define MACH_MSG_OOL_DESCRIPTOR  		1
+#define MACH_MSG_OOL_PORTS_DESCRIPTOR 		2
+#define MACH_MSG_OOL_VOLATILE_DESCRIPTOR  	3
+
+
+#pragma pack(4)
+
+typedef struct
+{
+  natural_t         pad1;
+  mach_msg_size_t		pad2;
+  unsigned int			pad3 : 24;
+  mach_msg_descriptor_type_t	type : 8;
+} mach_msg_type_descriptor_t;
+
+typedef struct
+{
+	mach_port_t			name;
+#if !(defined(_KERNEL) && defined(__LP64__))
+	mach_msg_size_t		pad1;
+	unsigned int			pad2 : 16;
+#else
+	mach_msg_size_t		pad1 : 8;
+	unsigned int			pad2 : 8;
+#endif
+	mach_msg_type_name_t		disposition : 8;
+	mach_msg_descriptor_type_t	type : 8;
+#if defined(_KERNEL)
+  uint32_t      pad_end;
+#endif
+} mach_msg_port_descriptor_t;
+
+typedef struct
+{
+  uint32_t			address;
+  mach_msg_size_t       	size;
+  boolean_t     		deallocate: 8;
+  mach_msg_copy_options_t       copy: 8;
+  unsigned int     		pad1: 8;
+  mach_msg_descriptor_type_t    type: 8;
+} mach_msg_ool_descriptor32_t;
+
+typedef struct
+{
+  uint64_t			address;
+  boolean_t     		deallocate: 8;
+  mach_msg_copy_options_t       copy: 8;
+  unsigned int     		pad1: 8;
+  mach_msg_descriptor_type_t    type: 8;
+  mach_msg_size_t       	size;
+} mach_msg_ool_descriptor64_t;
+
+typedef struct
+{
+  void* address;
+#ifndef __LP64__
+  mach_msg_size_t       	size;
+#endif
+  boolean_t     		deallocate: 8;
+  mach_msg_copy_options_t       copy: 8;
+  unsigned int     		pad1: 8;
+  mach_msg_descriptor_type_t    type: 8;
+#ifdef __LP64__
+  mach_msg_size_t       	size;
+#endif
+#if defined(KERNEL) && !defined(__LP64__)
+  uint32_t          pad_end;
+#endif
+} mach_msg_ool_descriptor_t;
+
+typedef struct
+{
+  uint32_t			address;
+  mach_msg_size_t		count;
+  boolean_t     		deallocate: 8;
+  mach_msg_copy_options_t       copy: 8;
+  mach_msg_type_name_t		disposition : 8;
+  mach_msg_descriptor_type_t	type : 8;
+} mach_msg_ool_ports_descriptor32_t;
+
+typedef struct
+{
+  uint64_t			address;
+  boolean_t     		deallocate: 8;
+  mach_msg_copy_options_t       copy: 8;
+  mach_msg_type_name_t		disposition : 8;
+  mach_msg_descriptor_type_t	type : 8;
+  mach_msg_size_t		count;
+} mach_msg_ool_ports_descriptor64_t;
+
+typedef struct
+{
+  void*				address;
+  boolean_t     		deallocate: 8;
+  mach_msg_copy_options_t       copy: 8;
+  mach_msg_type_name_t		disposition : 8;
+  mach_msg_descriptor_type_t  type : 8;
+  mach_msg_size_t   count;
+} mach_msg_ool_ports_descriptor_t;
+
+typedef union
+{
+  mach_msg_port_descriptor_t		port;
+  mach_msg_ool_descriptor_t		out_of_line;
+  mach_msg_ool_ports_descriptor_t	ool_ports;
+  mach_msg_type_descriptor_t		type;
+} mach_msg_descriptor_t;
+
+typedef struct
+{
+        mach_msg_size_t msgh_descriptor_count;
+} mach_msg_body_t;
+
+#define MACH_MSG_BODY_NULL (mach_msg_body_t *) 0
+#define MACH_MSG_DESCRIPTOR_NULL (mach_msg_descriptor_t *) 0
+
+typedef	struct
+{
+  mach_msg_bits_t	msgh_bits;
+  mach_msg_size_t	msgh_size;
+  mach_port_t		msgh_remote_port;
+  mach_port_t		msgh_local_port;
+  mach_port_name_t 	msgh_voucher_port;
+  mach_msg_id_t		msgh_id;
+} mach_msg_header_t;
+
+#define	msgh_reserved		msgh_voucher_port
+#define MACH_MSG_NULL (mach_msg_header_t *) 0
+
+typedef struct
+{
+        mach_msg_header_t       header;
+        mach_msg_body_t         body;
+} mach_msg_base_t;
+
+typedef	unsigned int mach_msg_trailer_type_t;
+
+#define	MACH_MSG_TRAILER_FORMAT_0	0
+
+typedef	unsigned int mach_msg_trailer_size_t;
+
+typedef struct 
+{
+  mach_msg_trailer_type_t	msgh_trailer_type;
+  mach_msg_trailer_size_t	msgh_trailer_size;
+} mach_msg_trailer_t;
+
+typedef struct
+{
+  mach_msg_trailer_type_t       msgh_trailer_type;
+  mach_msg_trailer_size_t       msgh_trailer_size;
+  mach_port_seqno_t             msgh_seqno;
+} mach_msg_seqno_trailer_t;
+
+typedef struct
+{
+  unsigned int			val[2];
+} security_token_t;
+
+typedef struct 
+{
+  mach_msg_trailer_type_t	msgh_trailer_type;
+  mach_msg_trailer_size_t	msgh_trailer_size;
+  mach_port_seqno_t		msgh_seqno;
+  security_token_t		msgh_sender;
+} mach_msg_security_trailer_t;
+
+/*
+ * The audit token is an opaque token which identifies
+ * Mach tasks and senders of Mach messages as subjects
+ * to the BSM audit system.  Only the appropriate BSM
+ * library routines should be used to interpret the
+ * contents of the audit token as the representation
+ * of the subject identity within the token may change
+ * over time.
+ */
+typedef struct
+{
+  unsigned int                  val[8];
+} audit_token_t;
+
+typedef struct 
+{
+  mach_msg_trailer_type_t       msgh_trailer_type;
+  mach_msg_trailer_size_t       msgh_trailer_size;
+  mach_port_seqno_t             msgh_seqno;
+  security_token_t              msgh_sender;
+  audit_token_t                 msgh_audit;
+} mach_msg_audit_trailer_t;
+
+typedef struct 
+{
+  mach_msg_trailer_type_t       msgh_trailer_type;
+  mach_msg_trailer_size_t       msgh_trailer_size;
+  mach_port_seqno_t             msgh_seqno;
+  security_token_t              msgh_sender;
+  audit_token_t                 msgh_audit;
+  mach_port_context_t           msgh_context;
+} mach_msg_context_trailer_t;
+
+typedef struct
+{
+  mach_port_name_t sender;
+} msg_labels_t;
+
+/* 
+   Trailer type to pass MAC policy label info as a mach message trailer.
+*/
+
+typedef struct
+{
+  mach_msg_trailer_type_t       msgh_trailer_type;
+  mach_msg_trailer_size_t       msgh_trailer_size;
+  mach_port_seqno_t             msgh_seqno;
+  security_token_t              msgh_sender;
+  audit_token_t                 msgh_audit;
+  mach_port_context_t           msgh_context;
+  int                           msgh_ad;
+  msg_labels_t                  msgh_labels;
+} mach_msg_mac_trailer_t;
+
+
+#define MACH_MSG_TRAILER_MINIMUM_SIZE  sizeof(mach_msg_trailer_t)
+
+/*
+ * These values can change from release to release - but clearly
+ * code cannot request additional trailer elements one was not
+ * compiled to understand.  Therefore, it is safe to use this
+ * constant when the same module specified the receive options.
+ * Otherwise, you run the risk that the options requested by
+ * another module may exceed the local modules notion of
+ * MAX_TRAILER_SIZE.
+ */
+
+typedef mach_msg_mac_trailer_t mach_msg_max_trailer_t;
+#define MAX_TRAILER_SIZE ((mach_msg_size_t)sizeof(mach_msg_max_trailer_t))
+
+typedef mach_msg_security_trailer_t mach_msg_format_0_trailer_t;
+
+#define MACH_MSG_TRAILER_FORMAT_0_SIZE sizeof(mach_msg_format_0_trailer_t)
+#define MACH_MSG_TRAILER_MINIMUM_SIZE  sizeof(mach_msg_trailer_t)
+#define   KERNEL_SECURITY_TOKEN_VALUE  { {0, 1} }
+extern security_token_t KERNEL_SECURITY_TOKEN;
+
+#define   KERNEL_AUDIT_TOKEN_VALUE  { {0, 0, 0, 0, 0, 0, 0, 0} }
+extern audit_token_t KERNEL_AUDIT_TOKEN;
+
+typedef	integer_t mach_msg_options_t;
+
+typedef struct
+{
+  mach_msg_header_t	header;
+} mach_msg_empty_send_t;
+
+typedef struct
+{
+  mach_msg_header_t	header;
+  mach_msg_trailer_t	trailer;
+} mach_msg_empty_rcv_t;
+
+typedef union
+{
+  mach_msg_empty_send_t	send;
+  mach_msg_empty_rcv_t	rcv;
+} mach_msg_empty_t;
+
+#pragma pack()
+
+/* utility to round the message size - will become machine dependent */
+#define round_msg(x)	(((mach_msg_size_t)(x) + sizeof (natural_t) - 1) & \
+				~(sizeof (natural_t) - 1))
+
+/*
+ *  There is no fixed upper bound to the size of Mach messages.
+ */
+
+#define	MACH_MSG_SIZE_MAX	((mach_msg_size_t) ~0)
+
+/*
+ *  Compatibility definitions, for code written
+ *  when there was a msgh_kind instead of msgh_seqno.
+ */
+
+#define MACH_MSGH_KIND_NORMAL		0x00000000
+#if	0
+/* code using this is likely to break, so better not to have it defined */
+#define MACH_MSGH_KIND_NOTIFICATION	0x00000001
+#endif
+#define	msgh_kind			msgh_seqno
+#define mach_msg_kind_t			mach_port_seqno_t
+
+/*
+ *  The msgt_number field specifies the number of data elements.
+ *  The msgt_size field specifies the size of each data element, in bits.
+ *  The msgt_name field specifies the type of each data element.
+ *  If msgt_inline is TRUE, the data follows the type descriptor
+ *  in the body of the message.  If msgt_inline is FALSE, then a pointer
+ *  to the data should follow the type descriptor, and the data is
+ *  sent out-of-line.  In this case, if msgt_deallocate is TRUE,
+ *  then the out-of-line data is moved (instead of copied) into the message.
+ *  If msgt_longform is TRUE, then the type descriptor is actually
+ *  a mach_msg_type_long_t.
+ *
+ *  The actual amount of inline data following the descriptor must
+ *  a multiple of the word size.  For out-of-line data, this is a
+ *  pointer.  For inline data, the supplied data size (calculated
+ *  from msgt_number/msgt_size) is rounded up.  This guarantees
+ *  that type descriptors always fall on word boundaries.
+ *
+ *  For port rights, msgt_size must be 8*sizeof(mach_port_t).
+ *  If the data is inline, msgt_deallocate should be FALSE.
+ *  The msgt_unused bit should be zero.
+ *  The msgt_name, msgt_size, msgt_number fields in
+ *  a mach_msg_type_long_t should be zero.
+ */
+
+typedef natural_t mach_msg_type_size_t;
+typedef natural_t mach_msg_type_number_t;
+
+/*
+ *  Values received/carried in messages.  Tells the receiver what
+ *  sort of port right he now has.
+ *
+ *  MACH_MSG_TYPE_PORT_NAME is used to transfer a port name
+ *  which should remain uninterpreted by the kernel.  (Port rights
+ *  are not transferred, just the port name.)
+ */
+
+#define MACH_MSG_TYPE_PORT_NONE		0
+
+#define MACH_MSG_TYPE_PORT_NAME		15
+#define MACH_MSG_TYPE_PORT_RECEIVE	MACH_MSG_TYPE_MOVE_RECEIVE
+#define MACH_MSG_TYPE_PORT_SEND		MACH_MSG_TYPE_MOVE_SEND
+#define MACH_MSG_TYPE_PORT_SEND_ONCE	MACH_MSG_TYPE_MOVE_SEND_ONCE
+
+#define MACH_MSG_TYPE_LAST		22		/* Last assigned */
+
+/*
+ *  A dummy value.  Mostly used to indicate that the actual value
+ *  will be filled in later, dynamically.
+ */
+
+#define MACH_MSG_TYPE_POLYMORPHIC	((mach_msg_type_name_t) -1)
+
+/*
+ *	Is a given item a port type?
+ */
+
+#define MACH_MSG_TYPE_PORT_ANY(x)			\
+	(((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) &&		\
+	 ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
+
+#define	MACH_MSG_TYPE_PORT_ANY_SEND(x)			\
+	(((x) >= MACH_MSG_TYPE_MOVE_SEND) &&		\
+	 ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
+
+#define	MACH_MSG_TYPE_PORT_ANY_RIGHT(x)			\
+	(((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) &&		\
+	 ((x) <= MACH_MSG_TYPE_MOVE_SEND_ONCE))
+
+typedef integer_t mach_msg_option_t;
+
+#define MACH_MSG_OPTION_NONE	0x00000000
+
+#define	MACH_SEND_MSG		0x00000001
+#define	MACH_RCV_MSG		0x00000002
+#define MACH_RCV_LARGE          0x00000004      /* report large message sizes */
+#define MACH_RCV_LARGE_IDENTITY 0x00000008      /* identify source of large messages */
+
+
+#define MACH_SEND_TIMEOUT	0x00000010
+#define MACH_SEND_INTERRUPT	0x00000040	/* libmach implements */
+#define MACH_SEND_NOTIFY	0x00000080
+#define MACH_SEND_ALWAYS	0x00010000	/* internal use only */
+#define MACH_SEND_TRAILER	0x00020000
+
+
+
+#define MACH_RCV_TIMEOUT	0x00000100
+#define MACH_RCV_NOTIFY		0x00000200
+#define MACH_RCV_INTERRUPT	0x00000400	/* libmach implements */
+#define MACH_RCV_VOUCHER	0x00000800	/* willing to receive voucher port */
+#define MACH_RCV_OVERWRITE	0x00001000
+
+/* 
+ * NOTE: a 0x00------ RCV mask implies to ask for
+ * a MACH_MSG_TRAILER_FORMAT_0 with 0 Elements, 
+ * which is equivalent to a mach_msg_trailer_t.
+ */
+#define MACH_RCV_TRAILER_NULL   0
+#define MACH_RCV_TRAILER_SEQNO  1
+#define MACH_RCV_TRAILER_SENDER 2
+#define MACH_RCV_TRAILER_AUDIT  3
+#define MACH_RCV_TRAILER_CTX    4
+#define MACH_RCV_TRAILER_AV     7
+#define MACH_RCV_TRAILER_LABELS 8
+
+
+#define MACH_RCV_TRAILER_TYPE(x)     (((x) & 0xf) << 28) 
+#define MACH_RCV_TRAILER_ELEMENTS(x) (((x) & 0xf) << 24)  
+#define MACH_RCV_TRAILER_MASK 	     ((0xff << 24))
+
+
+#define GET_RCV_ELEMENTS(y) (((y) >> 24) & 0xf)
+
+#ifdef _KERNEL
+/* The options that the kernel honors when passed from user space */
+#define MACH_SEND_USER		 (MACH_SEND_MSG | \
+				  MACH_SEND_TIMEOUT | MACH_SEND_NOTIFY | \
+				  MACH_SEND_TRAILER)
+
+#define MACH_RCV_USER		 (MACH_RCV_MSG | \
+				  MACH_RCV_TIMEOUT | MACH_RCV_OVERWRITE | \
+				  MACH_RCV_LARGE | MACH_RCV_LARGE_IDENTITY | \
+				  MACH_RCV_TRAILER_MASK)
+
+#define MACH_MSG_OPTION_USER	 (MACH_SEND_USER | MACH_RCV_USER)
+#endif
+
+/* 
+ * XXXMAC: note that in the case of MACH_RCV_TRAILER_LABELS, 
+ * we just fall through to mach_msg_max_trailer_t.
+ * This is correct behavior since mach_msg_max_trailer_t is defined as
+ * mac_msg_mac_trailer_t which is used for the LABELS trailer.
+ * It also makes things work properly if MACH_RCV_TRAILER_LABELS is ORed 
+ * with one of the other options.
+ */
+
+#define REQUESTED_TRAILER_SIZE_NATIVE(y)                        \
+        ((mach_msg_trailer_size_t)                              \
+         ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_NULL) ?      \
+          sizeof(mach_msg_trailer_t) :                          \
+          ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SEQNO) ?    \
+           sizeof(mach_msg_seqno_trailer_t) :                   \
+          ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SENDER) ?   \
+           sizeof(mach_msg_security_trailer_t) :                \
+           ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_AUDIT) ?   \
+            sizeof(mach_msg_audit_trailer_t) :                  \
+            ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_CTX) ?    \
+             sizeof(mach_msg_context_trailer_t) :               \
+             ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_AV) ?    \
+              sizeof(mach_msg_mac_trailer_t) :                  \
+             sizeof(mach_msg_max_trailer_t))))))))
+
+#define REQUESTED_TRAILER_SIZE(y) REQUESTED_TRAILER_SIZE_NATIVE(y)
+
+/*
+ *  Much code assumes that mach_msg_return_t == kern_return_t.
+ *  This definition is useful for descriptive purposes.
+ *
+ *  See <mach/error.h> for the format of error codes.
+ *  IPC errors are system 4.  Send errors are subsystem 0;
+ *  receive errors are subsystem 1.  The code field is always non-zero.
+ *  The high bits of the code field communicate extra information
+ *  for some error codes.  MACH_MSG_MASK masks off these special bits.
+ */
+
+typedef kern_return_t mach_msg_return_t;
+
+#define MACH_MSG_SUCCESS		0x00000000
+
+
+#define	MACH_MSG_MASK			0x00003e00
+		/* All special error code bits defined below. */
+#define	MACH_MSG_IPC_SPACE		0x00002000
+		/* No room in IPC name space for another capability name. */
+#define	MACH_MSG_VM_SPACE		0x00001000
+		/* No room in VM address space for out-of-line memory. */
+#define	MACH_MSG_IPC_KERNEL		0x00000800
+		/* Kernel resource shortage handling an IPC capability. */
+#define	MACH_MSG_VM_KERNEL		0x00000400
+		/* Kernel resource shortage handling out-of-line memory. */
+#define MACH_MSG_INVALID_RT_DESCRIPTOR	0x00000200
+		/* Descriptor has an option incompatible with RT
+		   behavior */
+
+#define MACH_SEND_IN_PROGRESS		0x10000001
+		/* Thread is waiting to send.  (Internal use only.) */
+#define MACH_SEND_INVALID_DATA		0x10000002
+		/* Bogus in-line data. */
+#define MACH_SEND_INVALID_DEST		0x10000003
+		/* Bogus destination port. */
+#define MACH_SEND_TIMED_OUT		0x10000004
+		/* Message not sent before timeout expired. */
+#define MACH_SEND_INVALID_VOUCHER	0x10000005
+		/* Bogus voucher port. */
+#define MACH_SEND_INTERRUPTED		0x10000007
+		/* Software interrupt. */
+#define MACH_SEND_MSG_TOO_SMALL		0x10000008
+		/* Data doesn't contain a complete message. */
+#define MACH_SEND_INVALID_REPLY		0x10000009
+		/* Bogus reply port. */
+#define MACH_SEND_INVALID_RIGHT		0x1000000a
+		/* Bogus port rights in the message body. */
+#define MACH_SEND_INVALID_NOTIFY	0x1000000b
+		/* Bogus notify port argument. */
+#define MACH_SEND_INVALID_MEMORY	0x1000000c
+		/* Invalid out-of-line memory pointer. */
+#define MACH_SEND_NO_BUFFER		0x1000000d
+		/* No message buffer is available. */
+#define MACH_SEND_TOO_LARGE		0x1000000e
+		/* Send is too large for port */
+#define MACH_SEND_INVALID_TYPE		0x1000000f
+		/* Invalid msg-type specification. */
+#define MACH_SEND_INVALID_HEADER	0x10000010
+		/* A field in the header had a bad value. */
+#define MACH_SEND_INVALID_TRAILER	0x10000011
+		/* The trailer to be sent does not match kernel format. */
+
+#define MACH_SEND_INVALID_RT_OOL_SIZE	0x10000015
+		/* The OOL buffer size is too large for RT behavior */
+
+#define MACH_RCV_IN_PROGRESS		0x10004001
+		/* Thread is waiting for receive.  (Internal use only.) */
+#define MACH_RCV_INVALID_NAME		0x10004002
+		/* Bogus name for receive port/port-set. */
+#define MACH_RCV_TIMED_OUT		0x10004003
+		/* Didn't get a message within the timeout value. */
+#define MACH_RCV_TOO_LARGE		0x10004004
+		/* Message buffer is not large enough for inline data. */
+#define MACH_RCV_INTERRUPTED		0x10004005
+		/* Software interrupt. */
+#define MACH_RCV_PORT_CHANGED		0x10004006
+		/* Port moved into a set during the receive. */
+#define MACH_RCV_INVALID_NOTIFY		0x10004007
+		/* Bogus notify port argument. */
+#define MACH_RCV_INVALID_DATA		0x10004008
+		/* Bogus message buffer for inline data. */
+#define MACH_RCV_PORT_DIED		0x10004009
+		/* Port/set was sent away/died during receive. */
+#define	MACH_RCV_IN_SET			0x1000400a
+		/* Port is a member of a port set. */
+#define	MACH_RCV_HEADER_ERROR		0x1000400b
+		/* Error receiving message header.  See special bits. */
+#define	MACH_RCV_BODY_ERROR		0x1000400c
+		/* Error receiving message body.  See special bits. */
+#define	MACH_RCV_INVALID_TYPE		0x1000400d
+		/* Invalid msg-type specification in scatter list. */
+#define	MACH_RCV_SCATTER_SMALL		0x1000400e
+		/* Out-of-line overwrite region is not large enough */
+#define MACH_RCV_INVALID_TRAILER	0x1000400f
+		/* trailer type or number of trailer elements not supported */
+#define MACH_RCV_IN_PROGRESS_TIMED      0x10004011
+                /* Waiting for receive with timeout. (Internal use only.) */
+
+extern mach_msg_return_t	mach_msg_overwrite_trap(
+					mach_msg_header_t *msg,
+					mach_msg_option_t option,
+					mach_msg_size_t send_size,
+					mach_msg_size_t rcv_size,
+					mach_port_name_t rcv_name,
+					mach_msg_timeout_t timeout,
+					mach_port_name_t notify,
+					mach_msg_header_t *rcv_msg,
+					mach_msg_size_t rcv_limit);
+
+extern mach_msg_return_t	mach_msg_overwrite(
+					mach_msg_header_t *msg,
+					mach_msg_option_t option,
+					mach_msg_size_t send_size,
+					mach_msg_size_t rcv_size,
+					mach_port_name_t rcv_name,
+					mach_msg_timeout_t timeout,
+					mach_port_name_t notify,
+					mach_msg_header_t *rcv_msg,
+					mach_msg_size_t rcv_limit);
+
+extern mach_msg_return_t	mach_msg_trap(
+					mach_msg_header_t *msg,
+					mach_msg_option_t option,
+					mach_msg_size_t send_size,
+					mach_msg_size_t rcv_size,
+					mach_port_name_t rcv_name,
+					mach_msg_timeout_t timeout,
+					mach_port_name_t notify);
+
+extern mach_msg_return_t	mach_msg(
+					mach_msg_header_t *msg,
+					mach_msg_option_t option,
+					mach_msg_size_t send_size,
+					mach_msg_size_t rcv_size,
+					mach_port_name_t rcv_name,
+					mach_msg_timeout_t timeout,
+					mach_port_name_t notify);
+
+
+#if defined(_KERNEL) && defined(MACH_INTERNAL)
+struct thread_shuttle;
+
+extern mach_msg_return_t	mach_msg_receive_results(
+					struct thread_shuttle *thread);
+#endif
+
+#endif	/* _MACH_MESSAGE_H_ */


Property changes on: trunk/sys/sys/mach/message.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/mig.h
===================================================================
--- trunk/sys/sys/mach/mig.h	                        (rev 0)
+++ trunk/sys/sys/mach/mig.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1 @@
+#include <sys/mach/rpc.h>


Property changes on: trunk/sys/sys/mach/mig.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/mig_errors.h
===================================================================
--- trunk/sys/sys/mach/mig_errors.h	                        (rev 0)
+++ trunk/sys/sys/mach/mig_errors.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,176 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.5.3.1  92/03/03  16:22:20  jeffreyh
+ * 	Changes from TRUNK
+ * 	[92/02/26  12:10:53  jeffreyh]
+ * 
+ * Revision 2.7  92/01/15  13:44:38  rpd
+ * 	Changed MACH_IPC_COMPAT conditionals to default to not present.
+ * 
+ * Revision 2.6  92/01/03  20:21:52  dbg
+ * 	Add mig_routine_t.
+ * 	[91/11/11            dbg]
+ * 
+ * Revision 2.5  91/08/28  11:15:31  jsb
+ * 	Added MIG_SERVER_DIED.
+ * 	[91/08/21            rpd]
+ * 
+ * Revision 2.4  91/05/14  16:56:33  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:34:20  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:19:44  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:59:14  rpd
+ * 	Converted to new IPC.
+ * 	[90/03/26  22:37:01  rpd]
+ * 
+ * Revision 2.1  89/08/03  16:03:33  rwd
+ * Created.
+ * 
+ * Revision 2.4  89/02/25  18:38:41  gm0w
+ * 	Changes for cleanup.
+ * 
+ * Revision 2.3  89/02/07  01:01:21  mwyoung
+ * Relocated from sys/mig_errors.h
+ * 
+ * Revision 2.2  88/07/20  21:05:51  rpd
+ * Added definition of mig_symtab_t.
+ * 
+ *  2-Dec-87  David Golub (dbg) at Carnegie-Mellon University
+ *	Added MIG_ARRAY_TOO_LARGE.
+ *
+ * 25-May-87  Richard Draves (rpd) at Carnegie-Mellon University
+ *	Added definition of death_pill_t.
+ *
+ * 31-Jul-86  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ * Mach Interface Generator errors
+ *
+ */
+
+#ifndef	_MACH_MIG_ERRORS_H_
+#define _MACH_MIG_ERRORS_H_
+
+#include <sys/mach/kern_return.h>
+#include <sys/mach/message.h>
+#include <sys/mach/rpc.h>
+#include <sys/mach/vm_types.h>
+
+/*
+ *	These error codes should be specified as system 4, subsytem 2.
+ *	But alas backwards compatibility makes that impossible.
+ *	The problem is old clients of new servers (eg, the kernel)
+ *	which get strange large error codes when there is a Mig problem
+ *	in the server.  Unfortunately, the IPC system doesn't have
+ *	the knowledge to convert the codes in this situation.
+ */
+
+#define MIG_TYPE_ERROR		-300	/* client type check failure */
+#define MIG_REPLY_MISMATCH	-301	/* wrong reply message ID */
+#define MIG_REMOTE_ERROR	-302	/* server detected error */
+#define MIG_BAD_ID		-303	/* bad request message ID */
+#define MIG_BAD_ARGUMENTS	-304	/* server type check failure */
+#define MIG_NO_REPLY		-305	/* no reply should be send */
+#define MIG_EXCEPTION		-306	/* server raised exception */
+#define MIG_ARRAY_TOO_LARGE	-307	/* array not large enough */
+#define MIG_SERVER_DIED		-308	/* server died */
+#define MIG_TRAILER_ERROR       -309    /* trailer has an unknown format */
+
+#include <sys/mach/ndr.h>
+
+#pragma pack(4)
+typedef struct {
+	mach_msg_header_t	Head;
+	NDR_record_t		NDR;
+	kern_return_t		RetCode;
+} mig_reply_error_t;
+#pragma pack()
+
+typedef struct mig_symtab {
+	char	*ms_routine_name;
+	int	ms_routine_number;
+	void    (*ms_routine)(void);	/* Since the functions in the
+					 * symbol table have unknown
+					 * signatures, this is the best
+					 * we can do...
+					 */
+} mig_symtab_t;
+
+/* Client side reply port allocate */
+extern mach_port_t mig_get_reply_port(void);
+
+/* Client side reply port deallocate */
+extern void mig_dealloc_reply_port(mach_port_t reply_port);
+
+/* Client side reply port "deallocation" */
+extern void mig_put_reply_port(mach_port_t reply_port);
+
+/* Allocate memory for out-of-stack mig structures */
+extern char *mig_user_allocate(vm_size_t size);
+
+/* Deallocate memory used for out-of-stack mig structures */
+extern void mig_user_deallocate(char *data, vm_size_t size);
+
+/* Bounded string copy */
+extern int mig_strncpy(
+	char	*dest,
+	char	*src,
+	int	len);
+
+#endif	/* _MACH_MIG_ERRORS_H_ */


Property changes on: trunk/sys/sys/mach/mig_errors.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ndr.h
===================================================================
--- trunk/sys/sys/mach/ndr.h	                        (rev 0)
+++ trunk/sys/sys/mach/ndr.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+
+#ifndef _NDR_H_
+#define _NDR_H_
+
+typedef struct {
+    unsigned char       mig_vers;
+    unsigned char       if_vers;
+    unsigned char       reserved1;
+    unsigned char       mig_encoding;
+    unsigned char       int_rep;
+    unsigned char       char_rep;
+    unsigned char       float_rep;
+    unsigned char       reserved2;
+} NDR_record_t;
+
+/*
+ * MIG supported protocols for Network Data Representation
+ */
+#define  NDR_PROTOCOL_2_0      0
+
+/*
+ * NDR 2.0 format flag type definition and values.
+ */
+#define  NDR_INT_BIG_ENDIAN    0
+#define  NDR_INT_LITTLE_ENDIAN 1
+#define  NDR_FLOAT_IEEE        0
+#define  NDR_FLOAT_VAX         1
+#define  NDR_FLOAT_CRAY        2
+#define  NDR_FLOAT_IBM         3
+#define  NDR_CHAR_ASCII        0
+#define  NDR_CHAR_EBCDIC       1
+
+
+extern NDR_record_t NDR_record;
+
+
+#endif /* _NDR_H_ */


Property changes on: trunk/sys/sys/mach/ndr.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/ndr_def.h
===================================================================
--- trunk/sys/sys/mach/ndr_def.h	                        (rev 0)
+++ trunk/sys/sys/mach/ndr_def.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,21 @@
+#include <sys/mach/ndr.h>
+
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+#define NDR_INT_ENDIAN NDR_INT_LITTLE_ENDIAN
+#elif _BYTE_ORDER == _BIG_ENDIAN
+#define NDR_INT_ENDIAN NDR_INT_BIG_ENDIAN
+#else
+#error "bad endian value"
+#endif
+
+
+NDR_record_t NDR_record = {
+        0,                      /* mig_reserved */
+        0,                      /* mig_reserved */
+        0,                      /* mig_reserved */
+        NDR_PROTOCOL_2_0,               
+        NDR_INT_ENDIAN,
+        NDR_CHAR_ASCII,
+        NDR_FLOAT_IEEE,
+        0,
+};


Property changes on: trunk/sys/sys/mach/ndr_def.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/notify.h
===================================================================
--- trunk/sys/sys/mach/notify.h	                        (rev 0)
+++ trunk/sys/sys/mach/notify.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,149 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4.2.1  92/03/03  16:22:23  jeffreyh
+ * 	Changes form TRUNK
+ * 	[92/02/26  12:12:10  jeffreyh]
+ * 
+ * Revision 2.5  92/01/15  13:44:41  rpd
+ * 	Changed MACH_IPC_COMPAT conditionals to default to not present.
+ * 
+ * Revision 2.4  91/05/14  16:58:21  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:35:18  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:20:02  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:59:32  rpd
+ * 	Converted to new IPC.
+ * 	[90/03/26  22:38:14  rpd]
+ * 
+ * Revision 2.7.7.1  90/02/20  22:24:32  rpd
+ * 	Revised for new IPC.
+ * 	[90/02/19  23:38:57  rpd]
+ * 
+ *
+ * Condensed history:
+ *	Moved ownership rights under MACH_IPC_XXXHACK (rpd).
+ * 	Added NOTIFY_PORT_DESTROYED (rpd).
+ *	Added notification message structure definition (mwyoung).
+ *	Created, based on Accent values (mwyoung).
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/notify.h
+ *
+ *	Kernel notification message definitions.
+ */
+
+#ifndef	_MACH_NOTIFY_H_
+#define _MACH_NOTIFY_H_
+
+#include <sys/types.h>
+#include <vm/vm.h> /* boolean_t */
+#include <sys/mach/port.h>
+#include <sys/mach/message.h>
+#include <sys/mach/ndr.h>
+
+/*
+ *  An alternative specification of the notification interface
+ *  may be found in mach/notify.defs.
+ */
+
+#define MACH_NOTIFY_FIRST		0100
+#define MACH_NOTIFY_PORT_DELETED	(MACH_NOTIFY_FIRST + 001 )
+			/* A send or send-once right was deleted. */
+#define MACH_NOTIFY_PORT_DESTROYED	(MACH_NOTIFY_FIRST + 005)
+			/* A receive right was (would have been) deallocated */
+#define MACH_NOTIFY_NO_SENDERS		(MACH_NOTIFY_FIRST + 006)
+			/* Receive right has no extant send rights */
+#define MACH_NOTIFY_SEND_ONCE		(MACH_NOTIFY_FIRST + 007)
+			/* An extant send-once right died */
+#define MACH_NOTIFY_DEAD_NAME		(MACH_NOTIFY_FIRST + 010)
+			/* Send or send-once right died, leaving a dead-name */
+#define MACH_NOTIFY_LAST		(MACH_NOTIFY_FIRST + 015)
+
+typedef struct {
+    mach_msg_header_t	not_header;
+    NDR_record_t	NDR;
+    mach_port_name_t not_port;/* MACH_MSG_TYPE_PORT_NAME */
+    mach_msg_format_0_trailer_t trailer;
+} mach_port_deleted_notification_t;
+
+typedef struct {
+    mach_msg_header_t	not_header;
+    mach_msg_body_t	not_body;
+    mach_msg_port_descriptor_t not_port;/* MACH_MSG_TYPE_PORT_RECEIVE */
+    mach_msg_format_0_trailer_t trailer;
+} mach_port_destroyed_notification_t;
+
+typedef struct {
+    mach_msg_header_t	not_header;
+    NDR_record_t	NDR;
+    mach_msg_type_number_t not_count;
+    mach_msg_format_0_trailer_t trailer;
+} mach_no_senders_notification_t;
+
+typedef struct {
+    mach_msg_header_t	not_header;
+    mach_msg_format_0_trailer_t trailer;
+} mach_send_once_notification_t;
+
+typedef struct {
+    mach_msg_header_t	not_header;
+    NDR_record_t	NDR;
+    mach_port_name_t not_port;/* MACH_MSG_TYPE_PORT_NAME */
+    mach_msg_format_0_trailer_t trailer;
+} mach_dead_name_notification_t;
+
+#endif	/* _MACH_NOTIFY_H_ */


Property changes on: trunk/sys/sys/mach/notify.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/policy.h
===================================================================
--- trunk/sys/sys/mach/policy.h	                        (rev 0)
+++ trunk/sys/sys/mach/policy.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,249 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/14  16:58:29  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:35:22  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:20:11  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:59:37  rpd
+ * 	Created for new host/processor technology.
+ * 	[90/03/26  23:51:22  rpd]
+ * 
+ * 	Cleanup changes.
+ * 	[89/08/02            dlb]
+ * 	Created.
+ * 	[89/07/25  18:47:00  dlb]
+ * 
+ * Revision 2.3  89/10/15  02:05:50  rpd
+ * 	Minor cleanups.
+ * 
+ * Revision 2.2  89/10/11  14:40:53  dlb
+ * 	Cleanup changes.
+ * 	[89/08/02            dlb]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+#ifndef	_MACH_POLICY_H_
+#define _MACH_POLICY_H_
+
+/*
+ *	mach/policy.h
+ *
+ *	Definitions for scheduing policy.
+ */
+
+#include <sys/mach/vm_types.h>
+
+/*
+ *	Policy definitions.  Policies should be powers of 2,
+ *	but cannot be or'd together other than to test for a
+ *	policy 'class'.
+ */
+#define	POLICY_TIMESHARE	1	/* timesharing		*/
+#define	POLICY_RR		2	/* fixed round robin	*/
+#define POLICY_FIFO		4	/* fixed fifo		*/
+
+/*
+ *	Check if policy is of 'class' fixed-priority.
+ */
+#define	POLICYCLASS_FIXEDPRI	(POLICY_RR | POLICY_FIFO)
+
+/*
+ *	Check if policy is valid.
+ */
+#define invalid_policy(policy)			\
+	((policy) != POLICY_TIMESHARE &&	\
+	 (policy) != POLICY_RR &&		\
+	 (policy) != POLICY_FIFO)
+
+
+/*
+ *	New scheduling control interface
+ */
+typedef int 				policy_t;
+typedef integer_t			*policy_info_t;
+typedef integer_t			*policy_base_t;
+typedef integer_t			*policy_limit_t;
+
+
+/*
+ * 	Types for TIMESHARE policy
+ */
+struct policy_timeshare_base {			
+	integer_t		base_priority;
+};
+struct policy_timeshare_limit {
+	integer_t		max_priority;
+};
+struct policy_timeshare_info {
+	integer_t		max_priority;
+	integer_t		base_priority;
+	integer_t		cur_priority;
+	boolean_t		depressed;
+	integer_t		depress_priority;
+};
+
+typedef struct policy_timeshare_base	*policy_timeshare_base_t; 
+typedef struct policy_timeshare_limit	*policy_timeshare_limit_t;
+typedef struct policy_timeshare_info	*policy_timeshare_info_t;
+
+typedef struct policy_timeshare_base	policy_timeshare_base_data_t; 
+typedef struct policy_timeshare_limit	policy_timeshare_limit_data_t;
+typedef struct policy_timeshare_info	policy_timeshare_info_data_t;
+
+
+#define POLICY_TIMESHARE_BASE_COUNT		\
+	(sizeof(struct policy_timeshare_base)/sizeof(integer_t))
+#define POLICY_TIMESHARE_LIMIT_COUNT		\
+	(sizeof(struct policy_timeshare_limit)/sizeof(integer_t))
+#define POLICY_TIMESHARE_INFO_COUNT		\
+	(sizeof(struct policy_timeshare_info)/sizeof(integer_t))
+
+
+/*
+ *	Types for the ROUND ROBIN (RR) policy
+ */
+struct policy_rr_base {				
+	integer_t		base_priority;
+	integer_t		quantum;
+};
+struct policy_rr_limit {
+	integer_t		max_priority;
+};
+struct policy_rr_info {
+	integer_t		max_priority;
+	integer_t		base_priority;
+	integer_t		quantum;
+	boolean_t		depressed;
+	integer_t		depress_priority;
+};
+
+typedef struct policy_rr_base		*policy_rr_base_t;
+typedef struct policy_rr_limit		*policy_rr_limit_t;
+typedef struct policy_rr_info		*policy_rr_info_t;
+
+typedef struct policy_rr_base		policy_rr_base_data_t;
+typedef struct policy_rr_limit		policy_rr_limit_data_t;
+typedef struct policy_rr_info		policy_rr_info_data_t;
+
+#define POLICY_RR_BASE_COUNT		\
+	(sizeof(struct policy_rr_base)/sizeof(integer_t))
+#define POLICY_RR_LIMIT_COUNT		\
+	(sizeof(struct policy_rr_limit)/sizeof(integer_t))
+#define POLICY_RR_INFO_COUNT		\
+	(sizeof(struct policy_rr_info)/sizeof(integer_t))
+
+
+/*
+ * 	Types for the FIRST-IN-FIRST-OUT (FIFO) policy
+ */
+struct policy_fifo_base {		
+	integer_t		base_priority;
+};
+struct policy_fifo_limit {
+	integer_t		max_priority;
+};
+struct policy_fifo_info {
+	integer_t		max_priority;
+	integer_t		base_priority;
+	boolean_t		depressed;
+	integer_t		depress_priority;
+};
+
+typedef struct policy_fifo_base		*policy_fifo_base_t;
+typedef struct policy_fifo_limit	*policy_fifo_limit_t;
+typedef struct policy_fifo_info		*policy_fifo_info_t;
+
+typedef struct policy_fifo_base		policy_fifo_base_data_t;
+typedef struct policy_fifo_limit	policy_fifo_limit_data_t;
+typedef struct policy_fifo_info		policy_fifo_info_data_t;
+
+#define POLICY_FIFO_BASE_COUNT		\
+	(sizeof(struct policy_fifo_base)/sizeof(integer_t))
+#define POLICY_FIFO_LIMIT_COUNT		\
+	(sizeof(struct policy_fifo_limit)/sizeof(integer_t))
+#define POLICY_FIFO_INFO_COUNT		\
+	(sizeof(struct policy_fifo_info)/sizeof(integer_t))
+
+
+/*
+ * 	Aggregate policy types
+ */
+
+struct policy_bases {
+	policy_timeshare_base_data_t	ts;
+	policy_rr_base_data_t		rr;
+	policy_fifo_base_data_t		fifo;
+};
+
+struct policy_limits {
+	policy_timeshare_limit_data_t	ts;
+	policy_rr_limit_data_t		rr;
+	policy_fifo_limit_data_t	fifo;
+};
+
+struct policy_infos {
+	policy_timeshare_info_data_t	ts;
+	policy_rr_info_data_t		rr;
+	policy_fifo_info_data_t		fifo;
+};
+
+typedef struct policy_bases		policy_base_data_t;
+typedef struct policy_limits		policy_limit_data_t;
+typedef struct policy_infos		policy_info_data_t;
+
+
+#endif /* _MACH_POLICY_H_ */


Property changes on: trunk/sys/sys/mach/policy.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/port.h
===================================================================
--- trunk/sys/sys/mach/port.h	                        (rev 0)
+++ trunk/sys/sys/mach/port.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,451 @@
+/*
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ * NOTICE: This file was modified by McAfee Research in 2004 to introduce
+ * support for mandatory and extensible security protections.  This notice
+ * is included in support of clause 2.2 (b) of the Apple Public License,
+ * Version 2.0.
+ */
+/*
+ */
+/*
+ *	File:	mach/port.h
+ *
+ *	Definition of a Mach port
+ *
+ *	Mach ports are the endpoints to Mach-implemented communications
+ *	channels (usually uni-directional message queues, but other types
+ *	also exist).
+ *
+ *	Unique collections of these endpoints are maintained for each
+ *	Mach task.  Each Mach port in the task's collection is given a 
+ *	[task-local] name to identify it - and the the various "rights"
+ *	held by the task for that specific endpoint.
+ *
+ *	This header defines the types used to identify these Mach ports
+ *	and the various rights associated with them.  For more info see:
+ *
+ *	<mach/mach_port.h> - manipulation of port rights in a given space
+ *	<mach/message.h> - message queue [and port right passing] mechanism
+ *
+ */
+
+#ifndef	_MACH_PORT_H_
+#define _MACH_PORT_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <vm/vm.h>
+#include <sys/mach/vm_types.h>
+
+
+/*
+ *	mach_port_name_t - the local identity for a Mach port
+ *
+ *	The name is Mach port namespace specific.  It is used to
+ *	identify the rights held for that port by the task whose
+ *	namespace is implied [or specifically provided].
+ *
+ *	Use of this type usually implies just a name - no rights.
+ *	See mach_port_t for a type that implies a "named right."
+ *
+ */
+
+#ifdef	_KERNEL
+
+/* 
+ *	mach_port_t - a named port right
+ *
+ *	In the kernel, "rights" are represented [named] by pointers to
+ *	the ipc port object in question. There is no port namespace for the
+ *	rights to be collected.
+ *
+ *	Actually, there is namespace for the kernel task.  But most kernel
+ *	code - including, but not limited to, Mach IPC code - lives in the
+ *	limbo between the current user-level task and the "next" task. Very
+ *	little of the kernel code runs in full kernel task context.  So very
+ *	little of it gets to use the kernel task's port name space.  
+ *
+ *	Because of this implementation approach, all in-kernel rights for
+ *	a given port coalesce [have the same name/pointer].  The actual
+ *	references are counted in the port itself.  It is up to the kernel
+ *	code in question to "just remember" how many [and what type of]
+ *	rights it holds and handle them appropriately.
+ *
+ */
+
+#ifndef	MACH_KERNEL_PRIVATE
+/*
+ *	For kernel code that resides outside of Mach proper, we opaque the
+ *	port structure definition.
+ */
+struct ipc_port ;
+
+#endif	/* MACH_KERNEL_PRIVATE */
+
+typedef struct ipc_port *ipc_port_t;
+typedef ipc_port_t		mach_port_t;
+
+
+#define IPC_PORT_NULL		((ipc_port_t) 0UL)
+#define IPC_PORT_DEAD		((ipc_port_t)~0UL)
+#define IPC_PORT_VALID(port) \
+	((port) != IPC_PORT_NULL && (port) != IPC_PORT_DEAD)
+
+/*
+ * Since the 32-bit and 64-bit representations of ~0 are different,
+ * explicitly handle MACH_PORT_DEAD
+ */
+
+#else	/* KERNEL */
+
+/* 
+ *	mach_port_t - a named port right
+ *
+ *	In user-space, "rights" are represented by the name of the
+ *	right in the Mach port namespace.  Even so, this type is
+ *	presented as a unique one to more clearly denote the presence
+ *	of a right coming along with the name. 
+ *
+ *	Often, various rights for a port held in a single name space
+ *	will coalesce and are, therefore, be identified by a single name
+ *	[this is the case for send and receive rights].  But not
+ *	always [send-once rights currently get a unique name for
+ *	each right].      
+ *
+ */
+#if 0
+#include <sys/_types.h>
+#include <sys/_types/_mach_port_t.h>
+#endif
+typedef natural_t mach_port_t;
+
+#endif	/* KERNEL */
+
+typedef natural_t mach_port_name_t;
+typedef mach_port_name_t *mach_port_name_array_t;
+
+typedef mach_port_t			*mach_port_array_t;
+
+/*
+ *  MACH_PORT_NULL is a legal value that can be carried in messages.
+ *  It indicates the absence of any port or port rights.  (A port
+ *  argument keeps the message from being "simple", even if the
+ *  value is MACH_PORT_NULL.)  The value MACH_PORT_DEAD is also a legal
+ *  value that can be carried in messages.  It indicates
+ *  that a port right was present, but it died.
+ */
+
+#define MACH_PORT_NULL		((mach_port_t)0)
+#define MACH_PORT_DEAD		((mach_port_t) ~0)
+#define MACH_PORT_VALID(name)				\
+		(((name) != MACH_PORT_NULL) && 		\
+		 ((name) != MACH_PORT_DEAD))
+
+#define MACH_PORT_NAME_NULL		0  /* intentional loose typing */
+#define MACH_PORT_NAME_DEAD		((mach_port_name_t) ~0)
+#define MACH_PORT_NAME_VALID(name)			\
+		(((name) != MACH_PORT_NAME_NULL) && 		\
+		 ((name) != MACH_PORT_NAME_DEAD))
+
+
+/*
+ *	For kernel-selected [assigned] port names, the name is
+ *	comprised of two parts: a generation number and an index.
+ *	This approach keeps the exact same name from being generated
+ *	and reused too quickly [to catch right/reference counting bugs].
+ *	The dividing line between the constituent parts is exposed so
+ *	that efficient "mach_port_name_t to data structure pointer"
+ *	conversion implementation can be made.  But it is possible
+ *	for user-level code to assign their own names to Mach ports.
+ *	These are not required to participate in this algorithm.  So
+ *	care should be taken before "assuming" this model.
+ *
+ */
+
+#if 0
+
+#define	MACH_PORT_INDEX(name)		((name) >> 8)
+#define	MACH_PORT_GEN(name)		(((name) & 0xff) << 24)
+#define	MACH_PORT_MAKE(index, gen)	\
+		(((index) << 8) | (gen) >> 24)
+
+#else	/* NO_PORT_GEN */
+
+#define	MACH_PORT_INDEX(name)		(name)
+#define	MACH_PORT_GEN(name)		(0)
+#define	MACH_PORT_MAKE(index, gen)	(index)
+
+#endif	/* NO_PORT_GEN */
+#define MACH_PORT_MAKEB(index, bits)    \
+                MACH_PORT_MAKE(index, IE_BITS_GEN(bits))
+
+#define MACH_PORT_VALID(name)   \
+                (((name) != MACH_PORT_NULL) && ((name) != MACH_PORT_DEAD))
+
+
+
+#include <sys/mach/ipc/port.h>
+/*
+ *  These are the different rights a task may have for a port.
+ *  The MACH_PORT_RIGHT_* definitions are used as arguments
+ *  to mach_port_allocate, mach_port_get_refs, etc, to specify
+ *  a particular right to act upon.  The mach_port_names and
+ *  mach_port_type calls return bitmasks using the MACH_PORT_TYPE_*
+ *  definitions.  This is because a single name may denote
+ *  multiple rights.
+ */
+
+typedef natural_t mach_port_right_t;
+
+#define MACH_PORT_RIGHT_SEND		((mach_port_right_t) 0)
+#define MACH_PORT_RIGHT_RECEIVE		((mach_port_right_t) 1)
+#define MACH_PORT_RIGHT_SEND_ONCE	((mach_port_right_t) 2)
+#define MACH_PORT_RIGHT_PORT_SET	((mach_port_right_t) 3)
+#define MACH_PORT_RIGHT_DEAD_NAME	((mach_port_right_t) 4)
+#define MACH_PORT_RIGHT_LABELH	        ((mach_port_right_t) 5)
+#define MACH_PORT_RIGHT_NUMBER		((mach_port_right_t) 6)
+
+typedef natural_t mach_port_type_t;
+typedef mach_port_type_t *mach_port_type_array_t;
+
+#define MACH_PORT_TYPE(right)						\
+		((mach_port_type_t)(((mach_port_type_t) 1)  		\
+		<< ((right) + ((mach_port_right_t) 16))))	
+#define MACH_PORT_TYPE_NONE	    ((mach_port_type_t) 0L)
+#define MACH_PORT_TYPE_SEND	    MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND)
+#define MACH_PORT_TYPE_RECEIVE	    MACH_PORT_TYPE(MACH_PORT_RIGHT_RECEIVE)
+#define MACH_PORT_TYPE_SEND_ONCE    MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND_ONCE)
+#define MACH_PORT_TYPE_PORT_SET	    MACH_PORT_TYPE(MACH_PORT_RIGHT_PORT_SET)
+#define MACH_PORT_TYPE_DEAD_NAME    MACH_PORT_TYPE(MACH_PORT_RIGHT_DEAD_NAME)
+#define MACH_PORT_TYPE_LABELH       MACH_PORT_TYPE(MACH_PORT_RIGHT_LABELH)
+
+/* Convenient combinations. */
+
+#define MACH_PORT_TYPE_SEND_RECEIVE					\
+		(MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_RECEIVE)
+#define	MACH_PORT_TYPE_SEND_RIGHTS					\
+		(MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_SEND_ONCE)
+#define	MACH_PORT_TYPE_PORT_RIGHTS					\
+		(MACH_PORT_TYPE_SEND_RIGHTS|MACH_PORT_TYPE_RECEIVE)
+#define	MACH_PORT_TYPE_PORT_OR_DEAD					\
+		(MACH_PORT_TYPE_PORT_RIGHTS|MACH_PORT_TYPE_DEAD_NAME)
+#define MACH_PORT_TYPE_ALL_RIGHTS					\
+		(MACH_PORT_TYPE_PORT_OR_DEAD|MACH_PORT_TYPE_PORT_SET)
+
+/* Dummy type bits that mach_port_type/mach_port_names can return. */
+
+#define MACH_PORT_TYPE_DNREQUEST		0x80000000
+#define MACH_PORT_TYPE_SPREQUEST		0x40000000
+#define MACH_PORT_TYPE_SPREQUEST_DELAYED	0x20000000
+
+/* User-references for capabilities. */
+
+typedef natural_t mach_port_urefs_t;
+typedef integer_t mach_port_delta_t;			/* change in urefs */
+
+/* Attributes of ports.  (See mach_port_get_receive_status.) */
+
+typedef natural_t mach_port_seqno_t;		/* sequence number */
+typedef natural_t mach_port_mscount_t;		/* make-send count */
+typedef natural_t mach_port_msgcount_t;		/* number of msgs */
+typedef natural_t mach_port_rights_t;		/* number of rights */
+
+/*
+ *	Are there outstanding send rights for a given port?
+ */
+#define	MACH_PORT_SRIGHTS_NONE		0		/* no srights */
+#define	MACH_PORT_SRIGHTS_PRESENT	1		/* srights */
+typedef unsigned int mach_port_srights_t;	/* status of send rights */
+
+typedef struct mach_port_status {
+	mach_port_rights_t	mps_pset;	/* count of containing port sets */
+	mach_port_seqno_t	mps_seqno;	/* sequence number */
+	mach_port_mscount_t	mps_mscount;	/* make-send count */
+	mach_port_msgcount_t	mps_qlimit;	/* queue limit */
+	mach_port_msgcount_t	mps_msgcount;	/* number in the queue */
+	mach_port_rights_t	mps_sorights;	/* how many send-once rights */
+	boolean_t		mps_srights;	/* do send rights exist? */
+	boolean_t		mps_pdrequest;	/* port-deleted requested? */
+	boolean_t		mps_nsrequest;	/* no-senders requested? */
+	natural_t		mps_flags;		/* port flags */
+} mach_port_status_t;
+
+/* System-wide values for setting queue limits on a port */
+#define MACH_PORT_QLIMIT_ZERO		((mach_port_msgcount_t) 0)
+#define MACH_PORT_QLIMIT_BASIC		((mach_port_msgcount_t) 5)
+#define MACH_PORT_QLIMIT_SMALL		((mach_port_msgcount_t) 16)
+#define MACH_PORT_QLIMIT_LARGE		((mach_port_msgcount_t) 1024)
+#define MACH_PORT_QLIMIT_KERNEL		((mach_port_msgcount_t) 65536)
+#define MACH_PORT_QLIMIT_MIN		MACH_PORT_QLIMIT_ZERO
+#define MACH_PORT_QLIMIT_DEFAULT	MACH_PORT_QLIMIT_BASIC
+#define MACH_PORT_QLIMIT_MAX		MACH_PORT_QLIMIT_LARGE
+
+typedef struct mach_port_limits {
+	mach_port_msgcount_t	mpl_qlimit;	/* number of msgs */
+} mach_port_limits_t;
+
+/* Possible values for mps_flags (part of mach_port_status_t) */
+#define MACH_PORT_STATUS_FLAG_TEMPOWNER		0x01
+#define MACH_PORT_STATUS_FLAG_GUARDED		0x02
+#define MACH_PORT_STATUS_FLAG_STRICT_GUARD	0x04
+#define MACH_PORT_STATUS_FLAG_IMP_DONATION	0x08
+#define MACH_PORT_STATUS_FLAG_REVIVE		0x10
+#define MACH_PORT_STATUS_FLAG_TASKPTR		0x20
+
+typedef struct mach_port_info_ext {
+	mach_port_status_t	mpie_status;
+	mach_port_msgcount_t	mpie_boost_cnt;
+	uint32_t		reserved[6];
+} mach_port_info_ext_t;
+
+typedef integer_t *mach_port_info_t;		/* varying array of natural_t */
+
+/* Flavors for mach_port_get/set_attributes() */
+typedef int	mach_port_flavor_t;
+#define MACH_PORT_LIMITS_INFO		1	/* uses mach_port_status_t */
+#define MACH_PORT_RECEIVE_STATUS	2	/* uses mach_port_limits_t */
+#define MACH_PORT_DNREQUESTS_SIZE	3	/* info is int */
+#define MACH_PORT_TEMPOWNER		4	/* indicates receive right will be reassigned to another task */
+#define MACH_PORT_IMPORTANCE_RECEIVER	5	/* indicates recieve right accepts priority donation */
+#define MACH_PORT_DENAP_RECEIVER	6	/* indicates receive right accepts de-nap donation */
+#define MACH_PORT_INFO_EXT		7	/* uses mach_port_info_ext_t */
+
+#define MACH_PORT_LIMITS_INFO_COUNT	((natural_t) \
+	(sizeof(mach_port_limits_t)/sizeof(natural_t)))
+#define MACH_PORT_RECEIVE_STATUS_COUNT	((natural_t) \
+	(sizeof(mach_port_status_t)/sizeof(natural_t)))
+#define MACH_PORT_DNREQUESTS_SIZE_COUNT 1
+#define MACH_PORT_INFO_EXT_COUNT	((natural_t) \
+	(sizeof(mach_port_info_ext_t)/sizeof(natural_t)))
+/*
+ * Structure used to pass information about port allocation requests.
+ * Must be padded to 64-bits total length.
+ */
+typedef struct mach_port_qos {
+	unsigned int		name:1;		/* name given */
+	unsigned int 		prealloc:1;	/* prealloced message */
+	boolean_t		pad1:30;
+	natural_t		len;
+} mach_port_qos_t;
+
+/* Mach Port Guarding definitions */
+
+/*
+ * Flags for mach_port_options (used for
+ * invocation of mach_port_construct).
+ * Indicates attributes to be set for the newly
+ * allocated port.
+ */
+#define MPO_CONTEXT_AS_GUARD	0x01	/* Add guard to the port */
+#define MPO_QLIMIT		0x02	/* Set qlimit for the port msg queue */
+#define MPO_TEMPOWNER		0x04	/* Set the tempowner bit of the port */
+#define MPO_IMPORTANCE_RECEIVER 0x08	/* Mark the port as importance receiver */
+#define MPO_INSERT_SEND_RIGHT   0x10	/* Insert a send right for the port */
+#define MPO_STRICT		0x20	/* Apply strict guarding for port */
+#define MPO_DENAP_RECEIVER	0x40	/* Mark the port as App de-nap receiver */
+/*
+ * Structure to define optional attributes for a newly
+ * constructed port.
+ */
+typedef struct mach_port_options {
+	uint32_t		flags;		/* Flags defining attributes for port */
+	mach_port_limits_t	mpl;		/* Message queue limit for port */
+	uint64_t		reserved[2];	/* Reserved */
+}mach_port_options_t;
+
+typedef mach_port_options_t *mach_port_options_ptr_t;
+
+/*
+ * EXC_GUARD represents a guard violation for both
+ * mach ports and file descriptors. GUARD_TYPE_ is used
+ * to differentiate among them.
+ */
+#define GUARD_TYPE_MACH_PORT	0x1
+
+/* Reasons for exception for a guarded mach port */
+enum mach_port_guard_exception_codes {
+	kGUARD_EXC_DESTROY		= 1u << 0,
+	kGUARD_EXC_MOD_REFS		= 1u << 1,
+	kGUARD_EXC_SET_CONTEXT		= 1u << 2,
+	kGUARD_EXC_UNGUARDED		= 1u << 3,
+	kGUARD_EXC_INCORRECT_GUARD	= 1u << 4
+};
+
+#if	0 && !__DARWIN_UNIX03 && !defined(_NO_PORT_T_FROM_MACH)
+/*
+ *  Mach 3.0 renamed everything to have mach_ in front of it.
+ *  These types and macros are provided for backward compatibility
+ *	but are deprecated.
+ */
+typedef mach_port_t		port_t;
+typedef mach_port_name_t	port_name_t;
+typedef mach_port_name_t	*port_name_array_t;
+
+#define PORT_NULL		((port_t) 0)
+#define PORT_DEAD		((port_t) ~0)
+#define PORT_VALID(name) \
+		((port_t)(name) != PORT_NULL && (port_t)(name) != PORT_DEAD)
+
+#endif	/* !__DARWIN_UNIX03 && !_NO_PORT_T_FROM_MACH */
+
+
+#define CAST_MACH_PORT_TO_NAME(x) ((mach_port_name_t)(uintptr_t)(x))
+#define CAST_MACH_NAME_TO_PORT(x) ((x) == MACH_PORT_NAME_DEAD ? (mach_port_t)IPC_PORT_DEAD : (mach_port_t)(uintptr_t)(x))
+
+
+
+#endif	/* _MACH_PORT_H_ */


Property changes on: trunk/sys/sys/mach/port.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/processor.h
===================================================================
--- trunk/sys/sys/mach/processor.h	                        (rev 0)
+++ trunk/sys/sys/mach/processor.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,354 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6  91/05/14  16:45:38  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.5  91/02/05  17:28:34  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  16:16:14  mrt]
+ * 
+ * Revision 2.4  90/09/09  14:32:32  rpd
+ * 	Use decl_simple_lock_data.
+ * 	[90/08/30            rpd]
+ * 
+ * Revision 2.3  90/08/07  17:58:42  rpd
+ * 	Added processor_set_name_array_t.
+ * 	[90/08/07            rpd]
+ * 
+ * Revision 2.2  90/06/02  14:55:39  rpd
+ * 	Created for new host/processor technology.
+ * 	[90/03/26  23:50:00  rpd]
+ * 
+ * 	Merge to X96
+ * 	[89/08/02  23:01:16  dlb]
+ * 
+ * 	Add quantum_adj_lock to pset structure.  Enclose some fields
+ * 	in NCPUS > 1 conditionals.
+ * 	[89/06/15            dlb]
+ * 
+ * 	Add all_psets_count declaration.
+ * 	[89/06/09            dlb]
+ * 
+ * 	Add processor_set_array_t.
+ * 	[89/06/08            dlb]
+ * 
+ * 	Add max_priority, policies fields to processor_set structure.
+ * 	[89/05/12            dlb]
+ * 	Add load factor/average fields to processor set structure.
+ * 	[89/02/09            dlb]
+ * 
+ * Revision 2.5  89/11/20  11:23:50  mja
+ * 	Put policies field under MACH_FIXPRI conditional.
+ * 	[89/11/10            dlb]
+ * 
+ * Revision 2.4  89/10/15  02:05:13  rpd
+ * 	Minor cleanups.
+ * 
+ * Revision 2.3  89/10/12  21:34:28  dlb
+ * 	Get ast_check_t from machine/ast_types.h instead of machine/ast.h
+ * 	[89/10/12            dlb]
+ * 
+ * Revision 2.2  89/10/11  14:20:44  dlb
+ * 	Add remote ast check support for multiprocessors.
+ * 	Add quantum_adj_lock to pset structure.  Enclose some fields
+ * 		in NCPUS > 1 conditionals.
+ * 	Add max_priority, policies fields to processor_set structure.
+ * 	Add load factor/average fields to processor set structure.
+ * 
+ * 27-Sep-88  David Black (dlb) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ *	processor.h:	Processor and processor-set definitions.
+ */
+
+#ifndef	_KERN_PROCESSOR_H_
+#define	_KERN_PROCESSOR_H_
+
+/*
+ *	Data structures for managing processors and sets of processors.
+ */
+
+#if 0
+#include <cpus.h>
+#include <mach_host.h>
+
+#include <mach/kern_return.h>
+#endif
+#include <sys/mach/port.h>
+#include <compat/mach/kern_types.h>
+#if 0
+#include <kern/cpu_number.h>
+#include <kern/lock.h>
+#include <kern/queue.h>
+#include <kern/sched.h>
+#endif
+
+struct processor_set {
+	decl_mutex_data(,	lock);		/* lock for everything else */
+	boolean_t		active;		/* is pset in use */
+	struct ipc_port	*	pset_self;	/* port for operations */
+	struct ipc_port *	pset_name_self;	/* port for information */
+
+#ifdef notyet	
+	struct	run_queue	runq;		/* runq for this set */
+	queue_head_t		idle_queue;	/* idle processors */
+	int			idle_count;	/* how many ? */
+	decl_simple_lock_data(,idle_lock)	/* lock for above */
+	queue_head_t		processors;	/* all processors here */
+	int			processor_count;	/* how many ? */
+	boolean_t		empty;		/* true if no processors */
+	queue_head_t		tasks;		/* tasks assigned */
+	int			task_count;	/* how many */
+	queue_head_t		threads;	/* threads in this set */
+	int			thread_count;	/* how many */
+	int			ref_count;	/* structure ref count */
+	queue_chain_t		all_psets;	/* link for all_psets */
+	int			max_priority;	/* maximum priority */
+	int			policies;	/* bit vector for policies */
+	int			set_quantum;	/* current default quantum */
+#if	NCPUS > 1
+	int			quantum_adj_index; /* runtime quantum adj. */
+	decl_simple_lock_data(,quantum_adj_lock)  /* lock for above */
+	int			machine_quantum[NCPUS+1]; /* ditto */
+#endif	/* NCPUS > 1 */
+	integer_t		mach_factor;	/* mach_factor */
+	integer_t		load_average;	/* load_average */
+	long			sched_load;	/* load avg for scheduler */
+	policy_t		policy_default;	/* per set default */
+	policy_base_data_t	policy_base;	/* base attributes */
+	policy_limit_data_t	policy_limit;	/* limit attributes */
+#endif
+};
+
+#define PROCESSOR_SET_NULL	(processor_set_t)0
+
+extern struct processor_set	default_pset;
+
+struct processor {
+	#ifdef notyet
+#if	NCPUS > 1
+	struct run_queue runq;		/* local runq for this processor */
+#endif	/* NCPUS > 1*/
+	queue_chain_t	processor_queue; /* idle/assign/shutdown queue link */
+	int		state;		/* See below */
+	struct thread_shuttle
+			*next_thread,	/* next thread to run if dispatched */
+			*idle_thread;	/* this processor's idle thread. */
+	int		quantum;	/* quantum for current thread */
+	boolean_t	first_quantum;	/* first quantum in succession */
+	int		last_quantum;	/* last quantum assigned */
+
+	processor_set_t	processor_set;	/* processor set I belong to */
+	processor_set_t processor_set_next;	/* set I will belong to */
+	queue_chain_t	processors;	/* all processors in set */
+	int		slot_num;	/* machine-indep slot number */
+#if	NCPUS > 1
+	ast_check_t	ast_check_data;	/* for remote ast_check invocation */
+	queue_chain_t	softclock_queue;/* cpus handling softclocks */
+#endif	/* NCPUS > 1 */
+	/* punt id data temporarily */
+	#endif
+	decl_simple_lock_data(,lock)
+	struct ipc_port *processor_self;	/* port for operations */
+};
+
+#define PROCESSOR_NULL	(processor_t)0
+
+#if 0
+extern struct processor	processor_array[MAXCPUS];
+
+/*
+ *	Chain of all processor sets.
+ */
+extern queue_head_t		all_psets;
+#endif
+extern int			all_psets_count;
+decl_mutex_data(extern,		all_psets_lock)
+
+/*
+ *	XXX need a pointer to the master processor structure
+ */
+
+extern processor_t	master_processor;
+
+/*
+ *	NOTE: The processor->processor_set link is needed in one of the
+ *	scheduler's critical paths.  [Figure out where to look for another
+ *	thread to run on this processor.]  It is accessed without locking.
+ *	The following access protocol controls this field.
+ *
+ *	Read from own processor - just read.
+ *	Read from another processor - lock processor structure during read.
+ *	Write from own processor - lock processor structure during write.
+ *	Write from another processor - NOT PERMITTED.
+ *
+ */
+
+/*
+ *	Processor state locking:
+ *
+ *	Values for the processor state are defined below.  If the processor
+ *	is off-line or being shutdown, then it is only necessary to lock
+ *	the processor to change its state.  Otherwise it is only necessary
+ *	to lock its processor set's idle_lock.  Scheduler code will
+ *	typically lock only the idle_lock, but processor manipulation code
+ *	will often lock both.
+ */
+
+#define PROCESSOR_OFF_LINE	0	/* Not in system */
+#define	PROCESSOR_RUNNING	1	/* Running normally */
+#define	PROCESSOR_IDLE		2	/* idle */
+#define PROCESSOR_DISPATCHING	3	/* dispatching (idle -> running) */
+#define	PROCESSOR_ASSIGN	4	/* Assignment is changing */
+#define PROCESSOR_SHUTDOWN	5	/* Being shutdown */
+#define PROCESSOR_VIDLE		6	/* Running, but running idle thr */
+
+/*
+ *	Use processor ptr array to find current processor's data structure.
+ *	This replaces a multiplication (index into processor_array) with
+ *	an array lookup and a memory reference.  It also allows us to save
+ *	space if processor numbering gets too sparse.
+ */
+#if 0
+extern processor_t	processor_ptr[NCPUS];
+#endif
+#define cpu_to_processor(i)	(processor_ptr[i])
+
+#define current_processor()	(processor_ptr[cpu_number()])
+#define current_processor_set()	(current_processor()->processor_set)
+
+/* Useful lock macros */
+
+#define	pset_lock(pset)		mtx_lock(&(pset)->lock)
+#define	pset_lock_try(pset)	mtx_trylock(&(pset)->lock)
+#define pset_unlock(pset)	mtx_unlock(&(pset)->lock)
+
+#define processor_lock(pr)	simple_lock(&(pr)->lock)
+#define processor_unlock(pr)	simple_unlock(&(pr)->lock)
+
+typedef mach_port_t	*processor_array_t;
+typedef mach_port_t	*processor_port_array_t;
+typedef mach_port_t	*processor_set_array_t;
+typedef mach_port_t	*processor_set_name_array_t;
+typedef mach_port_t	*processor_set_name_port_array_t;
+
+extern void		pset_sys_bootstrap(void);
+
+extern void		pset_sys_init(void);
+
+extern int		pset_max_priority(
+				processor_set_t pset,
+				policy_t 	policy);
+
+extern int		pset_base_priority(
+				processor_set_t pset,
+				policy_t 	policy);
+
+extern int		pset_sched_data(
+				processor_set_t pset,
+				policy_t 	policy);
+
+
+extern void		pset_remove_processor(
+				processor_set_t	pset,
+				processor_t	processor);
+
+extern void		pset_add_processor(
+				processor_set_t	pset,
+				processor_t	processor);
+
+extern void		pset_remove_task(
+				processor_set_t	pset,
+				task_t		task);
+
+extern void		pset_add_task(
+				processor_set_t	pset,
+				task_t		task);
+
+extern void		pset_remove_thread(
+				processor_set_t	pset,
+				thread_t	thread);
+
+extern void		pset_add_thread(
+				processor_set_t	pset,
+				thread_t	thread);
+
+extern void		thread_change_psets(
+				thread_t	thread,
+				processor_set_t old_pset,
+				processor_set_t new_pset);
+
+extern void		pset_deallocate(
+				processor_set_t	pset);
+
+extern void		pset_reference(
+				processor_set_t	pset);
+
+extern kern_return_t	processor_assign(
+				processor_t	processor,
+				processor_set_t	new_pset,
+				boolean_t	wait);
+extern kern_return_t	processor_shutdown(
+				processor_t	processor);
+extern void		action_thread(void);
+
+/* Implemented by MD layer */
+
+extern void		cpu_up(
+				int		cpu);
+
+#endif	/* _KERN_PROCESSOR_H_ */


Property changes on: trunk/sys/sys/mach/processor.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/processor_info.h
===================================================================
--- trunk/sys/sys/mach/processor_info.h	                        (rev 0)
+++ trunk/sys/sys/mach/processor_info.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,184 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/14  16:58:46  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:35:31  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:20:39  mrt]
+ * 
+ * Revision 2.2  90/06/02  14:59:49  rpd
+ * 	Created for new host/processor technology.
+ * 	[90/03/26  23:51:38  rpd]
+ * 
+ * 	Merge to X96
+ * 	[89/08/02  23:12:21  dlb]
+ * 
+ * 	Add scheduling flavor of information.
+ * 	[89/07/25  18:52:18  dlb]
+ * 
+ * 	Add load average and mach factor to processor set basic info.
+ * 	[89/02/09            dlb]
+ * 
+ * Revision 2.3  89/10/15  02:05:54  rpd
+ * 	Minor cleanups.
+ * 
+ * Revision 2.2  89/10/11  14:41:03  dlb
+ * 	Add scheduling flavor of information.
+ * 
+ * 	Add load average and mach factor to processor set basic info.
+ * 	[89/02/09            dlb]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ *	File:	mach/processor_info.h
+ *	Author:	David L. Black
+ *	Date:	1988
+ *
+ *	Data structure definitions for processor_info, processor_set_info
+ */
+
+#ifndef	_MACH_PROCESSOR_INFO_H_
+#define _MACH_PROCESSOR_INFO_H_
+
+#include <sys/mach/machine.h>
+
+/*
+ *	Generic information structure to allow for expansion.
+ */
+typedef integer_t	*mach_processor_info_t;	/* varying array of int. */
+typedef mach_processor_info_t *processor_info_array_t;
+
+#define PROCESSOR_INFO_MAX	(1024)	/* max array size */
+typedef integer_t	processor_info_data_t[PROCESSOR_INFO_MAX];
+
+
+typedef integer_t	*processor_set_info_t;	/* varying array of int. */
+
+#define PROCESSOR_SET_INFO_MAX	(1024)	/* max array size */
+typedef integer_t	processor_set_info_data_t[PROCESSOR_SET_INFO_MAX];
+
+
+typedef int	*processor_slot_t;	/* varying array of int. */
+
+/*
+ *	Currently defined information.
+ */
+typedef int	processor_flavor_t;
+#define	PROCESSOR_BASIC_INFO	1		/* basic information */
+
+struct processor_basic_info {
+	cpu_type_t	cpu_type;	/* type of cpu */
+	cpu_subtype_t	cpu_subtype;	/* subtype of cpu */
+	boolean_t	running;	/* is processor running */
+	int		slot_num;	/* slot number */
+	boolean_t	is_master;	/* is this the master processor */
+};
+
+typedef	struct processor_basic_info	processor_basic_info_data_t;
+typedef struct processor_basic_info	*processor_basic_info_t;
+#define PROCESSOR_BASIC_INFO_COUNT \
+		(sizeof(processor_basic_info_data_t)/sizeof(natural_t))
+
+/*
+ *	Scaling factor for load_average, mach_factor.
+ */
+#define	LOAD_SCALE	1000		
+
+typedef	int	processor_set_flavor_t;
+#define	PROCESSOR_SET_BASIC_INFO	5	/* basic information */
+
+struct processor_set_basic_info {
+	int		processor_count;	/* How many processors */
+	int		default_policy;		/* When others not enabled */
+};
+
+typedef	struct processor_set_basic_info	processor_set_basic_info_data_t;
+typedef struct processor_set_basic_info	*processor_set_basic_info_t;
+#define PROCESSOR_SET_BASIC_INFO_COUNT \
+		(sizeof(processor_set_basic_info_data_t)/sizeof(natural_t))
+
+#define PROCESSOR_SET_LOAD_INFO		4	/* scheduling statistics */
+
+struct processor_set_load_info {
+        int             task_count;             /* How many tasks */
+        int             thread_count;           /* How many threads */
+        integer_t       load_average;           /* Scaled */
+        integer_t       mach_factor;            /* Scaled */
+};
+
+typedef struct processor_set_load_info processor_set_load_info_data_t;
+typedef struct processor_set_load_info *processor_set_load_info_t;
+#define PROCESSOR_SET_LOAD_INFO_COUNT	\
+                (sizeof(processor_set_load_info_data_t)/sizeof(natural_t))
+
+
+/*
+ *      New scheduling control interface
+ */
+#define PROCESSOR_SET_ENABLED_POLICIES                   3
+#define PROCESSOR_SET_ENABLED_POLICIES_COUNT	\
+		(sizeof(policy_t)/sizeof(natural_t))
+
+#define PROCESSOR_SET_TIMESHARE_DEFAULT                 10
+#define PROCESSOR_SET_TIMESHARE_LIMITS                  11
+
+#define PROCESSOR_SET_RR_DEFAULT                        20
+#define PROCESSOR_SET_RR_LIMITS                         21
+
+#define PROCESSOR_SET_FIFO_DEFAULT                      30
+#define PROCESSOR_SET_FIFO_LIMITS                       31
+
+#endif	/* _MACH_PROCESSOR_INFO_H_ */


Property changes on: trunk/sys/sys/mach/processor_info.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/prof_types.h
===================================================================
--- trunk/sys/sys/mach/prof_types.h	                        (rev 0)
+++ trunk/sys/sys/mach/prof_types.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+#ifndef	_MACH_PROF_TYPES_H
+#define	_MACH_PROF_TYPES_H
+
+#define	SAMPLE_MAX	256	/* Max array size */
+typedef unsigned	sample_array_t[SAMPLE_MAX];
+
+#endif	/* _MACH_PROF_TYPES_H */


Property changes on: trunk/sys/sys/mach/prof_types.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/queue.h
===================================================================
--- trunk/sys/sys/mach/queue.h	                        (rev 0)
+++ trunk/sys/sys/mach/queue.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,647 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/14  16:45:55  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:28:43  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  16:16:28  mrt]
+ * 
+ * Revision 2.2  89/09/08  11:26:11  dbg
+ * 	Streamlined generic queue macros.
+ * 	[89/08/17            dbg]
+ * 
+ * 19-Dec-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Added queue_remove_last; removed round_queue.  [Changes from
+ *	mwyoung: 19 Dec 88.]
+ *
+ * 29-Nov-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Removed include of cputypes.h.  Added queue_iterate.
+ *	Split into two groups the macros that operate directly on
+ *	queues (or expect the queue chain to be first in a structure)
+ *	and those that operate on generic structures (where the chain
+ *	may be anywhere).
+ *
+ * 17-Jan-88  Daniel Julin (dpj) at Carnegie-Mellon University
+ *	Added queue_enter_first, queue_last and queue_prev for use by
+ *	the TCP netport code.
+ *
+ * 12-Jun-85  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon rights
+ * to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	queue.h
+ *	Author:	Avadis Tevanian, Jr.
+ *	Date:	1985
+ *
+ *	Type definitions for generic queues.
+ *
+ */
+
+#ifndef	_KERN_QUEUE_H_
+#define	_KERN_QUEUE_H_
+
+#include <sys/mach/macro_help.h>
+
+/*
+ *	Queue of abstract objects.  Queue is maintained
+ *	within that object.
+ *
+ *	Supports fast removal from within the queue.
+ *
+ *	How to declare a queue of elements of type "foo_t":
+ *		In the "*foo_t" type, you must have a field of
+ *		type "queue_chain_t" to hold together this queue.
+ *		There may be more than one chain through a
+ *		"foo_t", for use by different queues.
+ *
+ *		Declare the queue as a "queue_t" type.
+ *
+ *		Elements of the queue (of type "foo_t", that is)
+ *		are referred to by reference, and cast to type
+ *		"queue_entry_t" within this module.
+ */
+
+/*
+ *	A generic doubly-linked list (queue).
+ */
+
+struct queue_entry {
+	struct queue_entry	*next;		/* next element */
+	struct queue_entry	*prev;		/* previous element */
+};
+
+typedef struct queue_entry	*queue_t;
+typedef	struct queue_entry	queue_head_t;
+typedef	struct queue_entry	queue_chain_t;
+typedef	struct queue_entry	*queue_entry_t;
+
+/*
+ *	enqueue puts "elt" on the "queue".
+ *	dequeue returns the first element in the "queue".
+ *	remqueue removes the specified "elt" from the specified "queue".
+ */
+
+#define enqueue(queue,elt)	enqueue_tail(queue, elt)
+#define	dequeue(queue)		dequeue_head(queue)
+
+#if	!defined(__GNUC__)
+
+/* Enqueue element to head of queue */
+extern void		enqueue_head(
+				queue_t		que,
+				queue_entry_t	elt);
+
+/* Enqueue element to tail of queue */
+extern void		enqueue_tail(
+				queue_t		que,
+				queue_entry_t	elt);
+
+/* Dequeue element from head of queue */
+extern queue_entry_t	dequeue_head(
+				queue_t	que);
+
+/* Dequeue element from tail of queue */
+extern queue_entry_t	dequeue_tail(
+				queue_t	que);
+
+/* Dequeue element */
+extern void		remqueue(
+				queue_t		que,
+				queue_entry_t	elt);
+
+/* Enqueue element after a particular elem */
+extern void		insque(
+				queue_entry_t	entry,
+				queue_entry_t	pred);
+
+/* Dequeue element */
+extern int		remque(
+				queue_entry_t elt);
+
+#else
+
+static __inline__ void
+enqueue_head(
+	queue_t		que,
+	queue_entry_t	elt)
+{
+	elt->next = que->next;
+	elt->prev = que;
+	elt->next->prev = elt;
+	que->next = elt;
+}
+
+static __inline__ void
+enqueue_tail(
+		queue_t		que,
+		queue_entry_t	elt)
+{
+	elt->next = que;
+	elt->prev = que->prev;
+	elt->prev->next = elt;
+	que->prev = elt;
+}
+
+static __inline__ queue_entry_t
+dequeue_head(
+	queue_t	que)
+{
+	register queue_entry_t	elt = (queue_entry_t) 0;
+
+	if (que->next != que) {
+		elt = que->next;
+		elt->next->prev = que;
+		que->next = elt->next;
+	}
+
+	return (elt);
+}
+
+static __inline__ queue_entry_t
+dequeue_tail(
+	queue_t	que)
+{
+	register queue_entry_t	elt = (queue_entry_t) 0;
+
+	if (que->prev != que) {
+		elt = que->prev;
+		elt->prev->next = que;
+		que->prev = elt->prev;
+	}
+
+	return (elt);
+}
+
+static __inline__ void
+remqueue(
+	queue_t		que __unused,
+	queue_entry_t	elt)
+{
+	elt->next->prev = elt->prev;
+	elt->prev->next = elt->next;
+}
+
+static __inline__ void
+insque(
+	queue_entry_t	entry,
+	queue_entry_t	pred)
+{
+	entry->next = pred->next;
+	entry->prev = pred;
+	(pred->next)->prev = entry;
+	pred->next = entry;
+}
+
+static __inline__ integer_t
+remque(
+	register queue_entry_t elt)
+{
+	(elt->next)->prev = elt->prev;
+	(elt->prev)->next = elt->next;
+
+	return((integer_t)elt);
+}
+
+#endif	/* defined(__GNUC__) */
+
+/*
+ *	Macro:		queue_init
+ *	Function:
+ *		Initialize the given queue.
+ *	Header:
+ *		void queue_init(q)
+ *			queue_t		q;	\* MODIFIED *\
+ */
+#define queue_init(q)	\
+MACRO_BEGIN		\
+	(q)->next = (q);\
+	(q)->prev = (q);\
+MACRO_END
+
+/*
+ *	Macro:		queue_first
+ *	Function:
+ *		Returns the first entry in the queue,
+ *	Header:
+ *		queue_entry_t queue_first(q)
+ *			queue_t	q;		\* IN *\
+ */
+#define	queue_first(q)	((q)->next)
+
+/*
+ *	Macro:		queue_next
+ *	Function:
+ *		Returns the entry after an item in the queue.
+ *	Header:
+ *		queue_entry_t queue_next(qc)
+ *			queue_t qc;
+ */
+#define	queue_next(qc)	((qc)->next)
+
+/*
+ *	Macro:		queue_last
+ *	Function:
+ *		Returns the last entry in the queue.
+ *	Header:
+ *		queue_entry_t queue_last(q)
+ *			queue_t	q;		\* IN *\
+ */
+#define	queue_last(q)	((q)->prev)
+
+/*
+ *	Macro:		queue_prev
+ *	Function:
+ *		Returns the entry before an item in the queue.
+ *	Header:
+ *		queue_entry_t queue_prev(qc)
+ *			queue_t qc;
+ */
+#define	queue_prev(qc)	((qc)->prev)
+
+/*
+ *	Macro:		queue_end
+ *	Function:
+ *		Tests whether a new entry is really the end of
+ *		the queue.
+ *	Header:
+ *		boolean_t queue_end(q, qe)
+ *			queue_t q;
+ *			queue_entry_t qe;
+ */
+#define	queue_end(q, qe)	((q) == (qe))
+
+/*
+ *	Macro:		queue_empty
+ *	Function:
+ *		Tests whether a queue is empty.
+ *	Header:
+ *		boolean_t queue_empty(q)
+ *			queue_t q;
+ */
+#define	queue_empty(q)		queue_end((q), queue_first(q))
+
+
+/*----------------------------------------------------------------*/
+/*
+ * Macros that operate on generic structures.  The queue
+ * chain may be at any location within the structure, and there
+ * may be more than one chain.
+ */
+
+/*
+ *	Macro:		queue_enter
+ *	Function:
+ *		Insert a new element at the tail of the queue.
+ *	Header:
+ *		void queue_enter(q, elt, type, field)
+ *			queue_t q;
+ *			<type> elt;
+ *			<type> is what's in our queue
+ *			<field> is the chain field in (*<type>)
+ */
+#define queue_enter(head, elt, type, field)			\
+MACRO_BEGIN							\
+	register queue_entry_t prev;				\
+								\
+	prev = (head)->prev;					\
+	if ((head) == prev) {					\
+		(head)->next = (queue_entry_t) (elt);		\
+	}							\
+	else {							\
+		((type)prev)->field.next = (queue_entry_t)(elt);\
+	}							\
+	(elt)->field.prev = prev;				\
+	(elt)->field.next = head;				\
+	(head)->prev = (queue_entry_t) elt;			\
+MACRO_END
+
+/*
+ *	Macro:		queue_enter_first
+ *	Function:
+ *		Insert a new element at the head of the queue.
+ *	Header:
+ *		void queue_enter_first(q, elt, type, field)
+ *			queue_t q;
+ *			<type> elt;
+ *			<type> is what's in our queue
+ *			<field> is the chain field in (*<type>)
+ */
+#define queue_enter_first(head, elt, type, field)		\
+MACRO_BEGIN							\
+	register queue_entry_t next;				\
+								\
+	next = (head)->next;					\
+	if ((head) == next) {					\
+		(head)->prev = (queue_entry_t) (elt);		\
+	}							\
+	else {							\
+		((type)next)->field.prev = (queue_entry_t)(elt);\
+	}							\
+	(elt)->field.next = next;				\
+	(elt)->field.prev = head;				\
+	(head)->next = (queue_entry_t) elt;			\
+MACRO_END
+
+/*
+ *	Macro:		queue_insert_before
+ *	Function:
+ *		Insert a new element before a given element.
+ *	Header:
+ *		void queue_insert_before(q, elt, cur, type, field)
+ *			queue_t q;
+ *			<type> elt;
+ *			<type> cur;
+ *			<type> is what's in our queue
+ *			<field> is the chain field in (*<type>)
+ */
+#define queue_insert_before(head, elt, cur, type, field)		\
+MACRO_BEGIN								\
+	register queue_entry_t prev;					\
+									\
+	if ((head) == (queue_entry_t)(cur)) {				\
+		(elt)->field.next = (head);				\
+		if ((head)->next == (head)) {	/* only element */	\
+			(elt)->field.prev = (head);			\
+			(head)->next = (queue_entry_t)(elt);		\
+		} else {			/* last element */	\
+			prev = (elt)->field.prev = (head)->prev;	\
+			((type)prev)->field.next = (queue_entry_t)(elt);\
+		}							\
+		(head)->prev = (queue_entry_t)(elt);			\
+	} else {							\
+		(elt)->field.next = (queue_entry_t)(cur);		\
+		if ((head)->next == (queue_entry_t)(cur)) {		\
+						/* first element */	\
+			(elt)->field.prev = (head);			\
+			(head)->next = (queue_entry_t)(elt);		\
+		} else {			/* middle element */	\
+			prev = (elt)->field.prev = (cur)->field.prev;	\
+			((type)prev)->field.next = (queue_entry_t)(elt);\
+		}							\
+		(cur)->field.prev = (queue_entry_t)(elt);		\
+	}								\
+MACRO_END
+
+/*
+ *	Macro:		queue_insert_after
+ *	Function:
+ *		Insert a new element after a given element.
+ *	Header:
+ *		void queue_insert_after(q, elt, cur, type, field)
+ *			queue_t q;
+ *			<type> elt;
+ *			<type> cur;
+ *			<type> is what's in our queue
+ *			<field> is the chain field in (*<type>)
+ */
+#define queue_insert_after(head, elt, cur, type, field)			\
+MACRO_BEGIN								\
+	register queue_entry_t next;					\
+									\
+	if ((head) == (queue_entry_t)(cur)) {				\
+		(elt)->field.prev = (head);				\
+		if ((head)->next == (head)) {	/* only element */	\
+			(elt)->field.next = (head);			\
+			(head)->prev = (queue_entry_t)(elt);		\
+		} else {			/* first element */	\
+			next = (elt)->field.next = (head)->next;	\
+			((type)next)->field.prev = (queue_entry_t)(elt);\
+		}							\
+		(head)->next = (queue_entry_t)(elt);			\
+	} else {							\
+		(elt)->field.prev = (queue_entry_t)(cur);		\
+		if ((head)->prev == (queue_entry_t)(cur)) {		\
+						/* last element */	\
+			(elt)->field.next = (head);			\
+			(head)->prev = (queue_entry_t)(elt);		\
+		} else {			/* middle element */	\
+			next = (elt)->field.next = (cur)->field.next;	\
+			((type)next)->field.prev = (queue_entry_t)(elt);\
+		}							\
+		(cur)->field.next = (queue_entry_t)(elt);		\
+	}								\
+MACRO_END
+
+/*
+ *	Macro:		queue_field [internal use only]
+ *	Function:
+ *		Find the queue_chain_t (or queue_t) for the
+ *		given element (thing) in the given queue (head)
+ */
+#define	queue_field(head, thing, type, field)			\
+		(((head) == (thing)) ? (head) : &((type)(thing))->field)
+
+/*
+ *	Macro:		queue_remove
+ *	Function:
+ *		Remove an arbitrary item from the queue.
+ *	Header:
+ *		void queue_remove(q, qe, type, field)
+ *			arguments as in queue_enter
+ */
+#define	queue_remove(head, elt, type, field)			\
+MACRO_BEGIN							\
+	register queue_entry_t	next, prev;			\
+								\
+	next = (elt)->field.next;				\
+	prev = (elt)->field.prev;				\
+								\
+	if ((head) == next)					\
+		(head)->prev = prev;				\
+	else							\
+		((type)next)->field.prev = prev;		\
+								\
+	if ((head) == prev)					\
+		(head)->next = next;				\
+	else							\
+		((type)prev)->field.next = next;		\
+MACRO_END
+
+/*
+ *	Macro:		queue_remove_first
+ *	Function:
+ *		Remove and return the entry at the head of
+ *		the queue.
+ *	Header:
+ *		queue_remove_first(head, entry, type, field)
+ *		entry is returned by reference
+ */
+#define	queue_remove_first(head, entry, type, field)		\
+MACRO_BEGIN							\
+	register queue_entry_t	next;				\
+								\
+	(entry) = (type) ((head)->next);			\
+	next = (entry)->field.next;				\
+								\
+	if ((head) == next)					\
+		(head)->prev = (head);				\
+	else							\
+		((type)(next))->field.prev = (head);		\
+	(head)->next = next;					\
+MACRO_END
+
+/*
+ *	Macro:		queue_remove_last
+ *	Function:
+ *		Remove and return the entry at the tail of
+ *		the queue.
+ *	Header:
+ *		queue_remove_last(head, entry, type, field)
+ *		entry is returned by reference
+ */
+#define	queue_remove_last(head, entry, type, field)		\
+MACRO_BEGIN							\
+	register queue_entry_t	prev;				\
+								\
+	(entry) = (type) ((head)->prev);			\
+	prev = (entry)->field.prev;				\
+								\
+	if ((head) == prev)					\
+		(head)->next = (head);				\
+	else							\
+		((type)(prev))->field.next = (head);		\
+	(head)->prev = prev;					\
+MACRO_END
+
+/*
+ *	Macro:		queue_assign
+ */
+#define	queue_assign(to, from, type, field)			\
+MACRO_BEGIN							\
+	((type)((from)->prev))->field.next = (to);		\
+	((type)((from)->next))->field.prev = (to);		\
+	*to = *from;						\
+MACRO_END
+
+/*
+ *	Macro:		queue_new_head
+ *	Function:
+ *		rebase old queue to new queue head
+ *	Header:
+ *		queue_new_head(old, new, type, field)
+ *			queue_t old;
+ *			queue_t new;
+ *			<type> is what's in our queue
+ *                      <field> is the chain field in (*<type>)
+ */
+#define queue_new_head(old, new, type, field)			\
+MACRO_BEGIN							\
+	if (!queue_empty(new)) {				\
+		*(new) = *(old);				\
+		((type)((new)->next))->field.prev = (new);	\
+		((type)((new)->prev))->field.next = (new);	\
+	} else {						\
+		queue_init(new);				\
+	}							\
+MACRO_END
+
+/*
+ *	Macro:		queue_iterate
+ *	Function:
+ *		iterate over each item in the queue.
+ *		Generates a 'for' loop, setting elt to
+ *		each item in turn (by reference).
+ *	Header:
+ *		queue_iterate(q, elt, type, field)
+ *			queue_t q;
+ *			<type> elt;
+ *			<type> is what's in our queue
+ *			<field> is the chain field in (*<type>)
+ */
+#define queue_iterate(head, elt, type, field)			\
+	for ((elt) = (type) queue_first(head);			\
+	     !queue_end((head), (queue_entry_t)(elt));		\
+	     (elt) = (type) queue_next(&(elt)->field))
+
+
+
+/*----------------------------------------------------------------*/
+/*
+ *	Define macros for queues with locks.
+ */
+struct mpqueue_head {
+	struct queue_entry	head;		/* header for queue */
+	decl_simple_lock_data(,	lock)		/* lock for queue */
+};
+
+typedef struct mpqueue_head	mpqueue_head_t;
+
+#define	round_mpq(size)		(size)
+
+#define mpqueue_init(q)					\
+MACRO_BEGIN						\
+	queue_init(&(q)->head);				\
+	simple_lock_init(&(q)->lock, ETAP_MISC_Q);	\
+MACRO_END
+
+#define mpenqueue_tail(q, elt)				\
+MACRO_BEGIN						\
+	simple_lock(&(q)->lock);			\
+	enqueue_tail(&(q)->head, elt);			\
+	simple_unlock(&(q)->lock);			\
+MACRO_END
+
+#define mpdequeue_head(q, elt)				\
+MACRO_BEGIN						\
+	simple_lock(&(q)->lock);			\
+	if (queue_empty(&(q)->head))			\
+		*(elt) = 0;				\
+	else						\
+		*(elt) = dequeue_head(&(q)->head);	\
+	simple_unlock(&(q)->lock);			\
+MACRO_END
+
+#endif	/* _KERN_QUEUE_H_ */


Property changes on: trunk/sys/sys/mach/queue.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/rpc.h
===================================================================
--- trunk/sys/sys/mach/rpc.h	                        (rev 0)
+++ trunk/sys/sys/mach/rpc.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,580 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+
+/*
+ * Mach RPC Subsystem Interfaces
+ */
+
+#ifndef	_MACH_RPC_H_
+#define _MACH_RPC_H_
+
+#include <sys/mach/kern_return.h>
+#include <sys/mach/port.h>
+#include <sys/mach/vm_types.h>
+
+#include <sys/mach/mig_errors.h>
+#include <sys/mach/ipc_common.h>
+
+#ifdef	MACH_KERNEL
+#include <ipc/ipc_object.h>
+#endif	/* MACH_KERNEL */
+
+/*
+ *
+ * Definition of RPC "glue code" operations vector -- entry
+ * points needed to accomplish short-circuiting
+ */
+typedef struct rpc_glue_vector {
+        kern_return_t   (*rpc_simple)(int, int, void *);
+        boolean_t       (*copyin)(mach_port_t, void *);
+        boolean_t       (*copyout)(mach_port_t, void *);
+        boolean_t       (*copyinstr)(mach_port_t, void *);
+        kern_return_t   (*thread_switch)(void *);
+        kern_return_t   (*thread_depress_abort)(mach_port_t);
+} *rpc_glue_vector_t;
+
+/*
+ * Macros used to dereference glue code ops vector -- note
+ * hard-wired references to global defined below.  Also note
+ * that most of the macros assume their caller has stacked
+ * the target args somewhere, so that they can pass just the
+ * address of the first arg to the short-circuited
+ * implementation.
+ */
+#define CAN_SHCIRCUIT(name)     (_rpc_glue_vector->name != 0)
+#define RPC_SIMPLE(port, rtn_num, argc, argv) \
+        ((*(_rpc_glue_vector->rpc_simple))(rtn_num, argc, (void *)(&(port))))
+#define COPYIN(map, from, to, count) \
+        ((*(_rpc_glue_vector->copyin))(map, (void *)(&(from))))
+#define COPYOUT(map, from, to, count) \
+        ((*(_rpc_glue_vector->copyout))(map, (void *)(&(from))))
+#define COPYINSTR(map, from, to, max, actual) \
+        ((*(_rpc_glue_vector->copyinstr))(map, (void *)(&(from))))
+#define THREAD_SWITCH(thread, option, option_time) \
+        ((*(_rpc_glue_vector->thread_switch))((void *)(&(thread))))
+#define THREAD_DEPRESS_ABORT(act)       \
+        ((*(_rpc_glue_vector->thread_depress_abort))(act))
+
+/*
+ * User machine dependent macros for mach rpc
+ */
+#define MACH_RPC(sig_ptr, sig_size, id, dest, arg_list)                    \
+        mach_rpc_trap(dest, id, (mach_rpc_signature_t) sig_ptr, sig_size)
+
+/*
+ * Kernel machine dependent macros for mach rpc
+ *
+ * User args (argv) begin two words above the frame pointer (past saved ebp 
+ * and return address) on the user stack. Return code is stored in register
+ * ecx, by convention (must be a caller-saves register, to survive return
+ * from server work function). The user space instruction pointer is eip,
+ * and the user stack pointer is uesp.
+ */
+#define MACH_RPC_ARGV(act)      ( (char *)(USER_REGS(act)->ebp + 8) )
+#define MACH_RPC_RET(act)       ( USER_REGS(act)->ecx )
+#define MACH_RPC_UIP(act)       ( USER_REGS(act)->eip )
+#define MACH_RPC_USP(act)       ( USER_REGS(act)->uesp )
+
+
+extern boolean_t        klcopyin(
+                                mach_port_t,
+                                void *);
+
+extern boolean_t        klcopyout(
+                                mach_port_t,
+                                void *);
+
+extern boolean_t        klcopyinstr(
+                                mach_port_t,
+                                void *);
+
+extern kern_return_t    klthread_switch(
+                                void *);
+
+/*
+ * The various bits of the type field of the routine_arg_descriptor
+ */
+
+/* The basic types */
+
+#define TYPE_SHIFT                      0
+#define MACH_RPC_PORT			(1 << TYPE_SHIFT)
+#define MACH_RPC_ARRAY                  (1 << (TYPE_SHIFT + 1))
+#define MACH_RPC_VARIABLE               (1 << (TYPE_SHIFT + 2))
+#define LAST_TYPE_BIT                   (TYPE_SHIFT+3)
+
+/* XXX Port arrays need not be variable arrays, as assumed below. Fixme. */
+#define MACH_RPC_ARRAY_FIX		(MACH_RPC_ARRAY)
+#define MACH_RPC_ARRAY_FIXED		(MACH_RPC_ARRAY)
+#define MACH_RPC_ARRAY_VAR		(MACH_RPC_ARRAY | MACH_RPC_VARIABLE)
+#define MACH_RPC_ARRAY_VARIABLE		(MACH_RPC_ARRAY | MACH_RPC_VARIABLE)
+#define MACH_RPC_PORT_ARRAY		(MACH_RPC_PORT  | MACH_RPC_ARRAY_VAR)
+
+/* Argument direction bits */
+
+#define DIRECT_SHIFT            	LAST_TYPE_BIT
+#define DIRECTION_SHIFT                 LAST_TYPE_BIT
+#define MACH_RPC_IN			(1 << DIRECTION_SHIFT)
+#define MACH_RPC_OUT			(1 << (DIRECTION_SHIFT + 1))
+#define LAST_DIRECT_BIT         	(DIRECTION_SHIFT + 2)
+#define LAST_DIRECTION_BIT              (DIRECTION_SHIFT + 2)
+
+#define MACH_RPC_INOUT			(MACH_RPC_IN | MACH_RPC_OUT)
+
+/* Persist and pointer bit */
+
+#define POINTER_SHIFT                   LAST_DIRECTION_BIT
+#define MACH_RPC_POINTER                (1 << POINTER_SHIFT)
+#define LAST_POINTER_BIT                (POINTER_SHIFT + 1)
+
+/* Port disposition bits */
+
+#define NAME_SHIFT                    	LAST_POINTER_BIT
+#define MACH_RPC_RECEIVE                (1 << NAME_SHIFT)
+#define MACH_RPC_SEND                   (2 << NAME_SHIFT)
+#define MACH_RPC_SEND_ONCE              (3 << NAME_SHIFT)
+#define LAST_NAME_BIT			(NAME_SHIFT + 2)
+
+#define ACTION_SHIFT			LAST_NAME_BIT
+#define MACH_RPC_MOVE                   (1 << ACTION_SHIFT)
+#define MACH_RPC_COPY                   (2 << ACTION_SHIFT)
+#define MACH_RPC_MAKE                   (3 << ACTION_SHIFT)
+#define LAST_ACTION_BIT                 (ACTION_SHIFT + 2)
+
+#define MACH_RPC_MOVE_RECEIVE		(MACH_RPC_MOVE | MACH_RPC_RECEIVE)
+#define MACH_RPC_MOVE_SEND		(MACH_RPC_MOVE | MACH_RPC_SEND)
+#define MACH_RPC_COPY_SEND		(MACH_RPC_COPY | MACH_RPC_SEND)
+#define MACH_RPC_MAKE_SEND		(MACH_RPC_MAKE | MACH_RPC_SEND)
+#define MACH_RPC_MOVE_SEND_ONCE		(MACH_RPC_MOVE | MACH_RPC_SEND_ONCE)
+#define MACH_RPC_MAKE_SEND_ONCE		(MACH_RPC_MAKE | MACH_RPC_SEND_ONCE)
+
+/* Hint for virtual vs. physical copy */ 
+
+#define OPTION_SHIFT                    LAST_ACTION_BIT
+#define MACH_RPC_PHYSICAL_COPY		(1 << OPTION_SHIFT)
+#define MACH_RPC_VIRTUAL_COPY		(1 << (OPTION_SHIFT + 1))
+#define LAST_OPTION_BIT                 (OPTION_SHIFT + 2)
+
+/* Deallocate? */
+
+#define DEALLOCATE_SHIFT                LAST_OPTION_BIT
+#define MACH_RPC_DEALLOCATE		(1 << DEALLOCATE_SHIFT)
+#define LAST_DEALLOCATE_BIT             (DEALLOCATE_SHIFT + 1)
+
+/* Argument is already on the stack */
+
+#define ONSTACK_SHIFT                   LAST_DEALLOCATE_BIT
+#define MACH_RPC_ONSTACK		(1 << ONSTACK_SHIFT)
+#define LAST_ONSTACK_BIT                (ONSTACK_SHIFT + 1)
+
+/* Is variable array bounded? Derived from type and arg.size */
+
+#define BOUND_SHIFT			LAST_ONSTACK_BIT
+#define MACH_RPC_BOUND			(1 << BOUND_SHIFT)
+#define MACH_RPC_UNBOUND		(0)
+#define BOUND				MACH_RPC_BOUND
+#define UNBND				MACH_RPC_UNBOUND
+#define LAST_BOUND_BIT			(BOUND_SHIFT + 1)
+
+/*
+ * Temporarily map old MiG names to the new names, until the 
+ * new MiG is ready. This allows us to continue developing the
+ * RPC path while MiG is being enhanced. *Temporary*
+ */
+#define OLD	
+#ifdef OLD
+#define ROUTINE_ARG_PORT	MACH_RPC_PORT
+#define ROUTINE_ARG_FIXED_ARRAY	MACH_RPC_ARRAY_FIXED
+#define	ROUTINE_ARG_VAR_ARRAY	MACH_RPC_ARRAY_VARIABLE
+
+#define	ROUTINE_ARG_IN		MACH_RPC_IN
+#define ROUTINE_ARG_OUT		MACH_RPC_OUT
+#define ROUTINE_ARG_INOUT	MACH_RPC_INOUT	
+
+#define direction		type
+#endif 	/* OLD */
+
+

+/*
+ * Basic mach rpc types.
+ */
+typedef unsigned int    routine_arg_type;
+typedef unsigned int	routine_arg_offset;
+typedef unsigned int	routine_arg_size;
+
+/*
+ * Definition for MIG-generated server stub routines.  These routines
+ * unpack the request message, call the server procedure, and pack the
+ * reply message.
+ */
+typedef void	(*mig_stub_routine_t) (mach_msg_header_t *InHeadP,
+				       mach_msg_header_t *OutHeadP);
+
+typedef mig_stub_routine_t mig_routine_t;
+
+/*
+ * Definition for MIG-generated server routine.  This routine takes a
+ * message, and returns the appropriate stub function for handling that
+ * message.
+ */
+typedef mig_routine_t (*mig_server_routine_t) (mach_msg_header_t *InHeadP);
+
+
+/*
+ * Definition for server implementation routines.  This is the routine
+ * called by the MIG-generated server stub routine.
+ */
+typedef kern_return_t   (*mig_impl_routine_t)(void);
+
+/*
+ * Definitions for a signature's argument and routine descriptor's.
+ */
+struct routine_arg_descriptor {
+	routine_arg_type	type;	   /* Port, Array, etc. */
+        routine_arg_size        size;      /* element size in bytes */
+        routine_arg_size        count;     /* number of elements */
+	routine_arg_offset	offset;	   /* Offset in list of routine args */
+};
+typedef struct routine_arg_descriptor *routine_arg_descriptor_t;
+
+struct routine_descriptor {
+	mig_impl_routine_t	impl_routine;	/* Server work func pointer   */
+	mig_stub_routine_t	stub_routine;	/* Unmarshalling func pointer */
+	unsigned int		argc;		/* Number of argument words   */
+	unsigned int		descr_count;	/* Number of complex argument */
+					        /* descriptors                */
+	struct routine_arg_descriptor *
+				arg_descr;	/* Pointer to beginning of    */
+						/* the arg_descr array        */
+	unsigned int		max_reply_msg;	/* Max size for reply msg     */
+};
+typedef struct routine_descriptor *routine_descriptor_t;
+
+struct mach_rpc_signature {
+    struct routine_descriptor rd;
+    struct routine_arg_descriptor rad[1];
+};
+typedef struct mach_rpc_signature *mach_rpc_signature_t;
+
+/*
+ *	A subsystem describes a set of server routines that can be invoked by
+ *	mach_rpc() on the ports that are registered with the subsystem.  For
+ *	each routine, the routine number is given, along with the
+ *	address of the implementation function in the server and a
+ *	description of the arguments of the routine (it's "signature").
+ *
+ *	This structure definition is only a template for what is really a
+ *	variable-length structure (generated by MIG for each subsystem).
+ *	The actual structures do not always have one entry in the routine
+ *	array, and also have a varying number of entries in the arg_descr
+ *	array.  Each routine has an array of zero or more arg descriptors
+ *	one for each complex arg.  These arrays are all catenated together
+ *	to form the arg_descr field of the subsystem struct.  The
+ *	arg_descr field of each routine entry points to a unique sub-sequence
+ *	within this catenated array.  The goal is to keep everything
+ *	contiguous.
+ */
+struct rpc_subsystem {
+	struct subsystem *subsystem;	/* Reserved for system use */
+
+	mach_msg_id_t	start;		/* Min routine number */
+	mach_msg_id_t	end;		/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max mach_msg size */
+	vm_address_t	base_addr;	/* Address of this struct in user */
+
+	struct routine_descriptor	/* Array of routine descriptors */
+			routine[1       /* Actually, (start-end+1) */
+				 ];
+
+	struct routine_arg_descriptor
+			arg_descriptor[1   /* Actually, the sum of the descr_ */
+					]; /* count fields for all routines   */
+};
+typedef struct rpc_subsystem  *rpc_subsystem_t;
+
+#define RPC_SUBSYSTEM_NULL	((rpc_subsystem_t) 0)
+
+/*
+ * This structure is user-visible, both to user-mode RPC code
+ * and to kernel-loaded servers.
+ */
+typedef struct rpc_port {
+
+	/*
+	 * Initial sub-structure in common with ipc_pset and rpc_port
+	 * First element is an ipc_object
+	 */
+	struct ipc_common_data rpc_port_comm;
+
+	unsigned int rpc_unused_pad[1];	/* XXX unused */
+
+} *rpc_port_t;
+
+#define rp_object		rpc_port_comm.icd_object
+				/* access to rp_object internals not needed */
+#define rp_kobject		rpc_port_comm.icd_kobject
+#define rp_subsystem		rpc_port_comm.icd_subsystem
+#define rp_sobject		rpc_port_comm.icd_sobject
+#define rp_sbits		rpc_port_comm.icd_sbits
+#define rp_receiver_name	rpc_port_comm.icd_receiver_name
+
+
+/* 
+ * 	New RPC declarations
+ *
+ *	First pass at definitions and types for the new rpc service.
+ *	This is subject to revision.
+ */
+
+/*
+ *	RPC macros
+ */
+
+#define RPC_MASK(shift,last)                                            \
+        ( ((1 << ((last)-(shift)))-1) << (shift) )
+
+#define RPC_FIELD(field,shift,last)                                     \
+        ( (field) & (((1 << ((last)-(shift)))-1) << (shift)) )
+
+#define RPC_BOUND(dsc)                                                  \
+        (((RPC_FIELD((dsc).type,TYPE_SHIFT+1,TYPE_SHIFT+3) ==           \
+           MACH_RPC_ARRAY_VARIABLE) && (dsc).count != 0) ? MACH_RPC_BOUND : 0)
+
+#define ROUNDUP2(x,n)    ((((unsigned)(x)) + (n) - 1) & ~((n)-1))
+#define ROUNDWORD(x)    ROUNDUP2(x,sizeof(int))
+
+/*
+ *      RPC errors
+ *
+ *      Display and process errors of different severity, from just for
+ *      information only to fatal (panic). Error code colors indicate how
+ *      difficult it is for the subsystem to handle the error correctly.
+ *      The implication is that, for example, early versions of the code may
+ *      not be handling code red errors properly. The code should use this
+ *      facility instead of regular printf's.
+ */
+
+#define	MACH_RPC_DEBUG	1
+
+#define ERR_INFO        1               /* purely informational */
+#define ERR_GREEN       2               /* easily handled error */
+#define ERR_YELLOW      3               /* medium difficult error */
+#define ERR_RED         4               /* difficult to handle error */
+#define ERR_FATAL       5               /* unrecoverable error, panic */
+
+#if MACH_RPC_DEBUG > 1
+#define rpc_error(E,S)                                                  \
+        printf("RPC error ");                                           \
+        rpc_error_show_severity(S);                                     \
+        printf("in file \"%s\", line %d: ", __FILE__, __LINE__);        \
+        printf E ;                                                      \
+        printf("\n");                                                   \
+        rpc_error_severity(S)
+#else
+#define rpc_error(E,S)                                                  \
+	if ((S) == ERR_FATAL || (S) == ERR_RED) {			\
+        printf("RPC error ");                                           \
+        rpc_error_show_severity(S);                                     \
+        printf("in file \"%s\", line %d: ", __FILE__, __LINE__);        \
+        printf E ;                                                      \
+        printf("\n");                                                   \
+        rpc_error_severity(S);						\
+	}
+#endif	/* MACH_RPC_DEBUG */
+
+/*
+ *      RPC buffer size and break points
+ *
+ *      These values define the rpc buffer size on the kernel stack,
+ *      and break point values for switching to virtual copy (cow).
+ *      This should be in a machine dependent include file. All sizes
+ *      are in word (sizeof(int)) units.
+ */
+
+#define RPC_KBUF_SIZE   16              /* kernel stack buffer size (ints) */
+#define RPC_COW_SIZE    1024            /* size where COW is a win (ints) */
+#define RPC_DESC_COUNT  4               /* default descriptor count */
+
+
+/*
+ *      RPC copy state
+ *
+ *      Record the rpc copy state for arrays, so we can unwind our state
+ *      during error processing. There is one entry per complex (signatured)
+ *      argument. The first entry is marked COPY_TYPE_ALLOC_KRN if this record
+ *      itself was kalloc'd because the number of complex arg descriptors
+ *      exceeded the default value (RPC_DESC_COUNT). This is not a conflict
+ *      since the first argument is always the destination port, never an array.
+ */
+
+#define COPY_TYPE_NO_COPY               0       /* nothing special */
+#define COPY_TYPE_ON_KSTACK             1       /* array is on kernel stack */
+#define COPY_TYPE_ON_SSTACK             2       /* array is on server stack */
+#define COPY_TYPE_VIRTUAL_IN            3       /* vm_map_copyin part of cow */
+#define COPY_TYPE_VIRTUAL_OUT_SVR       4       /* map cpyout svr part of cow */
+#define COPY_TYPE_VIRTUAL_OUT_CLN       5       /* map cpyout cln part of cow */
+#define COPY_TYPE_ALLOC_KRN             6       /* kernel kalloc'd for array */
+#define COPY_TYPE_ALLOC_SVR             7       /* vm_alloc'd in server space */
+#define COPY_TYPE_ALLOC_CLN             8       /* vm_alloc'd in client space */
+#define COPY_TYPE_PORT                  9       /* plain port translated */
+#define COPY_TYPE_PORT_ARRAY            10      /* port array translated */
+
+
+/*
+ * 	RPC types
+ */
+
+typedef int 			mach_rpc_id_t;
+typedef int 			mach_rpc_return_t;
+typedef unsigned int		mach_rpc_size_t;
+typedef unsigned int		mach_rpc_offset_t;
+
+struct rpc_copy_state {
+        unsigned                copy_type;      /* what kind of copy */
+        vm_offset_t             alloc_addr;     /* address to free */
+};
+typedef struct rpc_copy_state *rpc_copy_state_t;
+typedef struct rpc_copy_state  rpc_copy_state_data_t;
+
+typedef boolean_t (*copyfunc_t)(const char *, char *, vm_size_t);
+
+
+/*
+ *	RPC function declarations
+ */
+
+#ifdef	MACH_KERNEL
+
+extern 
+mach_rpc_return_t	mach_rpc_trap(
+				mach_port_t		dest_port,
+				mach_rpc_id_t		routine_num,
+				mach_rpc_signature_t	signature_ptr,
+				mach_rpc_size_t 	signature_size );
+										
+extern 
+mach_rpc_return_t	mach_rpc_return_trap( void );
+
+extern 
+mach_rpc_return_t	mach_rpc_return_error( void );
+
+void			mach_rpc_return_wrapper( void );
+
+void            	rpc_upcall( 
+				vm_offset_t		stack,
+				vm_offset_t		new_stack, 
+				vm_offset_t		server_func, 
+				int 			return_code );
+
+void            	rpc_error_severity( int severity );
+void            	rpc_error_show_severity( int severity );
+unsigned int    	name_rpc_to_ipc( unsigned int action );
+
+void			clean_port_array(
+				ipc_object_t *		array,
+				unsigned		count,
+				unsigned		cooked,
+				unsigned		direct );
+
+void            	unwind_rpc_state( 
+				routine_descriptor_t	routine, 
+				rpc_copy_state_t	state, 
+				int * 			arg_buf );
+
+kern_return_t		unwind_invoke_state( 
+				thread_act_t		thr_act );
+
+kern_return_t   	rpc_invke_args_in( 
+				routine_descriptor_t	routine, 
+				rpc_copy_state_t	state,
+				int *			arg_buf,
+				copyfunc_t		infunc );
+
+kern_return_t   	rpc_invke_args_out( 
+				routine_descriptor_t	routine, 
+				rpc_copy_state_t	state,
+				int *			arg_buf, 
+				int ** 			new_sp,
+				copyfunc_t		outfunc );
+
+kern_return_t   	rpc_reply_args_in( 
+				routine_descriptor_t	routine, 
+				rpc_copy_state_t	state,
+				int *			svr_buf,
+				copyfunc_t		infunc );
+
+kern_return_t   	rpc_reply_args_out( 
+				routine_descriptor_t	routine, 
+				rpc_copy_state_t	state,
+				int *			svr_buf, 
+				int * 			cln_buf,
+				copyfunc_t		outfunc );
+
+#endif	/* MACH_KERNEL */
+
+#ifndef __alpha
+/*
+ * This is machine dependent and doesn't belong here.
+ * jfraser
+ */
+
+/*
+ * Glue function extern declarations
+ */
+extern kern_return_t	machine_rpc_simple(
+				int, 
+				int,
+				void *);
+
+extern kern_return_t	klthread_depress_abort(
+				mach_port_t);
+
+#endif /* __alpha */
+/*
+ * An rpc_glue_vector_t defined either by the kernel or by crt0
+ */
+extern rpc_glue_vector_t _rpc_glue_vector;
+
+/*
+ * libmach helper functions:
+ */
+extern rpc_subsystem_t	mach_subsystem_join(
+				rpc_subsystem_t,
+				rpc_subsystem_t,
+				unsigned int *,
+				void *(* )(int));
+
+
+/* Allocate memory for out-of-line mig structures */
+extern void mig_allocate(vm_address_t *, vm_size_t);
+
+/* Deallocate memory used for out-of-line mig structures */
+extern void mig_deallocate(vm_address_t, vm_size_t);
+
+
+
+
+#endif	/* _MACH_RPC_H_ */
+
+


Property changes on: trunk/sys/sys/mach/rpc.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/sched_prim.h
===================================================================
--- trunk/sys/sys/mach/sched_prim.h	                        (rev 0)
+++ trunk/sys/sys/mach/sched_prim.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,420 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.7.3.1  92/03/03  16:20:25  jeffreyh
+ * 	Changes from TRUNK
+ * 	[92/02/26  11:55:18  jeffreyh]
+ * 
+ * Revision 2.8  92/01/03  20:14:49  dbg
+ * 	Removed THREAD_SHOULD_TERMINATE (again).
+ * 	[91/12/19            dbg]
+ * 
+ * Revision 2.7  91/05/18  14:33:14  rpd
+ * 	Added recompute_priorities.
+ * 	[91/03/31            rpd]
+ * 
+ * Revision 2.6  91/05/14  16:46:40  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.5  91/03/16  14:51:26  rpd
+ * 	Added declarations of new functions.
+ * 	[91/02/24            rpd]
+ * 
+ * Revision 2.4  91/02/05  17:29:09  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  16:17:24  mrt]
+ * 
+ * Revision 2.3  90/06/02  14:56:03  rpd
+ * 	Updated to new scheduling technology.
+ * 	[90/03/26  22:17:10  rpd]
+ * 
+ * Revision 2.2  90/01/11  11:44:04  dbg
+ * 	Export thread_bind.
+ * 	[89/12/06            dbg]
+ * 
+ * Revision 2.1  89/08/03  15:53:39  rwd
+ * Created.
+ * 
+ * 29-Jun-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Removed THREAD_SHOULD_TERMINATE.
+ *
+ * 16-May-88  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Added thread_wakeup_with_result routine; thread_wakeup
+ *	is a special case.
+ *
+ * 16-Apr-88  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Added THREAD_RESTART wait result value.
+ *
+ * 29-Feb-88  David Black (dlb) at Carnegie-Mellon University
+ *	thread_setrun is now a real routine.
+ *
+ * 13-Oct-87  David Golub (dbg) at Carnegie-Mellon University
+ *	Moved thread_will_wait and thread_go to sched_prim_macros.h,
+ *	to avoid including thread.h everywhere.
+ *
+ *  5-Oct-87  David Golub (dbg) at Carnegie-Mellon University
+ *	Created.  Moved thread_will_wait and thread_go here from
+ *	mach_ipc.
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	sched_prim.h
+ *	Author:	David Golub
+ *
+ *	Scheduling primitive definitions file
+ *
+ */
+
+#ifndef	_KERN_SCHED_PRIM_H_
+#define _KERN_SCHED_PRIM_H_
+
+#include <sys/mach/vm_types.h>
+#include <sys/mach/kern_return.h>
+#include <compat/mach/kern_types.h>
+#include <sys/lock.h>
+#define MACH_LDEBUG 0
+
+
+
+typedef	void	*event_t;			/* wait event */
+typedef	void	(*continuation_t)(void);	/* continuation */
+typedef void (*unlock_fcn_t)(void * lock);
+
+/*
+ *	Exported interface to sched_prim.c.
+ *	A few of these functions are actually defined in
+ *	ipc_sched.c, for historical reasons.
+ */
+
+#if 0
+/* Initialize scheduler module */
+extern void		sched_init(void);
+
+/* Set timeout for current thread */
+extern void		thread_set_timeout(
+				int	t);	/* timeout interval in ticks */
+
+/* Called when timeout expires at splsoftclock */
+extern void		thread_timeout(
+				thread_t thread);
+
+/*
+ * Set up thread timeout element when thread is created.
+ */
+extern void		thread_timeout_setup(
+				thread_t	thread);
+
+/*
+ * Prevent a thread from restarting after it blocks interruptibly
+ */
+extern boolean_t	thread_stop( 
+				thread_t	thread);
+
+/*
+ * wait for a thread to stop
+ */
+extern boolean_t	thread_wait(
+				thread_t	thread);
+
+/*
+ * thread_stop a thread then wait for it to stop (both of the above)
+ */
+extern boolean_t	thread_stop_wait(
+				thread_t	thread);
+
+/*
+ * Cancel a stop and continue the thread if necessary.
+ */
+extern void		thread_unstop(
+				thread_t	thread);
+
+/* Declare thread will wait on a particular event */
+extern void		assert_wait(
+				event_t		event,
+				boolean_t	interruptible);
+
+/* Wake up locked thread directly, passing result */
+extern void		clear_wait_locked(
+				register thread_t	thread,
+				int			result,
+				boolean_t		interrupt_only);
+
+#define		clear_wait(Th,Res,Iable)			\
+		{	spl_t s = splsched();			\
+			thread_lock(Th);			\
+			clear_wait_locked(Th,Res,Iable);	\
+			thread_unlock(Th);			\
+			splx(s);				\
+		}
+
+
+/* Wake up thread (or threads) waiting on a particular event */
+extern void		thread_wakeup_prim(
+				event_t		event,
+				boolean_t	one_thread,
+#if	MACH_LDEBUG
+				int		result,
+				int		debug);
+#else
+				int		result);
+#endif
+
+
+#if	NCPUS > 1
+/* Bind thread to a particular processor */
+extern void		thread_bind(
+				thread_t	thread,
+				processor_t	processor);
+
+#define thread_bind_locked(thread,processor)	\
+		(thread)->bound_processor = (processor)
+
+#else	/*NCPUS > 1*/
+#define thread_bind(thread,processor)
+#define thread_bind_locked(thread,processor)
+#endif	/*NCPUS > 1*/
+
+/* Select a thread to run on a particular processor */
+extern thread_t		thread_select(
+				processor_t	myprocessor);
+
+/* Stop old thread and run new thread */
+extern void		thread_invoke(
+				thread_t	old_thread,
+				thread_t	new_thread,
+				int		reason);
+
+/* Called when current thread is given new stack */
+extern void		thread_continue(
+				thread_t	old_thread);
+
+/* Block current thread, indicating reason (Block or Quantum expiration) */
+extern void		thread_block_reason(
+				void	(*continuation)(void),
+				int	reason);
+
+/* Block current thread (Block reason) */
+extern void		thread_block(void);
+
+/* Switch directly to a particular thread */
+extern void		thread_run(
+				void	(*continuation)(void),
+				thread_t	new_thread);
+
+/* Dispatch a thread not on a run queue */
+extern void		thread_dispatch(
+				thread_t	thread);
+
+/* Make thread runnable */
+extern void		thread_setrun(
+				thread_t	th,
+				boolean_t	may_preempt,
+				boolean_t	tail);
+
+/* Invoke continuation */
+extern void		call_continuation(
+				void		(*continuation)(void));
+
+/* Compute effective priority of the specified thread */
+extern void		compute_priority(
+				thread_t	thread,
+			        int		resched);
+
+/* Version of compute_priority for current thread or
+ * thread being manipuldated by scheduler.
+ */
+extern void		compute_my_priority(
+				thread_t	thread);
+
+/* Recompute priorities of all threads (done periodically) */
+extern void		recompute_priorities(void);
+
+/* Update priority of thread that has been sleeping or suspended.
+ * Used to "catch up" with the system.
+ */
+extern void		update_priority(
+				thread_t	th);
+
+/* Idle thread loop */
+extern void		idle_thread(void);
+
+/* Scheduling thread loop */
+extern void		sched_thread(void);
+
+/*
+ *	Flags for thread_setrun()
+ */
+
+#define HEAD_Q	0	/* FALSE */
+#define TAIL_Q	1	/* TRUE */
+
+/*
+ *	Routines defined as macros
+ */
+
+#if	MACH_LDEBUG
+#define thread_wakeup(x)						\
+    	        thread_wakeup_prim((x), FALSE, THREAD_AWAKENED, FALSE)
+#define thread_wakeup_with_result(x, z)					\
+		thread_wakeup_prim((x), FALSE, (z), FALSE)
+#define thread_wakeup_one(x)						\
+		thread_wakeup_prim((x), TRUE, THREAD_AWAKENED, FALSE)
+#define	thread_wakeup_debug(x)						\
+		thread_wakeup_prim((x), FALSE, THREAD_AWAKENED, TRUE);
+#else  /* MACH_LDEBUG */
+#define thread_wakeup(x)						\
+    	        thread_wakeup_prim((x), FALSE, THREAD_AWAKENED)
+#define thread_wakeup_with_result(x, z)					\
+		thread_wakeup_prim((x), FALSE, (z))
+#define thread_wakeup_one(x)						\
+		thread_wakeup_prim((x), TRUE, THREAD_AWAKENED)
+#endif /* MACH_LDEBUG */
+
+/*
+ *	thread_sleep_mutex:
+ *
+ *	Cause the current thread to wait until the specified event
+ *	occurs.  The specified mutex is unlocked before releasing
+ *	the cpu.  (This is a convenient way to sleep without manually
+ *	calling assert_wait).
+ */
+
+#define thread_sleep_mutex(event,lock,interruptible)			\
+	MACRO_BEGIN							\
+	assert_wait(event, interruptible);	/* assert event */	\
+	mutex_unlock(lock);			/* release the lock */	\
+	thread_block();	/* block ourselves */	\
+	MACRO_END
+
+/*
+ *	thread_sleep_simple_lock:
+ *
+ *	Cause the current thread to wait until the specified event
+ *	occurs.  The specified simple_lock is unlocked before releasing
+ *	the cpu.  (This is a convenient way to sleep without manually
+ *	calling assert_wait).
+ */
+
+#define thread_sleep_simple_lock(event,lock,interruptible)		\
+	MACRO_BEGIN							\
+	assert_wait(event, interruptible);	/* assert event */	\
+	simple_unlock(lock);			/* release the lock */	\
+	thread_block();	/* block ourselves */	\
+	MACRO_END
+
+/*
+ *	thread_sleep_interlock:
+ *
+ *	Cause the current thread to wait until the specified event
+ *	occurs.  The specified HW interlock is unlocked before releasing
+ *	the cpu.  (This is a convenient way to sleep without manually
+ *	calling assert_wait).
+ */
+
+#define thread_sleep_interlock(event,lock,interruptible)		\
+	MACRO_BEGIN							\
+	assert_wait(event, interruptible);	/* assert event */	\
+	interlock_unlock(lock);			/* release the lock */	\
+	thread_block();	/* block ourselves */	\
+	MACRO_END
+
+/*
+ *	Machine-dependent code must define these functions.
+ */
+
+/* Start thread running */
+extern void	thread_bootstrap_return(void);
+
+/* Return from exception */
+extern void	thread_exception_return(void);
+
+extern thread_t	switch_context(
+			thread_t	old_thread,
+			void		(*continuation)(void),
+			thread_t	new_thread);
+
+/* Attach stack to thread */
+extern void	machine_kernel_stack_init(
+			thread_t	thread,
+			void		(*continuation)(void));
+
+extern void	load_context(
+			thread_t	thread);
+
+extern thread_act_t	switch_act(
+				thread_act_t	act);
+
+extern void	machine_switch_act(
+			thread_t	thread,
+			thread_act_t	old,
+			thread_act_t	new,
+			unsigned	cpu);
+
+/*
+ *	These functions are either defined in kern/thread.c
+ *	or are defined directly by machine-dependent code.
+ */
+
+/* Allocate an activation stack */
+extern vm_offset_t stack_alloc(void);
+
+/* Free an activation stack */
+extern void	stack_free(
+			vm_offset_t	stack);
+
+/* Collect excess kernel stacks */
+extern void	stack_collect(void);
+#endif
+
+#endif	
+
+/* _KERN_SCHED_PRIM_H_ */


Property changes on: trunk/sys/sys/mach/sched_prim.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/std_types.defs
===================================================================
--- trunk/sys/sys/mach/std_types.defs	                        (rev 0)
+++ trunk/sys/sys/mach/std_types.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2002,2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Mach kernel standard interface type declarations
+ */
+
+#ifndef	_MACH_STD_TYPES_DEFS_
+#define _MACH_STD_TYPES_DEFS_
+
+/* from ISO/IEC 988:1999 spec */
+/* 7.18.1.1 Exact-width integer types */
+
+type int8_t = MACH_MSG_TYPE_INTEGER_8;
+type uint8_t = MACH_MSG_TYPE_INTEGER_8;
+type int16_t = MACH_MSG_TYPE_INTEGER_16;
+type uint16_t = MACH_MSG_TYPE_INTEGER_16;
+type int32_t = MACH_MSG_TYPE_INTEGER_32;
+type uint32_t = MACH_MSG_TYPE_INTEGER_32;
+type int64_t = MACH_MSG_TYPE_INTEGER_64;
+type uint64_t = MACH_MSG_TYPE_INTEGER_64;
+
+/*
+ * Legacy fixed-length Mach types which should
+ * be replaced with the Standard types from above.
+ */
+type int32 = int32_t;
+type unsigned32 = uint32_t;
+type int64 = int64_t;
+type unsigned64 = uint64_t;
+
+/*
+ * Other fixed length Mach types.
+ */
+type char = MACH_MSG_TYPE_CHAR;
+type boolean_t = MACH_MSG_TYPE_BOOLEAN;
+
+#include <sys/mach/machine_types.defs>
+
+type kern_return_t = int;
+
+type pointer_t = ^array[] of MACH_MSG_TYPE_BYTE
+	ctype: vm_offset_t;
+
+
+type mach_port_t = MACH_MSG_TYPE_COPY_SEND;
+type mach_port_array_t = array[] of mach_port_t;
+
+type mach_port_name_t = MACH_MSG_TYPE_PORT_NAME;
+type mach_port_name_array_t = array[] of mach_port_name_t;
+
+type mach_port_right_t = natural_t;
+
+type mach_port_type_t = natural_t;
+type mach_port_type_array_t = array[] of mach_port_type_t;
+
+type mach_port_urefs_t = natural_t;
+type mach_port_delta_t = integer_t;
+type mach_port_seqno_t = natural_t;
+type mach_port_mscount_t = unsigned;
+type mach_port_msgcount_t = unsigned;
+type mach_port_rights_t = unsigned;
+type mach_msg_id_t = integer_t;
+type mach_msg_size_t = natural_t;
+type mach_msg_type_name_t = unsigned;
+type mach_msg_options_t = integer_t;
+
+type mach_port_move_receive_t =		MACH_MSG_TYPE_MOVE_RECEIVE
+	ctype: mach_port_t;
+type mach_port_copy_send_t =		MACH_MSG_TYPE_COPY_SEND
+	ctype: mach_port_t;
+type mach_port_make_send_t =		MACH_MSG_TYPE_MAKE_SEND
+	ctype: mach_port_t;
+type mach_port_move_send_t =		MACH_MSG_TYPE_MOVE_SEND
+	ctype: mach_port_t;
+type mach_port_make_send_once_t =	MACH_MSG_TYPE_MAKE_SEND_ONCE
+	ctype: mach_port_t;
+type mach_port_move_send_once_t =	MACH_MSG_TYPE_MOVE_SEND_ONCE
+	ctype: mach_port_t;
+
+type mach_port_receive_t =		MACH_MSG_TYPE_PORT_RECEIVE
+	ctype: mach_port_t;
+type mach_port_send_t =			MACH_MSG_TYPE_PORT_SEND
+	ctype: mach_port_t;
+type mach_port_send_once_t =		MACH_MSG_TYPE_PORT_SEND_ONCE
+	ctype: mach_port_t;
+
+type mach_port_poly_t = polymorphic
+	ctype: mach_port_t;
+
+import <sys/mach/std_types.h>;
+import <sys/mach/mig.h>;
+
+#endif	/* _MACH_STD_TYPES_DEFS_ */
+
+/* vim: set ft=c : */

Added: trunk/sys/sys/mach/std_types.h
===================================================================
--- trunk/sys/sys/mach/std_types.h	                        (rev 0)
+++ trunk/sys/sys/mach/std_types.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,182 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/06/25  10:30:50  rpd
+ * 	Added ipc/ipc_port.h inside the kernel.
+ * 	[91/05/27            rpd]
+ * 
+ * Revision 2.3  91/05/14  16:59:01  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.2  91/02/05  17:35:39  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:20:57  mrt]
+ * 
+ * Revision 2.1  89/08/03  16:04:44  rwd
+ * Created.
+ * 
+ * Revision 2.3  89/02/25  18:40:23  gm0w
+ * 	Changes for cleanup.
+ * 
+ * Revision 2.2  89/01/15  16:31:59  rpd
+ * 	Moved from kern/ to mach/.
+ * 	[89/01/15  14:34:14  rpd]
+ * 
+ * Revision 2.2  89/01/12  07:59:07  rpd
+ * 	Created.
+ * 	[89/01/12  04:15:40  rpd]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Mach standard external interface type definitions.
+ *
+ */
+
+#ifndef	STD_TYPES_H_
+#define	STD_TYPES_H_
+#define MACH_KDB 0
+#define MACH_COUNTERS 0
+#define ZONE_DEBUG 0
+#include <sys/mach/kern_return.h>
+#include <sys/mach/port.h>
+#include <sys/mach/vm_types.h>
+
+#ifdef _KERNEL
+#include <sys/mach/mach_vm.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+
+
+#ifndef MACH_VERBOSE_DEBUGGING
+#define MACH_VERBOSE_DEBUGGING 0
+#endif
+
+#ifndef MDPRINTF
+#if MACH_VERBOSE_DEBUGGING
+#define MDPRINTF(x) printf x
+#else
+#define MDPRINTF(...)
+#endif
+#endif
+
+
+#define decl_mutex_data(__annot, __lock) __annot struct mtx __lock;
+#define assert(exp) KASSERT(exp, (#exp))
+#define MACH_VERIFY(exp, str) do {					\
+		if (!(exp)) printf str;				\
+	} while (0) 
+#define mach_mutex_init(a, b) mtx_init(a, b, NULL, MTX_DEF|MTX_DUPOK)
+#define MACH_IPC_DEBUG 0
+#define MACH_DEBUG 0
+#define MACH_MACHINE_ROUTINES 0
+#define BYTE_SIZE NBBY
+#define THREAD_NULL NULL
+#define XK_PROXY 0
+#define NORMA_IPC 0
+#define VM_MAP_COPYIN_OPT_SRC_DESTROY 0
+#define VM_MAP_COPYIN_OPT_STEAL_PAGES 0
+#define VM_MAP_COPYIN_OPT_STEAL_PAGES 0
+#define VM_MAP_REMOVE_WAIT_FOR_KWIRE 0
+#define VM_MAP_REMOVE_INTERRUPTIBLE 0
+#define page_aligned(addr) ((addr & PAGE_MASK) == 0)
+/* XXX FIX THIS */
+#define zinit(size1, sizemax, size2, name) uma_zcreate(name, size1, NULL, NULL, NULL, NULL, 0, 0)
+#define zone_change(zone, flag, val)
+#define kalloc(size) malloc(size, M_MACH_KALLOC, M_WAITOK)
+#define KALLOC(size, rt) ((vm_offset_t)malloc(size, M_MACH_KALLOC, M_WAITOK))
+#define kfree(ptr, size) free((void *)(ptr), M_MACH_KALLOC)
+#define KFREE(ptr, size, rt) free((void *)(ptr), M_MACH_KALLOC)
+#define copyinmsg copyin
+#define copyoutmsg copyout
+#if MACH_DEBUG && defined(INVARIANTS)
+#define UNSUPPORTED { panic("%s not supported", __FUNCTION__); return (KERN_NOT_SUPPORTED); }
+#elif defined(INVARIANTS)
+#define UNSUPPORTED { printf("%s not supported", __FUNCTION__); return (KERN_NOT_SUPPORTED); }
+#else
+#define UNSUPPORTED { return (KERN_NOT_SUPPORTED); }
+#endif
+/* drop reference */
+#define vm_map_copyin_page_list(map, addr, length, options, etc0, etc1) 0
+#define vm_map_deallocate(map)
+#define vm_object_pager_wakeup(map)
+#define ds_notify(map) 0
+#define ds_master_notify(map) 0
+#define vm_map_copy_steal_pages(copy)
+#define thread_deallocate(thread)
+#define task_name_deallocate(task)
+#define assert_wait(a, b)
+#define cpu_number() curcpu
+#define copyoutmap(a, b, c, d) copyout((const void *)b, (void *)c, d)
+#define copyinmap(a, b, c, d) copyin((const void *)b, (void *)c, d)
+
+#define vm_allocate mach_vm_allocate
+#define vm_deallocate mach_vm_deallocate
+
+#define decl_simple_lock_data(a, b) a struct mtx b;
+	
+#include <vm/vm.h>
+
+#define VM_MAP_COPY_PAGE_LIST_MAX	20
+#define	VM_MAP_COPY_PAGE_LIST_MAX_SIZE	(VM_MAP_COPY_PAGE_LIST_MAX * PAGE_SIZE)
+
+
+#include <sys/mach/macro_help.h>
+#else
+#define decl_simple_lock_data(a, b)
+#define decl_mutex_data(__annot, __lock)
+#endif
+#endif	/* STD_TYPES_H_ */


Property changes on: trunk/sys/sys/mach/std_types.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/task.h
===================================================================
--- trunk/sys/sys/mach/task.h	                        (rev 0)
+++ trunk/sys/sys/mach/task.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,382 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6.4.3  92/09/15  17:23:01  jeffreyh
+ * 	Cleanup for profiling, dont include profil.h
+ * 	[92/07/24            bernadat]
+ * 
+ * Revision 2.6.4.2  92/05/27  00:46:27  jeffreyh
+ * 	Added mcmsg_task field to task in MCMSG ifdefs
+ * 	[regnier at ssd.intel.com]
+ * 
+ * Revision 2.6.4.1  92/02/18  19:11:41  jeffreyh
+ * 	New fields for profiling
+ * 	(Bernard Tabib & Andrei Danes @ gr.osf.org)
+ * 	[91/09/16            bernadat]
+ * 
+ * Revision 2.5.2.1  91/09/26  04:48:34  bernadat
+ * 	New fields for profiling
+ * 	(Bernard Tabib & Andrei Danes @ gr.osf.org)
+ * 	[91/09/16            bernadat]
+ * 
+ * Revision 2.6  91/11/15  14:11:16  rpd
+ * 	NORMA_TASK: added child_node field, which determines where child tasks
+ * 	are created for the given task. A value of -1 means local node.
+ * 	[91/09/23  09:19:35  jsb]
+ * 
+ * Revision 2.5  91/05/14  16:48:20  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.4  91/02/05  17:30:06  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  16:19:18  mrt]
+ * 
+ * Revision 2.3  90/06/02  14:56:48  rpd
+ * 	Removed kernel_vm_space, keep_wired.  They are no longer needed.
+ * 	[90/04/29            rpd]
+ * 	Converted to new IPC.
+ * 	[90/03/26  22:23:06  rpd]
+ * 
+ * Revision 2.2  89/09/08  11:26:47  dbg
+ * 	Add 'keep_wired' privilege field, to allow out-of-line data
+ * 	passed to task to remain wired.  Needed for default pager.
+ * 	Remove kernel_vm_space (not used).
+ * 	[89/07/17            dbg]
+ * 
+ * 19-Oct-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Removed all non-MACH data structures.
+ *
+ * Revision 2.6  88/09/25  22:16:41  rpd
+ * 	Changed port_cache fields/definitions to obj_cache.
+ * 	[88/09/24  18:13:13  rpd]
+ * 
+ * Revision 2.5  88/08/24  02:46:30  mwyoung
+ * 	Adjusted include file references.
+ * 	[88/08/17  02:24:13  mwyoung]
+ * 
+ * Revision 2.4  88/07/20  21:07:49  rpd
+ * Added ipc_task_lock/ipc_task_unlock definitions.
+ * Changes for port sets.
+ * Add ipc_next_name field, used for assigning local port names.
+ * 
+ * Revision 2.3  88/07/17  18:56:33  mwyoung
+ * .
+ * 
+ * Revision 2.2.2.1  88/06/28  20:02:03  mwyoung
+ * Cleaned up.  Replaced task_t->kernel_only with
+ * task_t->kernel_ipc_space, task_t->kernel_vm_space, and
+ * task_t->ipc_privilege, to prevent overloading errors.
+ * 
+ * Remove current_task() declaration.
+ * Eliminate paging_task.
+ * 
+ * Revision 2.2.1.2  88/06/26  00:45:49  rpd
+ * Changes for port sets.
+ * 
+ * Revision 2.2.1.1  88/06/23  23:32:38  rpd
+ * Add ipc_next_name field, used for assigning local port names.
+ * 
+ * 21-Jun-88  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Cleaned up.  Replaced task_t->kernel_only with
+ *	task_t->kernel_ipc_space, task_t->kernel_vm_space, and
+ *	task_t->ipc_privilege, to prevent overloading errors.
+ *
+ * 19-Apr-88  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Remove current_task() declaration.
+ *	Eliminate paging_task.
+ *
+ * 18-Jan-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Removed task_data (now is per_thread).  Added
+ *	task_bootstrap_port.  Added new routine declarations.
+ *	Removed wake_active (unused).  Added fields to accumulate
+ *	user and system time for terminated threads.
+ *
+ *  19-Feb-88 Douglas Orr (dorr) at Carnegie-Mellon University
+ *	Change emulation bit mask into vector of routine  addrs
+ *
+ *  27-Jan-87 Douglas Orr (dorr) at Carnegie-Mellon University
+ *	Add support for user space syscall emulation (bit mask
+ *	of enabled user space syscalls and user space emulation
+ *	routine).
+ *
+ *  3-Dec-87  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Change port cache account for per-task port names.
+ *	Should move IPC stuff to a separate file :-).
+ *	Add reply port for use by kernel-internal tasks.
+ *
+ *  2-Dec-87  David Black (dlb) at Carnegie-Mellon University
+ *	Added active field.
+ *
+ * 18-Nov-87  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Eliminate conditionals, flush history.
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	task.h
+ *	Author:	Avadis Tevanian, Jr.
+ *
+ *	This file contains the structure definitions for tasks.
+ *
+ */
+/*
+ * Copyright (c) 1993 The University of Utah and
+ * the Computer Systems Laboratory (CSL).  All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist at cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ */
+
+#ifndef	_KERN_TASK_H_
+#define _KERN_TASK_H_
+#if 0
+#include <mach_host.h>
+#include <fast_tas.h>
+#include <task_swapper.h>
+#endif
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+
+#include <sys/mach/port.h>
+#include <sys/mach/time_value.h>
+#include <sys/mach/message.h>
+
+#if 0
+#include <sys/mach/mach_param.h>
+#endif
+#include <sys/mach/task_info.h>
+#include <sys/mach/exception.h>
+
+#include <compat/mach/kern_types.h>
+
+#if 0
+#include <mach_prof.h>
+#include <kern/lock.h>
+#include <kern/syscall_emulation.h>
+#include <vm/vm_map.h>
+#endif
+#include <sys/mach/queue.h>
+
+#define MACH_HOST 1
+#define MACH_PROF 0
+#define NORMA_TASK 0
+#define FAST_TAS 0
+#define TASK_SWAPPER  0
+
+#include <sys/mach/mach_types.h>
+#include <sys/mach/mach_param.h>
+
+
+extern ipc_port_t convert_task_to_port(task_t);
+extern ipc_port_t convert_task_name_to_port(task_name_t);
+extern ipc_port_t convert_task_suspension_token_to_port(task_suspension_token_t task);
+
+/* Convert from a port (in this case, an SO right to a task's resume port) to a task. */
+extern task_suspension_token_t convert_port_to_task_suspension_token(ipc_port_t port);
+
+
+typedef struct mach_task {
+	/* Synchronization/destruction information */
+	decl_mutex_data(,lock)		/* Task's lock */
+	int		ref_count;	/* Number of references to me */
+	boolean_t	active;		/* Task has not been terminated */
+	boolean_t	kernel_loaded;	/* Created with kernel_task_create() */
+
+	struct ipc_space *itk_space;
+	uint64_t		itk_uniqueid;
+	uint64_t		itk_puniqueid;
+	decl_mutex_data(,itk_lock_data)
+
+	/* IPC structures */
+	struct exception_action exc_actions[EXC_TYPES_COUNT];
+		 			/* a send right each valid element  */
+	struct ipc_port *itk_self;	/* not a right, doesn't hold ref */
+	struct ipc_port *itk_nself;	/* not a right, doesn't hold ref */
+	struct ipc_port *itk_sself;	/* a send right */
+	struct ipc_port *itk_host;	/* a send right */
+	struct ipc_port *itk_bootstrap;	/* a send right */
+	struct ipc_port *itk_seatbelt;	/* a send right */
+	struct ipc_port *itk_gssd;	/* yet another send right */
+	struct ipc_port *itk_debug_control; /* send right for debugmode communications */
+	struct ipc_port *itk_task_access; /* and another send right */ 
+	struct ipc_port *itk_resume;	/* a receive right to resume this task */
+	struct ipc_port *itk_registered[TASK_PORT_REGISTER_MAX];
+					/* all send rights */
+
+        /* Ledgers */
+	struct proc *itk_p;
+
+	/* Active activations in this task */
+	int		thr_act_count;
+	int		res_act_count;
+	struct mtx		act_list_lock;	/* XXX act_list lock */
+	int		priority;		/* for new threads */
+	int		max_priority;		/* maximum priority */
+	int		sched_data;		/* for use by policy */
+	int		policy;			/* scheduling policy */
+	processor_set_t	processor_set;	/* processor set for new threads */
+
+	/* Task security token */
+	security_token_t sec_token;
+	audit_token_t audit_token;
+	/* Synchronizer ownership information */
+	queue_head_t	semaphore_list;		/* list of owned semaphores   */
+	int		semaphores_owned;	/* number of semaphores owned */
+
+	int		messages_received;
+	
+#ifdef notyet	/* Active activations in this task */
+	queue_head_t	thr_acts;	/* list of thread_activations */
+	int		thr_act_count;
+	queue_head_t	thr_acts;	/* list of thread_activations */
+	int		res_act_count;
+	mutex_t		act_list_lock;	/* XXX act_list lock */
+
+
+	/* Miscellaneous */
+	vm_map_t	map;		/* Address space description */
+	queue_chain_t	pset_tasks;	/* list of tasks assigned to pset */
+	void		*user_data;	/* Arbitrary data settable via IPC */
+	int		suspend_count;	/* Internal scheduling only */
+
+	/* User-visible scheduling information */
+	int		user_stop_count;	/* outstanding stops */
+        
+	/* Statistics */
+	time_value_t	total_user_time;
+				/* total user time for dead threads */
+	time_value_t	total_system_time;
+				/* total system time for dead threads */
+
+	/* RPC subsystem information */
+	queue_head_t	subsystem_list;	/* list of subsystems */
+	int		subsystem_count;/* number of subsystems */
+
+	queue_head_t	lock_set_list;		/* list of owned lock sets    */
+	int 		lock_sets_owned;	/* number of lock sets owned  */
+
+	/* User space system call emulation support */
+	struct 	eml_dispatch	*eml_dispatch;
+
+	MACHINE_TASK
+#endif
+} Task;
+
+#define TASK_NULL	((task_t) 0)
+
+typedef	mach_port_t *task_array_t;
+typedef	mach_port_t *task_port_array_t;
+
+#define task_lock(task)		mtx_lock(&(task)->lock)
+#define task_lock_try(task)	mtx_trylock(&(task)->lock)
+#define task_unlock(task)	mtx_unlock(&(task)->lock)
+
+#define	itk_lock_init(task)	mach_mutex_init(&(task)->itk_lock_data, \
+					   "ETAP_THREAD_TASK_ITK")
+#define	itk_lock(task)		mtx_lock(&(task)->itk_lock_data)
+#define	itk_unlock(task)	mtx_unlock(&(task)->itk_lock_data)
+
+/*
+ *	Internal only routines
+ */
+
+/* Initialize task module */
+extern void		task_init(void);
+
+/* task create */
+extern kern_return_t	task_create_local(
+				task_t		parent_task,
+				boolean_t	inherit_memory,
+				boolean_t	kernel_loaded,
+				task_t		*child_task);	/* OUT */
+
+/* Take reference on task (make sure it doesn't go away) */
+extern void		task_reference(
+				task_t	task);
+
+/* Remove reference to task */
+extern void		task_deallocate(
+				task_t	task);
+
+/* Set tasks max priority (does not affect threads within task) */
+extern kern_return_t	task_max_priority(
+				task_t		task,
+				processor_set_t	pset,
+				int		max_priority);
+
+#if	MACH_HOST
+/* Freeze and unfreeze task from being reassigned processor sets */
+extern void		task_freeze(
+				task_t		task);
+
+extern void		task_unfreeze(
+				task_t		task);
+#endif	/* MACH_HOST */
+
+extern void		consider_task_collect(void);
+
+extern task_t		kernel_task;
+
+#endif	/* _KERN_TASK_H_ */


Property changes on: trunk/sys/sys/mach/task.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/task_info.h
===================================================================
--- trunk/sys/sys/mach/task_info.h	                        (rev 0)
+++ trunk/sys/sys/mach/task_info.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,389 @@
+/*
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ *	Machine-independent task information structures and definitions.
+ *
+ *	The definitions in this file are exported to the user.  The kernel
+ *	will translate its internal data structures to these structures
+ *	as appropriate.
+ *
+ */
+
+#ifndef	_MACH_TASK_INFO_H_
+#define	_MACH_TASK_INFO_H_
+
+#include <sys/mach/message.h>
+#include <sys/mach/vm_types.h>
+#include <sys/mach/time_value.h>
+#include <sys/mach/policy.h>
+#include <sys/mach/vm_statistics.h> /* for vm_extmod_statistics_data_t */
+#ifndef _KERNEL
+#include <Availability.h>
+#endif
+#include <sys/cdefs.h>
+
+/*
+ *	Generic information structure to allow for expansion.
+ */
+typedef	natural_t	task_flavor_t;
+typedef	integer_t	*task_info_t;		/* varying array of int */
+
+/* Deprecated, use per structure _data_t's instead */
+#define	TASK_INFO_MAX	(1024)		/* maximum array size */
+typedef	integer_t	task_info_data_t[TASK_INFO_MAX];
+
+/*
+ *	Currently defined information structures.
+ */
+
+#pragma pack(4)
+
+/* Don't use this, use MACH_TASK_BASIC_INFO instead */
+#define TASK_BASIC_INFO_32      4       /* basic information */
+#define TASK_BASIC2_INFO_32      6
+
+struct task_basic_info_32 {
+        integer_t       suspend_count;  /* suspend count for task */
+        natural_t       virtual_size;   /* virtual memory size (bytes) */
+        natural_t       resident_size;  /* resident memory size (bytes) */
+        time_value_t    user_time;      /* total user run time for
+                                           terminated threads */
+        time_value_t    system_time;    /* total system run time for
+                                           terminated threads */
+	policy_t	policy;		/* default policy for new threads */
+};
+typedef struct task_basic_info_32       task_basic_info_32_data_t;
+typedef struct task_basic_info_32       *task_basic_info_32_t;
+#define TASK_BASIC_INFO_32_COUNT   \
+                (sizeof(task_basic_info_32_data_t) / sizeof(natural_t))
+
+/* Don't use this, use MACH_TASK_BASIC_INFO instead */
+struct task_basic_info_64 {
+        integer_t       suspend_count;  /* suspend count for task */
+        mach_vm_size_t  virtual_size;   /* virtual memory size (bytes) */
+        mach_vm_size_t  resident_size;  /* resident memory size (bytes) */
+        time_value_t    user_time;      /* total user run time for
+                                           terminated threads */
+        time_value_t    system_time;    /* total system run time for
+                                           terminated threads */
+	policy_t	policy;		/* default policy for new threads */
+};
+typedef struct task_basic_info_64       task_basic_info_64_data_t;
+typedef struct task_basic_info_64       *task_basic_info_64_t;
+
+#define TASK_BASIC_INFO_64      5       /* 64-bit capable basic info */
+#define TASK_BASIC_INFO_64_COUNT   \
+                (sizeof(task_basic_info_64_data_t) / sizeof(natural_t))
+
+
+/* localized structure - cannot be safely passed between tasks of differing sizes */
+/* Don't use this, use MACH_TASK_BASIC_INFO instead */
+struct task_basic_info {
+        integer_t       suspend_count;  /* suspend count for task */
+        vm_size_t       virtual_size;   /* virtual memory size (bytes) */
+        vm_size_t       resident_size;  /* resident memory size (bytes) */
+        time_value_t    user_time;      /* total user run time for
+                                           terminated threads */
+        time_value_t    system_time;    /* total system run time for
+                                           terminated threads */
+	policy_t	policy;		/* default policy for new threads */
+};
+
+typedef struct task_basic_info          task_basic_info_data_t;
+typedef struct task_basic_info          *task_basic_info_t;
+#define TASK_BASIC_INFO_COUNT   \
+                (sizeof(task_basic_info_data_t) / sizeof(natural_t))
+#if !defined(__LP64__)
+#define TASK_BASIC_INFO TASK_BASIC_INFO_32
+#else
+#define TASK_BASIC_INFO TASK_BASIC_INFO_64
+#endif
+
+
+
+#define	TASK_EVENTS_INFO	2	/* various event counts */
+
+struct task_events_info {
+	integer_t	faults;		/* number of page faults */
+	integer_t 	pageins;	/* number of actual pageins */
+	integer_t 	cow_faults;	/* number of copy-on-write faults */
+	integer_t 	messages_sent;	/* number of messages sent */
+	integer_t 	messages_received; /* number of messages received */
+        integer_t 	syscalls_mach;  /* number of mach system calls */
+	integer_t 	syscalls_unix;  /* number of unix system calls */
+	integer_t 	csw;            /* number of context switches */
+};
+typedef struct task_events_info		task_events_info_data_t;
+typedef struct task_events_info		*task_events_info_t;
+#define	TASK_EVENTS_INFO_COUNT		((mach_msg_type_number_t) \
+		(sizeof(task_events_info_data_t) / sizeof(natural_t)))
+
+#define	TASK_THREAD_TIMES_INFO	3	/* total times for live threads -
+					   only accurate if suspended */
+
+struct task_thread_times_info {
+	time_value_t	user_time;	/* total user run time for
+					   live threads */
+	time_value_t	system_time;	/* total system run time for
+					   live threads */
+};
+
+typedef struct task_thread_times_info	task_thread_times_info_data_t;
+typedef struct task_thread_times_info	*task_thread_times_info_t;
+#define	TASK_THREAD_TIMES_INFO_COUNT	((mach_msg_type_number_t) \
+		(sizeof(task_thread_times_info_data_t) / sizeof(natural_t)))
+
+#define TASK_ABSOLUTETIME_INFO	1
+
+struct task_absolutetime_info {
+	uint64_t		total_user;
+	uint64_t		total_system;
+	uint64_t		threads_user;	/* existing threads only */
+	uint64_t		threads_system;
+};
+
+typedef struct task_absolutetime_info	task_absolutetime_info_data_t;
+typedef struct task_absolutetime_info	*task_absolutetime_info_t;
+#define TASK_ABSOLUTETIME_INFO_COUNT	((mach_msg_type_number_t) \
+		(sizeof (task_absolutetime_info_data_t) / sizeof (natural_t)))
+
+#define TASK_KERNELMEMORY_INFO	7
+
+struct task_kernelmemory_info {
+	uint64_t		total_palloc;	/* private kernel mem alloc'ed */
+	uint64_t		total_pfree;	/* private kernel mem freed */
+	uint64_t		total_salloc;	/* shared kernel mem alloc'ed */
+	uint64_t		total_sfree;	/* shared kernel mem freed */
+};
+
+typedef struct task_kernelmemory_info	task_kernelmemory_info_data_t;
+typedef struct task_kernelmemory_info	*task_kernelmemory_info_t;
+#define TASK_KERNELMEMORY_INFO_COUNT	((mach_msg_type_number_t) \
+		(sizeof (task_kernelmemory_info_data_t) / sizeof (natural_t)))
+
+#define TASK_SECURITY_TOKEN		13
+#define TASK_SECURITY_TOKEN_COUNT	((mach_msg_type_number_t) \
+		(sizeof(security_token_t) / sizeof(natural_t)))
+
+#define TASK_AUDIT_TOKEN		15
+#define TASK_AUDIT_TOKEN_COUNT	\
+		(sizeof(audit_token_t) / sizeof(natural_t))
+
+
+#define TASK_AFFINITY_TAG_INFO		16 	/* This is experimental. */
+
+struct task_affinity_tag_info {
+	integer_t		set_count;
+	integer_t		min;
+	integer_t		max;
+	integer_t		task_count;
+};
+typedef struct task_affinity_tag_info	task_affinity_tag_info_data_t;
+typedef struct task_affinity_tag_info	*task_affinity_tag_info_t;
+#define TASK_AFFINITY_TAG_INFO_COUNT	\
+		(sizeof(task_affinity_tag_info_data_t) / sizeof(natural_t))
+
+#define TASK_DYLD_INFO			17
+
+struct task_dyld_info {
+	mach_vm_address_t	all_image_info_addr;
+	mach_vm_size_t		all_image_info_size;
+	integer_t		all_image_info_format;		
+};
+typedef struct task_dyld_info	task_dyld_info_data_t;
+typedef struct task_dyld_info	*task_dyld_info_t;
+#define TASK_DYLD_INFO_COUNT	\
+    		(sizeof(task_dyld_info_data_t) / sizeof(natural_t))
+#define TASK_DYLD_ALL_IMAGE_INFO_32	0	/* format value */
+#define TASK_DYLD_ALL_IMAGE_INFO_64	1	/* format value */
+
+
+#define TASK_EXTMOD_INFO			19
+
+struct task_extmod_info {
+	unsigned char	task_uuid[16];
+	vm_extmod_statistics_data_t		extmod_statistics;
+};
+typedef struct task_extmod_info	task_extmod_info_data_t;
+typedef struct task_extmod_info	*task_extmod_info_t;
+#define TASK_EXTMOD_INFO_COUNT	\
+    		(sizeof(task_extmod_info_data_t) / sizeof(natural_t))
+
+
+#define MACH_TASK_BASIC_INFO     20         /* always 64-bit basic info */
+struct mach_task_basic_info {
+        mach_vm_size_t  virtual_size;       /* virtual memory size (bytes) */
+        mach_vm_size_t  resident_size;      /* resident memory size (bytes) */
+        mach_vm_size_t  resident_size_max;  /* maximum resident memory size (bytes) */
+        time_value_t    user_time;          /* total user run time for
+                                               terminated threads */
+        time_value_t    system_time;        /* total system run time for
+                                               terminated threads */
+        policy_t        policy;             /* default policy for new threads */
+        integer_t       suspend_count;      /* suspend count for task */
+};
+typedef struct mach_task_basic_info       mach_task_basic_info_data_t;
+typedef struct mach_task_basic_info       *mach_task_basic_info_t;
+#define MACH_TASK_BASIC_INFO_COUNT   \
+                (sizeof(mach_task_basic_info_data_t) / sizeof(natural_t))
+
+
+#define TASK_POWER_INFO	21
+
+struct task_power_info {
+	uint64_t		total_user;
+	uint64_t		total_system;
+	uint64_t		task_interrupt_wakeups;
+	uint64_t		task_platform_idle_wakeups;
+	uint64_t		task_timer_wakeups_bin_1;
+	uint64_t		task_timer_wakeups_bin_2;
+};
+
+typedef struct task_power_info	task_power_info_data_t;
+typedef struct task_power_info	*task_power_info_t;
+#define TASK_POWER_INFO_COUNT	((mach_msg_type_number_t) \
+		(sizeof (task_power_info_data_t) / sizeof (natural_t)))
+
+
+
+#define TASK_VM_INFO		22
+#define TASK_VM_INFO_PURGEABLE	23
+struct task_vm_info {
+        mach_vm_size_t  virtual_size;	    /* virtual memory size (bytes) */
+	integer_t	region_count;	    /* number of memory regions */
+	integer_t	page_size;
+        mach_vm_size_t  resident_size;	    /* resident memory size (bytes) */
+        mach_vm_size_t  resident_size_peak; /* peak resident size (bytes) */
+
+	mach_vm_size_t	device;
+	mach_vm_size_t	device_peak;
+	mach_vm_size_t	internal;
+	mach_vm_size_t	internal_peak;
+	mach_vm_size_t	external;
+	mach_vm_size_t	external_peak;
+	mach_vm_size_t	reusable;
+	mach_vm_size_t	reusable_peak;
+	mach_vm_size_t	purgeable_volatile_pmap;
+	mach_vm_size_t	purgeable_volatile_resident;
+	mach_vm_size_t	purgeable_volatile_virtual;
+	mach_vm_size_t	compressed;
+	mach_vm_size_t	compressed_peak;
+	mach_vm_size_t	compressed_lifetime;
+};
+typedef struct task_vm_info	task_vm_info_data_t;
+typedef struct task_vm_info	*task_vm_info_t;
+#define TASK_VM_INFO_COUNT	((mach_msg_type_number_t) \
+		(sizeof (task_vm_info_data_t) / sizeof (natural_t)))
+
+
+typedef struct vm_purgeable_info	task_purgable_info_t;
+
+
+#define TASK_TRACE_MEMORY_INFO  24
+struct task_trace_memory_info {
+	uint64_t  user_memory_address; 	/* address of start of trace memory buffer */
+	uint64_t  buffer_size;			/* size of buffer in bytes */
+	uint64_t  mailbox_array_size;	/* size of mailbox area in bytes */
+};
+typedef struct task_trace_memory_info task_trace_memory_info_data_t;
+typedef struct task_trace_memory_info * task_trace_memory_info_t;
+#define TASK_TRACE_MEMORY_INFO_COUNT  ((mach_msg_type_number_t) \
+		(sizeof(task_trace_memory_info_data_t) / sizeof(natural_t)))
+
+#define TASK_WAIT_STATE_INFO  25    /* deprecated. */
+struct task_wait_state_info {
+	uint64_t  total_wait_state_time;	/* Time that all threads past and present have been in a wait state */
+	uint64_t  total_wait_sfi_state_time;	/* Time that threads have been in SFI wait (should be a subset of total wait state time */
+	uint32_t  _reserved[4];
+};
+typedef struct task_wait_state_info task_wait_state_info_data_t;
+typedef struct task_wait_state_info * task_wait_state_info_t;
+#define TASK_WAIT_STATE_INFO_COUNT  ((mach_msg_type_number_t) \
+		(sizeof(task_wait_state_info_data_t) / sizeof(natural_t)))
+
+#define TASK_POWER_INFO_V2	26
+
+typedef struct {
+	uint64_t		task_gpu_utilisation;
+	uint64_t		task_gpu_stat_reserved0;
+	uint64_t		task_gpu_stat_reserved1;
+	uint64_t		task_gpu_stat_reserved2;
+} gpu_energy_data;
+
+typedef gpu_energy_data *gpu_energy_data_t;
+struct task_power_info_v2 {
+	task_power_info_data_t	cpu_energy;
+	gpu_energy_data gpu_energy;
+};
+
+typedef struct task_power_info_v2	task_power_info_v2_data_t;
+typedef struct task_power_info_v2	*task_power_info_v2_t;
+#define TASK_POWER_INFO_V2_COUNT	((mach_msg_type_number_t) \
+		(sizeof (task_power_info_v2_data_t) / sizeof (natural_t)))
+
+/*
+ * Obsolete interfaces.
+ */
+
+#define TASK_SCHED_TIMESHARE_INFO	10
+#define TASK_SCHED_RR_INFO		11
+#define TASK_SCHED_FIFO_INFO		12
+
+#define TASK_SCHED_INFO			14
+
+#pragma pack()
+
+#endif	/* _MACH_TASK_INFO_H_ */


Property changes on: trunk/sys/sys/mach/task_info.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/task_policy.h
===================================================================
--- trunk/sys/sys/mach/task_policy.h	                        (rev 0)
+++ trunk/sys/sys/mach/task_policy.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+#ifndef _MACH_TASK_POLICY_H_
+#define _MACH_TASK_POLICY_H_
+
+#include <sys/mach/mach_types.h>
+
+/*
+ * These are the calls for accessing the policy parameters
+ * of a particular task.
+ *
+ * The extra 'get_default' parameter to the second call is
+ * IN/OUT as follows:
+ * 1) if asserted on the way in it indicates that the default
+ * values should be returned, not the ones currently set, in
+ * this case 'get_default' will always be asserted on return;
+ * 2) if unasserted on the way in, the current settings are
+ * desired and if still unasserted on return, then the info
+ * returned reflects the current settings, otherwise if
+ * 'get_default' returns asserted, it means that there are no
+ * current settings due to other parameters taking precedence,
+ * and the default ones are being returned instead.
+ */
+
+typedef natural_t	task_policy_flavor_t;
+typedef integer_t	*task_policy_t;
+
+/*
+kern_return_t	task_policy_set(
+					task_t					task,
+					task_policy_flavor_t	flavor,
+					task_policy_t			policy_info,
+					mach_msg_type_number_t	count);
+
+kern_return_t	task_policy_get(
+					task_t					task,
+					task_policy_flavor_t	flavor,
+					task_policy_t			policy_info,
+					mach_msg_type_number_t	*count,
+					boolean_t				*get_default);
+*/
+
+/*
+ * Defined flavors.
+ */
+/*
+ * TASK_CATEGORY_POLICY:
+ *
+ * This provides information to the kernel about the role
+ * of the task in the system.
+ *
+ * Parameters:
+ *
+ * role: Enumerated as follows:
+ *
+ * TASK_UNSPECIFIED is the default, since the role is not
+ * inherited from the parent.
+ *
+ * TASK_FOREGROUND_APPLICATION should be assigned when the
+ * task is a normal UI application in the foreground from
+ * the HI point of view.
+ * **N.B. There may be more than one of these at a given time.
+ *
+ * TASK_BACKGROUND_APPLICATION should be assigned when the
+ * task is a normal UI application in the background from
+ * the HI point of view.
+ *
+ * TASK_CONTROL_APPLICATION should be assigned to the unique
+ * UI application which implements the pop-up application dialog.
+ * There can only be one task at a time with this designation,
+ * which is assigned FCFS.
+ *
+ * TASK_GRAPHICS_SERVER should be assigned to the graphics
+ * management (window) server.  There can only be one task at
+ * a time with this designation, which is assigned FCFS.
+ */
+
+#define TASK_CATEGORY_POLICY		1
+
+#define TASK_SUPPRESSION_POLICY		3
+#define TASK_POLICY_STATE		4
+#define TASK_BASE_QOS_POLICY		8
+#define TASK_OVERRIDE_QOS_POLICY	9
+#define TASK_BASE_LATENCY_QOS_POLICY	10
+#define TASK_BASE_THROUGHPUT_QOS_POLICY	11
+
+
+enum task_role {
+	TASK_RENICED = -1,
+	TASK_UNSPECIFIED = 0,
+	TASK_FOREGROUND_APPLICATION,
+	TASK_BACKGROUND_APPLICATION,
+	TASK_CONTROL_APPLICATION,
+	TASK_GRAPHICS_SERVER,
+	TASK_THROTTLE_APPLICATION,
+	TASK_NONUI_APPLICATION,
+	TASK_DEFAULT_APPLICATION
+};
+
+typedef integer_t	task_role_t;
+
+struct task_category_policy {
+	task_role_t		role;
+};
+
+typedef struct task_category_policy		task_category_policy_data_t;
+typedef struct task_category_policy		*task_category_policy_t;
+
+#define TASK_CATEGORY_POLICY_COUNT	((mach_msg_type_number_t) \
+	(sizeof (task_category_policy_data_t) / sizeof (integer_t)))
+
+
+enum task_latency_qos {
+	LATENCY_QOS_TIER_UNSPECIFIED = 0x0,
+	LATENCY_QOS_TIER_0 = ((0xFF<<16) | 1),
+	LATENCY_QOS_TIER_1 = ((0xFF<<16) | 2),
+	LATENCY_QOS_TIER_2 = ((0xFF<<16) | 3),
+	LATENCY_QOS_TIER_3 = ((0xFF<<16) | 4),
+	LATENCY_QOS_TIER_4 = ((0xFF<<16) | 5),
+	LATENCY_QOS_TIER_5 = ((0xFF<<16) | 6)
+
+};
+typedef integer_t	task_latency_qos_t;
+enum task_throughput_qos {
+	THROUGHPUT_QOS_TIER_UNSPECIFIED = 0x0,
+	THROUGHPUT_QOS_TIER_0 = ((0xFE<<16) | 1),
+	THROUGHPUT_QOS_TIER_1 = ((0xFE<<16) | 2),
+	THROUGHPUT_QOS_TIER_2 = ((0xFE<<16) | 3),
+	THROUGHPUT_QOS_TIER_3 = ((0xFE<<16) | 4),
+	THROUGHPUT_QOS_TIER_4 = ((0xFE<<16) | 5),
+	THROUGHPUT_QOS_TIER_5 = ((0xFE<<16) | 6),
+};
+
+#define LATENCY_QOS_LAUNCH_DEFAULT_TIER LATENCY_QOS_TIER_3
+#define THROUGHPUT_QOS_LAUNCH_DEFAULT_TIER THROUGHPUT_QOS_TIER_3
+
+typedef integer_t	task_throughput_qos_t;
+
+struct task_qos_policy {
+	task_latency_qos_t task_latency_qos_tier;
+	task_throughput_qos_t task_throughput_qos_tier;
+};
+
+typedef struct task_qos_policy *task_qos_policy_t;
+#define TASK_QOS_POLICY_COUNT	((mach_msg_type_number_t) \
+	(sizeof (struct task_qos_policy) / sizeof (integer_t)))
+
+/* These should be removed - they belong in proc_info.h */
+#define PROC_FLAG_DARWINBG           0x8000    /* process in darwin background */
+#define PROC_FLAG_EXT_DARWINBG		 0x10000   /* process in darwin background - external enforcement */
+#define PROC_FLAG_IOS_APPLEDAEMON    0x20000   /* process is apple ios daemon */
+#define PROC_FLAG_IOS_IMPPROMOTION   0x80000   /* process is apple ios daemon */
+#define PROC_FLAG_ADAPTIVE           0x100000  /* Process is adaptive */
+#define PROC_FLAG_ADAPTIVE_IMPORTANT 0x200000  /* Process is adaptive, and is currently important */
+#define PROC_FLAG_IMPORTANCE_DONOR   0x400000  /* Process is marked as an importance donor */
+#define PROC_FLAG_SUPPRESSED         0x800000  /* Process is suppressed */
+#define PROC_FLAG_APPLICATION        0x1000000 /* Process is an application */
+#define PROC_FLAG_IOS_APPLICATION PROC_FLAG_APPLICATION /* Process is an application */
+
+
+
+
+#endif	/* _MACH_TASK_POLICY_H_ */


Property changes on: trunk/sys/sys/mach/task_policy.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/task_server.h
===================================================================
--- trunk/sys/sys/mach/task_server.h	                        (rev 0)
+++ trunk/sys/sys/mach/task_server.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,2862 @@
+#ifndef	_task_server_
+#define	_task_server_
+
+/* Module task */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#ifdef _KERNEL
+#include <sys/mach/ndr.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#else /* !_KERNEL */
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#endif /*_KERNEL */
+
+#ifdef AUTOTEST
+#ifndef FUNCTION_PTR_T
+#define FUNCTION_PTR_T
+typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
+typedef struct {
+        char            *name;
+        function_ptr_t  function;
+} function_table_entry;
+typedef function_table_entry   *function_table_t;
+#endif /* FUNCTION_PTR_T */
+#endif /* AUTOTEST */
+
+#ifndef	task_MSG_COUNT
+#define	task_MSG_COUNT	42
+#endif	/* task_MSG_COUNT */
+
+#include <sys/mach/std_types.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc_mig.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach_debug/mach_debug_types.h>
+
+#ifdef __BeforeMigServerHeader
+__BeforeMigServerHeader
+#endif /* __BeforeMigServerHeader */
+
+
+/* Routine task_create */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_create
+#if	defined(LINTLIBRARY)
+    (target_task, ledgers, ledgersCnt, inherit_memory, child_task)
+	task_t target_task;
+	ledger_array_t ledgers;
+	mach_msg_type_number_t ledgersCnt;
+	boolean_t inherit_memory;
+	task_t *child_task;
+{ return task_create(target_task, ledgers, ledgersCnt, inherit_memory, child_task); }
+#else
+(
+	task_t target_task,
+	ledger_array_t ledgers,
+	mach_msg_type_number_t ledgersCnt,
+	boolean_t inherit_memory,
+	task_t *child_task
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_terminate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_terminate
+#if	defined(LINTLIBRARY)
+    (target_task)
+	task_t target_task;
+{ return task_terminate(target_task); }
+#else
+(
+	task_t target_task
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_threads */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_threads
+#if	defined(LINTLIBRARY)
+    (target_task, act_list, act_listCnt)
+	task_t target_task;
+	thread_act_array_t *act_list;
+	mach_msg_type_number_t *act_listCnt;
+{ return task_threads(target_task, act_list, act_listCnt); }
+#else
+(
+	task_t target_task,
+	thread_act_array_t *act_list,
+	mach_msg_type_number_t *act_listCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_ports_register */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_ports_register
+#if	defined(LINTLIBRARY)
+    (target_task, init_port_set, init_port_setCnt)
+	task_t target_task;
+	mach_port_array_t init_port_set;
+	mach_msg_type_number_t init_port_setCnt;
+{ return mach_ports_register(target_task, init_port_set, init_port_setCnt); }
+#else
+(
+	task_t target_task,
+	mach_port_array_t init_port_set,
+	mach_msg_type_number_t init_port_setCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_ports_lookup */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_ports_lookup
+#if	defined(LINTLIBRARY)
+    (target_task, init_port_set, init_port_setCnt)
+	task_t target_task;
+	mach_port_array_t *init_port_set;
+	mach_msg_type_number_t *init_port_setCnt;
+{ return mach_ports_lookup(target_task, init_port_set, init_port_setCnt); }
+#else
+(
+	task_t target_task,
+	mach_port_array_t *init_port_set,
+	mach_msg_type_number_t *init_port_setCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_info
+#if	defined(LINTLIBRARY)
+    (target_task, flavor, task_info_out, task_info_outCnt)
+	task_name_t target_task;
+	task_flavor_t flavor;
+	task_info_t task_info_out;
+	mach_msg_type_number_t *task_info_outCnt;
+{ return task_info(target_task, flavor, task_info_out, task_info_outCnt); }
+#else
+(
+	task_name_t target_task,
+	task_flavor_t flavor,
+	task_info_t task_info_out,
+	mach_msg_type_number_t *task_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_info
+#if	defined(LINTLIBRARY)
+    (target_task, flavor, task_info_in, task_info_inCnt)
+	task_t target_task;
+	task_flavor_t flavor;
+	task_info_t task_info_in;
+	mach_msg_type_number_t task_info_inCnt;
+{ return task_set_info(target_task, flavor, task_info_in, task_info_inCnt); }
+#else
+(
+	task_t target_task,
+	task_flavor_t flavor,
+	task_info_t task_info_in,
+	mach_msg_type_number_t task_info_inCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_suspend */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_suspend
+#if	defined(LINTLIBRARY)
+    (target_task)
+	task_t target_task;
+{ return task_suspend(target_task); }
+#else
+(
+	task_t target_task
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_resume */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_resume
+#if	defined(LINTLIBRARY)
+    (target_task)
+	task_t target_task;
+{ return task_resume(target_task); }
+#else
+(
+	task_t target_task
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_special_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_special_port
+#if	defined(LINTLIBRARY)
+    (task, which_port, special_port)
+	task_t task;
+	int which_port;
+	mach_port_t *special_port;
+{ return task_get_special_port(task, which_port, special_port); }
+#else
+(
+	task_t task,
+	int which_port,
+	mach_port_t *special_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_special_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_special_port
+#if	defined(LINTLIBRARY)
+    (task, which_port, special_port)
+	task_t task;
+	int which_port;
+	mach_port_t special_port;
+{ return task_set_special_port(task, which_port, special_port); }
+#else
+(
+	task_t task,
+	int which_port,
+	mach_port_t special_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine thread_create_from_user */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t thread_create_from_user
+#if	defined(LINTLIBRARY)
+    (parent_task, child_act)
+	task_t parent_task;
+	thread_act_t *child_act;
+{ return thread_create_from_user(parent_task, child_act); }
+#else
+(
+	task_t parent_task,
+	thread_act_t *child_act
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine thread_create_running_from_user */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t thread_create_running_from_user
+#if	defined(LINTLIBRARY)
+    (parent_task, flavor, new_state, new_stateCnt, child_act)
+	task_t parent_task;
+	thread_state_flavor_t flavor;
+	thread_state_t new_state;
+	mach_msg_type_number_t new_stateCnt;
+	thread_act_t *child_act;
+{ return thread_create_running_from_user(parent_task, flavor, new_state, new_stateCnt, child_act); }
+#else
+(
+	task_t parent_task,
+	thread_state_flavor_t flavor,
+	thread_state_t new_state,
+	mach_msg_type_number_t new_stateCnt,
+	thread_act_t *child_act
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_exception_ports
+#if	defined(LINTLIBRARY)
+    (task, exception_mask, new_port, behavior, new_flavor)
+	task_t task;
+	exception_mask_t exception_mask;
+	mach_port_t new_port;
+	exception_behavior_t behavior;
+	thread_state_flavor_t new_flavor;
+{ return task_set_exception_ports(task, exception_mask, new_port, behavior, new_flavor); }
+#else
+(
+	task_t task,
+	exception_mask_t exception_mask,
+	mach_port_t new_port,
+	exception_behavior_t behavior,
+	thread_state_flavor_t new_flavor
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_exception_ports
+#if	defined(LINTLIBRARY)
+    (task, exception_mask, masks, masksCnt, old_handlers, old_behaviors, old_flavors)
+	task_t task;
+	exception_mask_t exception_mask;
+	exception_mask_array_t masks;
+	mach_msg_type_number_t *masksCnt;
+	exception_handler_array_t old_handlers;
+	exception_behavior_array_t old_behaviors;
+	exception_flavor_array_t old_flavors;
+{ return task_get_exception_ports(task, exception_mask, masks, masksCnt, old_handlers, old_behaviors, old_flavors); }
+#else
+(
+	task_t task,
+	exception_mask_t exception_mask,
+	exception_mask_array_t masks,
+	mach_msg_type_number_t *masksCnt,
+	exception_handler_array_t old_handlers,
+	exception_behavior_array_t old_behaviors,
+	exception_flavor_array_t old_flavors
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_swap_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_swap_exception_ports
+#if	defined(LINTLIBRARY)
+    (task, exception_mask, new_port, behavior, new_flavor, masks, masksCnt, old_handlerss, old_behaviors, old_flavors)
+	task_t task;
+	exception_mask_t exception_mask;
+	mach_port_t new_port;
+	exception_behavior_t behavior;
+	thread_state_flavor_t new_flavor;
+	exception_mask_array_t masks;
+	mach_msg_type_number_t *masksCnt;
+	exception_handler_array_t old_handlerss;
+	exception_behavior_array_t old_behaviors;
+	exception_flavor_array_t old_flavors;
+{ return task_swap_exception_ports(task, exception_mask, new_port, behavior, new_flavor, masks, masksCnt, old_handlerss, old_behaviors, old_flavors); }
+#else
+(
+	task_t task,
+	exception_mask_t exception_mask,
+	mach_port_t new_port,
+	exception_behavior_t behavior,
+	thread_state_flavor_t new_flavor,
+	exception_mask_array_t masks,
+	mach_msg_type_number_t *masksCnt,
+	exception_handler_array_t old_handlerss,
+	exception_behavior_array_t old_behaviors,
+	exception_flavor_array_t old_flavors
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine semaphore_create */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t semaphore_create
+#if	defined(LINTLIBRARY)
+    (task, semaphore, policy, value)
+	task_t task;
+	semaphore_t *semaphore;
+	int policy;
+	int value;
+{ return semaphore_create(task, semaphore, policy, value); }
+#else
+(
+	task_t task,
+	semaphore_t *semaphore,
+	int policy,
+	int value
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine semaphore_destroy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t semaphore_destroy
+#if	defined(LINTLIBRARY)
+    (task, semaphore)
+	task_t task;
+	semaphore_t semaphore;
+{ return semaphore_destroy(task, semaphore); }
+#else
+(
+	task_t task,
+	semaphore_t semaphore
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_policy_set */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_policy_set
+#if	defined(LINTLIBRARY)
+    (task, flavor, policy_info, policy_infoCnt)
+	task_t task;
+	task_policy_flavor_t flavor;
+	task_policy_t policy_info;
+	mach_msg_type_number_t policy_infoCnt;
+{ return task_policy_set(task, flavor, policy_info, policy_infoCnt); }
+#else
+(
+	task_t task,
+	task_policy_flavor_t flavor,
+	task_policy_t policy_info,
+	mach_msg_type_number_t policy_infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_policy_get */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_policy_get
+#if	defined(LINTLIBRARY)
+    (task, flavor, policy_info, policy_infoCnt, get_default)
+	task_t task;
+	task_policy_flavor_t flavor;
+	task_policy_t policy_info;
+	mach_msg_type_number_t *policy_infoCnt;
+	boolean_t *get_default;
+{ return task_policy_get(task, flavor, policy_info, policy_infoCnt, get_default); }
+#else
+(
+	task_t task,
+	task_policy_flavor_t flavor,
+	task_policy_t policy_info,
+	mach_msg_type_number_t *policy_infoCnt,
+	boolean_t *get_default
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_policy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_policy
+#if	defined(LINTLIBRARY)
+    (task, policy, base, baseCnt, set_limit, change)
+	task_t task;
+	policy_t policy;
+	policy_base_t base;
+	mach_msg_type_number_t baseCnt;
+	boolean_t set_limit;
+	boolean_t change;
+{ return task_policy(task, policy, base, baseCnt, set_limit, change); }
+#else
+(
+	task_t task,
+	policy_t policy,
+	policy_base_t base,
+	mach_msg_type_number_t baseCnt,
+	boolean_t set_limit,
+	boolean_t change
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_ras_pc */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_ras_pc
+#if	defined(LINTLIBRARY)
+    (target_task, basepc, boundspc)
+	task_t target_task;
+	vm_address_t basepc;
+	vm_address_t boundspc;
+{ return task_set_ras_pc(target_task, basepc, boundspc); }
+#else
+(
+	task_t target_task,
+	vm_address_t basepc,
+	vm_address_t boundspc
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_zone_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_zone_info
+#if	defined(LINTLIBRARY)
+    (target_task, names, namesCnt, info, infoCnt)
+	task_t target_task;
+	mach_zone_name_array_t *names;
+	mach_msg_type_number_t *namesCnt;
+	task_zone_info_array_t *info;
+	mach_msg_type_number_t *infoCnt;
+{ return task_zone_info(target_task, names, namesCnt, info, infoCnt); }
+#else
+(
+	task_t target_task,
+	mach_zone_name_array_t *names,
+	mach_msg_type_number_t *namesCnt,
+	task_zone_info_array_t *info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_assign */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_assign
+#if	defined(LINTLIBRARY)
+    (task, new_set, assign_threads)
+	task_t task;
+	processor_set_t new_set;
+	boolean_t assign_threads;
+{ return task_assign(task, new_set, assign_threads); }
+#else
+(
+	task_t task,
+	processor_set_t new_set,
+	boolean_t assign_threads
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_assign_default */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_assign_default
+#if	defined(LINTLIBRARY)
+    (task, assign_threads)
+	task_t task;
+	boolean_t assign_threads;
+{ return task_assign_default(task, assign_threads); }
+#else
+(
+	task_t task,
+	boolean_t assign_threads
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_assignment */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_assignment
+#if	defined(LINTLIBRARY)
+    (task, assigned_set)
+	task_t task;
+	processor_set_name_t *assigned_set;
+{ return task_get_assignment(task, assigned_set); }
+#else
+(
+	task_t task,
+	processor_set_name_t *assigned_set
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_policy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_policy
+#if	defined(LINTLIBRARY)
+    (task, pset, policy, base, baseCnt, limit, limitCnt, change)
+	task_t task;
+	processor_set_t pset;
+	policy_t policy;
+	policy_base_t base;
+	mach_msg_type_number_t baseCnt;
+	policy_limit_t limit;
+	mach_msg_type_number_t limitCnt;
+	boolean_t change;
+{ return task_set_policy(task, pset, policy, base, baseCnt, limit, limitCnt, change); }
+#else
+(
+	task_t task,
+	processor_set_t pset,
+	policy_t policy,
+	policy_base_t base,
+	mach_msg_type_number_t baseCnt,
+	policy_limit_t limit,
+	mach_msg_type_number_t limitCnt,
+	boolean_t change
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_state */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_state
+#if	defined(LINTLIBRARY)
+    (task, flavor, old_state, old_stateCnt)
+	task_t task;
+	thread_state_flavor_t flavor;
+	thread_state_t old_state;
+	mach_msg_type_number_t *old_stateCnt;
+{ return task_get_state(task, flavor, old_state, old_stateCnt); }
+#else
+(
+	task_t task,
+	thread_state_flavor_t flavor,
+	thread_state_t old_state,
+	mach_msg_type_number_t *old_stateCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_state */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_state
+#if	defined(LINTLIBRARY)
+    (task, flavor, new_state, new_stateCnt)
+	task_t task;
+	thread_state_flavor_t flavor;
+	thread_state_t new_state;
+	mach_msg_type_number_t new_stateCnt;
+{ return task_set_state(task, flavor, new_state, new_stateCnt); }
+#else
+(
+	task_t task,
+	thread_state_flavor_t flavor,
+	thread_state_t new_state,
+	mach_msg_type_number_t new_stateCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_phys_footprint_limit */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_phys_footprint_limit
+#if	defined(LINTLIBRARY)
+    (task, new_limit, old_limit)
+	task_t task;
+	int new_limit;
+	int *old_limit;
+{ return task_set_phys_footprint_limit(task, new_limit, old_limit); }
+#else
+(
+	task_t task,
+	int new_limit,
+	int *old_limit
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_suspend2 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_suspend2
+#if	defined(LINTLIBRARY)
+    (target_task, suspend_token)
+	task_t target_task;
+	task_suspension_token_t *suspend_token;
+{ return task_suspend2(target_task, suspend_token); }
+#else
+(
+	task_t target_task,
+	task_suspension_token_t *suspend_token
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_resume2 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_resume2
+#if	defined(LINTLIBRARY)
+    (suspend_token)
+	task_suspension_token_t suspend_token;
+{ return task_resume2(suspend_token); }
+#else
+(
+	task_suspension_token_t suspend_token
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_purgable_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_purgable_info
+#if	defined(LINTLIBRARY)
+    (task, stats)
+	task_t task;
+	task_purgable_info_t *stats;
+{ return task_purgable_info(task, stats); }
+#else
+(
+	task_t task,
+	task_purgable_info_t *stats
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_mach_voucher */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_mach_voucher
+#if	defined(LINTLIBRARY)
+    (task, which, voucher)
+	task_t task;
+	mach_voucher_selector_t which;
+	ipc_voucher_t *voucher;
+{ return task_get_mach_voucher(task, which, voucher); }
+#else
+(
+	task_t task,
+	mach_voucher_selector_t which,
+	ipc_voucher_t *voucher
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_mach_voucher */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_mach_voucher
+#if	defined(LINTLIBRARY)
+    (task, voucher)
+	task_t task;
+	ipc_voucher_t voucher;
+{ return task_set_mach_voucher(task, voucher); }
+#else
+(
+	task_t task,
+	ipc_voucher_t voucher
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_swap_mach_voucher */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_swap_mach_voucher
+#if	defined(LINTLIBRARY)
+    (task, new_voucher, old_voucher)
+	task_t task;
+	ipc_voucher_t new_voucher;
+	ipc_voucher_t *old_voucher;
+{ return task_swap_mach_voucher(task, new_voucher, old_voucher); }
+#else
+(
+	task_t task,
+	ipc_voucher_t new_voucher,
+	ipc_voucher_t *old_voucher
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_create */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_create
+#if	defined(LINTLIBRARY)
+    (target_task, ledgers, ledgersCnt, inherit_memory, child_task)
+	task_t target_task;
+	ledger_array_t ledgers;
+	mach_msg_type_number_t ledgersCnt;
+	boolean_t inherit_memory;
+	task_t *child_task;
+{ return task_create(target_task, ledgers, ledgersCnt, inherit_memory, child_task); }
+#else
+(
+	task_t target_task,
+	ledger_array_t ledgers,
+	mach_msg_type_number_t ledgersCnt,
+	boolean_t inherit_memory,
+	task_t *child_task
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_terminate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_terminate
+#if	defined(LINTLIBRARY)
+    (target_task)
+	task_t target_task;
+{ return task_terminate(target_task); }
+#else
+(
+	task_t target_task
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_threads */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_threads
+#if	defined(LINTLIBRARY)
+    (target_task, act_list, act_listCnt)
+	task_t target_task;
+	thread_act_array_t *act_list;
+	mach_msg_type_number_t *act_listCnt;
+{ return task_threads(target_task, act_list, act_listCnt); }
+#else
+(
+	task_t target_task,
+	thread_act_array_t *act_list,
+	mach_msg_type_number_t *act_listCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_ports_register */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_ports_register
+#if	defined(LINTLIBRARY)
+    (target_task, init_port_set, init_port_setCnt)
+	task_t target_task;
+	mach_port_array_t init_port_set;
+	mach_msg_type_number_t init_port_setCnt;
+{ return mach_ports_register(target_task, init_port_set, init_port_setCnt); }
+#else
+(
+	task_t target_task,
+	mach_port_array_t init_port_set,
+	mach_msg_type_number_t init_port_setCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_ports_lookup */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_ports_lookup
+#if	defined(LINTLIBRARY)
+    (target_task, init_port_set, init_port_setCnt)
+	task_t target_task;
+	mach_port_array_t *init_port_set;
+	mach_msg_type_number_t *init_port_setCnt;
+{ return mach_ports_lookup(target_task, init_port_set, init_port_setCnt); }
+#else
+(
+	task_t target_task,
+	mach_port_array_t *init_port_set,
+	mach_msg_type_number_t *init_port_setCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_info
+#if	defined(LINTLIBRARY)
+    (target_task, flavor, task_info_out, task_info_outCnt)
+	task_name_t target_task;
+	task_flavor_t flavor;
+	task_info_t task_info_out;
+	mach_msg_type_number_t *task_info_outCnt;
+{ return task_info(target_task, flavor, task_info_out, task_info_outCnt); }
+#else
+(
+	task_name_t target_task,
+	task_flavor_t flavor,
+	task_info_t task_info_out,
+	mach_msg_type_number_t *task_info_outCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_info
+#if	defined(LINTLIBRARY)
+    (target_task, flavor, task_info_in, task_info_inCnt)
+	task_t target_task;
+	task_flavor_t flavor;
+	task_info_t task_info_in;
+	mach_msg_type_number_t task_info_inCnt;
+{ return task_set_info(target_task, flavor, task_info_in, task_info_inCnt); }
+#else
+(
+	task_t target_task,
+	task_flavor_t flavor,
+	task_info_t task_info_in,
+	mach_msg_type_number_t task_info_inCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_suspend */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_suspend
+#if	defined(LINTLIBRARY)
+    (target_task)
+	task_t target_task;
+{ return task_suspend(target_task); }
+#else
+(
+	task_t target_task
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_resume */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_resume
+#if	defined(LINTLIBRARY)
+    (target_task)
+	task_t target_task;
+{ return task_resume(target_task); }
+#else
+(
+	task_t target_task
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_special_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_special_port
+#if	defined(LINTLIBRARY)
+    (task, which_port, special_port)
+	task_t task;
+	int which_port;
+	mach_port_t *special_port;
+{ return task_get_special_port(task, which_port, special_port); }
+#else
+(
+	task_t task,
+	int which_port,
+	mach_port_t *special_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_special_port */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_special_port
+#if	defined(LINTLIBRARY)
+    (task, which_port, special_port)
+	task_t task;
+	int which_port;
+	mach_port_t special_port;
+{ return task_set_special_port(task, which_port, special_port); }
+#else
+(
+	task_t task,
+	int which_port,
+	mach_port_t special_port
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine thread_create_from_user */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t thread_create_from_user
+#if	defined(LINTLIBRARY)
+    (parent_task, child_act)
+	task_t parent_task;
+	thread_act_t *child_act;
+{ return thread_create_from_user(parent_task, child_act); }
+#else
+(
+	task_t parent_task,
+	thread_act_t *child_act
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine thread_create_running_from_user */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t thread_create_running_from_user
+#if	defined(LINTLIBRARY)
+    (parent_task, flavor, new_state, new_stateCnt, child_act)
+	task_t parent_task;
+	thread_state_flavor_t flavor;
+	thread_state_t new_state;
+	mach_msg_type_number_t new_stateCnt;
+	thread_act_t *child_act;
+{ return thread_create_running_from_user(parent_task, flavor, new_state, new_stateCnt, child_act); }
+#else
+(
+	task_t parent_task,
+	thread_state_flavor_t flavor,
+	thread_state_t new_state,
+	mach_msg_type_number_t new_stateCnt,
+	thread_act_t *child_act
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_exception_ports
+#if	defined(LINTLIBRARY)
+    (task, exception_mask, new_port, behavior, new_flavor)
+	task_t task;
+	exception_mask_t exception_mask;
+	mach_port_t new_port;
+	exception_behavior_t behavior;
+	thread_state_flavor_t new_flavor;
+{ return task_set_exception_ports(task, exception_mask, new_port, behavior, new_flavor); }
+#else
+(
+	task_t task,
+	exception_mask_t exception_mask,
+	mach_port_t new_port,
+	exception_behavior_t behavior,
+	thread_state_flavor_t new_flavor
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_exception_ports
+#if	defined(LINTLIBRARY)
+    (task, exception_mask, masks, masksCnt, old_handlers, old_behaviors, old_flavors)
+	task_t task;
+	exception_mask_t exception_mask;
+	exception_mask_array_t masks;
+	mach_msg_type_number_t *masksCnt;
+	exception_handler_array_t old_handlers;
+	exception_behavior_array_t old_behaviors;
+	exception_flavor_array_t old_flavors;
+{ return task_get_exception_ports(task, exception_mask, masks, masksCnt, old_handlers, old_behaviors, old_flavors); }
+#else
+(
+	task_t task,
+	exception_mask_t exception_mask,
+	exception_mask_array_t masks,
+	mach_msg_type_number_t *masksCnt,
+	exception_handler_array_t old_handlers,
+	exception_behavior_array_t old_behaviors,
+	exception_flavor_array_t old_flavors
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_swap_exception_ports */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_swap_exception_ports
+#if	defined(LINTLIBRARY)
+    (task, exception_mask, new_port, behavior, new_flavor, masks, masksCnt, old_handlerss, old_behaviors, old_flavors)
+	task_t task;
+	exception_mask_t exception_mask;
+	mach_port_t new_port;
+	exception_behavior_t behavior;
+	thread_state_flavor_t new_flavor;
+	exception_mask_array_t masks;
+	mach_msg_type_number_t *masksCnt;
+	exception_handler_array_t old_handlerss;
+	exception_behavior_array_t old_behaviors;
+	exception_flavor_array_t old_flavors;
+{ return task_swap_exception_ports(task, exception_mask, new_port, behavior, new_flavor, masks, masksCnt, old_handlerss, old_behaviors, old_flavors); }
+#else
+(
+	task_t task,
+	exception_mask_t exception_mask,
+	mach_port_t new_port,
+	exception_behavior_t behavior,
+	thread_state_flavor_t new_flavor,
+	exception_mask_array_t masks,
+	mach_msg_type_number_t *masksCnt,
+	exception_handler_array_t old_handlerss,
+	exception_behavior_array_t old_behaviors,
+	exception_flavor_array_t old_flavors
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine semaphore_create */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t semaphore_create
+#if	defined(LINTLIBRARY)
+    (task, semaphore, policy, value)
+	task_t task;
+	semaphore_t *semaphore;
+	int policy;
+	int value;
+{ return semaphore_create(task, semaphore, policy, value); }
+#else
+(
+	task_t task,
+	semaphore_t *semaphore,
+	int policy,
+	int value
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine semaphore_destroy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t semaphore_destroy
+#if	defined(LINTLIBRARY)
+    (task, semaphore)
+	task_t task;
+	semaphore_t semaphore;
+{ return semaphore_destroy(task, semaphore); }
+#else
+(
+	task_t task,
+	semaphore_t semaphore
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_policy_set */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_policy_set
+#if	defined(LINTLIBRARY)
+    (task, flavor, policy_info, policy_infoCnt)
+	task_t task;
+	task_policy_flavor_t flavor;
+	task_policy_t policy_info;
+	mach_msg_type_number_t policy_infoCnt;
+{ return task_policy_set(task, flavor, policy_info, policy_infoCnt); }
+#else
+(
+	task_t task,
+	task_policy_flavor_t flavor,
+	task_policy_t policy_info,
+	mach_msg_type_number_t policy_infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_policy_get */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_policy_get
+#if	defined(LINTLIBRARY)
+    (task, flavor, policy_info, policy_infoCnt, get_default)
+	task_t task;
+	task_policy_flavor_t flavor;
+	task_policy_t policy_info;
+	mach_msg_type_number_t *policy_infoCnt;
+	boolean_t *get_default;
+{ return task_policy_get(task, flavor, policy_info, policy_infoCnt, get_default); }
+#else
+(
+	task_t task,
+	task_policy_flavor_t flavor,
+	task_policy_t policy_info,
+	mach_msg_type_number_t *policy_infoCnt,
+	boolean_t *get_default
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_policy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_policy
+#if	defined(LINTLIBRARY)
+    (task, policy, base, baseCnt, set_limit, change)
+	task_t task;
+	policy_t policy;
+	policy_base_t base;
+	mach_msg_type_number_t baseCnt;
+	boolean_t set_limit;
+	boolean_t change;
+{ return task_policy(task, policy, base, baseCnt, set_limit, change); }
+#else
+(
+	task_t task,
+	policy_t policy,
+	policy_base_t base,
+	mach_msg_type_number_t baseCnt,
+	boolean_t set_limit,
+	boolean_t change
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_ras_pc */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_ras_pc
+#if	defined(LINTLIBRARY)
+    (target_task, basepc, boundspc)
+	task_t target_task;
+	vm_address_t basepc;
+	vm_address_t boundspc;
+{ return task_set_ras_pc(target_task, basepc, boundspc); }
+#else
+(
+	task_t target_task,
+	vm_address_t basepc,
+	vm_address_t boundspc
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_zone_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_zone_info
+#if	defined(LINTLIBRARY)
+    (target_task, names, namesCnt, info, infoCnt)
+	task_t target_task;
+	mach_zone_name_array_t *names;
+	mach_msg_type_number_t *namesCnt;
+	task_zone_info_array_t *info;
+	mach_msg_type_number_t *infoCnt;
+{ return task_zone_info(target_task, names, namesCnt, info, infoCnt); }
+#else
+(
+	task_t target_task,
+	mach_zone_name_array_t *names,
+	mach_msg_type_number_t *namesCnt,
+	task_zone_info_array_t *info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_assign */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_assign
+#if	defined(LINTLIBRARY)
+    (task, new_set, assign_threads)
+	task_t task;
+	processor_set_t new_set;
+	boolean_t assign_threads;
+{ return task_assign(task, new_set, assign_threads); }
+#else
+(
+	task_t task,
+	processor_set_t new_set,
+	boolean_t assign_threads
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_assign_default */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_assign_default
+#if	defined(LINTLIBRARY)
+    (task, assign_threads)
+	task_t task;
+	boolean_t assign_threads;
+{ return task_assign_default(task, assign_threads); }
+#else
+(
+	task_t task,
+	boolean_t assign_threads
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_assignment */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_assignment
+#if	defined(LINTLIBRARY)
+    (task, assigned_set)
+	task_t task;
+	processor_set_name_t *assigned_set;
+{ return task_get_assignment(task, assigned_set); }
+#else
+(
+	task_t task,
+	processor_set_name_t *assigned_set
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_policy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_policy
+#if	defined(LINTLIBRARY)
+    (task, pset, policy, base, baseCnt, limit, limitCnt, change)
+	task_t task;
+	processor_set_t pset;
+	policy_t policy;
+	policy_base_t base;
+	mach_msg_type_number_t baseCnt;
+	policy_limit_t limit;
+	mach_msg_type_number_t limitCnt;
+	boolean_t change;
+{ return task_set_policy(task, pset, policy, base, baseCnt, limit, limitCnt, change); }
+#else
+(
+	task_t task,
+	processor_set_t pset,
+	policy_t policy,
+	policy_base_t base,
+	mach_msg_type_number_t baseCnt,
+	policy_limit_t limit,
+	mach_msg_type_number_t limitCnt,
+	boolean_t change
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_state */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_state
+#if	defined(LINTLIBRARY)
+    (task, flavor, old_state, old_stateCnt)
+	task_t task;
+	thread_state_flavor_t flavor;
+	thread_state_t old_state;
+	mach_msg_type_number_t *old_stateCnt;
+{ return task_get_state(task, flavor, old_state, old_stateCnt); }
+#else
+(
+	task_t task,
+	thread_state_flavor_t flavor,
+	thread_state_t old_state,
+	mach_msg_type_number_t *old_stateCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_state */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_state
+#if	defined(LINTLIBRARY)
+    (task, flavor, new_state, new_stateCnt)
+	task_t task;
+	thread_state_flavor_t flavor;
+	thread_state_t new_state;
+	mach_msg_type_number_t new_stateCnt;
+{ return task_set_state(task, flavor, new_state, new_stateCnt); }
+#else
+(
+	task_t task,
+	thread_state_flavor_t flavor,
+	thread_state_t new_state,
+	mach_msg_type_number_t new_stateCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_phys_footprint_limit */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_phys_footprint_limit
+#if	defined(LINTLIBRARY)
+    (task, new_limit, old_limit)
+	task_t task;
+	int new_limit;
+	int *old_limit;
+{ return task_set_phys_footprint_limit(task, new_limit, old_limit); }
+#else
+(
+	task_t task,
+	int new_limit,
+	int *old_limit
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_suspend2 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_suspend2
+#if	defined(LINTLIBRARY)
+    (target_task, suspend_token)
+	task_t target_task;
+	task_suspension_token_t *suspend_token;
+{ return task_suspend2(target_task, suspend_token); }
+#else
+(
+	task_t target_task,
+	task_suspension_token_t *suspend_token
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_resume2 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_resume2
+#if	defined(LINTLIBRARY)
+    (suspend_token)
+	task_suspension_token_t suspend_token;
+{ return task_resume2(suspend_token); }
+#else
+(
+	task_suspension_token_t suspend_token
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_purgable_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_purgable_info
+#if	defined(LINTLIBRARY)
+    (task, stats)
+	task_t task;
+	task_purgable_info_t *stats;
+{ return task_purgable_info(task, stats); }
+#else
+(
+	task_t task,
+	task_purgable_info_t *stats
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_get_mach_voucher */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_get_mach_voucher
+#if	defined(LINTLIBRARY)
+    (task, which, voucher)
+	task_t task;
+	mach_voucher_selector_t which;
+	ipc_voucher_t *voucher;
+{ return task_get_mach_voucher(task, which, voucher); }
+#else
+(
+	task_t task,
+	mach_voucher_selector_t which,
+	ipc_voucher_t *voucher
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_set_mach_voucher */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_set_mach_voucher
+#if	defined(LINTLIBRARY)
+    (task, voucher)
+	task_t task;
+	ipc_voucher_t voucher;
+{ return task_set_mach_voucher(task, voucher); }
+#else
+(
+	task_t task,
+	ipc_voucher_t voucher
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_swap_mach_voucher */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_swap_mach_voucher
+#if	defined(LINTLIBRARY)
+    (task, new_voucher, old_voucher)
+	task_t task;
+	ipc_voucher_t new_voucher;
+	ipc_voucher_t *old_voucher;
+{ return task_swap_mach_voucher(task, new_voucher, old_voucher); }
+#else
+(
+	task_t task,
+	ipc_voucher_t new_voucher,
+	ipc_voucher_t *old_voucher
+);
+#endif	/* defined(LINTLIBRARY) */
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+boolean_t task_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+mig_routine_t task_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+extern const struct task_subsystem {
+	mig_server_routine_t	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[42];
+} task_subsystem;
+
+/* typedefs for all requests */
+
+#ifndef __Request__task_subsystem__defined
+#define __Request__task_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_ports_descriptor_t ledgers;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t ledgersCnt;
+		boolean_t inherit_memory;
+	} __Request__task_create_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_terminate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_threads_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_ports_descriptor_t init_port_set;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t init_port_setCnt;
+	} __Request__mach_ports_register_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__mach_ports_lookup_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		task_flavor_t flavor;
+		mach_msg_type_number_t task_info_outCnt;
+	} __Request__task_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		task_flavor_t flavor;
+		mach_msg_type_number_t task_info_inCnt;
+		integer_t task_info_in[52];
+	} __Request__task_set_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_suspend_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_resume_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int which_port;
+	} __Request__task_get_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t special_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int which_port;
+	} __Request__task_set_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__thread_create_from_user_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		thread_state_flavor_t flavor;
+		mach_msg_type_number_t new_stateCnt;
+		natural_t new_state[32];
+	} __Request__thread_create_running_from_user_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+		exception_behavior_t behavior;
+		thread_state_flavor_t new_flavor;
+	} __Request__task_set_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+	} __Request__task_get_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		exception_mask_t exception_mask;
+		exception_behavior_t behavior;
+		thread_state_flavor_t new_flavor;
+	} __Request__task_swap_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int policy;
+		int value;
+	} __Request__semaphore_create_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t semaphore;
+		/* end of the kernel processed data */
+	} __Request__semaphore_destroy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		task_policy_flavor_t flavor;
+		mach_msg_type_number_t policy_infoCnt;
+		integer_t policy_info[16];
+	} __Request__task_policy_set_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		task_policy_flavor_t flavor;
+		mach_msg_type_number_t policy_infoCnt;
+		boolean_t get_default;
+	} __Request__task_policy_get_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		policy_t policy;
+		mach_msg_type_number_t baseCnt;
+		integer_t base[5];
+		boolean_t set_limit;
+		boolean_t change;
+	} __Request__task_policy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t basepc;
+		vm_address_t boundspc;
+	} __Request__task_set_ras_pc_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_zone_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_set;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t assign_threads;
+	} __Request__task_assign_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t assign_threads;
+	} __Request__task_assign_default_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_get_assignment_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t pset;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		policy_t policy;
+		mach_msg_type_number_t baseCnt;
+		integer_t base[5];
+		mach_msg_type_number_t limitCnt;
+		integer_t limit[1];
+		boolean_t change;
+	} __Request__task_set_policy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		thread_state_flavor_t flavor;
+		mach_msg_type_number_t old_stateCnt;
+	} __Request__task_get_state_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		thread_state_flavor_t flavor;
+		mach_msg_type_number_t new_stateCnt;
+		natural_t new_state[32];
+	} __Request__task_set_state_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int new_limit;
+	} __Request__task_set_phys_footprint_limit_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_suspend2_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_resume2_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__task_purgable_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_voucher_selector_t which;
+	} __Request__task_get_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t voucher;
+		/* end of the kernel processed data */
+	} __Request__task_set_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t new_voucher;
+		mach_msg_port_descriptor_t old_voucher;
+		/* end of the kernel processed data */
+	} __Request__task_swap_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__task_subsystem__defined */
+
+
+/* union of all requests */
+
+#ifndef __RequestUnion__task_subsystem__defined
+#define __RequestUnion__task_subsystem__defined
+union __RequestUnion__task_subsystem {
+	__Request__task_create_t Request_task_create;
+	__Request__task_terminate_t Request_task_terminate;
+	__Request__task_threads_t Request_task_threads;
+	__Request__mach_ports_register_t Request_mach_ports_register;
+	__Request__mach_ports_lookup_t Request_mach_ports_lookup;
+	__Request__task_info_t Request_task_info;
+	__Request__task_set_info_t Request_task_set_info;
+	__Request__task_suspend_t Request_task_suspend;
+	__Request__task_resume_t Request_task_resume;
+	__Request__task_get_special_port_t Request_task_get_special_port;
+	__Request__task_set_special_port_t Request_task_set_special_port;
+	__Request__thread_create_from_user_t Request_thread_create_from_user;
+	__Request__thread_create_running_from_user_t Request_thread_create_running_from_user;
+	__Request__task_set_exception_ports_t Request_task_set_exception_ports;
+	__Request__task_get_exception_ports_t Request_task_get_exception_ports;
+	__Request__task_swap_exception_ports_t Request_task_swap_exception_ports;
+	__Request__semaphore_create_t Request_semaphore_create;
+	__Request__semaphore_destroy_t Request_semaphore_destroy;
+	__Request__task_policy_set_t Request_task_policy_set;
+	__Request__task_policy_get_t Request_task_policy_get;
+	__Request__task_policy_t Request_task_policy;
+	__Request__task_set_ras_pc_t Request_task_set_ras_pc;
+	__Request__task_zone_info_t Request_task_zone_info;
+	__Request__task_assign_t Request_task_assign;
+	__Request__task_assign_default_t Request_task_assign_default;
+	__Request__task_get_assignment_t Request_task_get_assignment;
+	__Request__task_set_policy_t Request_task_set_policy;
+	__Request__task_get_state_t Request_task_get_state;
+	__Request__task_set_state_t Request_task_set_state;
+	__Request__task_set_phys_footprint_limit_t Request_task_set_phys_footprint_limit;
+	__Request__task_suspend2_t Request_task_suspend2;
+	__Request__task_resume2_t Request_task_resume2;
+	__Request__task_purgable_info_t Request_task_purgable_info;
+	__Request__task_get_mach_voucher_t Request_task_get_mach_voucher;
+	__Request__task_set_mach_voucher_t Request_task_set_mach_voucher;
+	__Request__task_swap_mach_voucher_t Request_task_swap_mach_voucher;
+};
+#endif /* __RequestUnion__task_subsystem__defined */
+/* typedefs for all replies */
+
+#ifndef __Reply__task_subsystem__defined
+#define __Reply__task_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t child_task;
+		/* end of the kernel processed data */
+	} __Reply__task_create_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_terminate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_ports_descriptor_t act_list;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t act_listCnt;
+	} __Reply__task_threads_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__mach_ports_register_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_ports_descriptor_t init_port_set;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t init_port_setCnt;
+	} __Reply__mach_ports_lookup_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t task_info_outCnt;
+		integer_t task_info_out[52];
+	} __Reply__task_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_suspend_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_resume_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t special_port;
+		/* end of the kernel processed data */
+	} __Reply__task_get_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_special_port_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t child_act;
+		/* end of the kernel processed data */
+	} __Reply__thread_create_from_user_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t child_act;
+		/* end of the kernel processed data */
+	} __Reply__thread_create_running_from_user_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t old_handlers[32];
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t masksCnt;
+		exception_mask_t masks[32];
+		exception_behavior_t old_behaviors[32];
+		thread_state_flavor_t old_flavors[32];
+	} __Reply__task_get_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t old_handlerss[32];
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t masksCnt;
+		exception_mask_t masks[32];
+		exception_behavior_t old_behaviors[32];
+		thread_state_flavor_t old_flavors[32];
+	} __Reply__task_swap_exception_ports_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t semaphore;
+		/* end of the kernel processed data */
+	} __Reply__semaphore_create_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__semaphore_destroy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_policy_set_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t policy_infoCnt;
+		integer_t policy_info[16];
+		boolean_t get_default;
+	} __Reply__task_policy_get_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_policy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_ras_pc_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t names;
+		mach_msg_ool_descriptor_t info;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t namesCnt;
+		mach_msg_type_number_t infoCnt;
+	} __Reply__task_zone_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_assign_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_assign_default_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t assigned_set;
+		/* end of the kernel processed data */
+	} __Reply__task_get_assignment_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_policy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		mach_msg_type_number_t old_stateCnt;
+		natural_t old_state[32];
+	} __Reply__task_get_state_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_state_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int old_limit;
+	} __Reply__task_set_phys_footprint_limit_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t suspend_token;
+		/* end of the kernel processed data */
+	} __Reply__task_suspend2_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_resume2_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		task_purgable_info_t stats;
+	} __Reply__task_purgable_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t voucher;
+		/* end of the kernel processed data */
+	} __Reply__task_get_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_set_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t old_voucher;
+		/* end of the kernel processed data */
+	} __Reply__task_swap_mach_voucher_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__task_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__task_subsystem__defined
+#define __ReplyUnion__task_subsystem__defined
+union __ReplyUnion__task_subsystem {
+	__Reply__task_create_t Reply_task_create;
+	__Reply__task_terminate_t Reply_task_terminate;
+	__Reply__task_threads_t Reply_task_threads;
+	__Reply__mach_ports_register_t Reply_mach_ports_register;
+	__Reply__mach_ports_lookup_t Reply_mach_ports_lookup;
+	__Reply__task_info_t Reply_task_info;
+	__Reply__task_set_info_t Reply_task_set_info;
+	__Reply__task_suspend_t Reply_task_suspend;
+	__Reply__task_resume_t Reply_task_resume;
+	__Reply__task_get_special_port_t Reply_task_get_special_port;
+	__Reply__task_set_special_port_t Reply_task_set_special_port;
+	__Reply__thread_create_from_user_t Reply_thread_create_from_user;
+	__Reply__thread_create_running_from_user_t Reply_thread_create_running_from_user;
+	__Reply__task_set_exception_ports_t Reply_task_set_exception_ports;
+	__Reply__task_get_exception_ports_t Reply_task_get_exception_ports;
+	__Reply__task_swap_exception_ports_t Reply_task_swap_exception_ports;
+	__Reply__semaphore_create_t Reply_semaphore_create;
+	__Reply__semaphore_destroy_t Reply_semaphore_destroy;
+	__Reply__task_policy_set_t Reply_task_policy_set;
+	__Reply__task_policy_get_t Reply_task_policy_get;
+	__Reply__task_policy_t Reply_task_policy;
+	__Reply__task_set_ras_pc_t Reply_task_set_ras_pc;
+	__Reply__task_zone_info_t Reply_task_zone_info;
+	__Reply__task_assign_t Reply_task_assign;
+	__Reply__task_assign_default_t Reply_task_assign_default;
+	__Reply__task_get_assignment_t Reply_task_get_assignment;
+	__Reply__task_set_policy_t Reply_task_set_policy;
+	__Reply__task_get_state_t Reply_task_get_state;
+	__Reply__task_set_state_t Reply_task_set_state;
+	__Reply__task_set_phys_footprint_limit_t Reply_task_set_phys_footprint_limit;
+	__Reply__task_suspend2_t Reply_task_suspend2;
+	__Reply__task_resume2_t Reply_task_resume2;
+	__Reply__task_purgable_info_t Reply_task_purgable_info;
+	__Reply__task_get_mach_voucher_t Reply_task_get_mach_voucher;
+	__Reply__task_set_mach_voucher_t Reply_task_set_mach_voucher;
+	__Reply__task_swap_mach_voucher_t Reply_task_swap_mach_voucher;
+};
+#endif /* __RequestUnion__task_subsystem__defined */
+
+#ifndef subsystem_to_name_map_task
+#define subsystem_to_name_map_task \
+    { "task_create", 3400 },\
+    { "task_terminate", 3401 },\
+    { "task_threads", 3402 },\
+    { "mach_ports_register", 3403 },\
+    { "mach_ports_lookup", 3404 },\
+    { "task_info", 3405 },\
+    { "task_set_info", 3406 },\
+    { "task_suspend", 3407 },\
+    { "task_resume", 3408 },\
+    { "task_get_special_port", 3409 },\
+    { "task_set_special_port", 3410 },\
+    { "thread_create_from_user", 3411 },\
+    { "thread_create_running_from_user", 3412 },\
+    { "task_set_exception_ports", 3413 },\
+    { "task_get_exception_ports", 3414 },\
+    { "task_swap_exception_ports", 3415 },\
+    { "semaphore_create", 3418 },\
+    { "semaphore_destroy", 3419 },\
+    { "task_policy_set", 3420 },\
+    { "task_policy_get", 3421 },\
+    { "task_policy", 3423 },\
+    { "task_set_ras_pc", 3427 },\
+    { "task_zone_info", 3428 },\
+    { "task_assign", 3429 },\
+    { "task_assign_default", 3430 },\
+    { "task_get_assignment", 3431 },\
+    { "task_set_policy", 3432 },\
+    { "task_get_state", 3433 },\
+    { "task_set_state", 3434 },\
+    { "task_set_phys_footprint_limit", 3435 },\
+    { "task_suspend2", 3436 },\
+    { "task_resume2", 3437 },\
+    { "task_purgable_info", 3438 },\
+    { "task_get_mach_voucher", 3439 },\
+    { "task_set_mach_voucher", 3440 },\
+    { "task_swap_mach_voucher", 3441 }
+#endif
+
+#ifdef __AfterMigServerHeader
+__AfterMigServerHeader
+#endif /* __AfterMigServerHeader */
+
+#endif	 /* _task_server_ */


Property changes on: trunk/sys/sys/mach/task_server.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/task_special_ports.h
===================================================================
--- trunk/sys/sys/mach/task_special_ports.h	                        (rev 0)
+++ trunk/sys/sys/mach/task_special_ports.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,146 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4.2.1  92/03/03  16:22:36  jeffreyh
+ * 	Changes from TRUNK
+ * 	[92/02/26  12:20:27  jeffreyh]
+ * 
+ * Revision 2.5  92/01/15  13:44:54  rpd
+ * 	Changed MACH_IPC_COMPAT conditionals to default to not present.
+ * 
+ * Revision 2.4  91/05/14  17:00:57  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:36:29  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:21:29  mrt]
+ * 
+ * Revision 2.2  90/06/02  15:00:03  rpd
+ * 	Converted to new IPC.
+ * 	[90/03/26  22:40:08  rpd]
+ * 
+ * Revision 2.1  89/08/03  16:06:01  rwd
+ * Created.
+ * 
+ * Revision 2.3  89/02/25  18:41:12  gm0w
+ * 	Changes for cleanup.
+ * 
+ * 17-Jan-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/task_special_ports.h
+ *
+ *	Defines codes for special_purpose task ports.  These are NOT
+ *	port identifiers - they are only used for the task_get_special_port
+ *	and task_set_special_port routines.
+ *	
+ */
+
+#ifndef	_MACH_TASK_SPECIAL_PORTS_H_
+#define _MACH_TASK_SPECIAL_PORTS_H_
+
+typedef	int	task_special_port_t;
+
+#define TASK_KERNEL_PORT	1	/* Represents task to the outside
+					   world.*/
+
+#define TASK_HOST_PORT		2	/* The host (priv) port for task.  */
+
+#define TASK_NAME_PORT		3	/* the name (unpriv) port for task */
+
+#define TASK_BOOTSTRAP_PORT	4	/* Bootstrap environment for task. */
+
+#define TASK_WIRED_LEDGER_PORT	5	/* Wired resource ledger for task. */
+
+#define TASK_PAGED_LEDGER_PORT	6	/* Paged resource ledger for task. */
+
+#define TASK_SEATBELT_PORT	7	/* Seatbelt compiler/DEM port for task. */
+
+/* PORT 8 was the GSSD TASK PORT which transformed to a host port */
+
+#define TASK_ACCESS_PORT	9	/* Permission check for task_for_pid. */
+
+#define TASK_DEBUG_CONTROL_PORT 10 /* debug control port */
+
+/*
+ *	Definitions for ease of use
+ */
+
+#define task_get_kernel_port(task, port)	\
+		(task_get_special_port((task), TASK_KERNEL_PORT, (port)))
+
+#define task_set_kernel_port(task, port)	\
+		(task_set_special_port((task), TASK_KERNEL_PORT, (port)))
+
+#define task_get_host_port(task, port)		\
+		(task_get_special_port((task), TASK_HOST_PORT, (port)))
+
+#define task_set_host_port(task, port)	\
+		(task_set_special_port((task), TASK_HOST_PORT, (port)))
+
+#define task_get_bootstrap_port(task, port)	\
+		(task_get_special_port((task), TASK_BOOTSTRAP_PORT, (port)))
+
+#define task_set_bootstrap_port(task, port)	\
+		(task_set_special_port((task), TASK_BOOTSTRAP_PORT, (port)))
+
+#define task_get_task_access_port(task, port)	\
+		(task_get_special_port((task), TASK_ACCESS_PORT, (port)))
+
+#define task_set_task_access_port(task, port)	\
+		(task_set_special_port((task), TASK_ACCESS_PORT, (port)))
+
+
+#endif	/* _MACH_TASK_SPECIAL_PORTS_H_ */


Property changes on: trunk/sys/sys/mach/task_special_ports.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/thread.h
===================================================================
--- trunk/sys/sys/mach/thread.h	                        (rev 0)
+++ trunk/sys/sys/mach/thread.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,677 @@
+#ifndef SYS_MACH_THREAD_H_
+#define SYS_MACH_THREAD_H_
+
+#undef vm_map_remove
+#include <sys/proc.h>
+#include <vm/vm.h>
+#include <vm/pmap.h>
+#include <vm/vm_map.h>
+
+#include <sys/mach/task.h>
+
+
+
+/*
+ * thread_t->at_safe_point values
+ */
+#define NOT_AT_SAFE_POINT                0
+#define SAFE_EXCEPTION_RETURN           -1
+#define SAFE_BOOTSTRAP_RETURN           -2
+#define SAFE_EXTERNAL_RECEIVE           -3
+#define SAFE_THR_DEPRESS                -4
+#define SAFE_SUSPENDED                  -5
+#define SAFE_MISCELLANEOUS              -6
+#define SAFE_INTERNAL_RECEIVE           -7
+
+
+
+#define disable_preemption() critical_enter()
+#define enable_preemption() critical_exit()
+
+
+/* XXX move me */
+struct thread_shuttle {
+
+	/* IPC data structures */
+	struct thread_shuttle *ith_next, *ith_prev, *ith_pool_next;
+
+	struct ipc_kmsg_queue ith_messages;
+
+	struct mtx ith_lock_data;
+	struct mtx *ith_block_lock_data;
+	mach_port_t     ith_mig_reply;  /* reply port for mig */
+	struct ipc_port *ith_rpc_reply; /* reply port for kernel RPCs */
+	uint32_t timeout;
+	uint32_t sleep_stamp;
+
+		/* Various bits of stashed state */
+	union {
+		struct {
+			mach_msg_return_t	state;		/* receive state */
+			mach_port_seqno_t	seqno;		/* seqno of recvd message */
+		  	ipc_object_t		object;		/* object received on */
+		  	mach_vm_address_t	msg_addr;	/* receive buffer pointer */
+			mach_msg_size_t		msize;		/* max size for recvd msg */
+		  	mach_msg_option_t	option;		/* options for receive */
+		  	mach_msg_size_t		slist_size;	/* scatter list size */
+			mach_port_name_t	receiver_name;	/* the receive port name */
+			struct ipc_kmsg		*kmsg;		/* received message */
+			mach_msg_body_t *scatter_list;
+			mach_msg_size_t scatter_list_size;
+		} receive;
+		char *other;		/* catch-all for other state */
+	} saved;
+	kern_return_t	wait_result;	/* outcome of wait -
+					   may be examined by this thread
+					   WITHOUT locking */
+	struct callout *timer;		/* timer for thread */
+	struct thread *ith_td;
+
+	/* Special ports attached to this activation */
+	struct ipc_port *ith_self;	/* not a right, doesn't hold ref */
+	struct ipc_port *ith_sself;	/* a send right */
+	struct exception_action exc_actions[EXC_TYPES_COUNT];
+	int		ref_count;	/* number of references to me */
+	int ith_active;
+
+
+#define	ith_wait_result		wait_result
+
+#define	ith_option		saved.receive.option
+#define ith_scatter_list	saved.receive.scatter_list
+#define ith_scatter_list_size	saved.receive.scatter_list_size
+#define ith_state		saved.receive.state
+#define ith_object		saved.receive.object
+#define ith_msg_addr			saved.receive.msg_addr
+#define ith_msize		saved.receive.msize
+#define ith_receiver_name	saved.receive.receiver_name
+#define ith_kmsg		saved.receive.kmsg
+#define ith_seqno		saved.receive.seqno
+
+#define ith_other		saved.other
+
+#if 0
+
+
+	/*
+	 * Beginning of thread_shuttle proper
+	 */
+	queue_chain_t	links;		/* current run queue links */
+	run_queue_t	runq;		/* run queue p is on SEE BELOW */
+	int		whichq;		/* which queue level p is on */
+/*
+ *	NOTE:	The runq field in the thread structure has an unusual
+ *	locking protocol.  If its value is RUN_QUEUE_NULL, then it is
+ *	locked by the thread_lock, but if its value is something else
+ *	(i.e. a run_queue) then it is locked by that run_queue's lock.
+ */
+
+	/* Thread bookkeeping */
+	queue_chain_t	pset_threads;	/* list of all shuttles in proc set */
+
+	/* Self-preservation */
+	decl_simple_lock_data(,lock)	/* scheduling lock (thread_lock()) */
+	decl_simple_lock_data(,w_lock)  /* covers wake_active (wake_lock())*/
+	decl_mutex_data(,rpc_lock)	/* RPC lock (rpc_lock()) */
+	int		ref_count;	/* number of references to me */
+	
+	vm_offset_t     kernel_stack;   /* accurate only if the thread is 
+					   not swapped and not executing */
+
+	vm_offset_t	stack_privilege;/* reserved kernel stack */
+
+	/* Blocking information */
+	int		reason;		/* why we blocked */
+	event_t		wait_event;	/* event we are waiting on */
+	kern_return_t	wait_result;	/* outcome of wait -
+					   may be examined by this thread
+					   WITHOUT locking */
+	queue_chain_t	wait_link;	/* event's wait queue link */
+	boolean_t	wake_active;	/* Someone is waiting for this
+					   thread to become suspended */
+	int		state;		/* Thread state: */
+
+/*
+ *	Thread states [bits or'ed]
+ */
+#define TH_WAIT			0x01	/* thread is queued for waiting */
+#define TH_SUSP			0x02	/* thread has been asked to stop */
+#define TH_RUN			0x04	/* thread is running or on runq */
+#define TH_UNINT		0x08	/* thread is waiting uninteruptibly */
+#define	TH_HALTED		0x10	/* thread is halted at clean point ? */
+
+#define TH_ABORT		0x20	/* abort interruptible waits */
+#define TH_SWAPPED_OUT		0x40	/* thread is swapped out */
+
+#define TH_IDLE			0x80	/* thread is an idle thread */
+
+#define	TH_SCHED_STATE	(TH_WAIT|TH_SUSP|TH_RUN|TH_UNINT)
+
+/* These two flags will never be seen and might well be removed */
+#define	TH_STACK_HANDOFF	0x0100	/* thread has no kernel stack */
+#define	TH_STACK_COMING_IN	0x0200	/* thread is waiting for kernel stack */
+#define	TH_STACK_STATE	(TH_STACK_HANDOFF | TH_STACK_COMING_IN)
+
+	int		preempt;	/* Thread preemption status */
+#define	TH_PREEMPTABLE		0	/* Thread is preemptable */
+#define	TH_NOT_PREEMPTABLE	1	/* Thread is not preemptable */
+#define	TH_PREEMPTED		2	/* Thread has been preempted */
+
+#if	ETAP_EVENT_MONITOR
+	int		etap_reason;	/* real reason why we blocked */
+	boolean_t	etap_trace;	/* ETAP trace status */
+#endif	/* ETAP_EVENT_MONITOR */
+
+
+	/* Stack handoff information */
+	void		(*continuation)(/* start here next time runnable */
+				void);
+
+	/* Scheduling information */
+	int		priority;	/* thread's priority */
+	int		max_priority;	/* maximum priority */
+	int		sched_pri;	/* scheduled (computed) priority */
+	int		sched_data;	/* for use by policy */
+	int		policy;		/* scheduling policy */
+	int		depress_priority; /* depressed from this priority */
+	unsigned int	cpu_usage;	/* exp. decaying cpu usage [%cpu] */
+	unsigned int	sched_usage;	/* load-weighted cpu usage [sched] */
+	unsigned int	sched_stamp;	/* last time priority was updated */
+	unsigned int	sleep_stamp;	/* last time in TH_WAIT state */
+	unsigned int	sched_change_stamp;
+					/* last time priority or policy was
+					   explicitly changed (not the same
+					   units as sched_stamp!) */
+	int		unconsumed_quantum;	/* leftover quantum (RR/FIFO) */
+
+	/* VM global variables */
+	boolean_t	vm_privilege;	/* can use reserved memory? */
+	vm_offset_t	recover;	/* page fault recovery (copyin/out) */
+
+	/* IPC data structures */
+	struct thread_shuttle *ith_next, *ith_prev;
+
+	struct ipc_kmsg_queue ith_messages;
+
+	decl_mutex_data(,ith_lock_data)
+	mach_port_t	ith_mig_reply;	/* reply port for mig */
+	struct ipc_port	*ith_rpc_reply;	/* reply port for kernel RPCs */
+
+	/* Various bits of stashed state */
+	union {
+		struct {
+			mach_msg_option_t option;
+			mach_msg_body_t *scatter_list;
+			mach_msg_size_t scatter_list_size;
+		} receive;
+		char *other;		/* catch-all for other state */
+	} saved;
+
+	/* Timing data structures */
+	timer_data_t	user_timer;	/* user mode timer */
+	timer_data_t	system_timer;	/* system mode timer */
+	timer_data_t	depressed_timer;/* depressed priority timer */
+	timer_save_data_t user_timer_save;  /* saved user timer value */
+	timer_save_data_t system_timer_save;  /* saved sys timer val. */
+	unsigned int	cpu_delta;	/* cpu usage since last update */
+	unsigned int	sched_delta;	/* weighted cpu usage since update */
+
+	/* Time-outs */
+	timer_elt_data_t timer;		/* timer for thread */
+	timer_elt_data_t depress_timer;	/* timer for priority depression */
+
+	/* Ast/Halt data structures */
+	boolean_t	active;		/* how alive is the thread */
+
+	/* Processor data structures */
+	processor_set_t	processor_set;	/* assigned processor set */
+#if	NCPUS > 1
+	processor_t	bound_processor;	/* bound to processor ?*/
+#endif	/* NCPUS > 1 */
+#if	MACH_HOST
+	boolean_t	may_assign;	/* may assignment change? */
+	boolean_t	assign_active;	/* someone waiting for may_assign */
+#endif	/* MACH_HOST */
+
+#if	XKMACHKERNEL
+	int		xk_type;
+#endif	/* XKMACHKERNEL */
+
+#if	NCPUS > 1
+	processor_t	last_processor; /* processor this last ran on */
+#if	MACH_LOCK_MON
+	unsigned	lock_stack;	/* number of locks held */
+#endif  /* MACH_LOCK_MON */o
+#endif	/* NCPUS > 1 */
+
+	int		at_safe_point;	/* thread_abort_safely allowed */
+
+#if	MACH_LDEBUG
+	/*
+	 *	Debugging:  track acquired mutexes and locks.
+	 *	Because a thread can block while holding such
+	 *	synchronizers, we think of the thread as
+	 *	"owning" them.
+	 */
+#define	MUTEX_STACK_DEPTH	20
+#define	LOCK_STACK_DEPTH	20
+	mutex_t		*mutex_stack[MUTEX_STACK_DEPTH];
+	lock_t		*lock_stack[LOCK_STACK_DEPTH];
+	unsigned int	mutex_stack_index;
+	unsigned int	lock_stack_index;
+	unsigned	mutex_count;	/* XXX to be deleted XXX */
+	boolean_t	kthread;	/* thread is a kernel thread */
+#endif	/* MACH_LDEBUG */
+
+#if	LINUX_DEV
+	/*
+	 * State for Linux device drivers
+	 */
+	void            *linux_data;    /* used by linuxdev/mach/glue/block.c */
+#endif	/* LINUX_DEV */
+
+	/*
+	 * End of thread_shuttle proper
+	 */
+
+	/*
+	 * Migration and thread_activation linkage information
+	 */
+	struct thread_activation *top_act; /* "current" thr_act */
+
+} Thread_Shuttle;
+
+
+/* typedef of thread_t is in kern/kern_types.h */
+typedef struct thread_shuttle	*thread_shuttle_t;
+#define THREAD_NULL		((thread_t) 0)
+#define THREAD_SHUTTLE_NULL	((thread_shuttle_t)0)
+
+
+/*
+ * thread_t->at_safe_point values
+ */
+#define NOT_AT_SAFE_POINT		 0
+#define SAFE_EXCEPTION_RETURN		-1
+#define SAFE_BOOTSTRAP_RETURN		-2
+#define SAFE_EXTERNAL_RECEIVE		-3
+#define SAFE_THR_DEPRESS		-4
+#define SAFE_SUSPENDED			-5
+#define SAFE_MISCELLANEOUS		-6
+#define SAFE_INTERNAL_RECEIVE		-7
+
+extern thread_act_t active_kloaded[NCPUS];	/* "" kernel-loaded acts */
+extern vm_offset_t active_stacks[NCPUS];	/* active kernel stacks */
+extern vm_offset_t kernel_stack[NCPUS];
+
+#ifndef MACHINE_STACK_STASH
+/*
+ * MD Macro to fill up global stack state,
+ * keeping the MD structure sizes + games private
+ */
+#define MACHINE_STACK_STASH(stack)					\
+MACRO_BEGIN								\
+	mp_disable_preemption();					\
+	active_stacks[cpu_number()] = (stack),				\
+	    kernel_stack[cpu_number()] = (stack) + KERNEL_STACK_SIZE;	\
+	mp_enable_preemption();						\
+MACRO_END
+#endif	/* MACHINE_STACK_STASH */
+
+/*
+ *	Kernel-only routines
+ */
+
+/* Initialize thread module */
+extern void		thread_init(void);
+
+/* Take reference on thread (make sure it doesn't go away) */
+extern void		thread_reference(
+				thread_t	th);
+
+/* Release reference on thread */
+extern void		thread_deallocate(
+				thread_t	th);
+
+/* Set priority of calling thread */
+extern void		thread_set_own_priority(
+				int		priority);
+/* Reset thread's priority */
+extern kern_return_t thread_priority(
+				thread_act_t	thr_act,
+				int		priority,
+				boolean_t	set_max);
+
+/* Reset thread's max priority */
+extern kern_return_t	thread_max_priority(
+				thread_act_t	thr_act,
+				processor_set_t	pset,
+				int		max_priority);
+
+/* Reset thread's max priority while holding RPC locks */
+extern kern_return_t	thread_max_priority_locked(
+				thread_t	thread,
+				processor_set_t	pset,
+				int		max_priority);
+
+/* Set a thread's priority while holding RPC locks */
+extern kern_return_t	thread_priority_locked(
+				thread_t	thread,
+				int		priority,
+				boolean_t	set_max);
+
+/* Start a thread at specified routine */
+#define thread_start(thread, start) (thread)->continuation = (start)
+
+/* Create Kernel mode thread */
+extern thread_t		kernel_thread(
+				task_t	task,
+				void	(*start)(void),
+				void	*arg);
+
+/* Reaps threads waiting to be destroyed */
+extern void		reaper_thread(void);
+
+#if	MACH_HOST
+/* Preclude thread processor set assignement */
+extern void		thread_freeze(
+				thread_t	th);
+
+/* Assign thread to a processor set */
+extern void		thread_doassign(
+				thread_t		thread,
+				processor_set_t		new_pset,
+				boolean_t		release_freeze);
+
+/* Allow thread processor set assignement */
+extern void		thread_unfreeze(
+				thread_t	th);
+
+#endif	/* MACH_HOST */
+
+/* Insure thread always has a kernel stack */
+extern void		stack_privilege(
+				thread_t	th);
+
+extern void		consider_thread_collect(void);
+
+/*
+ *	Arguments to specify aggressiveness to thread halt.
+ *	Can't have MUST_HALT and SAFELY at the same time.
+ */
+#define	THREAD_HALT_NORMAL	0
+#define	THREAD_HALT_MUST_HALT	1	/* no deadlock checks */
+#define	THREAD_HALT_SAFELY	2	/* result must be restartable */
+
+/*
+ *	Macro-defined routines
+ */
+
+#define	thread_lock_init(th)	simple_lock_init(&(th)->lock, ETAP_THREAD_LOCK)
+#define thread_lock(th)		simple_lock(&(th)->lock)
+#define thread_unlock(th)	simple_unlock(&(th)->lock)
+
+#define thread_should_halt(thread)	\
+	(!(thread)->top_act || \
+	!(thread)->top_act->active || \
+	(thread)->top_act->ast & (AST_HALT|AST_TERMINATE))
+
+/*
+ * We consider a thread not preemptab	/*
+	 * Beginning of thread_shuttle proper
+	 */
+	queue_chain_t	links;		/* current run queue links */
+	run_queue_t	runq;		/* run queue p is on SEE BELOW */
+	int		whichq;		/* which queue level p is on */
+/*
+ *	NOTE:	The runq field in the thread structure has an unusual
+ *	locking protocol.  If its value is RUN_QUEUE_NULL, then it is
+ *	locked by the thread_lock, but if its value is something else
+ *	(i.e. a run_queue) then it is locked by that run_queue's lock.
+ */
+
+	/* Thread bookkeeping */
+	queue_chain_t	pset_threads;	/* list of all shuttles in proc set */
+
+	/* Self-preservation */
+	decl_simple_lock_data(,lock)	/* scheduling lock (thread_lock()) */
+	decl_simple_lock_data(,w_lock)  /* covers wake_active (wake_lock())*/
+	decl_mutex_data(,rpc_lock)	/* RPC lock (rpc_lock()) */
+	
+	vm_offset_t     kernel_stack;   /* accurate only if the thread is 
+					   not swapped and not executing */
+
+	vm_offset_t	stack_privilege;/* reserved kernel stack */
+
+	/* Blocking information */
+	int		reason;		/* why we blocked */
+	event_t		wait_event;	/* event we are waiting on */
+	kern_return_t	wait_result;	/* outcome of wait -
+					   may be examined by this thread
+					   WITHOUT locking */
+	queue_chain_t	wait_link;	/* event's wait queue link */
+	boolean_t	wake_active;	/* Someone is waiting for this
+					   thread to become suspended */
+	int		state;		/* Thread state: */
+
+/*
+ *	Thread states [bits or'ed]
+ */
+#define TH_WAIT			0x01	/* thread is queued for waiting */
+#define TH_SUSP			0x02	/* thread has been asked to stop */
+#define TH_RUN			0x04	/* thread is running or on runq */
+#define TH_UNINT		0x08	/* thread is waiting uninteruptibly */
+#define	TH_HALTED		0x10	/* thread is halted at clean point ? */
+
+#define TH_ABORT		0x20	/* abort interruptible waits */
+#define TH_SWAPPED_OUT		0x40	/* thread is swapped out */
+
+#define TH_IDLE			0x80	/* thread is an idle thread */
+
+#define	TH_SCHED_STATE	(TH_WAIT|TH_SUSP|TH_RUN|TH_UNINT)
+
+/* These two flags will never be seen and might well be removed */
+#define	TH_STACK_HANDOFF	0x0100	/* thread has no kernel stack */
+#define	TH_STACK_COMING_IN	0x0200	/* thread is waiting for kernel stack */
+#define	TH_STACK_STATE	(TH_STACK_HANDOFF | TH_STACK_COMING_IN)
+
+	int		preempt;	/* Thread preemption status */
+#define	TH_PREEMPTABLE		0	/* Thread is preemptable */
+#define	TH_NOT_PREEMPTABLE	1	/* Thread is not preemptable */
+#define	TH_PREEMPTED		2	/* Thread has been preempted */
+
+#if	ETAP_EVENT_MONITOR
+	int		etap_reason;	/* real reason why we blocked */
+	boolean_t	etap_trace;	/* ETAP trace status */
+#endif	/* ETAP_EVENT_MONITOR */
+
+
+	/* Stack handoff information */
+	void		(*continuation)(/* start here next time runnable */
+				void);
+
+	/* Scheduling information */
+	int		priority;	/* thread's priority */
+	int		max_priority;	/* maximum priority */
+	int		sched_pri;	/* scheduled (computed) priority */
+	int		sched_data;	/* for use by policy */
+	int		policy;		/* scheduling policy */
+	int		depress_priority; /* depressed from this priority */
+	unsigned int	cpu_usage;	/* exp. decaying cpu usage [%cpu] */
+	unsigned int	sched_usage;	/* load-weighted cpu usage [sched] */
+	unsigned int	sched_stamp;	/* last time priority was updated */
+	unsigned int	sleep_stamp;	/* last time in TH_WAIT state */
+	unsigned int	sched_change_stamp;
+					/* last time priority or policy was
+					   explicitly changed (not the same
+					   units as sched_stamp!) */
+	int		unconsumed_quantum;	/* leftover quantum (RR/FIFO) */
+
+	/* VM global variables */
+	boolean_t	vm_privilege;	/* can use reserved memory? */
+	vm_offset_t	recover;	/* page fault recovery (copyin/out) */
+
+	/* IPC data structures */
+	struct thread_shuttle *ith_next, *ith_prev;
+
+	struct ipc_kmsg_queue ith_messages;
+
+	decl_mutex_data(,ith_lock_data)
+	mach_port_t	ith_mig_reply;	/* reply port for mig */
+	struct ipc_port	*ith_rpc_reply;	/* reply port for kernel RPCs */
+
+	/* Various bits of stashed state */
+	union {
+		struct {
+			mach_msg_option_t option;
+			mach_msg_body_t *scatter_list;
+			mach_msg_size_t scatter_list_size;
+		} receive;
+		char *other;		/* catch-all for other state */
+	} saved;
+
+	/* Timing data structures */
+	timer_data_t	user_timer;	/* user mode timer */
+	timer_data_t	system_timer;	/* system mode timer */
+	timer_data_t	depressed_timer;/* depressed priority timer */
+	timer_save_data_t user_timer_save;  /* saved user timer value */
+	timer_save_data_t system_timer_save;  /* saved sys timer val. */
+	unsigned int	cpu_delta;	/* cpu usage since last update */
+	unsigned int	sched_delta;	/* weighted cpu usage since update */
+
+	/* Time-outs */
+	timer_elt_data_t timer;		/* timer for thread */
+	timer_elt_data_t depress_timer;	/* timer for priority depression */
+
+	/* Ast/Halt data structures */
+	boolean_t	active;		/* how alive is the thread */
+
+	/* Processor data structures */
+	processor_set_t	processor_set;	/* assigned processor set */
+#if	NCPUS > 1
+	processor_t	bound_processor;	/* bound to processor ?*/
+#endif	/* NCPUS > 1 */
+#if	MACH_HOST
+	boolean_t	may_assign;	/* may assignment change? */
+	boolean_t	assign_active;	/* someone waiting for may_assign */
+#endif	/* MACH_HOST */
+
+#if	XKMACHKERNEL
+	int		xk_type;
+#endif	/* XKMACHKERNEL */
+
+#if	NCPUS > 1
+	processor_t	last_processor; /* processor this last ran on */
+#if	MACH_LOCK_MON
+	unsigned	lock_stack;	/* number of locks held */
+#endif  /* MACH_LOCK_MON */
+#endif	/* NCPUS > 1 */
+
+	int		at_safe_point;	/* thread_abort_safely allowed */
+
+#if	MACH_LDEBUG
+	/*
+	 *	Debugging:  track acquired mutexes and locks.
+	 *	Because a thread can block while holding such
+	 *	synchronizers, we think of the thread as
+	 *	"owning" them.
+	 */
+#define	MUTEX_STACK_DEPTH	20
+#define	LOCK_STACK_DEPTH	20
+	mutex_t		*mutex_stack[MUTEX_STACK_DEPTH];
+	lock_t		*lock_stack[LOCK_STACK_DEPTH];
+	unsigned int	mutex_stack_index;
+	unsigned int	lock_stack_index;
+	unsigned	mutex_count;	/* XXX to be deleted XXX */
+	boolean_t	kthread;	/* thread is a kernel thread */
+#endif	/* MACH_LDEBUG */
+
+#if	LINUX_DEV
+	/*
+	 * State for Linux device drivers
+	 */
+	void            *linux_data;    /* used by linuxdev/mach/glue/block.c */
+#endif	/* LINUX_DEV */
+
+	/*
+	 * End of thread_shuttle proper
+	 */
+
+	/*
+	 * Migration and thread_activation linkage information
+	 */
+	struct thread_activation *top_act; /* "current" thr_act */
+
+
+#endif
+
+
+};
+
+#define	ith_wait_result		wait_result
+
+#define	ith_option		saved.receive.option
+#define ith_scatter_list	saved.receive.scatter_list
+#define ith_scatter_list_size	saved.receive.scatter_list_size
+#define ith_task		ith_td->td_proc->p_machdata
+#define ith_map			ith_td->td_proc->p_vmspace->vm_map
+#define ith_other		saved.other
+
+#define thread_map(thread) (&(thread)->ith_td->td_proc->p_vmspace->vm_map)
+
+static __inline thread_t
+current_thread(void)
+{
+
+	return (curthread->td_machdata);
+}
+
+
+static __inline task_t
+current_task(void)
+{
+
+	return (curthread->td_proc->p_machdata);
+}
+
+#define current_space() current_task()->itk_space
+
+#define current_act() current_thread()
+
+static __inline vm_map_t
+current_map(void)
+{
+
+	return (&curthread->td_proc->p_vmspace->vm_map);
+}
+
+#define act_deallocate(act) thread_deallocate(act)
+#define act_lock(act)  mtx_lock(&(act)->ith_lock_data)
+#define act_lock_try(act) mtx_trylock(&(act)->ith_lock_data)
+#define act_unlock(act) mtx_unlock(&act->ith_lock_data)
+#define act_locked_act_reference(act) ((act)->ref_count++)
+
+
+/* wakeup a thread */
+extern void thread_go(thread_t);
+extern void thread_will_wait_with_timeout(thread_t, int);
+extern void thread_will_wait(thread_t);
+extern void thread_block(void);
+#if 0
+extern void assert_wait(event_t, boolean_t);
+#else
+#define assert_wait(a, b)
+#endif
+/*
+ *	Possible results of assert_wait - returned in
+ *	current_thread()->wait_result.
+ */
+#define	THREAD_WAITING		-1
+#define THREAD_AWAKENED		0		/* normal wakeup */
+#define THREAD_TIMED_OUT	1		/* timeout expired */
+#define THREAD_INTERRUPTED	2		/* interrupted by clear_wait */
+#define THREAD_RESTART		3		/* restart operation entirely */
+#define	THREAD_NOT_WAITING		10
+
+
+#endif


Property changes on: trunk/sys/sys/mach/thread.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/thread_info.h
===================================================================
--- trunk/sys/sys/mach/thread_info.h	                        (rev 0)
+++ trunk/sys/sys/mach/thread_info.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,168 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/14  17:01:06  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:36:34  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:21:39  mrt]
+ * 
+ * Revision 2.2  90/06/02  15:00:08  rpd
+ * 	Updated for new scheduling info.
+ * 	[90/03/26  22:40:55  rpd]
+ * 
+ * Revision 2.1  89/08/03  16:06:07  rwd
+ * Created.
+ * 
+ * Revision 2.4  89/02/25  18:41:18  gm0w
+ * 	Changes for cleanup.
+ * 
+ *  4-Mar-88  David Black (dlb) at Carnegie-Mellon University
+ *	Added TH_USAGE_SCALE for cpu_usage field.
+ *
+ * 15-Jan-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Changed to generic interface (variable-length array) to allow
+ *	for expansion.  Renamed to thread_info.
+ *
+ *  1-Jun-87  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/thread_info
+ *
+ *	Thread information structure and definitions.
+ *
+ *	The defintions in this file are exported to the user.  The kernel
+ *	will translate its internal data structures to these structures
+ *	as appropriate.
+ *
+ */
+
+#ifndef	_MACH_THREAD_INFO_H_
+#define _MACH_THREAD_INFO_H_
+
+#include <sys/mach/policy.h>
+#include <sys/mach/time_value.h>
+#include <sys/mach/vm_types.h>
+
+/*
+ *	Generic information structure to allow for expansion.
+ */
+typedef	natural_t	thread_flavor_t;
+typedef	integer_t	*thread_info_t;		/* varying array of int */
+
+#define THREAD_INFO_MAX		(1024)	/* maximum array size */
+typedef	integer_t	thread_info_data_t[THREAD_INFO_MAX];
+
+/*
+ *	Currently defined information.
+ */
+#define THREAD_BASIC_INFO         	3     /* basic information */
+
+struct thread_basic_info {
+        time_value_t    user_time;      /* user run time */
+        time_value_t    system_time;    /* system run time */
+        integer_t       cpu_usage;      /* scaled cpu usage percentage */
+	policy_t	policy;		/* scheduling policy in effect */
+        integer_t       run_state;      /* run state (see below) */
+        integer_t       flags;          /* various flags (see below) */
+        integer_t       suspend_count;  /* suspend count for thread */
+        integer_t       sleep_time;     /* number of seconds that thread
+                                           has been sleeping */
+};
+
+typedef struct thread_basic_info  thread_basic_info_data_t;
+typedef struct thread_basic_info  *thread_basic_info_t;
+#define THREAD_BASIC_INFO_COUNT   \
+                (sizeof(thread_basic_info_data_t) / sizeof(natural_t))
+
+/*
+ *	Scale factor for usage field.
+ */
+
+#define TH_USAGE_SCALE	1000
+
+/*
+ *	Thread run states (state field).
+ */
+
+#define TH_STATE_RUNNING	1	/* thread is running normally */
+#define TH_STATE_STOPPED	2	/* thread is stopped */
+#define TH_STATE_WAITING	3	/* thread is waiting normally */
+#define TH_STATE_UNINTERRUPTIBLE 4	/* thread is in an uninterruptible
+					   wait */
+#define TH_STATE_HALTED		5	/* thread is halted at a
+					   clean point */
+
+/*
+ *	Thread flags (flags field).
+ */
+#define TH_FLAGS_SWAPPED	0x1	/* thread is swapped out */
+#define TH_FLAGS_IDLE		0x2	/* thread is an idle thread */
+
+#define THREAD_SCHED_TIMESHARE_INFO	10
+#define THREAD_SCHED_RR_INFO		11
+#define THREAD_SCHED_FIFO_INFO		12
+
+/*
+ *      Constant definitions for thread_switch trap.
+ */
+
+#define SWITCH_OPTION_NONE              0
+#define SWITCH_OPTION_DEPRESS           1
+#define SWITCH_OPTION_WAIT              2
+
+
+#endif	/* _MACH_THREAD_INFO_H_ */


Property changes on: trunk/sys/sys/mach/thread_info.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/thread_pool.h
===================================================================
--- trunk/sys/sys/mach/thread_pool.h	                        (rev 0)
+++ trunk/sys/sys/mach/thread_pool.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,98 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/*
+ * Copyright (c) 1993 The University of Utah and
+ * the Computer Systems Laboratory (CSL).  All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist at cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ *      Author: Bryan Ford, University of Utah CSL
+ *
+ *	File:	thread_pool.h
+ *
+ *	Defines the thread_pool: a pool of available activations.
+ *
+ */
+
+#ifndef	_KERN_THREAD_POOL_H_
+#define _KERN_THREAD_POOL_H_
+
+#include <sys/mach/kern_return.h>
+#include <sys/mach/ipc/ipc_object.h>
+
+typedef struct thread_pool {
+
+	/* List of available activations, all active but not in use.  */
+	struct thread_shuttle	*thr_acts;
+
+	/* true if somebody is waiting for an activation from this pool */
+	int waiting;
+
+} thread_pool, *thread_pool_t;
+#define THREAD_POOL_NULL	((thread_pool_t)0)
+
+/* Exported to kern/startup.c only */
+kern_return_t	thread_pool_init(thread_pool_t new_thread_pool);
+
+/* remove thread from thread pool */
+void thread_pool_remove(thread_act_t thread);
+
+/* Get an activation from a thread_pool, blocking if need be */
+extern thread_act_t thread_pool_get_act( ipc_object_t , int);
+extern void thread_pool_put_act( thread_act_t );
+
+/* Wake up a waiter upon return to thread_pool */
+extern void thread_pool_wakeup( thread_pool_t );
+
+#if	MACH_ASSERT
+/*
+ * Debugging support - "watchacts", a patchable selective trigger
+ */
+extern unsigned int watchacts;	/* debug printf trigger */
+#define WA_SCHED	0x001	/* kern/sched_prim.c	*/
+#define WA_THR		0x002	/* kern/thread.c	*/
+#define WA_ACT_LNK	0x004	/* kern/thread_act.c act mgmt	*/
+#define WA_ACT_HDLR	0x008	/* kern/thread_act.c act hldrs	*/
+#define WA_TASK		0x010	/* kern/task.c		*/
+#define WA_BOOT		0x020	/* bootstrap,startup.c	*/
+#define WA_PCB		0x040	/* machine/pcb.c	*/
+#define WA_PORT		0x080	/* ports + port sets	*/
+#define WA_EXIT		0x100	/* exit path		*/
+#define WA_SWITCH	0x200	/* context switch (!!)	*/
+#define WA_STATE	0x400	/* get/set state  (!!)	*/
+#define WA_ALL		(~0)
+#endif	/* MACH_ASSERT */
+
+#endif /* _KERN_THREAD_POOL_H_ */


Property changes on: trunk/sys/sys/mach/thread_pool.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/thread_special_ports.h
===================================================================
--- trunk/sys/sys/mach/thread_special_ports.h	                        (rev 0)
+++ trunk/sys/sys/mach/thread_special_ports.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,107 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4.2.1  92/03/03  16:22:38  jeffreyh
+ * 	Changes from TRUNK
+ * 	[92/02/26  12:20:46  jeffreyh]
+ * 
+ * Revision 2.5  92/01/15  13:44:57  rpd
+ * 	Changed MACH_IPC_COMPAT conditionals to default to not present.
+ * 
+ * Revision 2.4  91/05/14  17:01:15  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:36:38  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:21:48  mrt]
+ * 
+ * Revision 2.2  90/06/02  15:00:15  rpd
+ * 	Converted to new IPC.
+ * 	[90/03/26  22:41:20  rpd]
+ * 
+ * Revision 2.1  89/08/03  16:06:13  rwd
+ * Created.
+ * 
+ * Revision 2.3  89/02/25  18:41:23  gm0w
+ * 	Changes for cleanup.
+ * 
+ * 17-Jan-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/thread_special_ports.h
+ *
+ *	Defines codes for special_purpose thread ports.  These are NOT
+ *	port identifiers - they are only used for the thread_get_special_port
+ *	and thread_set_special_port routines.
+ *	
+ */
+
+#ifndef	_MACH_THREAD_SPECIAL_PORTS_H_
+#define _MACH_THREAD_SPECIAL_PORTS_H_
+
+#define THREAD_KERNEL_PORT	1	/* Represents the thread to the outside
+					   world.*/
+
+/*
+ *	Definitions for ease of use
+ */
+
+#define thread_get_kernel_port(thread, port)	\
+		(thread_get_special_port((thread), THREAD_KERNEL_PORT, (port)))
+
+#define thread_set_kernel_port(thread, port)	\
+		(thread_set_special_port((thread), THREAD_KERNEL_PORT, (port)))
+
+#endif	/* _MACH_THREAD_SPECIAL_PORTS_H_ */


Property changes on: trunk/sys/sys/mach/thread_special_ports.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/thread_status.h
===================================================================
--- trunk/sys/sys/mach/thread_status.h	                        (rev 0)
+++ trunk/sys/sys/mach/thread_status.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,139 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.3  91/05/14  17:01:22  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.2  91/02/05  17:36:42  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:21:56  mrt]
+ * 
+ * Revision 2.1  89/08/03  16:06:18  rwd
+ * Created.
+ * 
+ * Revision 2.4  89/02/25  18:41:29  gm0w
+ * 	Changes for cleanup.
+ * 
+ * Revision 2.3  89/02/07  00:53:47  mwyoung
+ * Relocated from mach/thread_status.h
+ * 
+ * Revision 2.2  88/08/25  18:21:12  mwyoung
+ * 	Adjusted include file references.
+ * 	[88/08/16  04:16:13  mwyoung]
+ * 	
+ * 	Add THREAD_STATE_FLAVOR_LIST; remove old stuff.
+ * 	[88/08/11  18:49:48  mwyoung]
+ * 
+ *
+ * 15-Jan-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Replaced with variable-length array for flexibile interface.
+ *
+ * 28-Apr-87  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Latest hacks to keep MiG happy wrt refarrays.
+ *
+ * 27-Mar-87  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/thread_status.h
+ *	Author:	Avadis Tevanian, Jr.
+ *
+ *	This file contains the structure definitions for the user-visible
+ *	thread state.  This thread state is examined with the thread_get_state
+ *	kernel call and may be changed with the thread_set_state kernel call.
+ *
+ */
+
+#ifndef	THREAD_STATUS_H_
+#define	THREAD_STATUS_H_
+
+/*
+ *	The actual structure that comprises the thread state is defined
+ *	in the machine dependent module.
+ */
+#include <sys/mach/mach_types.h>
+#include <sys/mach/vm_types.h>
+/*
+ *	Generic definition for machine-dependent thread status.
+ */
+
+#define x86_THREAD_STATE32              1
+#define x86_FLOAT_STATE32               2
+#define x86_EXCEPTION_STATE32           3
+#define x86_THREAD_STATE64              4
+#define x86_FLOAT_STATE64               5
+#define x86_EXCEPTION_STATE64           6
+#define x86_THREAD_STATE                7
+#define x86_FLOAT_STATE                 8
+#define x86_EXCEPTION_STATE             9
+#define x86_DEBUG_STATE32               10
+#define x86_DEBUG_STATE64               11
+#define x86_DEBUG_STATE                 12
+#define THREAD_STATE_NONE               13
+/* 14 and 15 are used for the internal x86_SAVED_STATE flavours */
+#define x86_AVX_STATE32                 16
+#define x86_AVX_STATE64                 17
+#define x86_AVX_STATE                   18
+
+
+typedef	natural_t	*thread_state_t;	/* Variable-length array */
+
+typedef	int	thread_state_data_t[THREAD_STATE_MAX];
+
+#define	THREAD_STATE_FLAVOR_LIST	0	/* List of valid flavors */
+
+typedef	int			thread_state_flavor_t;
+typedef thread_state_flavor_t	*thread_state_flavor_array_t;
+
+#endif	/* THREAD_STATUS_H_ */


Property changes on: trunk/sys/sys/mach/thread_status.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/thread_switch.h
===================================================================
--- trunk/sys/sys/mach/thread_switch.h	                        (rev 0)
+++ trunk/sys/sys/mach/thread_switch.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,104 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/14  17:01:33  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:36:45  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:22:02  mrt]
+ * 
+ * Revision 2.2  90/06/02  15:00:19  rpd
+ * 	Created for new host/processor technology.
+ * 	[90/03/26  23:51:49  rpd]
+ * 
+ * 	Merge to X96
+ * 	[89/08/02  23:12:52  dlb]
+ * 
+ * 	Created.
+ * 	[89/07/25  19:05:41  dlb]
+ * 
+ * Revision 2.3  89/10/15  02:06:04  rpd
+ * 	Minor cleanups.
+ * 
+ * Revision 2.2  89/10/11  14:41:47  dlb
+ * 	Merge.
+ * 	[89/09/01  17:57:58  dlb]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+#ifndef	_MACH_THREAD_SWITCH_H_
+#define	_MACH_THREAD_SWITCH_H_
+
+#include <sys/mach/kern_return.h>
+#include <sys/mach/message.h>
+#include <sys/mach/port.h>
+
+/*
+ *	Constant definitions for thread_switch trap.
+ */
+
+#define	SWITCH_OPTION_NONE	0
+#define SWITCH_OPTION_DEPRESS	1
+#define SWITCH_OPTION_WAIT	2
+#define SWITCH_OPTION_IDLE	3
+
+#define valid_switch_option(opt)	((0 <= (opt)) && ((opt) <= 2))
+
+/* Attempt to context switch */
+extern kern_return_t	mach_thread_switch(
+				mach_port_name_t		thread_name,
+				int			option,
+				mach_msg_timeout_t	option_time);
+
+#endif	/* _MACH_THREAD_SWITCH_H_ */


Property changes on: trunk/sys/sys/mach/thread_switch.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/time_value.h
===================================================================
--- trunk/sys/sys/mach/time_value.h	                        (rev 0)
+++ trunk/sys/sys/mach/time_value.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,134 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/18  14:35:13  rpd
+ * 	Added mapped_time_value_t.
+ * 	[91/03/21            rpd]
+ * 
+ * Revision 2.3  91/05/14  17:01:40  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.2  91/02/05  17:36:49  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:22:07  mrt]
+ * 
+ * Revision 2.1  89/08/03  16:06:24  rwd
+ * Created.
+ * 
+ * Revision 2.4  89/02/25  18:41:34  gm0w
+ * 	Changes for cleanup.
+ * 
+ * Revision 2.3  89/02/07  00:53:58  mwyoung
+ * Relocated from sys/time_value.h
+ * 
+ * Revision 2.2  89/01/31  01:21:58  rpd
+ * 	TIME_MICROS_MAX should be 1 Million, not 10 Million.
+ * 	[88/10/12            dlb]
+ * 
+ *  4-Jan-88  David Golub (dbg) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+#ifndef	TIME_VALUE_H_
+#define	TIME_VALUE_H_
+
+/*
+ *	Time value returned by kernel.
+ */
+
+struct time_value {
+	integer_t seconds;
+	integer_t microseconds;
+};
+typedef	struct time_value	time_value_t;
+
+/*
+ *	Macros to manipulate time values.  Assume that time values
+ *	are normalized (microseconds <= 999999).
+ */
+#define	TIME_MICROS_MAX	(1000000)
+
+#define	time_value_add_usec(val, micros)	{	\
+	if (((val)->microseconds += (micros))		\
+		>= TIME_MICROS_MAX) {			\
+	    (val)->microseconds -= TIME_MICROS_MAX;	\
+	    (val)->seconds++;				\
+	}						\
+}
+
+#define	time_value_add(result, addend)		{		\
+	(result)->microseconds += (addend)->microseconds;	\
+	(result)->seconds += (addend)->seconds;			\
+	if ((result)->microseconds >= TIME_MICROS_MAX) {	\
+	    (result)->microseconds -= TIME_MICROS_MAX;		\
+	    (result)->seconds++;				\
+	}							\
+}
+
+/*
+ *	Time value available through the mapped-time interface.
+ *	Read this mapped value with
+ *		do {
+ *			secs = mtime->seconds;
+ *			usecs = mtime->microseconds;
+ *		} while (secs != mtime->check_seconds);
+ */
+
+typedef struct mapped_time_value {
+	integer_t seconds;
+	integer_t microseconds;
+	integer_t check_seconds;
+} mapped_time_value_t;
+
+#endif	/* TIME_VALUE_H_ */


Property changes on: trunk/sys/sys/mach/time_value.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/vm_attributes.h
===================================================================
--- trunk/sys/sys/mach/vm_attributes.h	                        (rev 0)
+++ trunk/sys/sys/mach/vm_attributes.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,108 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4  91/05/14  17:02:37  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:37:24  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:22:17  mrt]
+ * 
+ * Revision 2.2  90/01/22  23:05:53  af
+ * 	Created.
+ * 	[89/12/08            af]
+ * 
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/vm_attributes.h
+ *	Author:	Alessandro Forin
+ *
+ *	Virtual memory attributes definitions.
+ *
+ *	These definitions are in addition to the machine-independent
+ *	ones (e.g. protection), and are only selectively supported
+ *	on specific machine architectures.
+ *
+ */
+
+#ifndef	VM_ATTRIBUTES_H_
+#define	VM_ATTRIBUTES_H_
+
+/*
+ *	Types of machine-dependent attributes
+ */
+typedef unsigned int	vm_machine_attribute_t;
+
+#define	MATTR_CACHE		1	/* cachability */
+#define MATTR_MIGRATE		2	/* migrability */
+#define	MATTR_REPLICATE		4	/* replicability */
+
+/*
+ *	Values for the above, e.g. operations on attribute
+ */
+typedef int		vm_machine_attribute_val_t;
+
+#define MATTR_VAL_OFF		0	/* (generic) turn attribute off */
+#define MATTR_VAL_ON		1	/* (generic) turn attribute on */
+#define MATTR_VAL_GET		2	/* (generic) return current value */
+
+#define MATTR_VAL_CACHE_FLUSH	6	/* flush from all caches */
+#define MATTR_VAL_DCACHE_FLUSH	7	/* flush from data caches */
+#define MATTR_VAL_ICACHE_FLUSH	8	/* flush from instruction caches */
+#define MATTR_VAL_CACHE_SYNC	9	/* sync I+D caches */
+#define MATTR_VAL_CACHE_SYNC	9	/* sync I+D caches */
+
+#define MATTR_VAL_GET_INFO	10	/* get page info (stats) */
+
+#endif	/* VM_ATTRIBUTES_H_ */


Property changes on: trunk/sys/sys/mach/vm_attributes.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/vm_behavior.h
===================================================================
--- trunk/sys/sys/mach/vm_behavior.h	                        (rev 0)
+++ trunk/sys/sys/mach/vm_behavior.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/*
+ *	File:	mach/vm_behavior.h
+ *
+ *	Virtual memory map behavior definitions.
+ *
+ */
+
+#ifndef	_MACH_VM_BEHAVIOR_H_
+#define _MACH_VM_BEHAVIOR_H_
+
+/*
+ *	Types defined:
+ *
+ *	vm_behavior_t	behavior codes.
+ */
+
+typedef int		vm_behavior_t;
+
+/*
+ *	Enumeration of valid values for vm_behavior_t.
+ *	These describe expected page reference behavior for 
+ *	for a given range of virtual memory.  For implementation 
+ *	details see vm/vm_fault.c
+ */
+
+
+#define VM_BEHAVIOR_DEFAULT	((vm_behavior_t) 0)	/* default */
+#define VM_BEHAVIOR_RANDOM	((vm_behavior_t) 1)	/* random */
+#define VM_BEHAVIOR_SEQUENTIAL	((vm_behavior_t) 2)	/* forward sequential */
+#define VM_BEHAVIOR_RSEQNTL	((vm_behavior_t) 3)	/* reverse sequential */
+
+#endif	/*_MACH_VM_BEHAVIOR_H_*/


Property changes on: trunk/sys/sys/mach/vm_behavior.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/vm_inherit.h
===================================================================
--- trunk/sys/sys/mach/vm_inherit.h	                        (rev 0)
+++ trunk/sys/sys/mach/vm_inherit.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,95 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.3  91/05/14  17:02:47  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.2  91/02/05  17:37:31  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:22:24  mrt]
+ * 
+ * Revision 2.1  89/08/03  16:06:30  rwd
+ * Created.
+ * 
+ * Revision 2.3  89/02/25  18:42:18  gm0w
+ * 	Changes for cleanup.
+ * 
+ * 16-Sep-85  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/vm_inherit.h
+ *	Author:	Avadis Tevanian, Jr., Michael Wayne Young
+ *
+ *	Virtual memory map inheritance definitions.
+ *
+ */
+
+#ifndef	VM_INHERIT_H_
+#define	VM_INHERIT_H_
+
+
+/*
+ *	Enumeration of valid values for vm_inherit_t.
+ */
+
+#define	VM_INHERIT_SHARE	((vm_inherit_t) 0)	/* share with child */
+#define	VM_INHERIT_COPY		((vm_inherit_t) 1)	/* copy into child */
+#define VM_INHERIT_NONE		((vm_inherit_t) 2)	/* absent from child */
+#define	VM_INHERIT_DONATE_COPY	((vm_inherit_t) 3)	/* copy and delete */
+
+#define VM_INHERIT_DEFAULT	VM_INHERIT_COPY
+#define VM_INHERIT_LAST_VALID VM_INHERIT_NONE
+
+#endif	/* VM_INHERIT_H_ */


Property changes on: trunk/sys/sys/mach/vm_inherit.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/vm_map_server.h
===================================================================
--- trunk/sys/sys/mach/vm_map_server.h	                        (rev 0)
+++ trunk/sys/sys/mach/vm_map_server.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,2217 @@
+#ifndef	_vm_map_server_
+#define	_vm_map_server_
+
+/* Module vm_map */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#ifdef _KERNEL
+#include <sys/mach/ndr.h>
+#include <sys/mach/kern_return.h>
+#include <sys/mach/notify.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach/message.h>
+#include <sys/mach/mig_errors.h>
+#else /* !_KERNEL */
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#endif /*_KERNEL */
+
+#ifdef AUTOTEST
+#ifndef FUNCTION_PTR_T
+#define FUNCTION_PTR_T
+typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
+typedef struct {
+        char            *name;
+        function_ptr_t  function;
+} function_table_entry;
+typedef function_table_entry   *function_table_t;
+#endif /* FUNCTION_PTR_T */
+#endif /* AUTOTEST */
+
+#ifndef	vm_map_MSG_COUNT
+#define	vm_map_MSG_COUNT	31
+#endif	/* vm_map_MSG_COUNT */
+
+#include <sys/mach/std_types.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/ipc_sync.h>
+#include <sys/mach/ipc/ipc_voucher.h>
+#include <sys/mach/ipc_host.h>
+#include <sys/mach/ipc_tt.h>
+#include <sys/mach/ipc_mig.h>
+#include <sys/mach/mig.h>
+#include <sys/mach/mach_types.h>
+#include <sys/mach_debug/mach_debug_types.h>
+#include <sys/mach/vm_types.h>
+
+#ifdef __BeforeMigServerHeader
+__BeforeMigServerHeader
+#endif /* __BeforeMigServerHeader */
+
+
+/* Routine vm_region */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_region
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, flavor, info, infoCnt, object_name)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t *size;
+	vm_region_flavor_t flavor;
+	vm_region_info_t info;
+	mach_msg_type_number_t *infoCnt;
+	mach_port_t *object_name;
+{ return vm_region(target_task, address, size, flavor, info, infoCnt, object_name); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t *size,
+	vm_region_flavor_t flavor,
+	vm_region_info_t info,
+	mach_msg_type_number_t *infoCnt,
+	mach_port_t *object_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_allocate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_allocate
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, flags)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t size;
+	int flags;
+{ return vm_allocate(target_task, address, size, flags); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t size,
+	int flags
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_deallocate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_deallocate
+#if	defined(LINTLIBRARY)
+    (target_task, address, size)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+{ return vm_deallocate(target_task, address, size); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_protect */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_protect
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, set_maximum, new_protection)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	boolean_t set_maximum;
+	vm_prot_t new_protection;
+{ return vm_protect(target_task, address, size, set_maximum, new_protection); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	boolean_t set_maximum,
+	vm_prot_t new_protection
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_inherit */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_inherit
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, new_inheritance)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_inherit_t new_inheritance;
+{ return vm_inherit(target_task, address, size, new_inheritance); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_inherit_t new_inheritance
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_read */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_read
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, data, dataCnt)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_offset_t *data;
+	mach_msg_type_number_t *dataCnt;
+{ return vm_read(target_task, address, size, data, dataCnt); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_offset_t *data,
+	mach_msg_type_number_t *dataCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_read_list */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_read_list
+#if	defined(LINTLIBRARY)
+    (target_task, data_list, count)
+	vm_map_t target_task;
+	vm_read_entry_t data_list;
+	natural_t count;
+{ return vm_read_list(target_task, data_list, count); }
+#else
+(
+	vm_map_t target_task,
+	vm_read_entry_t data_list,
+	natural_t count
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_write */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_write
+#if	defined(LINTLIBRARY)
+    (target_task, address, data, dataCnt)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_offset_t data;
+	mach_msg_type_number_t dataCnt;
+{ return vm_write(target_task, address, data, dataCnt); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_offset_t data,
+	mach_msg_type_number_t dataCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_copy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_copy
+#if	defined(LINTLIBRARY)
+    (target_task, source_address, size, dest_address)
+	vm_map_t target_task;
+	vm_address_t source_address;
+	vm_size_t size;
+	vm_address_t dest_address;
+{ return vm_copy(target_task, source_address, size, dest_address); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t source_address,
+	vm_size_t size,
+	vm_address_t dest_address
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_read_overwrite */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_read_overwrite
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, data, outsize)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_address_t data;
+	vm_size_t *outsize;
+{ return vm_read_overwrite(target_task, address, size, data, outsize); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_address_t data,
+	vm_size_t *outsize
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_msync */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_msync
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, sync_flags)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_sync_t sync_flags;
+{ return vm_msync(target_task, address, size, sync_flags); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_sync_t sync_flags
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_behavior_set */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_behavior_set
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, new_behavior)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_behavior_t new_behavior;
+{ return vm_behavior_set(target_task, address, size, new_behavior); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_behavior_t new_behavior
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_machine_attribute */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_machine_attribute
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, attribute, value)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_machine_attribute_t attribute;
+	vm_machine_attribute_val_t *value;
+{ return vm_machine_attribute(target_task, address, size, attribute, value); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_machine_attribute_t attribute,
+	vm_machine_attribute_val_t *value
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_remap */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_remap
+#if	defined(LINTLIBRARY)
+    (target_task, target_address, size, mask, flags, src_task, src_address, copy, cur_protection, max_protection, inheritance)
+	vm_map_t target_task;
+	vm_address_t *target_address;
+	vm_size_t size;
+	vm_address_t mask;
+	int flags;
+	vm_map_t src_task;
+	vm_address_t src_address;
+	boolean_t copy;
+	vm_prot_t *cur_protection;
+	vm_prot_t *max_protection;
+	vm_inherit_t inheritance;
+{ return vm_remap(target_task, target_address, size, mask, flags, src_task, src_address, copy, cur_protection, max_protection, inheritance); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *target_address,
+	vm_size_t size,
+	vm_address_t mask,
+	int flags,
+	vm_map_t src_task,
+	vm_address_t src_address,
+	boolean_t copy,
+	vm_prot_t *cur_protection,
+	vm_prot_t *max_protection,
+	vm_inherit_t inheritance
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_wire */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_wire
+#if	defined(LINTLIBRARY)
+    (target_task, must_wire)
+	vm_map_t target_task;
+	boolean_t must_wire;
+{ return task_wire(target_task, must_wire); }
+#else
+(
+	vm_map_t target_task,
+	boolean_t must_wire
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_make_memory_entry */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_make_memory_entry
+#if	defined(LINTLIBRARY)
+    (target_task, size, offset, permission, object_handle, parent_entry)
+	vm_map_t target_task;
+	vm_size_t *size;
+	vm_offset_t offset;
+	vm_prot_t permission;
+	mem_entry_name_port_t *object_handle;
+	mem_entry_name_port_t parent_entry;
+{ return mach_make_memory_entry(target_task, size, offset, permission, object_handle, parent_entry); }
+#else
+(
+	vm_map_t target_task,
+	vm_size_t *size,
+	vm_offset_t offset,
+	vm_prot_t permission,
+	mem_entry_name_port_t *object_handle,
+	mem_entry_name_port_t parent_entry
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_map_page_query */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_map_page_query
+#if	defined(LINTLIBRARY)
+    (target_map, offset, disposition, ref_count)
+	vm_map_t target_map;
+	vm_offset_t offset;
+	integer_t *disposition;
+	integer_t *ref_count;
+{ return vm_map_page_query(target_map, offset, disposition, ref_count); }
+#else
+(
+	vm_map_t target_map,
+	vm_offset_t offset,
+	integer_t *disposition,
+	integer_t *ref_count
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_region_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_region_info
+#if	defined(LINTLIBRARY)
+    (task, address, region, objects, objectsCnt)
+	vm_map_t task;
+	vm_address_t address;
+	vm_info_region_t *region;
+	vm_info_object_array_t *objects;
+	mach_msg_type_number_t *objectsCnt;
+{ return mach_vm_region_info(task, address, region, objects, objectsCnt); }
+#else
+(
+	vm_map_t task,
+	vm_address_t address,
+	vm_info_region_t *region,
+	vm_info_object_array_t *objects,
+	mach_msg_type_number_t *objectsCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_mapped_pages_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_mapped_pages_info
+#if	defined(LINTLIBRARY)
+    (task, pages, pagesCnt)
+	vm_map_t task;
+	page_address_array_t *pages;
+	mach_msg_type_number_t *pagesCnt;
+{ return vm_mapped_pages_info(task, pages, pagesCnt); }
+#else
+(
+	vm_map_t task,
+	page_address_array_t *pages,
+	mach_msg_type_number_t *pagesCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_region_recurse */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_region_recurse
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, nesting_depth, info, infoCnt)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t *size;
+	natural_t *nesting_depth;
+	vm_region_recurse_info_t info;
+	mach_msg_type_number_t *infoCnt;
+{ return vm_region_recurse(target_task, address, size, nesting_depth, info, infoCnt); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t *size,
+	natural_t *nesting_depth,
+	vm_region_recurse_info_t info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_region_recurse_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_region_recurse_64
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, nesting_depth, info, infoCnt)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t *size;
+	natural_t *nesting_depth;
+	vm_region_recurse_info_t info;
+	mach_msg_type_number_t *infoCnt;
+{ return vm_region_recurse_64(target_task, address, size, nesting_depth, info, infoCnt); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t *size,
+	natural_t *nesting_depth,
+	vm_region_recurse_info_t info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_region_info_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_region_info_64
+#if	defined(LINTLIBRARY)
+    (task, address, region, objects, objectsCnt)
+	vm_map_t task;
+	vm_address_t address;
+	vm_info_region_64_t *region;
+	vm_info_object_array_t *objects;
+	mach_msg_type_number_t *objectsCnt;
+{ return mach_vm_region_info_64(task, address, region, objects, objectsCnt); }
+#else
+(
+	vm_map_t task,
+	vm_address_t address,
+	vm_info_region_64_t *region,
+	vm_info_object_array_t *objects,
+	mach_msg_type_number_t *objectsCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_region_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_region_64
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, flavor, info, infoCnt, object_name)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t *size;
+	vm_region_flavor_t flavor;
+	vm_region_info_t info;
+	mach_msg_type_number_t *infoCnt;
+	mach_port_t *object_name;
+{ return vm_region_64(target_task, address, size, flavor, info, infoCnt, object_name); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t *size,
+	vm_region_flavor_t flavor,
+	vm_region_info_t info,
+	mach_msg_type_number_t *infoCnt,
+	mach_port_t *object_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_make_memory_entry_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_make_memory_entry_64
+#if	defined(LINTLIBRARY)
+    (target_task, size, offset, permission, object_handle, parent_entry)
+	vm_map_t target_task;
+	memory_object_size_t *size;
+	memory_object_offset_t offset;
+	vm_prot_t permission;
+	mach_port_t *object_handle;
+	mem_entry_name_port_t parent_entry;
+{ return mach_make_memory_entry_64(target_task, size, offset, permission, object_handle, parent_entry); }
+#else
+(
+	vm_map_t target_task,
+	memory_object_size_t *size,
+	memory_object_offset_t offset,
+	vm_prot_t permission,
+	mach_port_t *object_handle,
+	mem_entry_name_port_t parent_entry
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_purgable_control */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_purgable_control
+#if	defined(LINTLIBRARY)
+    (target_task, address, control, state)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_purgable_t control;
+	int *state;
+{ return vm_purgable_control(target_task, address, control, state); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_purgable_t control,
+	int *state
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_region */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_region
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, flavor, info, infoCnt, object_name)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t *size;
+	vm_region_flavor_t flavor;
+	vm_region_info_t info;
+	mach_msg_type_number_t *infoCnt;
+	mach_port_t *object_name;
+{ return vm_region(target_task, address, size, flavor, info, infoCnt, object_name); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t *size,
+	vm_region_flavor_t flavor,
+	vm_region_info_t info,
+	mach_msg_type_number_t *infoCnt,
+	mach_port_t *object_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_allocate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_allocate
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, flags)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t size;
+	int flags;
+{ return vm_allocate(target_task, address, size, flags); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t size,
+	int flags
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_deallocate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_deallocate
+#if	defined(LINTLIBRARY)
+    (target_task, address, size)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+{ return vm_deallocate(target_task, address, size); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_protect */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_protect
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, set_maximum, new_protection)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	boolean_t set_maximum;
+	vm_prot_t new_protection;
+{ return vm_protect(target_task, address, size, set_maximum, new_protection); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	boolean_t set_maximum,
+	vm_prot_t new_protection
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_inherit */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_inherit
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, new_inheritance)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_inherit_t new_inheritance;
+{ return vm_inherit(target_task, address, size, new_inheritance); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_inherit_t new_inheritance
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_read */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_read
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, data, dataCnt)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_offset_t *data;
+	mach_msg_type_number_t *dataCnt;
+{ return vm_read(target_task, address, size, data, dataCnt); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_offset_t *data,
+	mach_msg_type_number_t *dataCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_read_list */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_read_list
+#if	defined(LINTLIBRARY)
+    (target_task, data_list, count)
+	vm_map_t target_task;
+	vm_read_entry_t data_list;
+	natural_t count;
+{ return vm_read_list(target_task, data_list, count); }
+#else
+(
+	vm_map_t target_task,
+	vm_read_entry_t data_list,
+	natural_t count
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_write */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_write
+#if	defined(LINTLIBRARY)
+    (target_task, address, data, dataCnt)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_offset_t data;
+	mach_msg_type_number_t dataCnt;
+{ return vm_write(target_task, address, data, dataCnt); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_offset_t data,
+	mach_msg_type_number_t dataCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_copy */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_copy
+#if	defined(LINTLIBRARY)
+    (target_task, source_address, size, dest_address)
+	vm_map_t target_task;
+	vm_address_t source_address;
+	vm_size_t size;
+	vm_address_t dest_address;
+{ return vm_copy(target_task, source_address, size, dest_address); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t source_address,
+	vm_size_t size,
+	vm_address_t dest_address
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_read_overwrite */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_read_overwrite
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, data, outsize)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_address_t data;
+	vm_size_t *outsize;
+{ return vm_read_overwrite(target_task, address, size, data, outsize); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_address_t data,
+	vm_size_t *outsize
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_msync */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_msync
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, sync_flags)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_sync_t sync_flags;
+{ return vm_msync(target_task, address, size, sync_flags); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_sync_t sync_flags
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_behavior_set */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_behavior_set
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, new_behavior)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_behavior_t new_behavior;
+{ return vm_behavior_set(target_task, address, size, new_behavior); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_behavior_t new_behavior
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_machine_attribute */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_machine_attribute
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, attribute, value)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_size_t size;
+	vm_machine_attribute_t attribute;
+	vm_machine_attribute_val_t *value;
+{ return vm_machine_attribute(target_task, address, size, attribute, value); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_size_t size,
+	vm_machine_attribute_t attribute,
+	vm_machine_attribute_val_t *value
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_remap */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_remap
+#if	defined(LINTLIBRARY)
+    (target_task, target_address, size, mask, flags, src_task, src_address, copy, cur_protection, max_protection, inheritance)
+	vm_map_t target_task;
+	vm_address_t *target_address;
+	vm_size_t size;
+	vm_address_t mask;
+	int flags;
+	vm_map_t src_task;
+	vm_address_t src_address;
+	boolean_t copy;
+	vm_prot_t *cur_protection;
+	vm_prot_t *max_protection;
+	vm_inherit_t inheritance;
+{ return vm_remap(target_task, target_address, size, mask, flags, src_task, src_address, copy, cur_protection, max_protection, inheritance); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *target_address,
+	vm_size_t size,
+	vm_address_t mask,
+	int flags,
+	vm_map_t src_task,
+	vm_address_t src_address,
+	boolean_t copy,
+	vm_prot_t *cur_protection,
+	vm_prot_t *max_protection,
+	vm_inherit_t inheritance
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine task_wire */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t task_wire
+#if	defined(LINTLIBRARY)
+    (target_task, must_wire)
+	vm_map_t target_task;
+	boolean_t must_wire;
+{ return task_wire(target_task, must_wire); }
+#else
+(
+	vm_map_t target_task,
+	boolean_t must_wire
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_make_memory_entry */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_make_memory_entry
+#if	defined(LINTLIBRARY)
+    (target_task, size, offset, permission, object_handle, parent_entry)
+	vm_map_t target_task;
+	vm_size_t *size;
+	vm_offset_t offset;
+	vm_prot_t permission;
+	mem_entry_name_port_t *object_handle;
+	mem_entry_name_port_t parent_entry;
+{ return mach_make_memory_entry(target_task, size, offset, permission, object_handle, parent_entry); }
+#else
+(
+	vm_map_t target_task,
+	vm_size_t *size,
+	vm_offset_t offset,
+	vm_prot_t permission,
+	mem_entry_name_port_t *object_handle,
+	mem_entry_name_port_t parent_entry
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_map_page_query */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_map_page_query
+#if	defined(LINTLIBRARY)
+    (target_map, offset, disposition, ref_count)
+	vm_map_t target_map;
+	vm_offset_t offset;
+	integer_t *disposition;
+	integer_t *ref_count;
+{ return vm_map_page_query(target_map, offset, disposition, ref_count); }
+#else
+(
+	vm_map_t target_map,
+	vm_offset_t offset,
+	integer_t *disposition,
+	integer_t *ref_count
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_region_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_region_info
+#if	defined(LINTLIBRARY)
+    (task, address, region, objects, objectsCnt)
+	vm_map_t task;
+	vm_address_t address;
+	vm_info_region_t *region;
+	vm_info_object_array_t *objects;
+	mach_msg_type_number_t *objectsCnt;
+{ return mach_vm_region_info(task, address, region, objects, objectsCnt); }
+#else
+(
+	vm_map_t task,
+	vm_address_t address,
+	vm_info_region_t *region,
+	vm_info_object_array_t *objects,
+	mach_msg_type_number_t *objectsCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_mapped_pages_info */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_mapped_pages_info
+#if	defined(LINTLIBRARY)
+    (task, pages, pagesCnt)
+	vm_map_t task;
+	page_address_array_t *pages;
+	mach_msg_type_number_t *pagesCnt;
+{ return vm_mapped_pages_info(task, pages, pagesCnt); }
+#else
+(
+	vm_map_t task,
+	page_address_array_t *pages,
+	mach_msg_type_number_t *pagesCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_region_recurse */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_region_recurse
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, nesting_depth, info, infoCnt)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t *size;
+	natural_t *nesting_depth;
+	vm_region_recurse_info_t info;
+	mach_msg_type_number_t *infoCnt;
+{ return vm_region_recurse(target_task, address, size, nesting_depth, info, infoCnt); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t *size,
+	natural_t *nesting_depth,
+	vm_region_recurse_info_t info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_region_recurse_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_region_recurse_64
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, nesting_depth, info, infoCnt)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t *size;
+	natural_t *nesting_depth;
+	vm_region_recurse_info_t info;
+	mach_msg_type_number_t *infoCnt;
+{ return vm_region_recurse_64(target_task, address, size, nesting_depth, info, infoCnt); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t *size,
+	natural_t *nesting_depth,
+	vm_region_recurse_info_t info,
+	mach_msg_type_number_t *infoCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_vm_region_info_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_vm_region_info_64
+#if	defined(LINTLIBRARY)
+    (task, address, region, objects, objectsCnt)
+	vm_map_t task;
+	vm_address_t address;
+	vm_info_region_64_t *region;
+	vm_info_object_array_t *objects;
+	mach_msg_type_number_t *objectsCnt;
+{ return mach_vm_region_info_64(task, address, region, objects, objectsCnt); }
+#else
+(
+	vm_map_t task,
+	vm_address_t address,
+	vm_info_region_64_t *region,
+	vm_info_object_array_t *objects,
+	mach_msg_type_number_t *objectsCnt
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_region_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_region_64
+#if	defined(LINTLIBRARY)
+    (target_task, address, size, flavor, info, infoCnt, object_name)
+	vm_map_t target_task;
+	vm_address_t *address;
+	vm_size_t *size;
+	vm_region_flavor_t flavor;
+	vm_region_info_t info;
+	mach_msg_type_number_t *infoCnt;
+	mach_port_t *object_name;
+{ return vm_region_64(target_task, address, size, flavor, info, infoCnt, object_name); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t *address,
+	vm_size_t *size,
+	vm_region_flavor_t flavor,
+	vm_region_info_t info,
+	mach_msg_type_number_t *infoCnt,
+	mach_port_t *object_name
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine mach_make_memory_entry_64 */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t mach_make_memory_entry_64
+#if	defined(LINTLIBRARY)
+    (target_task, size, offset, permission, object_handle, parent_entry)
+	vm_map_t target_task;
+	memory_object_size_t *size;
+	memory_object_offset_t offset;
+	vm_prot_t permission;
+	mach_port_t *object_handle;
+	mem_entry_name_port_t parent_entry;
+{ return mach_make_memory_entry_64(target_task, size, offset, permission, object_handle, parent_entry); }
+#else
+(
+	vm_map_t target_task,
+	memory_object_size_t *size,
+	memory_object_offset_t offset,
+	vm_prot_t permission,
+	mach_port_t *object_handle,
+	mem_entry_name_port_t parent_entry
+);
+#endif	/* defined(LINTLIBRARY) */
+
+/* Routine vm_purgable_control */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t vm_purgable_control
+#if	defined(LINTLIBRARY)
+    (target_task, address, control, state)
+	vm_map_t target_task;
+	vm_address_t address;
+	vm_purgable_t control;
+	int *state;
+{ return vm_purgable_control(target_task, address, control, state); }
+#else
+(
+	vm_map_t target_task,
+	vm_address_t address,
+	vm_purgable_t control,
+	int *state
+);
+#endif	/* defined(LINTLIBRARY) */
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+boolean_t vm_map_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+mig_routine_t vm_map_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+extern const struct vm_map_subsystem {
+	mig_server_routine_t	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[31];
+} vm_map_subsystem;
+
+/* typedefs for all requests */
+
+#ifndef __Request__vm_map_subsystem__defined
+#define __Request__vm_map_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_region_flavor_t flavor;
+		mach_msg_type_number_t infoCnt;
+	} __Request__vm_region_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		int flags;
+	} __Request__vm_allocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+	} __Request__vm_deallocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		boolean_t set_maximum;
+		vm_prot_t new_protection;
+	} __Request__vm_protect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_inherit_t new_inheritance;
+	} __Request__vm_inherit_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+	} __Request__vm_read_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_read_entry_t data_list;
+		natural_t count;
+	} __Request__vm_read_list_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		mach_msg_type_number_t dataCnt;
+	} __Request__vm_write_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t source_address;
+		vm_size_t size;
+		vm_address_t dest_address;
+	} __Request__vm_copy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_address_t data;
+	} __Request__vm_read_overwrite_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_sync_t sync_flags;
+	} __Request__vm_msync_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_behavior_t new_behavior;
+	} __Request__vm_behavior_set_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		vm_machine_attribute_t attribute;
+		vm_machine_attribute_val_t value;
+	} __Request__vm_machine_attribute_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t src_task;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t target_address;
+		vm_size_t size;
+		vm_address_t mask;
+		int flags;
+		vm_address_t src_address;
+		boolean_t copy;
+		vm_inherit_t inheritance;
+	} __Request__vm_remap_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		boolean_t must_wire;
+	} __Request__task_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t parent_entry;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_size_t size;
+		vm_offset_t offset;
+		vm_prot_t permission;
+	} __Request__mach_make_memory_entry_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_offset_t offset;
+	} __Request__vm_map_page_query_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+	} __Request__mach_vm_region_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+	} __Request__vm_mapped_pages_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+	} __Request__vm_region_recurse_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+	} __Request__vm_region_recurse_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+	} __Request__mach_vm_region_info_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_region_flavor_t flavor;
+		mach_msg_type_number_t infoCnt;
+	} __Request__vm_region_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t parent_entry;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		memory_object_size_t size;
+		memory_object_offset_t offset;
+		vm_prot_t permission;
+	} __Request__mach_make_memory_entry_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_purgable_t control;
+		int state;
+	} __Request__vm_purgable_control_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__vm_map_subsystem__defined */
+
+
+/* union of all requests */
+
+#ifndef __RequestUnion__vm_map_subsystem__defined
+#define __RequestUnion__vm_map_subsystem__defined
+union __RequestUnion__vm_map_subsystem {
+	__Request__vm_region_t Request_vm_region;
+	__Request__vm_allocate_t Request_vm_allocate;
+	__Request__vm_deallocate_t Request_vm_deallocate;
+	__Request__vm_protect_t Request_vm_protect;
+	__Request__vm_inherit_t Request_vm_inherit;
+	__Request__vm_read_t Request_vm_read;
+	__Request__vm_read_list_t Request_vm_read_list;
+	__Request__vm_write_t Request_vm_write;
+	__Request__vm_copy_t Request_vm_copy;
+	__Request__vm_read_overwrite_t Request_vm_read_overwrite;
+	__Request__vm_msync_t Request_vm_msync;
+	__Request__vm_behavior_set_t Request_vm_behavior_set;
+	__Request__vm_machine_attribute_t Request_vm_machine_attribute;
+	__Request__vm_remap_t Request_vm_remap;
+	__Request__task_wire_t Request_task_wire;
+	__Request__mach_make_memory_entry_t Request_mach_make_memory_entry;
+	__Request__vm_map_page_query_t Request_vm_map_page_query;
+	__Request__mach_vm_region_info_t Request_mach_vm_region_info;
+	__Request__vm_mapped_pages_info_t Request_vm_mapped_pages_info;
+	__Request__vm_region_recurse_t Request_vm_region_recurse;
+	__Request__vm_region_recurse_64_t Request_vm_region_recurse_64;
+	__Request__mach_vm_region_info_64_t Request_mach_vm_region_info_64;
+	__Request__vm_region_64_t Request_vm_region_64;
+	__Request__mach_make_memory_entry_64_t Request_mach_make_memory_entry_64;
+	__Request__vm_purgable_control_t Request_vm_purgable_control;
+};
+#endif /* __RequestUnion__vm_map_subsystem__defined */
+/* typedefs for all replies */
+
+#ifndef __Reply__vm_map_subsystem__defined
+#define __Reply__vm_map_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t object_name;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		mach_msg_type_number_t infoCnt;
+		int info[10];
+	} __Reply__vm_region_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_address_t address;
+	} __Reply__vm_allocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_deallocate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_protect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_inherit_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t data;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t dataCnt;
+	} __Reply__vm_read_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_read_entry_t data_list;
+	} __Reply__vm_read_list_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_write_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_copy_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_size_t outsize;
+	} __Reply__vm_read_overwrite_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_msync_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__vm_behavior_set_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_machine_attribute_val_t value;
+	} __Reply__vm_machine_attribute_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_address_t target_address;
+		vm_prot_t cur_protection;
+		vm_prot_t max_protection;
+	} __Reply__vm_remap_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__task_wire_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t object_handle;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_size_t size;
+	} __Reply__mach_make_memory_entry_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		integer_t disposition;
+		integer_t ref_count;
+	} __Reply__vm_map_page_query_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t objects;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_info_region_t region;
+		mach_msg_type_number_t objectsCnt;
+	} __Reply__mach_vm_region_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t pages;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		mach_msg_type_number_t pagesCnt;
+	} __Reply__vm_mapped_pages_info_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_address_t address;
+		vm_size_t size;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+		int info[19];
+	} __Reply__vm_region_recurse_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		vm_address_t address;
+		vm_size_t size;
+		natural_t nesting_depth;
+		mach_msg_type_number_t infoCnt;
+		int info[19];
+	} __Reply__vm_region_recurse_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_ool_descriptor_t objects;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_info_region_64_t region;
+		mach_msg_type_number_t objectsCnt;
+	} __Reply__mach_vm_region_info_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t object_name;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		vm_address_t address;
+		vm_size_t size;
+		mach_msg_type_number_t infoCnt;
+		int info[10];
+	} __Reply__vm_region_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t object_handle;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		memory_object_size_t size;
+	} __Reply__mach_make_memory_entry_64_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int state;
+	} __Reply__vm_purgable_control_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__vm_map_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__vm_map_subsystem__defined
+#define __ReplyUnion__vm_map_subsystem__defined
+union __ReplyUnion__vm_map_subsystem {
+	__Reply__vm_region_t Reply_vm_region;
+	__Reply__vm_allocate_t Reply_vm_allocate;
+	__Reply__vm_deallocate_t Reply_vm_deallocate;
+	__Reply__vm_protect_t Reply_vm_protect;
+	__Reply__vm_inherit_t Reply_vm_inherit;
+	__Reply__vm_read_t Reply_vm_read;
+	__Reply__vm_read_list_t Reply_vm_read_list;
+	__Reply__vm_write_t Reply_vm_write;
+	__Reply__vm_copy_t Reply_vm_copy;
+	__Reply__vm_read_overwrite_t Reply_vm_read_overwrite;
+	__Reply__vm_msync_t Reply_vm_msync;
+	__Reply__vm_behavior_set_t Reply_vm_behavior_set;
+	__Reply__vm_machine_attribute_t Reply_vm_machine_attribute;
+	__Reply__vm_remap_t Reply_vm_remap;
+	__Reply__task_wire_t Reply_task_wire;
+	__Reply__mach_make_memory_entry_t Reply_mach_make_memory_entry;
+	__Reply__vm_map_page_query_t Reply_vm_map_page_query;
+	__Reply__mach_vm_region_info_t Reply_mach_vm_region_info;
+	__Reply__vm_mapped_pages_info_t Reply_vm_mapped_pages_info;
+	__Reply__vm_region_recurse_t Reply_vm_region_recurse;
+	__Reply__vm_region_recurse_64_t Reply_vm_region_recurse_64;
+	__Reply__mach_vm_region_info_64_t Reply_mach_vm_region_info_64;
+	__Reply__vm_region_64_t Reply_vm_region_64;
+	__Reply__mach_make_memory_entry_64_t Reply_mach_make_memory_entry_64;
+	__Reply__vm_purgable_control_t Reply_vm_purgable_control;
+};
+#endif /* __RequestUnion__vm_map_subsystem__defined */
+
+#ifndef subsystem_to_name_map_vm_map
+#define subsystem_to_name_map_vm_map \
+    { "vm_region", 3800 },\
+    { "vm_allocate", 3801 },\
+    { "vm_deallocate", 3802 },\
+    { "vm_protect", 3803 },\
+    { "vm_inherit", 3804 },\
+    { "vm_read", 3805 },\
+    { "vm_read_list", 3806 },\
+    { "vm_write", 3807 },\
+    { "vm_copy", 3808 },\
+    { "vm_read_overwrite", 3809 },\
+    { "vm_msync", 3810 },\
+    { "vm_behavior_set", 3811 },\
+    { "vm_machine_attribute", 3813 },\
+    { "vm_remap", 3814 },\
+    { "task_wire", 3815 },\
+    { "mach_make_memory_entry", 3816 },\
+    { "vm_map_page_query", 3817 },\
+    { "mach_vm_region_info", 3818 },\
+    { "vm_mapped_pages_info", 3819 },\
+    { "vm_region_recurse", 3821 },\
+    { "vm_region_recurse_64", 3822 },\
+    { "mach_vm_region_info_64", 3823 },\
+    { "vm_region_64", 3824 },\
+    { "mach_make_memory_entry_64", 3825 },\
+    { "vm_purgable_control", 3830 }
+#endif
+
+#ifdef __AfterMigServerHeader
+__AfterMigServerHeader
+#endif /* __AfterMigServerHeader */
+
+#endif	 /* _vm_map_server_ */


Property changes on: trunk/sys/sys/mach/vm_map_server.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/vm_prot.h
===================================================================
--- trunk/sys/sys/mach/vm_prot.h	                        (rev 0)
+++ trunk/sys/sys/mach/vm_prot.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,143 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.4.3.1  92/03/03  16:22:41  jeffreyh
+ * 	[David L. Black 92/02/22  17:03:43  dlb at osf.org]
+ * 	   Add no change protection value for memory_object_lock_request.
+ * 
+ * Revision 2.4  91/05/14  17:03:00  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.3  91/02/05  17:37:38  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:22:39  mrt]
+ * 
+ * Revision 2.2  90/01/22  23:05:57  af
+ * 	Removed execute permission from default protection.
+ * 	On the only machine that cares for execute permission (mips)
+ * 	this is an expensive liability: it requires keeping
+ * 	Icache consistent memory that never contains code.
+ * 	[89/12/15            af]
+ * 
+ * Revision 2.1  89/08/03  16:06:47  rwd
+ * Created.
+ * 
+ * Revision 2.3  89/02/25  18:42:29  gm0w
+ * 	Changes for cleanup.
+ * 
+ *  6-Jun-85  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/vm_prot.h
+ *	Author:	Avadis Tevanian, Jr., Michael Wayne Young
+ *
+ *	Virtual memory protection definitions.
+ *
+ */
+
+#ifndef	VM_PROT_H_
+#define	VM_PROT_H_
+#include <vm/vm.h>
+#include <vm/vm_param.h>
+/*
+ *	Types defined:
+ *
+ *	vm_prot_t		VM protection values.
+ */
+
+/*
+ *	Protection values, defined as bits within the vm_prot_t type
+ */
+
+#define	VM_PROT_NONE	((vm_prot_t) 0x00)
+
+#define VM_PROT_READ	((vm_prot_t) 0x01)	/* read permission */
+#define VM_PROT_WRITE	((vm_prot_t) 0x02)	/* write permission */
+#define VM_PROT_EXECUTE	((vm_prot_t) 0x04)	/* execute permission */
+
+/*
+ *	The default protection for newly-created virtual memory
+ */
+
+
+/*
+ *	The maximum privileges possible, for parameter checking.
+ */
+
+#define VM_PROT_ALL	(VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
+
+/*
+ *	An invalid protection value.
+ *	Used only by memory_object_lock_request to indicate no change
+ *	to page locks.  Using -1 here is a bad idea because it
+ *	looks like VM_PROT_ALL and then some.
+ */
+#define VM_PROT_NO_CHANGE	((vm_prot_t) 0x08)
+
+/*
+ *	Another invalid protection value.
+ *	Used only by memory_object_data_request upon an object
+ *	which has specified a copy_call copy strategy. It is used
+ *	when the kernel wants a page belonging to a copy of the
+ *	object, and is only asking the object as a result of
+ *	following a shadow chain. This solves the race between pages
+ *	being pushed up by the memory manager and the kernel
+ *	walking down the shadow chain.
+ */
+#define VM_PROT_WANTS_COPY	((vm_prot_t) 0x10)
+
+#define VM_PROT_IS_MASK          ((vm_prot_t) 0x40)
+
+#endif	/* VM_PROT_H_ */


Property changes on: trunk/sys/sys/mach/vm_prot.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/vm_region.h
===================================================================
--- trunk/sys/sys/mach/vm_region.h	                        (rev 0)
+++ trunk/sys/sys/mach/vm_region.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/*
+ *	File:	mach/vm_region.h
+ *
+ *	Define the attributes of a task's memory region
+ *
+ */
+
+#ifndef	_MACH_VM_REGION_H_
+#define _MACH_VM_REGION_H_
+
+#include <sys/mach/vm_prot.h>
+#include <sys/mach/vm_inherit.h>
+#include <sys/mach/vm_behavior.h>
+
+/*
+ *	Types defined:
+ *
+ *	vm_region_info_t	memory region attributes
+ */
+
+#define VM_REGION_INFO_MAX      (1024)
+typedef int	*vm_region_info_t;
+typedef int	 vm_region_flavor_t;
+typedef int	 vm_region_info_data_t[VM_REGION_INFO_MAX];
+
+#define VM_REGION_BASIC_INFO	10
+
+struct vm_region_basic_info {
+	vm_prot_t		protection;
+	vm_prot_t		max_protection;
+	vm_inherit_t		inheritance;
+	boolean_t		shared;
+	boolean_t		reserved;
+	vm_offset_t		offset;
+	vm_behavior_t		behavior;
+	unsigned short		user_wired_count;
+};
+
+typedef struct vm_region_basic_info		*vm_region_basic_info_t;
+typedef struct vm_region_basic_info		 vm_region_basic_info_data_t;
+
+#define VM_REGION_BASIC_INFO_COUNT		\
+	(sizeof(vm_region_basic_info_data_t)/sizeof(int))
+
+struct mach_vm_read_entry {
+        mach_vm_address_t address;
+        mach_vm_size_t size;
+};
+
+struct vm_read_entry {
+        vm_address_t    address;
+        vm_size_t       size;
+};
+
+#define VM_MAP_ENTRY_MAX  (256)
+
+typedef struct mach_vm_read_entry       mach_vm_read_entry_t[VM_MAP_ENTRY_MAX];
+typedef struct vm_read_entry            vm_read_entry_t[VM_MAP_ENTRY_MAX];
+
+typedef int      *vm_region_recurse_info_t;
+typedef int vm_page_info_flavor_t;
+typedef int *vm_page_info_t;
+
+#endif	/*_MACH_VM_REGION_H_*/


Property changes on: trunk/sys/sys/mach/vm_region.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/vm_statistics.h
===================================================================
--- trunk/sys/sys/mach/vm_statistics.h	                        (rev 0)
+++ trunk/sys/sys/mach/vm_statistics.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,225 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/*
+ * MkLinux
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.3  91/05/14  17:03:07  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.2  91/02/05  17:37:41  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:22:49  mrt]
+ * 
+ * Revision 2.1  89/08/03  16:06:55  rwd
+ * Created.
+ * 
+ * Revision 2.4  89/02/25  18:42:35  gm0w
+ * 	Changes for cleanup.
+ * 
+ * Revision 2.3  89/02/07  00:54:39  mwyoung
+ * Relocated from sys/vm_statistics.h
+ * 
+ * Revision 2.2  89/01/30  22:08:54  rpd
+ * 	Made variable declarations use "extern".
+ * 	[89/01/25  15:26:30  rpd]
+ * 
+ * 30-Sep-86  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Changed "reclaim" to "inactive."
+ *
+ * 22-Aug-86  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Made vm_stat structure kernel-only.
+ *
+ * 22-May-86  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Defined vm_statistics_data_t as a real typedef so that
+ *	MatchMaker can deal with it.
+ *
+ * 14-Feb-86  Avadis Tevanian (avie) at Carnegie-Mellon University
+ *	Created.
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/vm_statistics.h
+ *	Author:	Avadis Tevanian, Jr., Michael Wayne Young, David Golub
+ *
+ *	Virtual memory statistics structure.
+ *
+ */
+
+#ifndef	VM_STATISTICS_H_
+#define	VM_STATISTICS_H_
+
+#include <sys/mach/vm_types.h>
+
+struct vm_statistics {
+	integer_t	free_count;		/* # of pages free */
+	integer_t	active_count;		/* # of pages active */
+	integer_t	inactive_count;		/* # of pages inactive */
+	integer_t	wire_count;		/* # of pages wired down */
+	integer_t	zero_fill_count;	/* # of zero fill pages */
+	integer_t	reactivations;		/* # of pages reactivated */
+	integer_t	pageins;		/* # of pageins */
+	integer_t	pageouts;		/* # of pageouts */
+	integer_t	faults;			/* # of faults */
+	integer_t	cow_faults;		/* # of copy-on-writes */
+	integer_t	lookups;		/* object cache lookups */
+	integer_t	hits;			/* object cache hits */
+
+	integer_t       purgeable_count;        /* # of pages purgeable */
+	integer_t       purges;                 /* # of pages purged */
+
+};
+
+typedef struct vm_statistics	*vm_statistics_t;
+typedef struct vm_statistics	vm_statistics_data_t;
+
+struct vm_extmod_statistics {
+        int64_t task_for_pid_count;                     /* # of times task port was looked up */
+        int64_t task_for_pid_caller_count;      /* # of times this task called task_for_pid */
+        int64_t thread_creation_count;          /* # of threads created in task */
+        int64_t thread_creation_caller_count;   /* # of threads created by task */
+        int64_t thread_set_state_count;         /* # of register state sets in task */
+        int64_t thread_set_state_caller_count;  /* # of register state sets by task */
+} __attribute__((aligned(8)));
+
+typedef struct vm_extmod_statistics *vm_extmod_statistics_t;
+typedef struct vm_extmod_statistics vm_extmod_statistics_data_t;
+
+typedef struct vm_purgeable_stat {
+        uint64_t        count;
+        uint64_t        size;
+}vm_purgeable_stat_t;
+
+struct vm_purgeable_info {
+        vm_purgeable_stat_t fifo_data[8];
+        vm_purgeable_stat_t obsolete_data;
+        vm_purgeable_stat_t lifo_data[8];
+};
+
+typedef struct vm_purgeable_info        *vm_purgeable_info_t;
+
+
+/*
+ * VM allocation flags:
+ * 
+ * VM_FLAGS_FIXED
+ *      (really the absence of VM_FLAGS_ANYWHERE)
+ *      Allocate new VM region at the specified virtual address, if possible.
+ * 
+ * VM_FLAGS_ANYWHERE
+ *      Allocate new VM region anywhere it would fit in the address space.
+ *
+ * VM_FLAGS_PURGABLE
+ *      Create a purgable VM object for that new VM region.
+ *
+ * VM_FLAGS_NO_PMAP_CHECK
+ *      (for DEBUG kernel config only, ignored for other configs)
+ *      Do not check that there is no stale pmap mapping for the new VM region.
+ *      This is useful for kernel memory allocations at bootstrap when building
+ *      the initial kernel address space while some memory is already in use.
+ *
+ * VM_FLAGS_OVERWRITE
+ *      The new VM region can replace existing VM regions if necessary
+ *      (to be used in combination with VM_FLAGS_FIXED).
+ *
+ * VM_FLAGS_NO_CACHE
+ *      Pages brought in to this VM region are placed on the speculative
+ *      queue instead of the active queue.  In other words, they are not
+ *      cached so that they will be stolen first if memory runs low.
+ */
+#define VM_FLAGS_FIXED          0x0000
+#define VM_FLAGS_ANYWHERE       0x0001
+#define VM_FLAGS_PURGABLE       0x0002
+#define VM_FLAGS_NO_CACHE       0x0010
+#define VM_FLAGS_OVERWRITE      0x4000  /* delete any existing mappings first */
+/*
+ * VM_FLAGS_SUPERPAGE_MASK
+ *      3 bits that specify whether large pages should be used instead of
+ *      base pages (!=0), as well as the requested page size.
+ */
+#define VM_FLAGS_SUPERPAGE_MASK 0x70000 /* bits 0x10000, 0x20000, 0x40000 */
+#define VM_FLAGS_RETURN_DATA_ADDR       0x100000 /* Return address of target data, rather than base of page */
+#define VM_FLAGS_ALIAS_MASK     0xFF000000
+#define VM_GET_FLAGS_ALIAS(flags, alias)                        \
+                (alias) = ((flags) & VM_FLAGS_ALIAS_MASK) >> 24 
+#define VM_SET_FLAGS_ALIAS(flags, alias)                        \
+                (flags) = (((flags) & ~VM_FLAGS_ALIAS_MASK) |   \
+                (((alias) & ~VM_FLAGS_ALIAS_MASK) << 24))
+
+/* These are the flags that we accept from user-space */
+#define VM_FLAGS_USER_ALLOCATE  (VM_FLAGS_FIXED |               \
+                                 VM_FLAGS_ANYWHERE |            \
+                                 VM_FLAGS_PURGABLE |            \
+                                 VM_FLAGS_NO_CACHE |            \
+                                 VM_FLAGS_OVERWRITE |           \
+                                 VM_FLAGS_SUPERPAGE_MASK |      \
+                                 VM_FLAGS_ALIAS_MASK)
+#define VM_FLAGS_USER_MAP       (VM_FLAGS_USER_ALLOCATE |       \
+                                 VM_FLAGS_RETURN_DATA_ADDR)
+#define VM_FLAGS_USER_REMAP     (VM_FLAGS_FIXED |    \
+                                 VM_FLAGS_ANYWHERE | \
+                                 VM_FLAGS_OVERWRITE| \
+                                 VM_FLAGS_RETURN_DATA_ADDR)
+
+/*
+ *	Each machine dependent implementation is expected to
+ *	keep certain statistics.  They may do this anyway they
+ *	so choose, but are expected to return the statistics
+ *	in the following structure.
+ */
+#if 0
+struct pmap_statistics {
+	integer_t	resident_count;	/* # of pages mapped (total)*/
+	integer_t	wired_count;	/* # of pages wired */
+};
+
+typedef struct pmap_statistics	*pmap_statistics_t;
+#endif
+#endif	/* VM_STATISTICS_H_ */


Property changes on: trunk/sys/sys/mach/vm_statistics.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/vm_sync.h
===================================================================
--- trunk/sys/sys/mach/vm_sync.h	                        (rev 0)
+++ trunk/sys/sys/mach/vm_sync.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,69 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ * MkLinux
+ */
+/*
+ *	File:	mach/vm_sync.h
+ *
+ *	Virtual memory synchronisation definitions.
+ *
+ */
+
+#ifndef VM_SYNC_H_
+#define VM_SYNC_H_
+
+typedef unsigned		vm_sync_t;
+
+/*
+ *	Synchronization flags, defined as bits within the vm_sync_t type
+ */
+
+#define	VM_SYNC_ASYNCHRONOUS	((vm_sync_t) 0x01)
+#define	VM_SYNC_SYNCHRONOUS	((vm_sync_t) 0x02)
+#define VM_SYNC_INVALIDATE	((vm_sync_t) 0x04)
+
+#endif  /* VM_SYNC_H_ */


Property changes on: trunk/sys/sys/mach/vm_sync.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach/vm_types.h
===================================================================
--- trunk/sys/sys/mach/vm_types.h	                        (rev 0)
+++ trunk/sys/sys/mach/vm_types.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 1991-1998 by Open Software Foundation, Inc. 
+ *              All Rights Reserved 
+ *  
+ * Permission to use, copy, modify, and distribute this software and 
+ * its documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appears in all copies and 
+ * that both the copyright notice and this permission notice appear in 
+ * supporting documentation. 
+ *  
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE. 
+ *  
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ * 
+ */
+
+#ifndef	MACH_VM_TYPES_H_
+#define MACH_VM_TYPES_H_
+
+#include <sys/types.h>
+
+typedef vm_offset_t     pointer_t;
+typedef vm_offset_t     vm_address_t;
+typedef int    vm_purgable_t;
+typedef uint32_t	natural_t;
+
+typedef vm_address_t	mach_vm_address_t;
+typedef vm_offset_t		mach_vm_offset_t;
+typedef vm_size_t		mach_vm_size_t;
+typedef vm_offset_t		vm_map_offset_t;
+typedef vm_address_t	vm_map_address_t;
+typedef vm_size_t		vm_map_size_t;
+typedef vm_address_t	mach_port_context_t;
+typedef	int32_t			integer_t;
+
+#ifndef _KERNEL
+typedef natural_t mach_vm_map_t; /* mach_port_t */
+#endif
+
+#endif	/* MACH_VM_TYPES_H_ */
+
+


Property changes on: trunk/sys/sys/mach/vm_types.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach_debug/hash_info.h
===================================================================
--- trunk/sys/sys/mach_debug/hash_info.h	                        (rev 0)
+++ trunk/sys/sys/mach_debug/hash_info.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+#ifndef	_MACH_DEBUG_HASH_INFO_H_
+#define _MACH_DEBUG_HASH_INFO_H_
+
+/*
+ *	Remember to update the mig type definitions
+ *	in mach_debug_types.defs when adding/removing fields.
+ */
+
+typedef struct hash_info_bucket {
+	natural_t	hib_count;	/* number of records in bucket */
+} hash_info_bucket_t;
+
+typedef hash_info_bucket_t *hash_info_bucket_array_t;
+
+#endif	/* _MACH_DEBUG_HASH_INFO_H_ */


Property changes on: trunk/sys/sys/mach_debug/hash_info.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach_debug/ipc_info.h
===================================================================
--- trunk/sys/sys/mach_debug/ipc_info.h	                        (rev 0)
+++ trunk/sys/sys/mach_debug/ipc_info.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach_debug/ipc_info.h
+ *	Author:	Rich Draves
+ *	Date:	March, 1990
+ *
+ *	Definitions for the IPC debugging interface.
+ */
+
+#ifndef	_MACH_DEBUG_IPC_INFO_H_
+#define _MACH_DEBUG_IPC_INFO_H_
+
+#include <sys/mach/port.h>
+#include <sys/mach/vm_types.h>
+
+/*
+ *	Remember to update the mig type definitions
+ *	in mach_debug_types.defs when adding/removing fields.
+ */
+
+typedef struct ipc_info_space {
+	natural_t iis_genno_mask;	/* generation number mask */
+	natural_t iis_table_size;	/* size of table */
+	natural_t iis_table_next;	/* next possible size of table */
+	natural_t iis_tree_size;	/* size of tree (UNUSED) */
+	natural_t iis_tree_small;	/* # of small entries in tree (UNUSED) */
+	natural_t iis_tree_hash;	/* # of hashed entries in tree (UNUSED) */
+} ipc_info_space_t;
+
+typedef struct ipc_info_space_basic {
+	natural_t iisb_genno_mask;	/* generation number mask */
+	natural_t iisb_table_size;	/* size of table */
+	natural_t iisb_table_next;	/* next possible size of table */
+	natural_t iisb_table_inuse;	/* number of entries in use */
+	natural_t iisb_reserved[2];	/* future expansion */
+} ipc_info_space_basic_t;
+
+typedef struct ipc_info_name {
+	mach_port_name_t iin_name;		/* port name, including gen number */
+/*boolean_t*/integer_t iin_collision;	/* collision at this entry? */
+	mach_port_type_t iin_type;	/* straight port type */
+	mach_port_urefs_t iin_urefs;	/* user-references */
+	natural_t iin_object;		/* object pointer/identifier */
+	natural_t iin_next;		/* marequest/next in free list */
+	natural_t iin_hash;		/* hash index */
+} ipc_info_name_t;
+
+typedef ipc_info_name_t *ipc_info_name_array_t;
+
+/* UNUSED */
+typedef struct ipc_info_tree_name {
+	ipc_info_name_t iitn_name;
+	mach_port_name_t iitn_lchild;	/* name of left child */
+	mach_port_name_t iitn_rchild;	/* name of right child */
+} ipc_info_tree_name_t;
+
+typedef ipc_info_tree_name_t *ipc_info_tree_name_array_t;
+
+#endif	/* _MACH_DEBUG_IPC_INFO_H_ */


Property changes on: trunk/sys/sys/mach_debug/ipc_info.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach_debug/lockgroup_info.h
===================================================================
--- trunk/sys/sys/mach_debug/lockgroup_info.h	                        (rev 0)
+++ trunk/sys/sys/mach_debug/lockgroup_info.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ *	File:	mach/lockgroup_info.h
+ *
+ *	Definitions for host_lockgroup_info call.
+ */
+
+#ifndef	_MACH_DEBUG_LOCKGROUP_INFO_H_
+#define	_MACH_DEBUG_LOCKGROUP_INFO_H_
+
+#include <sys/mach/mach_types.h>
+
+#define LOCKGROUP_MAX_NAME	64
+
+#define LOCKGROUP_ATTR_STAT	0x01ULL
+
+typedef struct lockgroup_info {
+	char		lockgroup_name[LOCKGROUP_MAX_NAME];
+	uint64_t	lockgroup_attr;
+	uint64_t	lock_spin_cnt;
+	uint64_t	lock_spin_util_cnt;
+	uint64_t	lock_spin_held_cnt;
+	uint64_t	lock_spin_miss_cnt;
+	uint64_t	lock_spin_held_max;
+	uint64_t	lock_spin_held_cum;
+	uint64_t	lock_mtx_cnt;
+	uint64_t	lock_mtx_util_cnt;
+	uint64_t	lock_mtx_held_cnt;
+	uint64_t	lock_mtx_miss_cnt;
+	uint64_t	lock_mtx_wait_cnt;
+	uint64_t	lock_mtx_held_max;
+	uint64_t	lock_mtx_held_cum;
+	uint64_t	lock_mtx_wait_max;
+	uint64_t	lock_mtx_wait_cum;
+	uint64_t	lock_rw_cnt;
+	uint64_t	lock_rw_util_cnt;
+	uint64_t	lock_rw_held_cnt;
+	uint64_t	lock_rw_miss_cnt;
+	uint64_t	lock_rw_wait_cnt;
+	uint64_t	lock_rw_held_max;
+	uint64_t	lock_rw_held_cum;
+	uint64_t	lock_rw_wait_max;
+	uint64_t	lock_rw_wait_cum;
+} lockgroup_info_t;
+
+typedef lockgroup_info_t *lockgroup_info_array_t;
+
+#endif	/* _MACH_DEBUG_LOCKGROUP_INFO_H_ */
+


Property changes on: trunk/sys/sys/mach_debug/lockgroup_info.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach_debug/mach_debug.h
===================================================================
--- trunk/sys/sys/mach_debug/mach_debug.h	                        (rev 0)
+++ trunk/sys/sys/mach_debug/mach_debug.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * Copyright (C) Apple Computer 1998
+ * ALL Rights Reserved
+ */
+/*
+ * This file represents the interfaces that used to come
+ * from creating the user headers from the mach_debug.defs file.
+ * Because mach_debug.defs was decomposed, this file now just
+ * wraps up all the new interface headers generated from
+ * each of the new .defs resulting from that decomposition.
+ */
+#ifndef	_MACH_DEBUG_MACH_DEBUG_H_
+#define _MACH_DEBUG_MACH_DEBUG_H_
+
+#include <mach_debug/mach_debug_types.h>
+
+#include <mach/mach_host.h>
+#include <mach/mach_port.h>
+#include <mach/mach_interface.h>
+
+#endif /* _MACH_DEBUG_MACH_DEBUG_H_ */
+
+


Property changes on: trunk/sys/sys/mach_debug/mach_debug.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach_debug/mach_debug_types.defs
===================================================================
--- trunk/sys/sys/mach_debug/mach_debug_types.defs	                        (rev 0)
+++ trunk/sys/sys/mach_debug/mach_debug_types.defs	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Mach kernel debugging interface type declarations
+ */
+
+#ifndef	_MACH_DEBUG_MACH_DEBUG_TYPES_DEFS_
+#define _MACH_DEBUG_MACH_DEBUG_TYPES_DEFS_
+
+#include <mach/std_types.defs>
+
+type zone_name_t = struct[80] of char;			/* deprecated */
+type zone_name_array_t = array[] of zone_name_t;	/* deprecated */
+
+type zone_info_t = struct[9] of integer_t;		/* deprecated */
+type zone_info_array_t = array[] of zone_info_t; 	/* deprecated */
+
+type mach_zone_name_t = struct[80] of char;
+type mach_zone_name_array_t = array[] of mach_zone_name_t;
+
+type mach_zone_info_t = struct[8] of uint64_t;
+type mach_zone_info_array_t = array[] of mach_zone_info_t;
+
+type task_zone_info_t = struct[11] of uint64_t;
+type task_zone_info_array_t = array[] of task_zone_info_t;
+
+type hash_info_bucket_t = struct[1] of natural_t;
+type hash_info_bucket_array_t = array[] of hash_info_bucket_t;
+
+type ipc_info_space_t = struct[6] of natural_t;
+type ipc_info_space_basic_t = struct[6] of natural_t;
+
+type ipc_info_name_t = struct[7] of natural_t;
+type ipc_info_name_array_t = array[] of ipc_info_name_t;
+
+type ipc_info_tree_name_t = struct[9] of natural_t;
+type ipc_info_tree_name_array_t = array[] of ipc_info_tree_name_t;
+
+type vm_info_region_t = struct[10] of natural_t;
+type vm_info_region_64_t = struct[11] of natural_t;
+type mach_vm_info_region_t = struct[14] of natural_t;
+
+type vm_info_object_t = struct[21] of natural_t;
+type vm_info_object_array_t = ^array[] of vm_info_object_t;
+
+type page_address_array_t = ^array[] of integer_t;
+
+type symtab_name_t = c_string[*:32];
+
+type lockgroup_info_t = struct[63] of integer_t;
+type lockgroup_info_array_t = array[] of lockgroup_info_t;
+
+import <sys/mach_debug/mach_debug_types.h>;
+
+#endif	/* _MACH_DEBUG_MACH_DEBUG_TYPES_DEFS_ */
+
+/* vim: set ft=c : */

Added: trunk/sys/sys/mach_debug/mach_debug_types.h
===================================================================
--- trunk/sys/sys/mach_debug/mach_debug_types.h	                        (rev 0)
+++ trunk/sys/sys/mach_debug/mach_debug_types.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Mach kernel debugging interface type declarations
+ */
+
+#ifndef	_MACH_DEBUG_MACH_DEBUG_TYPES_H_
+#define _MACH_DEBUG_MACH_DEBUG_TYPES_H_
+
+#include <sys/mach_debug/ipc_info.h>
+#include <sys/mach_debug/vm_info.h>
+#include <sys/mach_debug/zone_info.h>
+#include <sys/mach_debug/page_info.h>
+#include <sys/mach_debug/hash_info.h>
+#include <sys/mach_debug/lockgroup_info.h>
+
+typedef	char	symtab_name_t[32];
+
+#endif	/* _MACH_DEBUG_MACH_DEBUG_TYPES_H_ */


Property changes on: trunk/sys/sys/mach_debug/mach_debug_types.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach_debug/page_info.h
===================================================================
--- trunk/sys/sys/mach_debug/page_info.h	                        (rev 0)
+++ trunk/sys/sys/mach_debug/page_info.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+#ifndef MACH_DEBUG_PAGE_INFO_H 
+#define MACH_DEBUG_PAGE_INFO_H 
+
+#include <sys/mach/vm_types.h>
+
+typedef	vm_offset_t	*page_address_array_t;
+#endif	/* MACH_DEBUG_PAGE_INFO_H */


Property changes on: trunk/sys/sys/mach_debug/page_info.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach_debug/vm_info.h
===================================================================
--- trunk/sys/sys/mach_debug/vm_info.h	                        (rev 0)
+++ trunk/sys/sys/mach_debug/vm_info.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ *	File:	mach_debug/vm_info.h
+ *	Author:	Rich Draves
+ *	Date:	March, 1990
+ *
+ *	Definitions for the VM debugging interface.
+ */
+
+#ifndef	_MACH_DEBUG_VM_INFO_H_
+#define _MACH_DEBUG_VM_INFO_H_
+
+#include <sys/mach/vm_types.h>
+#include <sys/mach/vm_inherit.h>
+#include <sys/mach/vm_prot.h>
+#include <sys/mach/memory_object_types.h>
+
+#pragma pack(4)
+
+/*
+ *	Remember to update the mig type definitions
+ *	in mach_debug_types.defs when adding/removing fields.
+ */
+typedef struct mach_vm_info_region {
+	mach_vm_offset_t vir_start;	/* start of region */
+	mach_vm_offset_t vir_end;	/* end of region */
+	mach_vm_offset_t vir_object;	/* the mapped object(kernal addr) */
+	memory_object_offset_t vir_offset;	/* offset into object */
+	boolean_t vir_needs_copy;	/* does object need to be copied? */
+	vm_prot_t vir_protection;	/* protection code */
+	vm_prot_t vir_max_protection;	/* maximum protection */
+	vm_inherit_t vir_inheritance;	/* inheritance */
+	natural_t vir_wired_count;	/* number of times wired */
+	natural_t vir_user_wired_count; /* number of times user has wired */
+} mach_vm_info_region_t;
+
+typedef struct vm_info_region_64 {
+	natural_t vir_start;		/* start of region */
+	natural_t vir_end;		/* end of region */
+	natural_t vir_object;		/* the mapped object */
+	memory_object_offset_t vir_offset;	/* offset into object */
+	boolean_t vir_needs_copy;	/* does object need to be copied? */
+	vm_prot_t vir_protection;	/* protection code */
+	vm_prot_t vir_max_protection;	/* maximum protection */
+	vm_inherit_t vir_inheritance;	/* inheritance */
+	natural_t vir_wired_count;	/* number of times wired */
+	natural_t vir_user_wired_count; /* number of times user has wired */
+} vm_info_region_64_t;
+
+typedef struct vm_info_region {
+	natural_t vir_start;		/* start of region */
+	natural_t vir_end;		/* end of region */
+	natural_t vir_object;		/* the mapped object */
+	natural_t vir_offset;		/* offset into object */
+	boolean_t vir_needs_copy;	/* does object need to be copied? */
+	vm_prot_t vir_protection;	/* protection code */
+	vm_prot_t vir_max_protection;	/* maximum protection */
+	vm_inherit_t vir_inheritance;	/* inheritance */
+	natural_t vir_wired_count;	/* number of times wired */
+	natural_t vir_user_wired_count; /* number of times user has wired */
+} vm_info_region_t;
+
+
+typedef struct vm_info_object {
+	natural_t vio_object;		/* this object */
+	natural_t vio_size;		/* object size (valid if internal - but too small) */
+	unsigned int vio_ref_count;	/* number of references */
+	unsigned int vio_resident_page_count; /* number of resident pages */
+	unsigned int vio_absent_count;	/* number requested but not filled */
+	natural_t vio_copy;		/* copy object */
+	natural_t vio_shadow;		/* shadow object */
+	natural_t vio_shadow_offset;	/* offset into shadow object */
+	natural_t vio_paging_offset;	/* offset into memory object */
+	memory_object_copy_strategy_t vio_copy_strategy;
+					/* how to handle data copy */
+	vm_offset_t vio_last_alloc;	/* offset of last allocation */
+	/* many random attributes */
+	unsigned int vio_paging_in_progress;
+	boolean_t vio_pager_created;
+	boolean_t vio_pager_initialized;
+	boolean_t vio_pager_ready;
+	boolean_t vio_can_persist;
+	boolean_t vio_internal;
+	boolean_t vio_temporary;
+	boolean_t vio_alive;
+	boolean_t vio_purgable;
+	boolean_t vio_purgable_volatile;
+} vm_info_object_t;
+
+typedef vm_info_object_t *vm_info_object_array_t;
+
+#pragma pack()
+
+#endif	/* _MACH_DEBUG_VM_INFO_H_ */


Property changes on: trunk/sys/sys/mach_debug/vm_info.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/mach_debug/zone_info.h
===================================================================
--- trunk/sys/sys/mach_debug/zone_info.h	                        (rev 0)
+++ trunk/sys/sys/mach_debug/zone_info.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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
+ * 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.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+#ifndef	_MACH_DEBUG_ZONE_INFO_H_
+#define _MACH_DEBUG_ZONE_INFO_H_
+
+#include <sys/mach/vm_types.h>
+
+/*
+ *	Legacy definitions for host_zone_info().  This interface, and
+ *	these definitions have been deprecated in favor of the new
+ *	mach_zone_info() inteface and types below.
+ */
+
+#define ZONE_NAME_MAX_LEN		80
+
+typedef struct zone_name {
+	char		zn_name[ZONE_NAME_MAX_LEN];
+} zone_name_t;
+
+typedef zone_name_t *zone_name_array_t;
+
+
+typedef struct zone_info {
+	integer_t	zi_count;	/* Number of elements used now */
+	vm_size_t	zi_cur_size;	/* current memory utilization */
+	vm_size_t	zi_max_size;	/* how large can this zone grow */
+	vm_size_t	zi_elem_size;	/* size of an element */
+	vm_size_t	zi_alloc_size;	/* size used for more memory */
+	integer_t	zi_pageable;	/* zone pageable? */
+	integer_t	zi_sleepable;	/* sleep if empty? */
+	integer_t	zi_exhaustible;	/* merely return if empty? */
+	integer_t	zi_collectable;	/* garbage collect elements? */
+} zone_info_t;
+
+typedef zone_info_t *zone_info_array_t;
+
+
+/*
+ *	Remember to update the mig type definitions
+ *	in mach_debug_types.defs when adding/removing fields.
+ */
+
+#define MACH_ZONE_NAME_MAX_LEN		80
+
+typedef struct mach_zone_name {
+	char		mzn_name[ZONE_NAME_MAX_LEN];
+} mach_zone_name_t;
+
+typedef mach_zone_name_t *mach_zone_name_array_t;
+
+typedef struct mach_zone_info_data {
+	uint64_t	mzi_count;	/* count of elements in use */
+	uint64_t	mzi_cur_size;	/* current memory utilization */
+	uint64_t	mzi_max_size;	/* how large can this zone grow */
+        uint64_t	mzi_elem_size;	/* size of an element */
+	uint64_t	mzi_alloc_size;	/* size used for more memory */
+	uint64_t	mzi_sum_size;	/* sum of all allocs (life of zone) */
+	uint64_t	mzi_exhaustible;	/* merely return if empty? */
+	uint64_t	mzi_collectable;	/* garbage collect elements? */
+} mach_zone_info_t;
+
+typedef mach_zone_info_t *mach_zone_info_array_t;
+
+typedef struct task_zone_info_data {
+	uint64_t	tzi_count;	/* count of elements in use */
+	uint64_t	tzi_cur_size;	/* current memory utilization */
+	uint64_t	tzi_max_size;	/* how large can this zone grow */
+        uint64_t	tzi_elem_size;	/* size of an element */
+	uint64_t	tzi_alloc_size;	/* size used for more memory */
+	uint64_t	tzi_sum_size;	/* sum of all allocs (life of zone) */
+	uint64_t	tzi_exhaustible;	/* merely return if empty? */
+	uint64_t	tzi_collectable;	/* garbage collect elements? */
+	uint64_t	tzi_caller_acct;	/* charged to caller (or kernel) */
+	uint64_t	tzi_task_alloc;	/* sum of all allocs by this task */
+	uint64_t	tzi_task_free;	/* sum of all frees by this task */
+} task_zone_info_t;
+
+typedef task_zone_info_t *task_zone_info_array_t;
+#endif	/* _MACH_DEBUG_ZONE_INFO_H_ */


Property changes on: trunk/sys/sys/mach_debug/zone_info.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/proc.h
===================================================================
--- trunk/sys/sys/proc.h	2016-01-07 17:22:14 UTC (rev 7405)
+++ trunk/sys/sys/proc.h	2016-01-08 03:31:27 UTC (rev 7406)
@@ -312,7 +312,8 @@
 	struct vnet	*td_vnet;	/* (k) Effective vnet. */
 	const char	*td_vnet_lpush;	/* (k) Debugging vnet push / pop. */
 	struct trapframe *td_intr_frame;/* (k) Frame of the current irq */
-	struct proc *td_rfppwait_p;	/* (k) The vforked child */
+	struct proc	*td_rfppwait_p;	/* (k) The vforked child */
+	void		*td_machdata;   /* (k) mach state. */
 };
 
 struct mtx *thread_lock_block(struct thread *);
@@ -588,6 +589,8 @@
 	 */
 	LIST_ENTRY(proc) p_orphan;	/* (e) List of orphan processes. */
 	LIST_HEAD(, proc) p_orphans;	/* (e) Pointer to list of orphans. */
+
+	void		*p_machdata;	/* (c) Mach state data. */
 };
 
 #define	p_session	p_pgrp->pg_session



More information about the Midnightbsd-cvs mailing list