/* Module mach_port */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif #define EXPORT_BOOLEAN #include #include #include #include #include #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 #include /* Routine mach_port_names */ mig_internal void _Xmach_port_names (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; mach_msg_type_long_t namesType; mach_port_array_t names; mach_msg_type_long_t typesType; mach_port_type_array_t types; } Reply; register Request *In0P = (Request *) InHeadP; register Reply *OutP = (Reply *) OutHeadP; mig_external kern_return_t S_mach_port_names (mach_port_t task, mach_port_array_t *names, mach_msg_type_number_t *namesCnt, mach_port_type_array_t *types, mach_msg_type_number_t *typesCnt); auto const mach_msg_type_long_t namesType = { { /* msgt_name = */ 0, /* msgt_size = */ 0, /* msgt_number = */ 0, /* msgt_inline = */ FALSE, /* msgt_longform = */ TRUE, /* msgt_deallocate = */ TRUE, /* msgt_unused = */ 0 }, /* msgtl_name = */ 15, /* msgtl_size = */ 32, /* msgtl_number = */ 0, }; auto const mach_msg_type_long_t typesType = { { /* msgt_name = */ 0, /* msgt_size = */ 0, /* msgt_number = */ 0, /* msgt_inline = */ FALSE, /* msgt_longform = */ TRUE, /* msgt_deallocate = */ TRUE, /* msgt_unused = */ 0 }, /* msgtl_name = */ 2, /* msgtl_size = */ 32, /* msgtl_number = */ 0, }; mach_msg_type_number_t namesCnt; mach_msg_type_number_t typesCnt; #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 = S_mach_port_names(In0P->Head.msgh_request_port, &OutP->names, &namesCnt, &OutP->types, &typesCnt); if (OutP->RetCode != KERN_SUCCESS) return; OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; OutP->Head.msgh_size = 64; OutP->namesType = namesType; OutP->namesType.msgtl_number = namesCnt; OutP->typesType = typesType; OutP->typesType.msgtl_number = typesCnt; } /* Routine mach_port_type */ mig_internal void _Xmach_port_type (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t nameType; mach_port_t name; } Request; typedef struct { mach_msg_header_t Head; mach_msg_type_t RetCodeType; kern_return_t RetCode; mach_msg_type_t ptypeType; mach_port_type_t ptype; } Reply; register Request *In0P = (Request *) InHeadP; register Reply *OutP = (Reply *) OutHeadP; mig_external kern_return_t S_mach_port_type (mach_port_t task, mach_port_t name, mach_port_type_t *ptype); auto const mach_msg_type_t nameCheck = { /* msgt_name = */ 15, /* msgt_size = */ 32, /* msgt_number = */ 1, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; auto const mach_msg_type_t ptypeType = { /* 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 != 32) || (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_type(In0P->Head.msgh_request_port, In0P->name, &OutP->ptype); if (OutP->RetCode != KERN_SUCCESS) return; OutP->Head.msgh_size = 40; OutP->ptypeType = ptypeType; } /* Routine mach_port_rename */ mig_internal void _Xmach_port_rename (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t old_nameType; mach_port_t old_name; mach_msg_type_t new_nameType; mach_port_t new_name; } 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 S_mach_port_rename (mach_port_t task, mach_port_t old_name, mach_port_t new_name); auto const mach_msg_type_t old_nameCheck = { /* msgt_name = */ 15, /* msgt_size = */ 32, /* msgt_number = */ 1, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; auto const mach_msg_type_t new_nameCheck = { /* msgt_name = */ 15, /* 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 != 40) || (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->old_nameType, &old_nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->new_nameType, &new_nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_rename(In0P->Head.msgh_request_port, In0P->old_name, In0P->new_name); } /* Routine mach_port_allocate_name */ mig_internal void _Xmach_port_allocate_name (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t rightType; mach_port_right_t right; mach_msg_type_t nameType; mach_port_t name; } 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 S_mach_port_allocate_name (mach_port_t task, mach_port_right_t right, mach_port_t name); auto const mach_msg_type_t rightCheck = { /* 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 nameCheck = { /* msgt_name = */ 15, /* 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 != 40) || (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->rightType, &rightCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_allocate_name(In0P->Head.msgh_request_port, In0P->right, In0P->name); } /* Routine mach_port_allocate */ mig_internal void _Xmach_port_allocate (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t rightType; mach_port_right_t right; } Request; typedef struct { mach_msg_header_t Head; mach_msg_type_t RetCodeType; kern_return_t RetCode; mach_msg_type_t nameType; mach_port_t name; } Reply; register Request *In0P = (Request *) InHeadP; register Reply *OutP = (Reply *) OutHeadP; mig_external kern_return_t S_mach_port_allocate (mach_port_t task, mach_port_right_t right, mach_port_t *name); auto const mach_msg_type_t rightCheck = { /* 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 nameType = { /* msgt_name = */ 15, /* 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 != 32) || (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->rightType, &rightCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_allocate(In0P->Head.msgh_request_port, In0P->right, &OutP->name); if (OutP->RetCode != KERN_SUCCESS) return; OutP->Head.msgh_size = 40; OutP->nameType = nameType; } /* Routine mach_port_destroy */ mig_internal void _Xmach_port_destroy (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t nameType; mach_port_t name; } 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 S_mach_port_destroy (mach_port_t task, mach_port_t name); auto const mach_msg_type_t nameCheck = { /* msgt_name = */ 15, /* 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 != 32) || (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_destroy(In0P->Head.msgh_request_port, In0P->name); } /* Routine mach_port_deallocate */ mig_internal void _Xmach_port_deallocate (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t nameType; mach_port_t name; } 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 S_mach_port_deallocate (mach_port_t task, mach_port_t name); auto const mach_msg_type_t nameCheck = { /* msgt_name = */ 15, /* 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 != 32) || (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_deallocate(In0P->Head.msgh_request_port, In0P->name); } /* Routine mach_port_get_refs */ mig_internal void _Xmach_port_get_refs (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t nameType; mach_port_t name; mach_msg_type_t rightType; mach_port_right_t right; } Request; typedef struct { mach_msg_header_t Head; mach_msg_type_t RetCodeType; kern_return_t RetCode; mach_msg_type_t refsType; mach_port_urefs_t refs; } Reply; register Request *In0P = (Request *) InHeadP; register Reply *OutP = (Reply *) OutHeadP; mig_external kern_return_t S_mach_port_get_refs (mach_port_t task, mach_port_t name, mach_port_right_t right, mach_port_urefs_t *refs); auto const mach_msg_type_t nameCheck = { /* msgt_name = */ 15, /* msgt_size = */ 32, /* msgt_number = */ 1, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; auto const mach_msg_type_t rightCheck = { /* 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 refsType = { /* 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 != 40) || (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->rightType, &rightCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_get_refs(In0P->Head.msgh_request_port, In0P->name, In0P->right, &OutP->refs); if (OutP->RetCode != KERN_SUCCESS) return; OutP->Head.msgh_size = 40; OutP->refsType = refsType; } /* Routine mach_port_mod_refs */ mig_internal void _Xmach_port_mod_refs (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t nameType; mach_port_t name; mach_msg_type_t rightType; mach_port_right_t right; mach_msg_type_t deltaType; mach_port_delta_t delta; } 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 S_mach_port_mod_refs (mach_port_t task, mach_port_t name, mach_port_right_t right, mach_port_delta_t delta); auto const mach_msg_type_t nameCheck = { /* msgt_name = */ 15, /* msgt_size = */ 32, /* msgt_number = */ 1, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; auto const mach_msg_type_t rightCheck = { /* 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 deltaCheck = { /* 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 != 48) || (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->rightType, &rightCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->deltaType, &deltaCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_mod_refs(In0P->Head.msgh_request_port, In0P->name, In0P->right, In0P->delta); } /* Routine old_mach_port_get_receive_status */ mig_internal void _Xold_mach_port_get_receive_status (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t nameType; mach_port_t name; } Request; typedef struct { mach_msg_header_t Head; mach_msg_type_t RetCodeType; kern_return_t RetCode; mach_msg_type_t statusType; old_mach_port_status_t status; } Reply; register Request *In0P = (Request *) InHeadP; register Reply *OutP = (Reply *) OutHeadP; mig_external kern_return_t S_old_mach_port_get_receive_status (mach_port_t task, mach_port_t name, old_mach_port_status_t *status); auto const mach_msg_type_t nameCheck = { /* msgt_name = */ 15, /* 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 = */ 8, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; #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->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_old_mach_port_get_receive_status(In0P->Head.msgh_request_port, In0P->name, &OutP->status); if (OutP->RetCode != KERN_SUCCESS) return; OutP->Head.msgh_size = 68; OutP->statusType = statusType; } /* Routine mach_port_set_qlimit */ mig_internal void _Xmach_port_set_qlimit (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t nameType; mach_port_t name; mach_msg_type_t qlimitType; mach_port_msgcount_t qlimit; } 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 S_mach_port_set_qlimit (mach_port_t task, mach_port_t name, mach_port_msgcount_t qlimit); auto const mach_msg_type_t nameCheck = { /* msgt_name = */ 15, /* msgt_size = */ 32, /* msgt_number = */ 1, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; auto const mach_msg_type_t qlimitCheck = { /* 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 != 40) || (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->qlimitType, &qlimitCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_set_qlimit(In0P->Head.msgh_request_port, In0P->name, In0P->qlimit); } /* Routine mach_port_set_mscount */ mig_internal void _Xmach_port_set_mscount (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t nameType; mach_port_t name; mach_msg_type_t mscountType; mach_port_mscount_t mscount; } 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 S_mach_port_set_mscount (mach_port_t task, mach_port_t name, mach_port_mscount_t mscount); auto const mach_msg_type_t nameCheck = { /* msgt_name = */ 15, /* msgt_size = */ 32, /* msgt_number = */ 1, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; auto const mach_msg_type_t mscountCheck = { /* 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 != 40) || (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->mscountType, &mscountCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_set_mscount(In0P->Head.msgh_request_port, In0P->name, In0P->mscount); } /* Routine mach_port_get_set_status */ mig_internal void _Xmach_port_get_set_status (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t nameType; mach_port_t name; } Request; typedef struct { mach_msg_header_t Head; mach_msg_type_t RetCodeType; kern_return_t RetCode; mach_msg_type_long_t membersType; mach_port_array_t members; } Reply; register Request *In0P = (Request *) InHeadP; register Reply *OutP = (Reply *) OutHeadP; mig_external kern_return_t S_mach_port_get_set_status (mach_port_t task, mach_port_t name, mach_port_array_t *members, mach_msg_type_number_t *membersCnt); auto const mach_msg_type_t nameCheck = { /* msgt_name = */ 15, /* 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 membersType = { { /* msgt_name = */ 0, /* msgt_size = */ 0, /* msgt_number = */ 0, /* msgt_inline = */ FALSE, /* msgt_longform = */ TRUE, /* msgt_deallocate = */ TRUE, /* msgt_unused = */ 0 }, /* msgtl_name = */ 15, /* msgtl_size = */ 32, /* msgtl_number = */ 0, }; mach_msg_type_number_t membersCnt; #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->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_get_set_status(In0P->Head.msgh_request_port, In0P->name, &OutP->members, &membersCnt); if (OutP->RetCode != KERN_SUCCESS) return; OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; OutP->Head.msgh_size = 48; OutP->membersType = membersType; OutP->membersType.msgtl_number = membersCnt; } /* Routine mach_port_move_member */ mig_internal void _Xmach_port_move_member (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t memberType; mach_port_t member; mach_msg_type_t afterType; mach_port_t after; } 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 S_mach_port_move_member (mach_port_t task, mach_port_t member, mach_port_t after); auto const mach_msg_type_t memberCheck = { /* msgt_name = */ 15, /* msgt_size = */ 32, /* msgt_number = */ 1, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; auto const mach_msg_type_t afterCheck = { /* msgt_name = */ 15, /* 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 != 40) || (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->memberType, &memberCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->afterType, &afterCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_move_member(In0P->Head.msgh_request_port, In0P->member, In0P->after); } /* Routine mach_port_request_notification */ mig_internal void _Xmach_port_request_notification (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t nameType; mach_port_t name; mach_msg_type_t idType; mach_msg_id_t id; mach_msg_type_t syncType; mach_port_mscount_t sync; mach_msg_type_t notifyType; mach_port_t notify; } Request; typedef struct { mach_msg_header_t Head; mach_msg_type_t RetCodeType; kern_return_t RetCode; mach_msg_type_t previousType; mach_port_t previous; } Reply; register Request *In0P = (Request *) InHeadP; register Reply *OutP = (Reply *) OutHeadP; mig_external kern_return_t S_mach_port_request_notification (mach_port_t task, mach_port_t name, mach_msg_id_t id, mach_port_mscount_t sync, mach_port_t notify, mach_port_t *previous, mach_msg_type_name_t *previousPoly); boolean_t msgh_simple; auto const mach_msg_type_t nameCheck = { /* msgt_name = */ 15, /* msgt_size = */ 32, /* msgt_number = */ 1, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; auto const mach_msg_type_t idCheck = { /* 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 syncCheck = { /* 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 notifyCheck = { /* msgt_name = */ 18, /* msgt_size = */ 32, /* msgt_number = */ 1, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; auto const mach_msg_type_t previousType = { /* msgt_name = */ -1, /* msgt_size = */ 32, /* msgt_number = */ 1, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; mach_msg_type_name_t previousPoly; #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->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->idType, &idCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->syncType, &syncCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->notifyType, ¬ifyCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_request_notification(In0P->Head.msgh_request_port, In0P->name, In0P->id, In0P->sync, In0P->notify, &OutP->previous, &previousPoly); if (OutP->RetCode != KERN_SUCCESS) return; msgh_simple = TRUE; OutP->Head.msgh_size = 40; OutP->previousType = previousType; if (MACH_MSG_TYPE_PORT_ANY(previousPoly)) msgh_simple = FALSE; OutP->previousType.msgt_name = previousPoly; if (!msgh_simple) OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; } /* Routine mach_port_insert_right */ mig_internal void _Xmach_port_insert_right (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t nameType; mach_port_t name; mach_msg_type_t polyType; mach_port_t poly; } 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 S_mach_port_insert_right (mach_port_t task, mach_port_t name, mach_port_t poly, mach_msg_type_name_t polyPoly); #if TypeCheck boolean_t msgh_simple; #endif /* TypeCheck */ auto const mach_msg_type_t nameCheck = { /* msgt_name = */ 15, /* msgt_size = */ 32, /* msgt_number = */ 1, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; #if TypeCheck msgh_simple = !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); if ((In0P->Head.msgh_size != 40)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if ((In0P->polyType.msgt_inline != TRUE) || (In0P->polyType.msgt_longform != FALSE) || (MACH_MSG_TYPE_PORT_ANY(In0P->polyType.msgt_name) && msgh_simple) || (In0P->polyType.msgt_number != 1) || (In0P->polyType.msgt_size != 32)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_insert_right(In0P->Head.msgh_request_port, In0P->name, In0P->poly, In0P->polyType.msgt_name); } /* Routine mach_port_extract_right */ mig_internal void _Xmach_port_extract_right (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t nameType; mach_port_t name; mach_msg_type_t msgt_nameType; mach_msg_type_name_t msgt_name; } Request; typedef struct { mach_msg_header_t Head; mach_msg_type_t RetCodeType; kern_return_t RetCode; mach_msg_type_t polyType; mach_port_t poly; } Reply; register Request *In0P = (Request *) InHeadP; register Reply *OutP = (Reply *) OutHeadP; mig_external kern_return_t S_mach_port_extract_right (mach_port_t task, mach_port_t name, mach_msg_type_name_t msgt_name, mach_port_t *poly, mach_msg_type_name_t *polyPoly); boolean_t msgh_simple; auto const mach_msg_type_t nameCheck = { /* msgt_name = */ 15, /* msgt_size = */ 32, /* msgt_number = */ 1, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; auto const mach_msg_type_t msgt_nameCheck = { /* 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 polyType = { /* msgt_name = */ -1, /* msgt_size = */ 32, /* msgt_number = */ 1, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; mach_msg_type_name_t polyPoly; #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->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->msgt_nameType, &msgt_nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_extract_right(In0P->Head.msgh_request_port, In0P->name, In0P->msgt_name, &OutP->poly, &polyPoly); if (OutP->RetCode != KERN_SUCCESS) return; msgh_simple = TRUE; OutP->Head.msgh_size = 40; OutP->polyType = polyType; if (MACH_MSG_TYPE_PORT_ANY(polyPoly)) msgh_simple = FALSE; OutP->polyType.msgt_name = polyPoly; if (!msgh_simple) OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; } /* Routine mach_port_get_receive_status */ mig_internal void _Xmach_port_get_receive_status (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t nameType; mach_port_t name; } Request; typedef struct { mach_msg_header_t Head; mach_msg_type_t RetCodeType; kern_return_t RetCode; mach_msg_type_t statusType; mach_port_status_t status; } Reply; register Request *In0P = (Request *) InHeadP; register Reply *OutP = (Reply *) OutHeadP; mig_external kern_return_t S_mach_port_get_receive_status (mach_port_t task, mach_port_t name, mach_port_status_t *status); auto const mach_msg_type_t nameCheck = { /* msgt_name = */ 15, /* 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 = */ 9, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; #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->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_get_receive_status(In0P->Head.msgh_request_port, In0P->name, &OutP->status); if (OutP->RetCode != KERN_SUCCESS) return; OutP->Head.msgh_size = 72; OutP->statusType = statusType; } /* Routine mach_port_set_seqno */ mig_internal void _Xmach_port_set_seqno (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) { typedef struct { mach_msg_header_t Head; mach_msg_type_t nameType; mach_port_t name; mach_msg_type_t seqnoType; mach_port_seqno_t seqno; } 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 S_mach_port_set_seqno (mach_port_t task, mach_port_t name, mach_port_seqno_t seqno); auto const mach_msg_type_t nameCheck = { /* msgt_name = */ 15, /* msgt_size = */ 32, /* msgt_number = */ 1, /* msgt_inline = */ TRUE, /* msgt_longform = */ FALSE, /* msgt_deallocate = */ FALSE, /* msgt_unused = */ 0 }; auto const mach_msg_type_t seqnoCheck = { /* 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 != 40) || (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ #if TypeCheck if (BAD_TYPECHECK(&In0P->seqnoType, &seqnoCheck)) { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } #endif /* TypeCheck */ OutP->RetCode = S_mach_port_set_seqno(In0P->Head.msgh_request_port, In0P->name, In0P->seqno); } static mig_routine_t mach_port_server_routines[] = { _Xmach_port_names, _Xmach_port_type, _Xmach_port_rename, _Xmach_port_allocate_name, _Xmach_port_allocate, _Xmach_port_destroy, _Xmach_port_deallocate, _Xmach_port_get_refs, _Xmach_port_mod_refs, _Xold_mach_port_get_receive_status, _Xmach_port_set_qlimit, _Xmach_port_set_mscount, _Xmach_port_get_set_status, _Xmach_port_move_member, _Xmach_port_request_notification, _Xmach_port_insert_right, _Xmach_port_extract_right, _Xmach_port_get_receive_status, _Xmach_port_set_seqno, }; mig_external boolean_t mach_port_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 > 3218) || (InP->msgh_id < 3200) || ((routine = mach_port_server_routines[InP->msgh_id - 3200]) == 0)) { OutP->RetCode = MIG_BAD_ID; return FALSE; } (*routine) (InP, &OutP->Head); return TRUE; } mig_external mig_routine_t mach_port_server_routine (const mach_msg_header_t *InHeadP) { register int msgh_id; msgh_id = InHeadP->msgh_id - 3200; if ((msgh_id > 18) || (msgh_id < 0)) return 0; return mach_port_server_routines[msgh_id]; }