mach_port.h #########################
kern_return_t _kernelrpc_mach_port_names
(
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
);
mach_portUser.c #########################
mig_internal kern_return_t __MIG_check__Reply__mach_port_names_t(__Reply__mach_port_names_t *Out0P)
{
typedef __Reply__mach_port_names_t __Reply __attribute__((unused));
boolean_t msgh_simple;
#if __MigTypeCheck
unsigned int msgh_size;
#endif
if (Out0P->Head.msgh_id != 3300) {
if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
{ return MIG_SERVER_DIED; }
else
{ return MIG_REPLY_MISMATCH; }
}
msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX);
#if __MigTypeCheck
msgh_size = Out0P->Head.msgh_size;
if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 2 ||
msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
(!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS))
{ return MIG_TYPE_ERROR ; }
#endif
if (msgh_simple) {
return ((mig_reply_error_t *)Out0P)->RetCode;
}
#if __MigTypeCheck
if (Out0P->names.type != MACH_MSG_OOL_DESCRIPTOR) {
return MIG_TYPE_ERROR;
}
#endif
#if __MigTypeCheck
if (Out0P->types.type != MACH_MSG_OOL_DESCRIPTOR) {
return MIG_TYPE_ERROR;
}
#endif
return MACH_MSG_SUCCESS;
}
#endif
#endif
#endif
mig_external kern_return_t _kernelrpc_mach_port_names
(
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
)
{
#ifdef __MigPackStructs
#pragma pack(4)
#endif
typedef struct {
mach_msg_header_t Head;
} Request __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack()
#endif
#ifdef __MigPackStructs
#pragma pack(4)
#endif
typedef struct {
mach_msg_header_t Head;
mach_msg_body_t msgh_body;
mach_msg_ool_descriptor_t names;
mach_msg_ool_descriptor_t types;
NDR_record_t NDR;
mach_msg_type_number_t namesCnt;
mach_msg_type_number_t typesCnt;
mach_msg_trailer_t trailer;
} Reply __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack()
#endif
#ifdef __MigPackStructs
#pragma pack(4)
#endif
typedef struct {
mach_msg_header_t Head;
mach_msg_body_t msgh_body;
mach_msg_ool_descriptor_t names;
mach_msg_ool_descriptor_t types;
NDR_record_t NDR;
mach_msg_type_number_t namesCnt;
mach_msg_type_number_t typesCnt;
} __Reply __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack()
#endif
union {
Request In;
Reply Out;
} Mess;
Request *InP = &Mess.In;
Reply *Out0P = &Mess.Out;
mach_msg_return_t msg_result;
#ifdef __MIG_check__Reply__mach_port_names_t__defined
kern_return_t check_result;
#endif
__DeclareSendRpc(3200, "mach_port_names")
InP->Head.msgh_bits =
MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
InP->Head.msgh_request_port = task;
InP->Head.msgh_reply_port = mig_get_reply_port();
InP->Head.msgh_id = 3200;
InP->Head.msgh_reserved = 0;
#ifdef USING_VOUCHERS
if (voucher_mach_msg_set != NULL) {
voucher_mach_msg_set(&InP->Head);
}
#endif
__BeforeSendRpc(3200, "mach_port_names")
msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
__AfterSendRpc(3200, "mach_port_names")
if (msg_result != MACH_MSG_SUCCESS) {
__MachMsgErrorWithoutTimeout(msg_result);
{ return msg_result; }
}
#if defined(__MIG_check__Reply__mach_port_names_t__defined)
check_result = __MIG_check__Reply__mach_port_names_t((__Reply__mach_port_names_t *)Out0P);
if (check_result != MACH_MSG_SUCCESS)
{ return check_result; }
#endif
*names = (mach_port_name_array_t)(Out0P->names.address);
*namesCnt = Out0P->namesCnt;
*types = (mach_port_type_array_t)(Out0P->types.address);
*typesCnt = Out0P->typesCnt;
return KERN_SUCCESS;
}
mach_portServer.c #########################
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->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
return MIG_BAD_ARGUMENTS;
#endif
return MACH_MSG_SUCCESS;
}
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;
mach_msg_trailer_t trailer;
} Request __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack()
#endif
typedef __Request__mach_port_names_t __Request;
typedef __Reply__mach_port_names_t Reply __attribute__((unused));
Request *In0P = (Request *) InHeadP;
Reply *OutP = (Reply *) OutHeadP;
#ifdef __MIG_check__Request__mach_port_names_t__defined
kern_return_t check_result;
#endif
#if UseStaticTemplates
const static mach_msg_ool_descriptor_t namesTemplate = {
(void *)0,
0,
FALSE,
MACH_MSG_VIRTUAL_COPY,
0,
MACH_MSG_OOL_DESCRIPTOR,
};
#endif
#if UseStaticTemplates
const static mach_msg_ool_descriptor_t typesTemplate = {
(void *)0,
0,
FALSE,
MACH_MSG_VIRTUAL_COPY,
0,
MACH_MSG_OOL_DESCRIPTOR,
};
#endif
kern_return_t RetCode;
__DeclareRcvRpc(3200, "mach_port_names")
__BeforeRcvRpc(3200, "mach_port_names")
#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
#if UseStaticTemplates
OutP->names = namesTemplate;
#else
OutP->names.deallocate = FALSE;
OutP->names.copy = MACH_MSG_VIRTUAL_COPY;
OutP->names.pad1 = 0;
OutP->names.type = MACH_MSG_OOL_DESCRIPTOR;
#if defined(KERNEL) && !defined(__LP64__)
OutP->names.pad_end = 0;
#endif
#endif
#if UseStaticTemplates
OutP->types = typesTemplate;
#else
OutP->types.deallocate = FALSE;
OutP->types.copy = MACH_MSG_VIRTUAL_COPY;
OutP->types.pad1 = 0;
OutP->types.type = MACH_MSG_OOL_DESCRIPTOR;
#if defined(KERNEL) && !defined(__LP64__)
OutP->types.pad_end = 0;
#endif
#endif
OutP->namesCnt = 0;
OutP->typesCnt = 0;
RetCode = mach_port_names(In0P->Head.msgh_request_port, (mach_port_name_array_t *)&(OutP->names.address), &OutP->namesCnt, (mach_port_type_array_t *)&(OutP->types.address), &OutP->typesCnt);
if (RetCode != KERN_SUCCESS) {
MIG_RETURN_ERROR(OutP, RetCode);
}
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 = (mach_msg_size_t)(sizeof(Reply));
OutP->msgh_body.msgh_descriptor_count = 2;
__AfterRcvRpc(3200, "mach_port_names")
}