summaryrefslogtreecommitdiff
path: root/tmp/deviceServer.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmp/deviceServer.c')
-rw-r--r--tmp/deviceServer.c1168
1 files changed, 0 insertions, 1168 deletions
diff --git a/tmp/deviceServer.c b/tmp/deviceServer.c
deleted file mode 100644
index c0d1cece..00000000
--- a/tmp/deviceServer.c
+++ /dev/null
@@ -1,1168 +0,0 @@
-/* Module device */
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE 1
-#endif
-
-#define EXPORT_BOOLEAN
-#include <mach/boolean.h>
-#include <mach/kern_return.h>
-#include <mach/message.h>
-#include <mach/mig_errors.h>
-#include <mach/mig_support.h>
-
-#ifndef mig_internal
-#define mig_internal static
-#endif
-
-#ifndef mig_external
-#define mig_external
-#endif
-
-#ifndef TypeCheck
-#define TypeCheck 1
-#endif
-
-#ifndef UseExternRCSId
-#define UseExternRCSId 1
-#endif
-
-#define BAD_TYPECHECK(type, check) ({\
- union { mach_msg_type_t t; unsigned32_t w; } _t, _c;\
- _t.t = *(type); _c.t = *(check); _t.w != _c.w; })
-#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)
-
-#include <mach/std_types.h>
-#include <mach/mach_types.h>
-#include <device/device_types.h>
-#include <device/net_status.h>
-
-/* Routine device_open */
-mig_internal void _Xdevice_open
- (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
-{
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t modeType;
- dev_mode_t mode;
- mach_msg_type_long_t nameType;
- dev_name_t name;
- } Request;
-
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t RetCodeType;
- kern_return_t RetCode;
- mach_msg_type_t deviceType;
- mach_port_t device;
- } Reply;
-
- register Request *In0P = (Request *) InHeadP;
- register Reply *OutP = (Reply *) OutHeadP;
- mig_external kern_return_t ds_device_open
- (mach_port_t master_port, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, dev_mode_t mode, dev_name_t name, mach_port_t *device);
-
- auto const mach_msg_type_t modeCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t deviceType = {
- /* msgt_name = */ 19,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
-#if TypeCheck
- if ((In0P->Head.msgh_size != 172) ||
- (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->modeType, &modeCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if ((In0P->nameType.msgtl_header.msgt_inline != TRUE) ||
- (In0P->nameType.msgtl_header.msgt_longform != TRUE) ||
- (In0P->nameType.msgtl_name != 12) ||
- (In0P->nameType.msgtl_number != 1) ||
- (In0P->nameType.msgtl_size != 1024))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
- OutP->RetCode = ds_device_open(In0P->Head.msgh_request_port, In0P->Head.msgh_reply_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits), In0P->mode, In0P->name, &OutP->device);
- if (OutP->RetCode != KERN_SUCCESS)
- return;
-
- OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
- OutP->Head.msgh_size = 40;
-
- OutP->deviceType = deviceType;
-}
-
-/* Routine device_close */
-mig_internal void _Xdevice_close
- (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
-{
- typedef struct {
- mach_msg_header_t Head;
- } Request;
-
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t RetCodeType;
- kern_return_t RetCode;
- } Reply;
-
- register Request *In0P = (Request *) InHeadP;
- register Reply *OutP = (Reply *) OutHeadP;
- mig_external kern_return_t ds_device_close
- (mach_port_t device);
-
-#if TypeCheck
- if ((In0P->Head.msgh_size != 24) ||
- (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
- OutP->RetCode = ds_device_close(In0P->Head.msgh_request_port);
-}
-
-/* Routine device_write */
-mig_internal void _Xdevice_write
- (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
-{
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t modeType;
- dev_mode_t mode;
- mach_msg_type_t recnumType;
- recnum_t recnum;
- mach_msg_type_long_t dataType;
- io_buf_ptr_t data;
- } Request;
-
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t RetCodeType;
- kern_return_t RetCode;
- mach_msg_type_t bytes_writtenType;
- int bytes_written;
- } Reply;
-
- register Request *In0P = (Request *) InHeadP;
- register Reply *OutP = (Reply *) OutHeadP;
- mig_external kern_return_t ds_device_write
- (mach_port_t device, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, dev_mode_t mode, recnum_t recnum, io_buf_ptr_t data, mach_msg_type_number_t dataCnt, int *bytes_written);
-
- auto const mach_msg_type_t modeCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t recnumCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t bytes_writtenType = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
-#if TypeCheck
- if ((In0P->Head.msgh_size != 56) ||
- !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->modeType, &modeCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->recnumType, &recnumCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if ((In0P->dataType.msgtl_header.msgt_inline != FALSE) ||
- (In0P->dataType.msgtl_header.msgt_longform != TRUE) ||
- (In0P->dataType.msgtl_name != 9) ||
- (In0P->dataType.msgtl_size != 8))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
- OutP->RetCode = ds_device_write(In0P->Head.msgh_request_port, In0P->Head.msgh_reply_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits), In0P->mode, In0P->recnum, In0P->data, In0P->dataType.msgtl_number, &OutP->bytes_written);
- if (OutP->RetCode != KERN_SUCCESS)
- return;
-
- OutP->Head.msgh_size = 40;
-
- OutP->bytes_writtenType = bytes_writtenType;
-}
-
-/* Routine device_write_inband */
-mig_internal void _Xdevice_write_inband
- (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
-{
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t modeType;
- dev_mode_t mode;
- mach_msg_type_t recnumType;
- recnum_t recnum;
- mach_msg_type_t dataType;
- char data[128];
- } Request;
-
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t RetCodeType;
- kern_return_t RetCode;
- mach_msg_type_t bytes_writtenType;
- int bytes_written;
- } Reply;
-
- register Request *In0P = (Request *) InHeadP;
- register Reply *OutP = (Reply *) OutHeadP;
- mig_external kern_return_t ds_device_write_inband
- (mach_port_t device, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, dev_mode_t mode, recnum_t recnum, io_buf_ptr_inband_t data, mach_msg_type_number_t dataCnt, int *bytes_written);
-
- unsigned int msgh_size;
-
- auto const mach_msg_type_t modeCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t recnumCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t bytes_writtenType = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
-#if TypeCheck
- msgh_size = In0P->Head.msgh_size;
- if ((msgh_size < 44) ||
- (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->modeType, &modeCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->recnumType, &recnumCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if ((In0P->dataType.msgt_inline != TRUE) ||
- (In0P->dataType.msgt_longform != FALSE) ||
- (In0P->dataType.msgt_name != 8) ||
- (In0P->dataType.msgt_size != 8))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (msgh_size != 44 + ((In0P->dataType.msgt_number + 3) & ~3))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
- OutP->RetCode = ds_device_write_inband(In0P->Head.msgh_request_port, In0P->Head.msgh_reply_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits), In0P->mode, In0P->recnum, In0P->data, In0P->dataType.msgt_number, &OutP->bytes_written);
- if (OutP->RetCode != KERN_SUCCESS)
- return;
-
- OutP->Head.msgh_size = 40;
-
- OutP->bytes_writtenType = bytes_writtenType;
-}
-
-/* Routine device_read */
-mig_internal void _Xdevice_read
- (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
-{
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t modeType;
- dev_mode_t mode;
- mach_msg_type_t recnumType;
- recnum_t recnum;
- mach_msg_type_t bytes_wantedType;
- int bytes_wanted;
- } Request;
-
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t RetCodeType;
- kern_return_t RetCode;
- mach_msg_type_long_t dataType;
- io_buf_ptr_t data;
- } Reply;
-
- register Request *In0P = (Request *) InHeadP;
- register Reply *OutP = (Reply *) OutHeadP;
- mig_external kern_return_t ds_device_read
- (mach_port_t device, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, dev_mode_t mode, recnum_t recnum, int bytes_wanted, io_buf_ptr_t *data, mach_msg_type_number_t *dataCnt);
-
- auto const mach_msg_type_t modeCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t recnumCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t bytes_wantedCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_long_t dataType = {
- {
- /* msgt_name = */ 0,
- /* msgt_size = */ 0,
- /* msgt_number = */ 0,
- /* msgt_inline = */ FALSE,
- /* msgt_longform = */ TRUE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- },
- /* msgtl_name = */ 9,
- /* msgtl_size = */ 8,
- /* msgtl_number = */ 0,
- };
-
- mach_msg_type_number_t dataCnt;
-
-#if TypeCheck
- if ((In0P->Head.msgh_size != 48) ||
- (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->modeType, &modeCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->recnumType, &recnumCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->bytes_wantedType, &bytes_wantedCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
- OutP->RetCode = ds_device_read(In0P->Head.msgh_request_port, In0P->Head.msgh_reply_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits), In0P->mode, In0P->recnum, In0P->bytes_wanted, &OutP->data, &dataCnt);
- if (OutP->RetCode != KERN_SUCCESS)
- return;
-
- OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
- OutP->Head.msgh_size = 48;
-
- OutP->dataType = dataType;
-
- OutP->dataType.msgtl_number = dataCnt;
-}
-
-/* Routine device_read_inband */
-mig_internal void _Xdevice_read_inband
- (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
-{
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t modeType;
- dev_mode_t mode;
- mach_msg_type_t recnumType;
- recnum_t recnum;
- mach_msg_type_t bytes_wantedType;
- int bytes_wanted;
- } Request;
-
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t RetCodeType;
- kern_return_t RetCode;
- mach_msg_type_t dataType;
- char data[128];
- } Reply;
-
- register Request *In0P = (Request *) InHeadP;
- register Reply *OutP = (Reply *) OutHeadP;
- mig_external kern_return_t ds_device_read_inband
- (mach_port_t device, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, dev_mode_t mode, recnum_t recnum, int bytes_wanted, io_buf_ptr_inband_t data, mach_msg_type_number_t *dataCnt);
-
- auto const mach_msg_type_t modeCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t recnumCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t bytes_wantedCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t dataType = {
- /* msgt_name = */ 8,
- /* msgt_size = */ 8,
- /* msgt_number = */ 128,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- mach_msg_type_number_t dataCnt;
-
-#if TypeCheck
- if ((In0P->Head.msgh_size != 48) ||
- (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->modeType, &modeCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->recnumType, &recnumCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->bytes_wantedType, &bytes_wantedCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
- dataCnt = 128;
-
- OutP->RetCode = ds_device_read_inband(In0P->Head.msgh_request_port, In0P->Head.msgh_reply_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits), In0P->mode, In0P->recnum, In0P->bytes_wanted, OutP->data, &dataCnt);
- if (OutP->RetCode != KERN_SUCCESS)
- return;
-
- OutP->dataType = dataType;
-
- OutP->dataType.msgt_number = dataCnt;
- OutP->Head.msgh_size = 36 + ((dataCnt + 3) & ~3);
-}
-
-/* Routine xxx_device_set_status */
-mig_internal void _Xxxx_device_set_status
- (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
-{
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t flavorType;
- dev_flavor_t flavor;
- mach_msg_type_long_t statusType;
- int status[1024];
- } Request;
-
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t RetCodeType;
- kern_return_t RetCode;
- } Reply;
-
- register Request *In0P = (Request *) InHeadP;
- register Reply *OutP = (Reply *) OutHeadP;
- mig_external kern_return_t ds_xxx_device_set_status
- (mach_port_t device, dev_flavor_t flavor, dev_status_t status, mach_msg_type_number_t statusCnt);
-
- unsigned int msgh_size;
-
- auto const mach_msg_type_t flavorCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
-#if TypeCheck
- msgh_size = In0P->Head.msgh_size;
- if ((msgh_size < 44) ||
- (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if ((In0P->statusType.msgtl_header.msgt_inline != TRUE) ||
- (In0P->statusType.msgtl_header.msgt_longform != TRUE) ||
- (In0P->statusType.msgtl_name != 2) ||
- (In0P->statusType.msgtl_size != 32))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (msgh_size != 44 + (4 * In0P->statusType.msgtl_number))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
- OutP->RetCode = ds_xxx_device_set_status(In0P->Head.msgh_request_port, In0P->flavor, In0P->status, In0P->statusType.msgtl_number);
-}
-
-/* Routine xxx_device_get_status */
-mig_internal void _Xxxx_device_get_status
- (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
-{
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t flavorType;
- dev_flavor_t flavor;
- } Request;
-
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t RetCodeType;
- kern_return_t RetCode;
- mach_msg_type_long_t statusType;
- int status[1024];
- } Reply;
-
- register Request *In0P = (Request *) InHeadP;
- register Reply *OutP = (Reply *) OutHeadP;
- mig_external kern_return_t ds_xxx_device_get_status
- (mach_port_t device, dev_flavor_t flavor, dev_status_t status, mach_msg_type_number_t *statusCnt);
-
- auto const mach_msg_type_t flavorCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_long_t statusType = {
- {
- /* msgt_name = */ 0,
- /* msgt_size = */ 0,
- /* msgt_number = */ 0,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ TRUE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- },
- /* msgtl_name = */ 2,
- /* msgtl_size = */ 32,
- /* msgtl_number = */ 1024,
- };
-
- mach_msg_type_number_t statusCnt;
-
-#if TypeCheck
- if ((In0P->Head.msgh_size != 32) ||
- (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
- statusCnt = 1024;
-
- OutP->RetCode = ds_xxx_device_get_status(In0P->Head.msgh_request_port, In0P->flavor, OutP->status, &statusCnt);
- if (OutP->RetCode != KERN_SUCCESS)
- return;
-
- OutP->statusType = statusType;
-
- OutP->statusType.msgtl_number = statusCnt;
- OutP->Head.msgh_size = 44 + (4 * statusCnt);
-}
-
-/* Routine xxx_device_set_filter */
-mig_internal void _Xxxx_device_set_filter
- (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
-{
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t receive_portType;
- mach_port_t receive_port;
- mach_msg_type_t priorityType;
- int priority;
- mach_msg_type_long_t filterType;
- filter_t filter[128];
- } Request;
-
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t RetCodeType;
- kern_return_t RetCode;
- } Reply;
-
- register Request *In0P = (Request *) InHeadP;
- register Reply *OutP = (Reply *) OutHeadP;
- mig_external kern_return_t ds_xxx_device_set_filter
- (mach_port_t device, mach_port_t receive_port, int priority, filter_array_t filter, mach_msg_type_number_t filterCnt);
-
- unsigned int msgh_size;
-
- auto const mach_msg_type_t receive_portCheck = {
- /* msgt_name = */ 17,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t priorityCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
-#if TypeCheck
- msgh_size = In0P->Head.msgh_size;
- if ((msgh_size < 52) ||
- !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->receive_portType, &receive_portCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->priorityType, &priorityCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if ((In0P->filterType.msgtl_header.msgt_inline != TRUE) ||
- (In0P->filterType.msgtl_header.msgt_longform != TRUE) ||
- (In0P->filterType.msgtl_name != 1) ||
- (In0P->filterType.msgtl_size != 16))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (msgh_size != 52 + ((2 * In0P->filterType.msgtl_number + 3) & ~3))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
- OutP->RetCode = ds_xxx_device_set_filter(In0P->Head.msgh_request_port, In0P->receive_port, In0P->priority, In0P->filter, In0P->filterType.msgtl_number);
-}
-
-/* Routine device_map */
-mig_internal void _Xdevice_map
- (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
-{
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t protType;
- vm_prot_t prot;
- mach_msg_type_t offsetType;
- vm_offset_t offset;
- mach_msg_type_t sizeType;
- vm_size_t size;
- mach_msg_type_t unmapType;
- int unmap;
- } Request;
-
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t RetCodeType;
- kern_return_t RetCode;
- mach_msg_type_t pagerType;
- mach_port_t pager;
- } Reply;
-
- register Request *In0P = (Request *) InHeadP;
- register Reply *OutP = (Reply *) OutHeadP;
- mig_external kern_return_t ds_device_map
- (mach_port_t device, vm_prot_t prot, vm_offset_t offset, vm_size_t size, mach_port_t *pager, int unmap);
-
- auto const mach_msg_type_t protCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t offsetCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t sizeCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t unmapCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t pagerType = {
- /* msgt_name = */ 19,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
-#if TypeCheck
- if ((In0P->Head.msgh_size != 56) ||
- (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->protType, &protCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->offsetType, &offsetCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->unmapType, &unmapCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
- OutP->RetCode = ds_device_map(In0P->Head.msgh_request_port, In0P->prot, In0P->offset, In0P->size, &OutP->pager, In0P->unmap);
- if (OutP->RetCode != KERN_SUCCESS)
- return;
-
- OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
- OutP->Head.msgh_size = 40;
-
- OutP->pagerType = pagerType;
-}
-
-/* Routine device_set_status */
-mig_internal void _Xdevice_set_status
- (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
-{
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t flavorType;
- dev_flavor_t flavor;
- mach_msg_type_t statusType;
- int status[1024];
- } Request;
-
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t RetCodeType;
- kern_return_t RetCode;
- } Reply;
-
- register Request *In0P = (Request *) InHeadP;
- register Reply *OutP = (Reply *) OutHeadP;
- mig_external kern_return_t ds_device_set_status
- (mach_port_t device, dev_flavor_t flavor, dev_status_t status, mach_msg_type_number_t statusCnt);
-
- unsigned int msgh_size;
-
- auto const mach_msg_type_t flavorCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
-#if TypeCheck
- msgh_size = In0P->Head.msgh_size;
- if ((msgh_size < 36) ||
- (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if ((In0P->statusType.msgt_inline != TRUE) ||
- (In0P->statusType.msgt_longform != FALSE) ||
- (In0P->statusType.msgt_name != 2) ||
- (In0P->statusType.msgt_size != 32))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (msgh_size != 36 + (4 * In0P->statusType.msgt_number))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
- OutP->RetCode = ds_device_set_status(In0P->Head.msgh_request_port, In0P->flavor, In0P->status, In0P->statusType.msgt_number);
-}
-
-/* Routine device_get_status */
-mig_internal void _Xdevice_get_status
- (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
-{
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t flavorType;
- dev_flavor_t flavor;
- mach_msg_type_t statusCntType;
- mach_msg_type_number_t statusCnt;
- } Request;
-
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t RetCodeType;
- kern_return_t RetCode;
- mach_msg_type_t statusType;
- int status[1024];
- } Reply;
-
- register Request *In0P = (Request *) InHeadP;
- register Reply *OutP = (Reply *) OutHeadP;
- mig_external kern_return_t ds_device_get_status
- (mach_port_t device, dev_flavor_t flavor, dev_status_t status, mach_msg_type_number_t *statusCnt);
-
- auto const mach_msg_type_t flavorCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t statusCntCheck = {
- /* msgt_name = */ MACH_MSG_TYPE_INTEGER_32,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t statusType = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1024,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- mach_msg_type_number_t statusCnt;
-
-#if TypeCheck
- if ((In0P->Head.msgh_size != 40) ||
- (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->statusCntType, &statusCntCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
- statusCnt = 1024;
- if (In0P->statusCnt < statusCnt)
- statusCnt = In0P->statusCnt;
-
- OutP->RetCode = ds_device_get_status(In0P->Head.msgh_request_port, In0P->flavor, OutP->status, &statusCnt);
- if (OutP->RetCode != KERN_SUCCESS)
- return;
-
- OutP->statusType = statusType;
-
- OutP->statusType.msgt_number = statusCnt;
- OutP->Head.msgh_size = 36 + (4 * statusCnt);
-}
-
-/* Routine device_set_filter */
-mig_internal void _Xdevice_set_filter
- (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
-{
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t receive_portType;
- mach_port_t receive_port;
- mach_msg_type_t priorityType;
- int priority;
- mach_msg_type_t filterType;
- filter_t filter[128];
- } Request;
-
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t RetCodeType;
- kern_return_t RetCode;
- } Reply;
-
- register Request *In0P = (Request *) InHeadP;
- register Reply *OutP = (Reply *) OutHeadP;
- mig_external kern_return_t ds_device_set_filter
- (mach_port_t device, mach_port_t receive_port, int priority, filter_array_t filter, mach_msg_type_number_t filterCnt);
-
- unsigned int msgh_size;
-
- auto const mach_msg_type_t receive_portCheck = {
- /* msgt_name = */ 17,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- auto const mach_msg_type_t priorityCheck = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
-#if TypeCheck
- msgh_size = In0P->Head.msgh_size;
- if ((msgh_size < 44) ||
- !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->receive_portType, &receive_portCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (BAD_TYPECHECK(&In0P->priorityType, &priorityCheck))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if ((In0P->filterType.msgt_inline != TRUE) ||
- (In0P->filterType.msgt_longform != FALSE) ||
- (In0P->filterType.msgt_name != 1) ||
- (In0P->filterType.msgt_size != 16))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
-#if TypeCheck
- if (msgh_size != 44 + ((2 * In0P->filterType.msgt_number + 3) & ~3))
- { OutP->RetCode = MIG_BAD_ARGUMENTS; return; }
-#endif /* TypeCheck */
-
- OutP->RetCode = ds_device_set_filter(In0P->Head.msgh_request_port, In0P->receive_port, In0P->priority, In0P->filter, In0P->filterType.msgt_number);
-}
-
-static mig_routine_t device_server_routines[] = {
- _Xdevice_open,
- _Xdevice_close,
- _Xdevice_write,
- _Xdevice_write_inband,
- _Xdevice_read,
- _Xdevice_read_inband,
- _Xxxx_device_set_status,
- _Xxxx_device_get_status,
- _Xxxx_device_set_filter,
- _Xdevice_map,
- _Xdevice_set_status,
- _Xdevice_get_status,
- _Xdevice_set_filter,
-};
-
-mig_external boolean_t device_server
- (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
-{
- register mach_msg_header_t *InP = InHeadP;
- register mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP;
-
- auto const mach_msg_type_t RetCodeType = {
- /* msgt_name = */ MACH_MSG_TYPE_INTEGER_32,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- register mig_routine_t routine;
-
- OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0);
- OutP->Head.msgh_size = sizeof *OutP;
- OutP->Head.msgh_remote_port = InP->msgh_reply_port;
- OutP->Head.msgh_local_port = MACH_PORT_NULL;
- OutP->Head.msgh_seqno = 0;
- OutP->Head.msgh_id = InP->msgh_id + 100;
-
- OutP->RetCodeType = RetCodeType;
-
- if ((InP->msgh_id > 2812) || (InP->msgh_id < 2800) ||
- ((routine = device_server_routines[InP->msgh_id - 2800]) == 0)) {
- OutP->RetCode = MIG_BAD_ID;
- return FALSE;
- }
- (*routine) (InP, &OutP->Head);
- return TRUE;
-}
-
-mig_external mig_routine_t device_server_routine
- (const mach_msg_header_t *InHeadP)
-{
- register int msgh_id;
-
- msgh_id = InHeadP->msgh_id - 2800;
-
- if ((msgh_id > 12) || (msgh_id < 0))
- return 0;
-
- return device_server_routines[msgh_id];
-}
-